2

I recently bought a esp32 devkit with ch340 USB-UART bridge. After plugging it into the USB port of my Ubuntu 22.04 the serial port /dev/ttyUSB0 repeatedly connects and disconnects.

Also, I have tried this on Windows and Fedora where it worked as expected, so I think it might be a Ubuntu related issue.

dmesg output:

[ 662.091302] usb 1-2: new full-speed USB device number 117 using xhci_hcd
[ 662.253355] usb 1-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice=81.33
[ 662.253366] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 662.253370] usb 1-2: Product: USB Serial
[ 662.258186] ch341 1-2:1.0: ch341-uart converter detected
[ 662.272620] usb 1-2: ch341-uart converter now attached to ttyUSB0
[ 665.739336] usb 1-2: USB disconnect, device number 117
[ 665.739737] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 665.739770] ch341 1-2:1.0: device disconnected

tail -f /var/log/syslog shows two additional lines:

checking bus 1, device 125: "/sys/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-2"   
bus: 1, device: 125 was not an MTP device

I tried:

  • disabling autosuspend with udev rules as described in arch wiki (I'm not sure why this doesn't work)
  • disabling autosuspend by changing /sys/devices/*/power/level to on (the file is set back to auto after a few seconds)
  • updating to the latest kernel
  • debugging the driver with kprobe

Does anyone have an idea how to solve this? If I won't fix it I'll probably have to change distro, and I don't really have time to do it right now.

karel
  • 114,770
  • Certainly seems to be the driver. – David Apr 14 '23 at 13:04
  • rmmod will only remove the driver. If you want to stop that driver from loading you need to blacklist it as well. Add blacklist ch341 to the /etc/modprobe.d/blacklist.conf file to stop the driver from reloading. – Terrance Apr 14 '23 at 13:32
  • Blacklisting doesn't help, new driver is loaded and used, but the device is still connecting and disconnecting – Macuilxochitl Apr 14 '23 at 14:45
  • Try disabling all power saving features for USB. I never said that blacklisting will fix your issue, but it will stop the original ch341 driver from reloading is all since you claimed that driver reloaded within a few seconds of removing the module. – Terrance Apr 14 '23 at 14:54
  • Made an edit on disabling auto suspend – Macuilxochitl Apr 14 '23 at 20:06
  • Not sure if what you followed would work with autosuspend on the USB. Some are claiming that this one is still working. https://askubuntu.com/a/1161074/231142 But, I see that you went to Fedora, so this is all moot now. – Terrance Apr 16 '23 at 04:10

1 Answers1

2

In my case the Ubuntu braille reader was hogging the port. This worked for me.

sudo apt remove brltty

After that I was able to see the device connect and stay connected. You won't have to run that command again.