Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/dev/ttyUSB0 is not there anymore (nothing else changed) #121

Open
lfilho opened this issue Apr 9, 2024 · 19 comments
Open

/dev/ttyUSB0 is not there anymore (nothing else changed) #121

lfilho opened this issue Apr 9, 2024 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@lfilho
Copy link
Contributor

lfilho commented Apr 9, 2024

Type of device
Sonoff Dongle
DSM 7.2
Linux 4.4.302+ #69057 SMP Fri Jan 12 17:02:28 CST 2024 x86_64 GNU/Linux synology_geminilake_220+

Have the modules loaded?
Yes. Or I think they are. When i manually invoke sudo insmod /lib/modules/usbserial.ko, it returns: insmod: ERROR: could not insert module /lib/modules/usbserial.ko: File exists. Should it have returned nothing at all?

Output of lsusb

lsusb -cui
|__usb1          1d6b:0002:0404 09  2.00  480MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
  |__1-2         10c4:ea60:0100 00  2.00   12MBit/s 100mA 1IF  (ITead Sonoff Zigbee 3.0 USB Dongle Plus 1637575acb60ec11b230397625bfaa52)
  1-2:1.0         (IF) ff:00:00 2EPs () usbfs
  |__1-4         f400:f400:0100 00  2.00  480MBit/s 200mA 1IF  (Synology DiskStation 65001C106D345A24)
  1-4:1.0         (IF) 08:06:50 2EPs () usb-storage host2 (synoboot)

Note: it appears there isn't a device assigned as expected. It used to show /dev/ttyUSB0


Other info:

I didn't change the dongle nor the cable it is connected to synology. Everything was working until my zigbee devices stopped working last night, and while investigating why i eventually saw /dev/ttyUSB0 wasn't there as it used to. I've been trying to get it back there to no avail.

