# USB Problems on linux

**URL:** <https://community.openhab.org/t/usb-problems-on-linux/55183>\
**Category:** Beginners\
**Tags:** usb\
**Created:** [October 30, 2018, 9:54am UTC](https://community.openhab.org/t/usb-problems-on-linux/55183 "2018-10-30T09:54:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![skatun](https://community.openhab.org/user_avatar/community.openhab.org/skatun/32/17185_2.png) [@skatun](https://community.openhab.org/u/skatun)\
**Post date:** [October 30, 2018, 9:54am UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/1 "2018-10-30T09:54:21Z")

</div>

I am trying to figure out how USB works on openhabian on rpi3B+.

On windows USB sticks shows up as com5, com17 and so on.. And the numbers changes on reboot. On my RPI I seem to experience the same:

So i have a usb rs485 dongle using the modbus binding, this now throws me tons of errors, and this is enough to make the whole Openhab to freeze, GUI, works fine, but no other events are occuring!!

```php
2018-10-30 07:40:17.639 [ERROR] [et.wimpi.modbus.net.SerialConnection] - open port failed: Unknown Linux Application

2018-10-30 07:40:17.643 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/3 error: open port failed: Unknown Linux Application. Connection SerialConnection@b47d5d[portName=/dev/ttyUSB0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@1a79a88[portName=/dev/ttyUSB0]

2018-10-30 07:40:19.372 [ERROR] [et.wimpi.modbus.net.SerialConnection] - open port failed: Unknown Linux Application

2018-10-30 07:40:19.375 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 2/3 error: open port failed: Unknown Linux Application. Connection SerialConnection@b47d5d[portName=/dev/ttyUSB0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@1a79a88[portName=/dev/ttyUSB0]

2018-10-30 07:40:21.137 [ERROR] [et.wimpi.modbus.net.SerialConnection] - open port failed: Unknown Linux Application

2018-10-30 07:40:21.140 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 3/3 error: open port failed: Unknown Linux Application. Connection SerialConnection@b47d5d[portName=/dev/ttyUSB0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@1a79a88[portName=/dev/ttyUSB0]

2018-10-30 07:40:21.143 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 3, throwing last error: open port failed: Unknown Linux Application. Connection SerialConnection@b47d5d[portName=/dev/ttyUSB0,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@1a79a88[portName=/dev/ttyUSB0]

2018-10-30 07:40:21.146 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@b47d5d[portName=/dev/ttyUSB0,port=<null>] for endpoint ModbusSerialSlaveEndpoint@1a79a88[portName=/dev/ttyUSB0]: open port failed: Unknown Linux Application

```

So when I open up the USB I get this:

```php
[07:57:39] openhabian@openHABianPi:~$ lsusb
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

```

I want to make static names to my usb dongles

```php
`sudo nano /etc/udev/rules.d/99-usb-serial.rules`
`SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", OWNER="openhab" SYMLINK="modbus"`

```

and for my dmx dongle i followed another tutorial:

```php
sudo nano /etc/udev/rules.d/30-ftdidmx.rules

#KERNEL=="ttyUSB*", MODE="0666"

SUBSYSTEM=="usb|usb_device", ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="dialout"

```

1. should every USB dongle have its own file?
2. what should the files be called?
3. what subsystem should it be?
4. how do I know which group it should be?
5. how should the cfg file look like, i.e whats the usb name? `serial.vvfan.connection=/dev/ttyUSB0:19200:8:none:1:rtu:35:5000`

Thanks for any input on this topic…

---

<div class="post-metadata">

**Author:** ![MDAR](https://community.openhab.org/user_avatar/community.openhab.org/mdar/32/57900_2.png) [@MDAR](https://community.openhab.org/u/MDAR)\
**Post date:** [October 30, 2018, 10:14am UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/2 "2018-10-30T10:14:40Z")

</div>

Try looking for the softlink that is created for each device.

> <https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name>

I’m sure I’ve seen a system folder called “device\_by\_name” somewhere, but I can’t find it right now.

Updated, please refer to my later post for more information on the by-path symlinks. (Post No. 8)

---

<div class="post-metadata">

**Author:** ![skatun](https://community.openhab.org/user_avatar/community.openhab.org/skatun/32/17185_2.png) [@skatun](https://community.openhab.org/u/skatun)\
**Post date:** [October 30, 2018, 10:36am UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/3 "2018-10-30T10:36:02Z")

</div>

Thanks, however all my question are still the same after reading it though, they only talk about giving static name to one device.

1. should every USB dongle have its own file?
2. what should the files be called?
3. what subsystem should it be?
4. how do I know which group it should be?
5. how should the cfg file look like, i.e whats the usb name? `serial.vvfan.connection=/dev/ttyUSB0:19200:8:none:1:rtu:35:5000`

---

<div class="post-metadata">

**Author:** ![H102](https://community.openhab.org/user_avatar/community.openhab.org/h102/32/25595_2.png) [@H102](https://community.openhab.org/u/H102)\
**Post date:** [October 30, 2018, 3:12pm UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/4 "2018-10-30T15:12:49Z")

</div>

Have you tried adding the USB info to the EXTRA\_JAVA\_OPTS in etc/default/openhab2 ? Openhabian should take care of the rest.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 30, 2018, 6:15pm UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/5 "2018-10-30T18:15:07Z")

</div>

> [@skatun](#):
>
> should every USB dongle have its own file?

Yes. On Linux EVERYTHING is a file. Each device gets it’s own file.

> [@skatun](#):
>
> what should the files be called?

Usually the device files created are named /dev/ttyUSB# or /dev/ttyAM#.

> [@skatun](#):
>
> what subsystem should it be?

I don’t understand the question.

> [@skatun](#):
>
> how do I know which group it should be?

It will probably come up with either dialout or tty as the group. Make sure that what ever user needs to read/write to the device (i.e. openhab) is a member of that group. You can see by running `ls -l /dev/tty*`.

> [@skatun](#):
>
> how should the cfg file look like, i.e whats the usb name?

`/dev/ttyUSB0`

As with Windows, if you have more than one USB serial device then they may not end up on the same /dev/ttyUSB#. The link Stuart provided is a way to figure out which /dev/ttyUSB# a specific device came up on and link that to a static name you can use in OH. That way, no matter what /dev/ttyUSB# it shows up on it will have a static name.

As H102 indicates, you may need to add the device as EXTRA\_JAVA\_OPTS as well.

---

<div class="post-metadata">

**Author:** ![skatun](https://community.openhab.org/user_avatar/community.openhab.org/skatun/32/17185_2.png) [@skatun](https://community.openhab.org/u/skatun)\
**Post date:** [October 30, 2018, 7:44pm UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/6 "2018-10-30T19:44:34Z")

</div>

Thanks for the clarifying of question 4.

> [@rlkoshak](#):
>
> > should every USB dongle have its own file?
> 
> Yes. On Linux EVERYTHING is a file. Each device gets it’s own file.

Yes, like tty0,tty1 and so on, but when you use symlink should that be defined in one file or having one for each usb device?

1. `sudo nano /etc/udev/rules.d/99-usb-serial.rules`
2. ` sudo nano /etc/udev/rules.d/30-ftdidmx.rules`

and so on

> [@rlkoshak](#):
>
> > what subsystem should it be?
> 
> I don’t understand the question.

In the usb sym file for that device there is a subsystem setting, but I do not understand what it means:

> [@skatun](#):
>
> SUBSYSTEM==“usb|usb\_device”

> [@rlkoshak](#):
>
> > how should the cfg file look like, i.e whats the usb name?
> 
> `/dev/ttyUSB0`

I thought the whole point was that it then could be refered to as :  
` SYMLINK="modbus"`  
modbus or sth like dev/modbus..

Basically on the internet I found two quite differnet examples of symlink files and i do not quite understand the differences and how it should be set up to properly work with OH:

1. `SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", OWNER="openhab" SYMLINK="modbus"`
2. `SUBSYSTEM=="usb|usb_device", ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="dialout"`

Question 6 🙂 How do I find out which user belongs to which group as well?  
So any help on this topic would be great!

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 30, 2018, 8:08pm UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/7 "2018-10-30T20:08:02Z")

