juliagoda / ch341ser Goto Github PK
View Code? Open in Web Editor NEWCH341SER driver with fixed bug
License: GNU General Public License v3.0
CH341SER driver with fixed bug
License: GNU General Public License v3.0
The driver 'ch341' in kernel is broken. This driver works well.
Can`t build
Perhaps need kernel source?
Place *.dep in release -- is posible?
make[1]: *** /lib/modules/5.18.1-stb-exy+/build: No such file or directory. Stop.
make: *** [Makefile:7: default] Error 2```
also as
ls -la /lib/modules/5.18.1-stb-exy+/build
lrwxrwxrwx 1 root root 37 Jun 5 2022 /lib/modules/5.18.1-stb-exy+/build -> /home/compile/source/linux-stable-exy
miniboards:
```uname -a
Linux r2d3 5.18.1-stb-exy+ #1 SMP PREEMPT Sun Jun 5 10:36:47 CEST 2022 armv7l armv7l armv7l GNU/Linux```
According to arduino/arduino-ide#1788 the brltty driver needs to be uninstalled when using this driver, and I can confirm that.
it should be added to the README, to run
sudo apt remove brltty
if that happens.
I know, an issue isn't the right place to store this kind of information, but could you at this to a wiki or a list or something?
Hello
I have tested it on Ubuntu 18.04.5 LTS and it works fine.
I highly suggest that you would mention your correction to the original chinese developer and that this version would be integrated into most linux distributions as it works fine.
When using SecureBoot, you need to sign module. I have followed this instructions https://ubuntu.com/blog/how-to-sign-things-for-secure-boot
Otherwise make load
failed. Consider mention in Readme
. Hope it helps to somebody.
I ran into an issue where I was unable to compile the driver following the instructions presented here.
Navigating into the repo directory and running make:
make
make -C /lib/modules/5.15.6-arch2-1/build M=/home/user/CH341SER
make[1]: *** /lib/modules/5.15.6-arch2-1/build: No such file or directory. Stop.
make: *** [Makefile:7: default] Error 2
I then created the directory with:
sudo mkdir /lib/modules/5.15.6-arch2-1/build
Re-running make generates:
make
make -C /lib/modules/5.15.6-arch2-1/build M=/home/user/CH341SER
make[1]: Entering directory '/usr/lib/modules/5.15.6-arch2-1/build'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/usr/lib/modules/5.15.6-arch2-1/build'
make: *** [Makefile:7: default] Error 2
I then found that a reddit post that indicated that the linux-headers package needs to be installed: https://www.reddit.com/r/archlinux/comments/8j53dq/comment/dyx43om/?utm_source=share&utm_medium=web2x&context=3
sudo pacman -S linux-headers
I was then finally able to compile the driver.
It may make the installation easier to provide a list of dependencies for building the driver.
hello
i'm follow the readme.txt install this driver on Ubuntu 18.04, but it's not work.
uname -a
Linux lxeo 5.4.0-45-generic #49~18.04.2-Ubuntu SMP Wed Aug 26 16:29:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
lsmod | grep ch34
ch34x 24576 0
usbserial 49152 1 ch34x
dmesg | grep ch34
[ 57.989423] ch34x: loading out-of-tree module taints kernel.
[ 57.989477] ch34x: module verification failed: signature and/or required key missing - tainting kernel
[ 57.989761] usbcore: registered new interface driver ch34x
[ 57.989789] usbserial: USB Serial support registered for ch34x
[ 269.528281] usbserial: USB Serial deregistering driver ch34x
[ 269.528331] usbcore: deregistering interface driver ch34x
[ 272.788150] usbcore: registered new interface driver ch34x
[ 272.788168] usbserial: USB Serial support registered for ch34x
ls /dev/ttyUSB*
zsh: no matches found: /dev/ttyUSB*
Getting the following error when trying to make both the master and Ubuntu branches
make[1]: Entering directory '/usr/src/linux-headers-6.5.6-76060506-generic'
make[2]: *** No rule to make target 'Projects/CH341SER'. Stop.
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.5.6-76060506-generic'
make: *** [Makefile:7: default] Error 2
Hey, thanks for the driver, it works great.
The only thing that worries me a bit is the fact that when it's loaded it always results in a warning/error/trace after boot (Ubuntu 20.04.3 LTS focal, HWE 5.11.0-43-generic):
[Sun Dec 19 05:49:03 2021] ch34x 5-2.4:1.0: ch34x converter detected
[Sun Dec 19 05:49:03 2021] ------------[ cut here ]------------
[Sun Dec 19 05:49:03 2021] transfer buffer is on stack
[Sun Dec 19 05:49:03 2021] WARNING: CPU: 13 PID: 28585 at drivers/usb/core/hcd.c:1491 usb_hcd_map_urb_for_dma+0x303/0x4b0
[Sun Dec 19 05:49:03 2021] Modules linked in: rapl(+) eeepc_wmi(+) input_leds ch34x(OE+) snd usbserial nct6775 wmi_bmof joydev mxm_wmi efi_pstore zenpower(OE) soundcore ccp hwmon_vid ryzen_smu(OE) mac_hid nvidia_uvm(POE) parport_pc ppdev lp parport nfsd auth_rpcgss nfs_acl lockd grace sunrpc nfs_ssc ip_tables x_tables autofs4 dm_crypt raid10 raid1 raid0 multipath linear raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c hid_generic usbhid hid nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) mfd_aaeon asus_wmi sparse_keymap drm_kms_helper video crct10dif_pclmul syscopyarea sysfillrect sysimgblt fb_sys_fops crc32_pclmul ghash_clmulni_intel cec rc_core nvme aesni_intel drm crypto_simd cryptd nvme_core ahci xhci_pci glue_helper r8125(OE) libahci xhci_pci_renesas i2c_piix4 wmi
[Sun Dec 19 05:49:03 2021] CPU: 13 PID: 28585 Comm: systemd-udevd Tainted: P OE 5.11.0-43-generic #47~20.04.2-Ubuntu
[Sun Dec 19 05:49:03 2021] Hardware name: ASUS System Product Name/ROG CROSSHAIR VIII HERO (WI-FI), BIOS 3801 07/30/2021
[Sun Dec 19 05:49:03 2021] RIP: 0010:usb_hcd_map_urb_for_dma+0x303/0x4b0
[Sun Dec 19 05:49:03 2021] Code: 39 c1 73 5d 80 3d e5 a3 67 01 00 41 be f5 ff ff ff 0f 85 45 ff ff ff 48 c7 c7 15 3e 86 88 c6 05 cb a3 67 01 01 e8 53 f3 2f 00 <0f> 0b 41 8b 54 24 5c e9 26 ff ff ff 41 89 44 24 78 41 8b 54 24 5c
[Sun Dec 19 05:49:03 2021] RSP: 0018:ffffb1b14144f830 EFLAGS: 00010286
[Sun Dec 19 05:49:03 2021] RAX: 0000000000000000 RBX: 0000000000000c00 RCX: 0000000000000027
[Sun Dec 19 05:49:03 2021] RDX: 0000000000000027 RSI: 00000000ffffdfff RDI: ffff8f16ced58ac8
[Sun Dec 19 05:49:03 2021] RBP: ffffb1b14144f868 R08: ffff8f16ced58ac0 R09: ffffb1b14144f5f0
[Sun Dec 19 05:49:03 2021] R10: 0000000000000001 R11: 0000000000000001 R12: ffff8f0fce24ed80
[Sun Dec 19 05:49:03 2021] R13: ffff8f0fde262000 R14: 00000000fffffff5 R15: 0000000000000002
[Sun Dec 19 05:49:03 2021] FS: 00007f9567185880(0000) GS:ffff8f16ced40000(0000) knlGS:0000000000000000
[Sun Dec 19 05:49:03 2021] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[Sun Dec 19 05:49:03 2021] CR2: 00007f04b5e34870 CR3: 000000011fd80000 CR4: 0000000000350ee0
[Sun Dec 19 05:49:03 2021] Call Trace:
[Sun Dec 19 05:49:03 2021] xhci_map_urb_for_dma+0x14c/0x2a0
[Sun Dec 19 05:49:03 2021] ? vprintk_emit+0x120/0x240
[Sun Dec 19 05:49:03 2021] usb_hcd_submit_urb+0x84/0x2e0
[Sun Dec 19 05:49:03 2021] usb_submit_urb+0x1e2/0x5e0
[Sun Dec 19 05:49:03 2021] usb_start_wait_urb+0x71/0x180
[Sun Dec 19 05:49:03 2021] usb_control_msg+0xe3/0x140
[Sun Dec 19 05:49:03 2021] ? _cond_resched+0x19/0x30
[Sun Dec 19 05:49:03 2021] ch34x_attach+0x1ad/0x270 [ch34x]
[Sun Dec 19 05:49:03 2021] ? usb_serial_probe.cold+0x7c2/0xa75 [usbserial]
[Sun Dec 19 05:49:03 2021] usb_serial_probe.cold+0x700/0xa75 [usbserial]
[Sun Dec 19 05:49:03 2021] usb_probe_interface+0xed/0x290
[Sun Dec 19 05:49:03 2021] really_probe+0x357/0x460
[Sun Dec 19 05:49:03 2021] driver_probe_device+0xe9/0x160
[Sun Dec 19 05:49:03 2021] device_driver_attach+0x5d/0x70
[Sun Dec 19 05:49:03 2021] __driver_attach+0x8f/0x150
[Sun Dec 19 05:49:03 2021] ? device_driver_attach+0x70/0x70
[Sun Dec 19 05:49:03 2021] bus_for_each_dev+0x7e/0xc0
[Sun Dec 19 05:49:03 2021] driver_attach+0x1e/0x20
[Sun Dec 19 05:49:03 2021] usb_serial_register_drivers+0x416/0x450 [usbserial]
[Sun Dec 19 05:49:03 2021] ? 0xffffffffc281d000
[Sun Dec 19 05:49:03 2021] ch34x_init+0x23/0x1000 [ch34x]
[Sun Dec 19 05:49:03 2021] asus_wmi: Initialization: 0x0
[Sun Dec 19 05:49:03 2021] do_one_initcall+0x48/0x1d0
[Sun Dec 19 05:49:03 2021] ? _cond_resched+0x19/0x30
[Sun Dec 19 05:49:03 2021] ? kmem_cache_alloc_trace+0x37a/0x430
[Sun Dec 19 05:49:03 2021] ? do_init_module+0x28/0x260
[Sun Dec 19 05:49:03 2021] do_init_module+0x62/0x260
[Sun Dec 19 05:49:03 2021] load_module+0x11aa/0x1370
[Sun Dec 19 05:49:03 2021] ? security_kernel_post_read_file+0x5c/0x70
[Sun Dec 19 05:49:03 2021] ? security_kernel_post_read_file+0x5c/0x70
[Sun Dec 19 05:49:03 2021] __do_sys_finit_module+0xc2/0x120
[Sun Dec 19 05:49:03 2021] ? __do_sys_finit_module+0xc2/0x120
[Sun Dec 19 05:49:03 2021] __x64_sys_finit_module+0x1a/0x20
[Sun Dec 19 05:49:03 2021] do_syscall_64+0x38/0x90
[Sun Dec 19 05:49:03 2021] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[Sun Dec 19 05:49:03 2021] RIP: 0033:0x7f956770789d
[Sun Dec 19 05:49:03 2021] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c3 f5 0c 00 f7 d8 64 89 01 48
[Sun Dec 19 05:49:03 2021] RSP: 002b:00007ffcdc3295b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[Sun Dec 19 05:49:03 2021] RAX: ffffffffffffffda RBX: 000055b07a5ca410 RCX: 00007f956770789d
[Sun Dec 19 05:49:03 2021] RDX: 0000000000000000 RSI: 00007f95675e4ded RDI: 000000000000000f
[Sun Dec 19 05:49:03 2021] RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000000
[Sun Dec 19 05:49:03 2021] R10: 000000000000000f R11: 0000000000000246 R12: 00007f95675e4ded
[Sun Dec 19 05:49:03 2021] R13: 0000000000000000 R14: 000055b07a5c9ee0 R15: 000055b07a5ca410
[Sun Dec 19 05:49:03 2021] ---[ end trace e8507a8c15c7f9b2 ]---
Is this a combination of this driver and the asus_wmi module?
Edit: No, this also happens when asus_wmi is not loaded.
~/Downloads/CH341SER-master$ sudo make
make -C /lib/modules/4.15.0-142-generic/build M=/home/simon/Downloads/CH341SER-master
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-142-generic'
CC [M] /home/simon/Downloads/CH341SER-master/ch34x.o
/home/simon/Downloads/CH341SER-master/ch34x.c:1292:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.write_room = ch34x_write_room,
^
/home/simon/Downloads/CH341SER-master/ch34x.c:1292:20: note: (near initialization for ‘ch34x_device.write_room’)
/home/simon/Downloads/CH341SER-master/ch34x.c:1293:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.chars_in_buffer = ch34x_chars_in_buffer,
^
/home/simon/Downloads/CH341SER-master/ch34x.c:1293:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
scripts/Makefile.build:337: recipe for target '/home/simon/Downloads/CH341SER-master/ch34x.o' failed
make[2]: *** [/home/simon/Downloads/CH341SER-master/ch34x.o] Error 1
Makefile:1584: recipe for target '_module_/home/simon/Downloads/CH341SER-master' failed
make[1]: *** [_module_/home/simon/Downloads/CH341SER-master] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-142-generic'
Makefile:7: recipe for target 'default' failed
make: *** [default] Error 2
simon@ubuntu:~/Downloads/CH341SER-master$
make
sudo make load
then reboot, still can't find ttyUSB.
sudo dmesg | grep ch34x
still show the disconnect msg:
284.973396] ch34x 3-4.2:1.0: ch34x converter detected
[ 284.973894] usb 3-4.2: ch34x converter now attached to ttyUSB0
[ 285.019333] usb 3-4.2: usbfs: interface 0 claimed by ch34x while 'brltty' sets config #1
[ 285.019883] ch34x ttyUSB0: ch34x converter now disconnected from ttyUSB0
[ 285.019895] ch34x 3-4.2:1.0: device disconnected
then, I find : https://unix.stackexchange.com/questions/670636/unable-to-use-usb-dongle-based-on-usb-serial-converter-chip
use:
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
sudo systemctl mask brltty.path
then OK (no need to reboot)
Hello guys,
i have a xsens mti 670 gnss ins on a mti g 600 dk board. I use its rs232 portal and connect to my khadas vim 4(using ubuntu 20.04) usb (rs232-to-usb cable). When im trying to run the device i have an error which says Mti device not found
. I tried #6 solution and it worked, temporally. After a few days i have , still, the same problem. Device not found.
khadas@Khadas:~/catkin_ws$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 039: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 054: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 055: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 053: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
using khadas@Khadas:~$_ dmesg
[16467.661635] usb 1-1.1.1: Product: USB Serial
[16467.662573] ch34x 1-1.1.1:1.0: ch34x converter detected
[16467.663231] usb 1-1.1.1: ch34x converter now attached to ttyUSB1
[16468.749890] logitech-hidpp-device 0003:046D:4022.0028: HID++ 2.0 device connected.
[16470.079909] logitech-hidpp-device 0003:046D:4023.0027: HID++ 2.0 device connected.
when i connect device with micro usb cable it get recognized normally and it recognizes it as Xsens device.
These lines confirm that ch341 is installed and working properly?
[16467.661635] usb 1-1.1.1: Product: USB Serial
[16467.662573] ch34x 1-1.1.1:1.0: ch34x converter detected
[16467.663231] usb 1-1.1.1: ch34x converter now attached to ttyUSB1
Any help would be appreciated!!
Thanks in advance.
Hey, the driver does not seem to compile anymore since 45074ab for me.
Errors:
/home/tomg/Desktop/CH341SER/ch34x.c:1292:27: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
1292 | .write_room = ch34x_write_room,
| ^~~~~~~~~~~~~~~~
/home/tomg/Desktop/CH341SER/ch34x.c:1292:27: note: (near initialization for ‘ch34x_device.write_room’)
/home/tomg/Desktop/CH341SER/ch34x.c:1293:28: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
1293 | .chars_in_buffer = ch34x_chars_in_buffer,
| ^~~~~~~~~~~~~~~~~~~~~
/home/tomg/Desktop/CH341SER/ch34x.c:1293:28: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
Reverting the change from 45074ab suggested in #14 by changing the type of ch34x_write_room
and ch34x_chars_in_buffer
back to unsigned int
instead of int
seems to resolve the issue for me for now.
Arch Linux, Kernel: 5.14.14-zen1-1-zen
(All packages up to date and rebooted)
make -C /lib/modules/4.19.6-1-MANJARO/build M=/home/akr/Downloads/CH341SER-master
make[1]: Entering directory '/usr/lib/modules/4.19.6-1-MANJARO/build'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '/usr/lib/modules/4.19.6-1-MANJARO/build'
make: *** [Makefile:7: default] Error 2
OS:- Manjaor linux
Linux Kernel 4.19.6-1 LTS
When running the make command, I came across the following errors:
error: initialization of ‘unsigned int (*)(struct tty_struct )’ from incompatible pointer type ‘int ()(struct tty_struct )’ [-Werror=incompatible-pointer-types]
1304 | .write_room = ch34x_write_room,
| ^~~~~~~~~~~~~~~~
/home/ti/Downloads/CH341SER-master/ch34x.c:1304:20: note: (near initialization for ‘ch34x_device.write_room’)
/home/ti/Downloads/CH341SER-master/ch34x.c:1305:21: error: initialization of ‘unsigned int ()(struct tty_struct )’ from incompatible pointer type ‘int ()(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
1305 | .chars_in_buffer = ch34x_chars_in_buffer,
| ^~~~~~~~~~~~~~~~~~~~~
/home/ti/Downloads/CH341SER-master/ch34x.c:1305:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:297: /home/ti/Downloads/CH341SER-master/ch34x.o] Erro 1
make[1]: *** [Makefile:1906: /home/ti/Downloads/CH341SER-master] Erro 2
make[1]: Saindo do diretório '/usr/src/linux-headers-5.15.0-69-generic'
make: *** [Makefile:7: default] Erro 2
Hello,
how to fix this?
Thanks
Opensuse 15.4 x86_64
uname -r
5.14.21-150400.24.46-default
make
make -C /lib/modules/5.14.21-150400.24.46-default/build M=/tmp/CH341SER
make[1]: вход в каталог «/usr/src/linux-5.14.21-150400.24.46-obj/x86_64/default»
CC [M] /tmp/CH341SER/ch34x.o
/tmp/CH341SER/ch34x.c:1304:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.write_room = ch34x_write_room,
^~~~~~~~~~~~~~~~
/tmp/CH341SER/ch34x.c:1304:20: note: (near initialization for ‘ch34x_device.write_room’)
/tmp/CH341SER/ch34x.c:1305:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.chars_in_buffer = ch34x_chars_in_buffer,
^~~~~~~~~~~~~~~~~~~~~
/tmp/CH341SER/ch34x.c:1305:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
Hi,
i have tried it but not working:
root@3dprinters:~/CH341SER_FIX# export LANG=c
root@3dprinters:~/CH341SER_FIX# make
make -C /lib/modules/5.15.24-v7l+/build M=/root/CH341SER_FIX
make[1]: Entering directory '/usr/src/linux'
CC [M] /root/CH341SER_FIX/ch34x.o
MODPOST /root/CH341SER_FIX/Module.symvers
CC [M] /root/CH341SER_FIX/ch34x.mod.o
LD [M] /root/CH341SER_FIX/ch34x.ko
make[1]: Leaving directory '/usr/src/linux'
root@3dprinters:~/CH341SER_FIX# make load
modprobe usbserial
insmod ch34x.ko
insmod: ERROR: could not insert module ch34x.ko: Invalid module format
make: *** [Makefile:12: load] Error 1
how can resolve?
Thanks
➜ CH341SER git:(master) ✗ make
make -C /lib/modules/5.15.0-53-generic/build M=/home/zero/tmp/ch340/CH341SER
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-53-generic'
CC [M] /home/zero/tmp/ch340/CH341SER/ch34x.o
/home/zero/tmp/ch340/CH341SER/ch34x.c:1300:20: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
1300 | .write_room = ch34x_write_room,
| ^~~~~~~~~~~~~~~~
/home/zero/tmp/ch340/CH341SER/ch34x.c:1300:20: note: (near initialization for ‘ch34x_device.write_room’)
/home/zero/tmp/ch340/CH341SER/ch34x.c:1301:21: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
1301 | .chars_in_buffer = ch34x_chars_in_buffer,
| ^~~~~~~~~~~~~~~~~~~~~
/home/zero/tmp/ch340/CH341SER/ch34x.c:1301:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:297: /home/zero/tmp/ch340/CH341SER/ch34x.o] Error 1
make[1]: *** [Makefile:1903: /home/zero/tmp/ch340/CH341SER] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-53-generic'
make: *** [Makefile:7: default] Error 2
After adding my device's vendor and produt IDs to C file, I did make and make load, I can see in dmesg that it loads and that my device is attached to ttyUSB0, but when I try to access it with sudo stty -a -F /dev/ttyUSB0
it fails with segmentation fault or nothing, infinite loop, cannot even CTRL+C when it happens.
And then in my dmesg it shows:
[ 131.126796] usb 1-1.4: ch34x converter now attached to ttyUSB0
[ 179.118063] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000040
[ 179.129103] Mem abort info:
[ 179.132058] ESR = 0x0000000096000044
[ 179.135880] EC = 0x25: DABT (current EL), IL = 32 bits
[ 179.141359] SET = 0, FnV = 0
[ 179.144528] EA = 0, S1PTW = 0
[ 179.147723] FSC = 0x04: level 0 translation fault
[ 179.152677] Data abort info:
[ 179.155602] ISV = 0, ISS = 0x00000044
[ 179.159497] CM = 0, WnR = 1
[ 179.162512] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000440ff000
[ 179.169054] [0000000000000040] pgd=0000000000000000, p4d=0000000000000000
[ 179.175980] Internal error: Oops: 96000044 [#1] PREEMPT SMP
[ 179.181636] Modules linked in: ch34x(OE) usbserial cmac algif_hash algif_skcipher af_alg bnep hci_uart btqca btrtl btbcm btintel xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nft_counter xt_addrtype nft_compat nf_tables nfnetlink br_netfilter bridge stp llc overlay binfmt_misc btsdio bluetooth ecdh_generic ecc brcmfmac bcm2835_isp(CE) bcm2835_codec(CE) bcm2835_v4l2(CE) brcmutil v4l2_mem2mem bcm2835_mmal_vchiq(CE) videobuf2_vmalloc videobuf2_dma_contig cfg80211 videobuf2_memops snd_bcm2835(CE) videobuf2_v4l2 raspberrypi_hwmon snd_pcm videobuf2_common snd_timer snd videodev bcm2835_gpiomem vc_sm_cma(CE) nvmem_rmem mc rpivid_mem uio_pdrv_genirq uio sch_fq_codel dm_multipath ramoops reed_solomon drm pstore_blk pstore_zone ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor xor_neon raid6_pq libcrc32c raid1 raid0 multipath linear spidev
[ 179.181822] dwc2 roles i2c_bcm2835 udc_core crct10dif_ce spi_bcm2835 xhci_pci xhci_pci_renesas phy_generic aes_arm64
[ 179.281032] CPU: 2 PID: 2119 Comm: stty Tainted: G WC OE 5.15.0-1041-raspi #44-Ubuntu
[ 179.289947] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
[ 179.295860] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
When I run make
on my machine (PopOS 22.04), it build failed.
➜ CH341SER git:(ubuntu) ✗ sudo make
make -C /lib/modules/6.0.12-76060006-generic/build M=/home/nguyenhieu/Desktop/CH341SER
make[1]: Entering directory '/usr/src/linux-headers-6.0.12-76060006-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
CC [M] /home/nguyenhieu/Desktop/CH341SER/ch34x.o
/home/nguyenhieu/Desktop/CH341SER/ch34x.c:1298:27: error: initialization of ‘void (*)(struct tty_struct *, struct usb_serial_port *, struct ktermios *)’ from incompatible pointer type ‘void (*)(struct tty_struct *, struct usb_serial_port *, const struct ktermios *)’ [-Werror=incompatible-pointer-types]
1298 | .set_termios = ch34x_set_termios,
| ^~~~~~~~~~~~~~~~~
/home/nguyenhieu/Desktop/CH341SER/ch34x.c:1298:27: note: (near initialization for ‘ch34x_device.set_termios’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:249: /home/nguyenhieu/Desktop/CH341SER/ch34x.o] Error 1
make[1]: *** [Makefile:1852: /home/nguyenhieu/Desktop/CH341SER] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.0.12-76060006-generic'
make: *** [Makefile:7: default] Error 2
I checkout to this commit: e70c14c
Then I can build successfully.
Thank you for your work.
root@BytePrisoner-HLYL-WXX9:/ufo/CH341SER#
root@BytePrisoner-HLYL-WXX9:/ufo/CH341SER# uname -a
Linux BytePrisoner-HLYL-WXX9 6.5.0-17-generic #1722.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 16 14:32:32 UTC 2 x86_64 x86_64 x86_64 GNU/Linux22.04) 12.3.0
root@BytePrisoner-HLYL-WXX9:/ufo/CH341SER# make
make -C /lib/modules/6.5.0-17-generic/build M=/ufo/CH341SER
make[1]: 进入目录“/usr/src/linux-headers-6.5.0-17-generic”
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
make[1]: 离开目录“/usr/src/linux-headers-6.5.0-17-generic”
root@BytePrisoner-HLYL-WXX9:/ufo/CH341SER# make load
modprobe usbserial
insmod ch34x.ko
insmod: ERROR: could not insert module ch34x.ko: Key was rejected by service
make: *** [Makefile:12:load] 错误 1
root@BytePrisoner-HLYL-WXX9:/ufo/CH341SER#
As in the title, I have a device with ch340 which keeps connecting and disconnecting after being plugged in.
I gave a little bit of description on askubuntu and don't want to repeat myself.
It seems like always before disconnecting the usb_serial_suspend
function is called (I found this by using kprobe
from perf tools.
I would be truly grateful if someone knows a way to either fix or debug this.
Due to a small amount of free time, I would like to transfer this repo to someone who is able to continue to take care of it. Those willing to do so should let me know under this issue. Thanks for your understanding.
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
#include <linux/signal.h>
#else
#include <linux/sched/signal.h>
#endif
The file has different location for kernel earlier than 4.11
ERROR LOG:
➜ CH341SER git:(master) make
make -C /lib/modules/6.1.4-arch1-1/build M=/home/btfz/CH341SER
make[1]: Entering directory '/usr/lib/modules/6.1.4-arch1-1/build'
CC [M] /home/btfz/CH341SER/ch34x.o
/home/btfz/CH341SER/ch34x.c:1294:27: error: initialization of ‘void (*)(struct tty_struct *, struct usb_serial_port *, const struct ktermios *)’ from incompatible pointer type ‘void (*)(struct tty_struct *, struct usb_serial_port *, struct ktermios *)’ [-Werror=incompatible-pointer-types]
1294 | .set_termios = ch34x_set_termios,
| ^~~~~~~~~~~~~~~~~
edit the file CH341SER/ch34x.c
:
then
make
sudo make load
no need reboot, every thing is OK.
MY PC INFO:
➜ CH341SER git:(master) ✗ screenfetch
-`
.o+` btfz@lt-pc
`ooo/ OS: Arch Linux
`+oooo: Kernel: x86_64 Linux 6.1.4-arch1-1
`+oooooo: Uptime: 4h 11m
-+oooooo+: Packages: 1688
`/:-:++oooo+: Shell: zsh 5.9
`/++++/+++++++: Resolution: 3200x1080
`/++++++++++++++: DE: Xfce4
`/+++ooooooooooooo/` WM: Xfwm4
./ooosssso++osssssso+` WM Theme: Microdeck3
.oossssso-````/ossssss+` GTK Theme: Arc-Dark [GTK2]
-osssssso. :ssssssso. Icon Theme: Numix-Circle
:osssssss/ osssso+++. Font: Sans 10
/ossssssss/ +ssssooo/- Disk: 149G / 215G (73%)
`/ossssso+/:- -:/+osssso+- CPU: Intel Xeon E3-1230 V2 @ 8x 3.7GHz [39.0°C]
`+sso+:-` `.-/+oso: GPU: AMD/ATI Juniper PRO [Radeon HD 6750]
`++:. `-/+/ RAM: 2909MiB / 7891MiB
.` `/
I am so done with this. This is without a doubt the worst error ever, I hate make.
When I try to execute sudo make
in the CH341SER folder, it simply enters the modules/....../amd64/build foldder and leaves because no destination or make
control file was named.
When using the InstallACModule's "InstallCH340.sh" file, I finally have a ch34x.ko. So I tried to copy the file to the CH341SER folder and then wrote `sudo make load.
Except now I get the error
modprobe usbserial
insmod ch34x.ko
insmod: ERROR: could not insert module ch34x.ko: Invalid module format
make: *** [Makefile:12: load] Error 1
EDIT: Please help, put an end to this extrodinary suffering
uname -a
output: Linux tardigrade 6.1.8-artix1-1 #1 SMP PREEMPT_DYNAMIC Sun, 29 Jan 2023 17:17:21 +0000 x86_64 GNU/Linux
Build log:
DKMS make.log for ch34x-r62.e70c14c for kernel 6.1.8-artix1-1 (x86_64)
Сб 04 фев 2023 16:49:11 IST
make: Entering directory '/usr/lib/modules/6.1.8-artix1-1/build'
CC [M] /var/lib/dkms/ch34x/r62.e70c14c/build/ch34x.o
/var/lib/dkms/ch34x/r62.e70c14c/build/ch34x.c:1294:27: error: initialization of ‘void (*)(struct tty_struct *, struct usb_serial_port *, const struct ktermios *)’ from incompatible pointer type ‘void (*)(struct tty_struct *, struct usb_serial_port *, struct ktermios *)’ [-Werror=incompatible-pointer-types]
1294 | .set_termios = ch34x_set_termios,
| ^~~~~~~~~~~~~~~~~
/var/lib/dkms/ch34x/r62.e70c14c/build/ch34x.c:1294:27: note: (near initialization for ‘ch34x_device.set_termios’)
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:250: /var/lib/dkms/ch34x/r62.e70c14c/build/ch34x.o] Error 1
make: *** [Makefile:1992: /var/lib/dkms/ch34x/r62.e70c14c/build] Error 2
make: Leaving directory '/usr/lib/modules/6.1.8-artix1-1/build'
Yay (installer) log:
Building module:
Cleaning build area...
make -j6 KERNELRELEASE=6.1.8-artix1-1 -C /usr/lib/modules/6.1.8-artix1-1/build M=/var/lib/dkms/ch34x/r62.e70c14c/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.8-artix1-1 (x86_64)
Consult /var/lib/dkms/ch34x/r62.e70c14c/build/make.log for more information.
error: command failed to execute correctly
:: Running post-transaction hooks...
(1/1) Install DKMS modules
==> dkms install --no-depmod ch34x/r62.e70c14c -k 6.1.8-artix1-1
Error! Bad return status for module build on kernel: 6.1.8-artix1-1 (x86_64)
Consult /var/lib/dkms/ch34x/r62.e70c14c/build/make.log for more information.
==> WARNING: `dkms install --no-depmod ch34x/r62.e70c14c -k 6.1.8-artix1-1' exited 10
Hi,
This does not compile on Linux mint 19 giving the following messages:
make -C /lib/modules/5.4.0-87-generic/build M=/home/jeroen/CH341SER make[1]: Entering directory '/usr/src/linux-headers-5.4.0-87-generic' CC [M] /home/jeroen/CH341SER/ch34x.o /home/jeroen/CH341SER/ch34x.c:1292:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .write_room = ch34x_write_room, ^~~~~~~~~~~~~~~~ /home/jeroen/CH341SER/ch34x.c:1292:20: note: (near initialization for ‘ch34x_device.write_room’) /home/jeroen/CH341SER/ch34x.c:1293:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .chars_in_buffer = ch34x_chars_in_buffer, ^~~~~~~~~~~~~~~~~~~~~ /home/jeroen/CH341SER/ch34x.c:1293:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’) cc1: some warnings being treated as errors scripts/Makefile.build:270: recipe for target '/home/jeroen/CH341SER/ch34x.o' failed make[2]: *** [/home/jeroen/CH341SER/ch34x.o] Error 1 Makefile:1762: recipe for target '/home/jeroen/CH341SER' failed make[1]: *** [/home/jeroen/CH341SER] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-87-generic' Makefile:7: recipe for target 'default' failed make: *** [default] Error 2
gcc 7.5.0
Any ideas??
Thanks! Jeroen
hi !
I have the file in my drivers list
/usr/lib/modules/5.15.0-27-generic/kernel/drivers/usb/serial/ch341.ko
my esp32 module connect normally!
Please refer to the new repo: https://github.com/WCHSoftGroup/ch341ser_linux.
sudo dmesg | grep ch34x gitves the following :
[ 199.366031] usbcore: registered new interface driver ch34x
[ 199.366047] usbserial: USB Serial support registered for ch34x
I foloowed all steps for archlinux (all dependencies satisied)
root@raspberrypi:/home/pi/Downloads/CH341SER# make
make -C /lib/modules/5.4.51-v8+/build M=/home/pi/Downloads/CH341SER
make[1]: Entering directory '/root/linux-f2f7e4b23d8788e96f81a7522b2f703e51c53e70'
Building modules, stage 2.
MODPOST 1 modules
ERROR: "_mcount" [/home/pi/Downloads/CH341SER/ch34x.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[1]: *** [Makefile:1622: modules] Error 2
make[1]: Leaving directory '/root/linux-f2f7e4b23d8788e96f81a7522b2f703e51c53e70'
make: *** [Makefile:7: default] Error 2
root@raspberrypi:/home/pi/Downloads/CH341SER# uname -a
Linux raspberrypi 5.4.51-v8+ #1333 SMP PREEMPT Mon Aug 10 16:58:35 BST 2020 aarch64 GNU/Linux
root@raspberrypi:/home/pi/Downloads/CH341SER# gcc --version
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.