Contents of my /usr/local/etc/rc.d/ (does it matter specific owners/groups? That user is admin. before it was root and it wasn't working too)

/usr/local/etc/rc.d$ ll
-rwxrw-rw-  1 luiz users  463 Apr  9 09:32 usb-serial-drivers.sh
@lfilho lfilho added the bug Something isn't working label Apr 9, 2024
@lfilho
Copy link
Contributor Author

lfilho commented Apr 9, 2024

If it helps, here's how I installed the modules:

#!/bin/bash

set -eo pipefail
echo "Make sure you runt his script as root or with sudo"

echo "Downloading modules"
cd /lib/modules || exit 1
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/ch341.ko'
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/cp210x.ko'
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/pl2303.ko'
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/rndis_host.ko'
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/ti_usb_3410_5052.ko'

echo "Downloading script to start usb modules"
cd /usr/local/etc/rc.d || exit 1
wget 'https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/usb-serial-drivers.sh'
chmod +x /usr/local/etc/rc.d/usb-serial-drivers.sh

echo "Starting usb modules"
/usr/local/etc/rc.d/usb-serial-drivers.sh start

exit 0

@robertklep
Copy link
Owner

Can you check which modules are loaded?

lsmod | grep usbserial

@lfilho
Copy link
Contributor Author

lfilho commented Apr 11, 2024

Uuugh, I just ran the command again and now it's there?!? I didn't change a thing, except rebooting Synology 🤯.
I'll close this issue since i have no clue how to reproduce it and keep a closer eye if it happens again in the future. Sorry and thanks for the help!

@lfilho lfilho closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@lfilho
Copy link
Contributor Author

lfilho commented Apr 11, 2024

Oh! Just happened again! So, after the restart it was there, and I was playing with zigbee2mqtt addon via its Addon UI, inside home assistant, inside a VM, inside synology.

Here's the output of lsmod | grep usbserial:

usbserial              22278  5 ch341,cp210x,ti_usb_3410_5052,pl2303,ftdi_sio
usbcore               209065  18 uas,ch341,etxhci_hcd,usblp,uhci_hcd,usb_storage,cp210x,usbserial,ti_usb_3410_5052,ehci_hcd,ehci_pci,pl2303,usbhid,ftdi_sio,cdc_acm,xhci_hcd,xhci_pci

The reason I'm messing with zigbee2mqtt in the first place was that it stopped working out of the blue, apparently a known issue to be fixed on the next version. Do you think it could be either z2m, HA or Synology crashing the usb module somehow? Any other ideas?

@lfilho lfilho reopened this Apr 11, 2024
@robertklep
Copy link
Owner

I have no idea, but I would suspect a hardware issue, either with your dongle or the cable.

When it happens, are any relevant messages shown in the output of sudo dmesg?

@lfilho
Copy link
Contributor Author

lfilho commented Apr 11, 2024

Oof, that's rough.

Yeah, here it, grepped for "usb":

sudo dmesg | grep -i usb
[    0.000000] ACPI: SSDT 0x0000000077ABE000 000271 (v02 INSYDE UsbCTabl 00000003 ACPI 00040000)
[   12.529189] ACPI: bus type USB registered
[   12.533710] usbcore: registered new interface driver usbfs
[   12.539859] usbcore: registered new interface driver hub
[   12.545816] usbcore: registered new interface driver ethub
[   12.551959] usbcore: registered new device driver usb
[   12.585526] xhci_hcd 0000:00:15.0: new USB bus registered, assigned bus number 1
[   12.804710] hub 1-0:1.0: USB hub found
[   13.052133] xhci_hcd 0000:00:15.0: new USB bus registered, assigned bus number 2
[   13.060495] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[   13.069772] hub 2-0:1.0: USB hub found
[   13.336947] usb 1-2: new full-speed USB device number 2 using xhci_hcd
[   13.617302] usb 1-4: new high-speed USB device number 3 using xhci_hcd
[   32.157780] systemd[1]: Starting unbind USB device...
[   32.188373] systemd[1]: Created slice USBCopy's slice.
[   32.199503] systemd[1]: Starting USBCopy's slice.
[   32.386428] systemd[1]: Started unbind USB device.
[   32.545913] systemd[1]: Starting Mount usb fs...
[   35.080545] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   35.131267] uhci_hcd: USB Universal Host Controller Interface driver
[   37.015444] usbcore: registered new interface driver usblp
[   37.076011] usbcore: registered new interface driver usbhid
[   37.082240] usbhid: USB HID core driver
[   38.335058] usb-storage 1-4:1.0: USB Mass Storage device detected
[   38.342088] scsi host2: usb-storage 1-4:1.0
[   38.346863] usbcore: registered new interface driver usb-storage
[   38.461930] usbcore: registered new interface driver uas
[   75.552437] usbcore: registered new interface driver usbserial
[   75.577194] usbcore: registered new interface driver ftdi_sio
[   75.583640] usbserial: USB Serial support registered for FTDI USB Serial Device
[   75.636575] usbcore: registered new interface driver cdc_acm
[   75.642921] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   75.922087] usbcore: registered new interface driver cp210x
[   75.928332] usbserial: USB Serial support registered for cp210x
[   75.940737] usb 1-2: cp210x converter now attached to ttyUSB0
[   75.998792] usbcore: registered new interface driver ch341
[   76.004954] usbserial: USB Serial support registered for ch341-uart
[   76.046541] usbcore: registered new interface driver pl2303
[   76.052804] usbserial: USB Serial support registered for pl2303
[   76.095820] usbcore: registered new interface driver ti_usb_3410_5052
[   76.103083] usbserial: USB Serial support registered for TI USB 3410 1 port adapter
[   76.111687] usbserial: USB Serial support registered for TI USB 5052 2 port adapter
[82046.260558] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[82058.619624] usb 1-2: reset full-speed USB device number 2 using xhci_hcd

@robertklep
Copy link
Owner

I think these two suggest that as far as the OS is concerned, the dongle has been disconnected physically:

[82046.260558] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[82058.619624] usb 1-2: reset full-speed USB device number 2 using xhci_hcd

