# Send stuff from mangOH app to /dev/ttyUSBx

**URL:** <https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101>\
**Category:** Uncategorized\
**Created:** [June 8, 2016, 7:21pm UTC](https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101 "2016-06-08T19:21:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [June 8, 2016, 7:21pm UTC](https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101/1 "2016-06-08T19:21:43Z")

</div>

So I eventually got my FTDI USB-to-serial cable working on the command line.

Now - how do I do that from an app?

I have tried:

```auto
    int fd = open( "/dev/ttyUSB1", O_RDWR | O_NOCTTY | O_NDELAY );
    if( fd < 0 )
    {
    	LE_INFO("open failed");
    }

   ssize_t result = write( fd, "Opened.\r\n", 9 );
    
   if( result < 0 )
    {
    	LE_INFO("1st write failed");
    }

```

But the open fails.

Where am going wrong?

**Update:**  
errno is 2 when the open fails - which, I think, is

`ENOENT 2	/* No such file or directory */`

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [June 8, 2016, 9:39pm UTC](https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101/2 "2016-06-08T21:39:16Z")

</div>

If your app is sandboxed (if you don’t specify “sandboxed: false” in the .adef it will be), then /dev/ttyUSB1 won’t exist in the filesystem seen by your app.

See this section of the Legato documentation on how to put a device file into your sandbox:  
[http://legato.io/legato-docs/latest/defFilesAdef.html#defFilesAdef\_requiresDevice](http://legato.io/legato-docs/latest/defFilesAdef.html#defFilesAdef_requiresDevice)

Basically, you need this:

```auto
requires:
{
    device:
    {
        [rw] /dev/ttyUSB1 /dev/
        // Above line is a shortcut for: [rw] /dev/ttyUSB1 /dev/ttyUSB1
    }
}

```

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [June 9, 2016, 4:47pm UTC](https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101/3 "2016-06-09T16:47:30Z")

</div>

Yes, that’s it.

Thanks.

😁

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [March 6, 2017, 5:21am UTC](https://mangoh.discourse.group/t/send-stuff-from-mangoh-app-to-dev-ttyusbx/101/4 "2017-03-06T05:21:02Z")

</div>


