re: How to Install CH340 Drivers

on kubuntu 20.04 (ubuntu + KDE )

starting at:

Other Linux Distributions

unexpected output - driver didn’t build

alizard@terrarium-lenovo:~/Downloads/CH341SER-master/CH341SER-master$ make clean

rm -rf .tmp_versions Module.symvers *.mod.c *.o .ko ..cmd Module.markers modules.order

alizard@terrarium-lenovo:~/Downloads/CH341SER-master/CH341SER-master$ make

make -C /lib/modules/5.4.0-88-generic/build M=/home/alizard/Downloads/CH341SER-master/CH341SER-master

make[1]: Entering directory ‘/usr/src/linux-headers-5.4.0-88-generic’

AR /home/alizard/Downloads/CH341SER-master/CH341SER-master/built-in.a

CC [M] /home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.o

/home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.c:1292:20: error: initialization of ‘int (*)(struct tty_struct )’ from incompatible pointer type ‘unsigned int ()(struct tty_struct *)’ [-Werror=incompatible-pointer-types]

1292 | .write_room = ch34x_write_room,

| ^~~~~~~~~~~~~~~~

/home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.c:1292:20: note: (near initialization for ‘ch34x_device.write_room’)

/home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.c:1293:21: error: initialization of ‘int (*)(struct tty_struct )’ from incompatible pointer type ‘unsigned int ()(struct tty_struct *)’ [-Werror=incompatible-pointer-types]

1293 | .chars_in_buffer = ch34x_chars_in_buffer,

| ^~~~~~~~~~~~~~~~~~~~~

/home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.c:1293:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)

cc1: some warnings being treated as errors

make[2]: *** [scripts/Makefile.build:270: /home/alizard/Downloads/CH341SER-master/CH341SER-master/ch34x.o] Error 1

make[1]: *** [Makefile:1762: /home/alizard/Downloads/CH341SER-master/CH341SER-master] Error 2

make[1]: Leaving directory ‘/usr/src/linux-headers-5.4.0-88-generic’

make: *** [Makefile:7: default] Error 2

alizard@terrarium-lenovo:~/Downloads/CH341SER-master/CH341SER-master$

Some compilers are more strict than others and have better / different checks. In this case it just does not like the an unsigned int-pointer to be stored in an int-pointer field.

You can type-cast the pointer or change in the code around line 933 static unsigned int ch34x_write_room( struct tty_struct *tty )to ```
static int ch34x_write_room( struct tty_struct *tty )