So might be worthwhile to check if another cable (or even directly plugging it into the NAS, even though that's usually not a good idea due to interference issues) might solve it.

@lfilho
Copy link
Contributor Author

lfilho commented Apr 11, 2024 via email

@robertklep
Copy link
Owner

Fair point, but it doesn't change the fact that this looks like a hardware issue. Besides that, I only compile the modules and have no idea how they actually work or how to solve issues with them 😅

@mager33
Copy link

mager33 commented Apr 21, 2024

I'm stuck at the very same after installing DSM7.2.1-69057 Update 4 on my DS220+ (which was working totally fine with the Sonoff Zigbee 3.0 Stick. I followed all those steps and several variantions I found on the net, but no success: there is no /dev/ttyUSB0 any more.

@robertklep
Copy link
Owner

@mager33 what is the output of lsmod | grep usbserial and lsusb -cui?

@mager33
Copy link

mager33 commented Apr 21, 2024

USBSERIAL is available

usbserial              22278  7 ch341,cp210x,ti_usb_3410_5052,pl2303,ftdi_sio
usbcore               209065  17 uas,ch341,etxhci_hcd,usblp,uhci_hcd,usb_storage,cp210x,usbserial,ti_usb_3410_5052,ehci_hcd,ehci_pci,pl2303,usbhid,ftdi_sio,cdc_acm,xhci_hcd,xhci_pci

There is a port assigned, after 2x reboot (once with, once without the stick plugged in)

|__usb1          1d6b:0002:0404 09  2.00  480MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
  |__1-2         10c4:ea60:0100 00  2.00   12MBit/s 100mA 1IF  (ITead Sonoff Zigbee 3.0 USB Dongle Plus 689ec39eeed8eb11950f0a15b9da5f8b)
  1-2:1.0         (IF) ff:00:00 2EPs () cp210x ttyUSB0
  |__1-4         f400:f400:0100 00  2.00  480MBit/s 200mA 1IF  (Synology Diskstation 7F0016AC131A2E80)
  1-4:1.0         (IF) 08:06:50 2EPs () usb-storage host2 (synoboot)

I did sudo chmod 777 /dev/ttyUSB0 and it worked again.
Strange behaviour!
Consider my problem solved - and thanks for your work with all this!

@robertklep
Copy link
Owner

@mager33 is the dongle connected through an extension lead? If not, it should be 😊

@1uba
Copy link

1uba commented Apr 27, 2024

@robertklep you’re often mentioning to use the extension lead. So I bought AXAGON HUE-SA7BP 7-Port USB 3.0 CHARGING hub. My goal is to connect Jablotron 100+ and Home Assistant (running in Container on Synology 920+, version: DSM 7.2.1-69057 Update 5). I tried and read many topics about the issue - unfortunately I can’t still see ttyusb or ttyacm device in /dev. I have a same config as @lfilho above. Let me attach all the logs... I hope you can help me.

$ uname -u
synology_geminilake_920+
$ lsmod | grep usbserial
usbserial              22278  5 ch341,cp210x,ti_usb_3410_5052,pl2303,ftdi_sio
usbcore               209065  17 uas,ch341,etxhci_hcd,usblp,uhci_hcd,usb_storage,cp210x,usbserial,ti_usb_3410_5052,ehci_hcd,ehci_pci,pl2303,usbhid,ftdi_sio,cdc_acm,xhci_hcd,xhci_pci
$ lsusb -cui
|__usb1          1d6b:0002:0404 09  2.00  480MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
  |__1-4         f400:f400:0100 00  2.00  480MBit/s 200mA 1IF  (Synology DiskStation 7F001B0C8413F221)
  1-4:1.0         (IF) 08:06:50 2EPs () usb-storage host6 (synoboot)
|__usb2          1d6b:0003:0404 09  3.00 5000MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
$ sudo dmesg | grep -i usb
[    0.000000] ACPI: SSDT 0x0000000077ABE000 000271 (v02 INSYDE UsbCTabl 00000003 ACPI 00040000)
[   35.261407] ACPI: bus type USB registered
[   35.265928] usbcore: registered new interface driver usbfs
[   35.272076] usbcore: registered new interface driver hub
[   35.278033] usbcore: registered new interface driver ethub
[   35.284176] usbcore: registered new device driver usb
[   35.317855] xhci_hcd 0000:00:15.0: new USB bus registered, assigned bus number 1
[   35.537049] hub 1-0:1.0: USB hub found
[   35.783756] xhci_hcd 0000:00:15.0: new USB bus registered, assigned bus number 2
[   35.792083] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[   35.801409] hub 2-0:1.0: USB hub found
[   36.046074] usb 1-4: new high-speed USB device number 2 using xhci_hcd
[   36.554025] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   36.700267] usb 1-1: not running at top speed
[   37.073970] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   37.220220] usb 1-1: not running at top speed
[   37.593898] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   37.740154] usb 1-1: not running at top speed
[   38.113824] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   38.260128] usb 1-1: not running at top speed
[   38.633753] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   38.779980] usb 1-1: not running at top speed
[   39.153676] usb 1-1: new high-speed USB device number 3 using xhci_hcd
[   39.299906] usb 1-1: not running at top speed
[   39.328923] hub 1-1:1.0: USB hub found
[   39.435338] usb 2-1: new SuperSpeed USB device number 2 using xhci_hcd
[   39.481626] drivers/usb/core/hub.c (2962) Same device found. Change serial to ffffffd6ffffffa3ffffffebffffffc0 
[   39.494808] hub 2-1:1.0: USB hub found
[   57.486863] systemd[1]: Created slice synokernel-usbserial's slice.
[   57.499978] systemd[1]: Starting synokernel-usbserial's slice.
[   57.743742] systemd[1]: Starting unbind USB device...
[   58.055552] systemd[1]: Started unbind USB device.
[   58.248362] systemd[1]: Starting Mount usb fs...
[   59.032973] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   59.072147] uhci_hcd: USB Universal Host Controller Interface driver
[   60.747803] usbcore: registered new interface driver usblp
[   60.785207] usbcore: registered new interface driver usbhid
[   60.792104] usbhid: USB HID core driver
[   61.094603] usb-storage 1-4:1.0: USB Mass Storage device detected
[   61.101592] scsi host6: usb-storage 1-4:1.0
[   61.106368] usbcore: registered new interface driver usb-storage
[   61.130423] usbcore: registered new interface driver uas
[   85.824746] usbcore: registered new interface driver usbserial
[   85.900987] usbcore: registered new interface driver ftdi_sio
[   85.907464] usbserial: USB Serial support registered for FTDI USB Serial Device
[   85.956607] usbcore: registered new interface driver cdc_acm
[   85.962940] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   85.995437] usbcore: registered new interface driver cp210x
[   86.001715] usbserial: USB Serial support registered for cp210x
[   86.017597] usbcore: registered new interface driver ch341
[   86.023789] usbserial: USB Serial support registered for ch341-uart
[   86.055567] usbcore: registered new interface driver pl2303
[   86.061844] usbserial: USB Serial support registered for pl2303
[   86.101050] usbcore: registered new interface driver ti_usb_3410_5052
[   86.101066] usbserial: USB Serial support registered for TI USB 3410 1 port adapter
[   86.101076] usbserial: USB Serial support registered for TI USB 5052 2 port adapter

