The CH340 Drivers already come with the OS:
λ lsmod | grep -i ch34
ch341 24576 0
usbserial 69632 3 usb_wwan,ch341,option
When connecting the CH340 device, at first it is recognized, but it will then be automatically disconneted after a short while:
λ sudo dmesg | tail -f
[3372119.623083] usb 11-1: USB disconnect, device number 6
[3372128.858490] usb 11-1: new full-speed USB device number 7 using xhci_hcd
[3372129.020482] usb 11-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.62
[3372129.020490] usb 11-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[3372129.020493] usb 11-1: Product: USB2.0-Serial
[3372129.026685] ch341 11-1:1.0: ch341-uart converter detected
[3372129.041114] usb 11-1: ch341-uart converter now attached to ttyUSB4
[3372131.688510] usb 11-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[3372131.691769] ch341-uart ttyUSB4: ch341-uart converter now disconnected from ttyUSB4
[3372131.691804] ch341 11-1:1.0: device disconnected
The above dynamic is also observable in detail:
udevadm monitor --environment --udev
The culprit lies in the line:
[3372131.688510] usb 11-1: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
Searching for the message, we find this thread:
- https://unix.stackexchange.com/questions/670636/unable-to-use-usb-dongle-based-on-usb-serial-converter-chip
- juliagoda/CH341SER#18
So, it's a clash with another rule related to a specific Braille TTY device which has the same Vendor ID and Product ID:
λ ls /usr/lib/udev/rules.d/*brltty*.rules
/usr/lib/udev/rules.d/85-brltty.rules
We follow a more localized approach by following this answer:
We can comment the problematic rule from /usr/lib/udev/rules.d/85-brltty.rules
around line 291:
(the device: https://www.youtube.com/watch?v=C3PIpdcKfjg&ab_channel=LibraryofCongress )
# Device: 1A86:7523
# Baum [NLS eReader Zoomax (20 cells)]
### COMMENTED-OUT to avoid conflict with CH340 controlles (same VID:PID)
### ENV{PRODUCT}=="1a86/7523/*", ENV{BRLTTY_BRAILLE_DRIVER}="bm", GOTO="brltty_usb_run"
Once edited and saved the above file, instead of restarting the whole machine / OS, we can run the following commands:
NOTE: maybe unplug your CH430 device before of running this command:
sudo udevadm control --reload-rules && sudo service udev restart && sudo udevadm trigger && sudo systemctl restart brltty-udev.service
Verify that now the CH340 USB device is no longer auto-disconnected:
With udevadm
:
λ udevadm monitor --environment --udev | grep bind
UDEV [3373727.158750] bind /devices/pci0000:00/0000:00:08.3/0000:36:00.4/usb11/11-1/11-1:1.0/ttyUSB4 (usb-serial)
ACTION=bind
UDEV [3373727.159862] bind /devices/pci0000:00/0000:00:08.3/0000:36:00.4/usb11/11-1/11-1:1.0 (usb)
ACTION=bind
UDEV [3373727.176663] bind /devices/pci0000:00/0000:00:08.3/0000:36:00.4/usb11/11-1 (usb)
ACTION=bind
With dmesg
λ sudo dmesg --follow
[3373631.172846] usb 11-1: new full-speed USB device number 13 using xhci_hcd
[3373631.336398] usb 11-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.62
[3373631.336409] usb 11-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[3373631.336413] usb 11-1: Product: USB2.0-Serial
[3373631.341818] ch341 11-1:1.0: ch341-uart converter detected
[3373631.355787] usb 11-1: ch341-uart converter now attached to ttyUSB4
With ls
:
λ ls /dev/ttyUSB4
/dev/ttyUSB4
That's it, and no other Braille devices have been disabled other than the problematic one.
This was very useful! Thx!