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.

6
  • Certainly seems to be the driver.
    – David
    Apr 14 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 at 13:32
  • Blacklisting doesn't help, new driver is loaded and used, but the device is still connecting and disconnecting Apr 14 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 at 14:54
  • Made an edit on disabling auto suspend Apr 14 at 20:06

1 Answer 1

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.

3
  • Thank you, but this doesn't work for me. Do you know if there's a way to check if any other program is using the same port? Apr 14 at 21:39
  • If it was brltty the device wouldn't connect at all. I doubt the this would solve the problem. Aug 15 at 17:08
  • This worked for me. uname: Linux 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    – rundekugel
    Sep 15 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .