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
toon
(the file is set back toauto
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.
rmmod
will only remove the driver. If you want to stop that driver from loading you need to blacklist it as well. Addblacklist ch341
to the/etc/modprobe.d/blacklist.conf
file to stop the driver from reloading.