It seems that all drivers are loaded properly, the only weird thing is:
[ 35.792083] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.

@robertklep
Copy link
Owner

@1uba I don't see any device connected in the output of lsusb (not even the hub, by the looks of it).

Even if there's a device connected that isn't supported by any of the drivers, it should still be visible.

@1uba
Copy link

1uba commented Apr 28, 2024

Thank you for your quick reply @robertklep
After some investigation I figured that due to the water damage there was a problem with Jablotron main unit - and the servis connector was damaged. After its replacement, I am finally getting some progress. Unfortunately I can’t still see any ttyusb or ttyacm device in /dev. Do you know where could be a problem?

$ sudo dmesg | grep -i usb
...
[ 5038.758809] usb 1-1.4.3: new full-speed USB device number 6 using xhci_hcd
[ 5038.892521] hid-generic 0003:16D6:0008.0002: hiddev0: USB HID v1.11 Device [Jablotron ltd JA-100 Flexi] on usb-0000:00:15.0-1.4.3/input0
[ 5038.906791] usb-storage 1-1.4.3:1.1: USB Mass Storage device detected
[ 5038.914249] scsi host9: usb-storage 1-1.4.3:1.1
[ 5039.934168] sd 9:0:0:0: [usb1] 204800 512-byte logical blocks: (105 MB/100 MiB)
[ 5039.934410] sd 9:0:0:0: [usb1] Write Protect is on
[ 5039.934412] sd 9:0:0:0: [usb1] Mode Sense: 03 00 80 00
[ 5039.934876] sd 9:0:0:0: [usb1] No Caching mode page found
[ 5039.934878] sd 9:0:0:0: [usb1] Assuming drive cache: write through
[ 5039.945859]  usb1: p1
[ 5039.949000] sd 9:0:0:0: [usb1] Attached SCSI removable disk
[ 5039.987084] sd 9:0:0:1: [usb2] 2301952 512-byte logical blocks: (1.18 GB/1.10 GiB)
[ 5039.987240] sd 9:0:0:1: [usb2] Write Protect is on
[ 5039.987242] sd 9:0:0:1: [usb2] Mode Sense: 03 00 80 00
[ 5039.987423] sd 9:0:0:1: [usb2] No Caching mode page found
[ 5039.987425] sd 9:0:0:1: [usb2] Assuming drive cache: write through
[ 5039.997957]  usb2: p1
[ 5039.999247] sd 9:0:0:1: [usb2] Attached SCSI removable disk
[ 5044.063699] FAT-fs (usb1p1): FAT: nls_disk load default table
[ 5044.073118] FAT-fs (usb1p1): FAT: nls_io load default table
[ 5050.167794] FAT-fs (usb2p1): FAT: nls_disk load default table
[ 5050.177976] FAT-fs (usb2p1): FAT: nls_io load default table
$ lsusb -cui
|__usb1          1d6b:0002:0404 09  2.00  480MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
  |__1-1         0bda:5411:0001 09  2.10  480MBit/s 0mA 1IF  (Generic USB2.1 Hub ffffffd6ffffffa3ffffffebffffffcb) hub
    |__1-1.4     0bda:5411:0001 09  2.10  480MBit/s 0mA 1IF  (Generic USB2.1 Hub ffffffd6ffffffa3ffffffebffffffc1) hub
      |__1-1.4.3 16d6:0008:0107 00  2.00   12MBit/s 100mA 2IFs (Jablotron ltd JA-100 Flexi 14004036027151)
    1-1.4.3:1.0   (IF) 03:00:00 1EP  () usbhid 
    1-1.4.3:1.1   (IF) 08:06:50 2EPs () usb-storage host9 (usb1 usb2)
  |__1-4         f400:f400:0100 00  2.00  480MBit/s 200mA 1IF  (Synology DiskStation 7F001B0C8413F221)
  1-4:1.0         (IF) 08:06:50 2EPs () usb-storage host6 (synoboot)
|__usb2          1d6b:0003:0404 09  3.00 5000MBit/s 0mA 1IF  (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:00:15.0) hub
  |__2-1         0bda:0411:0001 09  3.20 5000MBit/s 0mA 1IF  (Generic USB3.2 Hub ffffffd6ffffffa3ffffffebffffffc0) hub

@robertklep
Copy link
Owner

@1uba it looks like it's presenting as two separate devices: a USB HID device (so it may act as a keyboard or a mouse or something similar) and a USB storage device (the drivers I provide only support USB serial devices).

Since you're looking to add support for it to Home Assistant, take a look at this integration.

@1uba
Copy link

1uba commented Apr 28, 2024

  • USB Storage device - it works as volume for the Jablotron Link .exe application - usually used for configuration.
  • USB HID device - I am confused why in my case its only connected as:
    [ 5038.892521] hid-generic 0003:16D6:0008.0002: hiddev0: USB HID v1.11 Device [Jablotron ltd JA-100 Flexi] on usb-0000:00:15.0-1.4.3/input0 ----> But I see is that others have there the hidraw so it works as serial:
    [2313475.624360] hid-generic 0003:16D6:0008.0001: hiddev96, hidraw: USB HID v1.11 Device [Jablotron It JA-100 Flexi] on usb-xhci-hed.6.auto-1.2/input

I was originally planning to start with HACS Jablotron 100+ integration. Both - even the HASS-JablotronSystem integration are supposed to be configured with the serial port. It’s mentioned in their documentatoin: "Note: Because my serial cable presents as a HID device there format is /dev/hidraw[x], others that present as serial may be at /dev/ttyUSB0 or similar."


$ modprobe hidraw
modprobe: FATAL: Module hidraw not found.

@robertklep
Copy link
Owner

hidraw isn't serial, it's a raw USB HID interface. Have you checked if you have a /dev/hidraw* device entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants