Verifying Kernel Drivers and Stable Device Paths for USB Serial Devices (ttyUSB0) on Home Assistant OS

Hi all,

I have two USB serial devices on Home Assistant OS:

  • CH341 USB serial adapter
  • Sonoff Zigbee 3.0 USB Dongle (ttyACM0)

I see these devices as /dev/ttyUSB0, /dev/ttyUSB1, and /dev/ttyACM0. The /dev/serial/by-id/ links show stable names, but device numbers (ttyUSB0 vs ttyUSB1) sometimes swap after reboot.

Inside the HA container, udevadm isn’t available, so I can’t get detailed device info. I tried using the Advanced SSH add-on with protection_mode: false and username: root but can’t successfully get Host OS shell access to run udevadm.

My questions:

  1. What’s the best way to get Host OS shell access to run commands like udevadm?
  2. How do I ensure stable device paths for these USB serial devices in HA?
  3. Is root:audio ownership for /dev/ttyUSB* normal or should it be changed?

Thanks for any advice or tips!

You’ll either need direct access to your machines console to get at the HAOS root shell, or search around to see how to setup your HAOS to allow access to its ssh server which uses port 22222.

The best practice method has been to use /dev/serial/by-id/blah-blah

2 Likes

This… 100%

1 Like

Thank you. I’ve tried to map /serial/by-id/ but it still not working. I suspect is a kernel problem.
I can’t understand why ownership of /dev/ttyUSB* is root:audio.

Doesn’t seem correct to me either.
You should be able to use the SSH AddOn and type dmesg | less and within the less app, you can search for ttyUSBx by typing /ttyUSBx (where x is 0, 1, etc.) and see what kernel module got assigned to it.
Here is an example:

[   11.834437] usbcore: registered new interface driver cp210x
[   11.845426] usbserial: USB Serial support registered for cp210x
[   11.854585] cp210x 2-1:1.0: cp210x converter detected
[   11.868271] usb 2-1: cp210x converter now attached to ttyUSB0

It could be that the linux driver for this device simply doesn’t work. It looks like some folks (here and here) are resorting to customization of the linux driver to get it to work (and whether these customs can be done for HAOS, I don’t know).

1 Like

Thank you so much!
that’s my exit code from dmesg:
[ 2.232689] usbcore: registered new interface driver ch341
[ 2.232704] usbserial: USB Serial support registered for ch341-uart
[ 2.232719] ch341 1-4:1.0: ch341-uart converter detected
[ 2.248345] usb 1-4: ch341-uart converter now attached to ttyUSB0
[ 2.253506] ch341 1-7:1.0: ch341-uart converter detected
[ 2.255659] usb 1-7: ch341-uart converter now attached to ttyUSB1

I also think that is kernel related iussue for old drivers.
I hope someone here will help in debugging.
Thanks again!

Yes it looks like it is installing the correct driver, but the other thing that bugs me is that it is presenting two ttyUSBs, when I think there should only be one, at least all the google searches I see where people compile their own drivers only show ttyUSB0. I simply think the existing HAOS kernel driver for the CH341 doesn’t work. Probably the only thing to do at the moment is to file an issue for HAOS and see what they say.

1 Like

I’ve opened a iussue here:

No one that can help me troubleshooting?
Thanks!