</div>

I can’t help with the rest. But the last question

```
id openhab

```

This will list all the groups openhab belongs to.

---

<div class="post-metadata">

**Author:** ![MDAR](https://community.openhab.org/user_avatar/community.openhab.org/mdar/32/57900_2.png) [@MDAR](https://community.openhab.org/u/MDAR)\
**Post date:** [November 14, 2018, 9:06am UTC](https://community.openhab.org/t/usb-problems-on-linux/55183/8 "2018-11-14T09:06:37Z")

</div>

If it helps anyone..

I have a Velleman [VMBRSUSB](https://www.velbus.eu/products/category/?id=383116) USB serial adapter for my Velbus network.

Although the tty port is assigned the same every time, I thought I’d see if my Ubuntu 16 LTS machine automatically created a symlink for it.

I found this …

`/dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00`

an `ls -l` command shows that it is a symlink.

```
   root@{device}:/dev/serial/by-id# ls -l
    total 0
    lrwxrwxrwx 1 root root 13 Oct 9 17:45 usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 -> ../../ttyACM0

```

I haven’t tried running Velserv with this symlink, but I don’t see any reason why it wouldn’t work.

Curiously, there is a by-path folder too, which might be useful

`cd /dev/serial/by-path`

I see only this file

```
root@{device}:/dev/serial/by-path# ls -l
total 0
lrwxrwxrwx 1 root root 13 Oct 9 17:45 platform-12120000.usb-usb-0:1:1.0 -> ../../ttyACM0

```

**Update**

I am now running VelServ using the symlink and it’s working perfectly

`./velserv - d /dev/serial/by-id/Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 - p 6000`
