Tested on Ubuntu 20, 21 earlier and they were not working. So upgraded Ubutbu to latest 22 version.
The issue is: The built in Kernals of Ubuntu and many Linux Kernals (between ) have the CH340 drivers broken / have bugs and not fixed (from kernal 5.4.0-87 and above)
Note: I didn't try on linux kernal 5.4.0-86 my self. I though I will see how is the situation in the latest linux kernal (as of 16/05/2022)
sudo apt-get update -y
sudo apt-get install neofetch -y
neofetch
I think it came with Kernel: 5.13.8-...
sudo add-apt-repository ppa:cappelikan/ppa
sudo apt-get update -y
sudo apt-get install mainline -y
sudo apt autoremove -y
Run mainline and select the latest kernel (I tried, as of 16/05/2022, kernel version: 5.17.8-051708-generic
)
After installation and reboot, run neofetch
again and check if the latest linux kernel is loaded.
sudo apt-get update -y
sudo apt-get install build-essential dwarves dkms make cmake -y
sudo apt autoremove -y
As per the guide here in sparkfun and https://github.com/juliagoda/CH341SER
git clone https://github.com/juliagoda/CH341SER
cd CH341SER
sudo make clean
# The Makefile looks for vmlinux in a certain location (check that cat Makefile)
# we need to move that
# https://forum.proxmox.com/threads/kernel-module-not-found-when-compile-skipping-btf-generation.100974/
cp /sys/kernel/btf/vmlinux /usr/lib/modules/`uname -r`/build/
sudo make
sudo make load
lsmod | grep ch34*
# NOTE: if other/prev ch34x drivers are loaded (and you know they were not working), then you can unload them by:
sudo rmmod ch34x
# Plug and unplug your CH340 device again on the USB port
sudo dmesg
# plug un-plug your device and then verify:
ls /dev/tty*
# make it accessible
sudo usermod -a -G dialout $(whoami)
sudo chmod a+rw /dev/ttyUSB0 # if /dev/ttyUSB0 was assigned
# To unload:
sudo rmmod ch34x
# or
sudo make unload
It came out during my test, at least on my machine, a service for some external brail hardware was conflicting with the drivers. I saw that in sudo dmesg
... ch340 1-10:1.0: ch341-uart converter detected
... usb 1-10: ch341-uart converter now attached to ttyUSB0
.
.
.
... usb 1-10: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
... ch340-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
It was apearing and dis-appearing. so I tried to hunt the service as such:
sudo systemctl list-units | grep brltty
I then disabled it:
sudo systemctl stop <brl service name or other service that is interferring and not needed>
sudo systemctl disable <brl service name or other service that is interferring and not needed>
sudo systemctl mask <brl service name or other service that is interferring and not needed>
for f in /usr/lib/udev/rules.d/*brltty*.rules; do
sudo ln -s /dev/null "/etc/udev/rules.d/$(basename "$f")"
done
sudo udevadm control --reload-rules
Automate loading and unloading ...
For latest Ubuntu 22.04 version just do this as described below
https://askubuntu.com/questions/1403705/dev-ttyusb0-not-present-in-ubuntu-22-04