fortian / cp210x

Linux driver for Silicon Labs CP210x USB serial chips supporting GPS PPS over USB
GNU General Public License v2.0
4 stars 1 forks source link

Can't receive data [was: Can't compile] #1

Open Najsr opened 3 years ago

Najsr commented 3 years ago

Hello,

I can't get this driver to compile it throws this error: Kernel version: 4.19.0-10-amd64

make -C /lib/modules/4.19.0-10-amd64/build M=/home/user/cp210x modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.0-10-amd64'
  CC [M]  /home/user/cp210x/cp210x.o
/home/user/cp210x/cp210x.c: In function ‘cp210x_get_tx_queue_byte_count’:
/home/user/cp210x/cp210x.c:703:26: error: dereferencing pointer to incomplete type ‘struct cp210x_comm_status’
     sts = kmalloc(sizeof(*sts), GFP_KERNEL);
                          ^~~~
/home/user/cp210x/cp210x.c: In function ‘cp210x_get_termios_port’:
/home/user/cp210x/cp210x.c:781:9: error: passing argument 5 of ‘cp210x_get_config’ from incompatible pointer type [-Werror=incompatible-pointer-types]
         &bits, 2);
         ^~~~~
/home/user/cp210x/cp210x.c:389:42: note: expected ‘unsigned int *’ but argument is of type ‘u16 *’ {aka ‘short unsigned int *’}
     u8 request, int value, unsigned int *data, unsigned int size) {
                            ~~~~~~~~~~~~~~^~~~
/home/user/cp210x/cp210x.c: In function ‘cp210x_set_termios’:
/home/user/cp210x/cp210x.c:941:37: error: passing argument 5 of ‘cp210x_get_config’ from incompatible pointer type [-Werror=incompatible-pointer-types]
             CP210X_GET_LINE_CTL, 0, &bits, 2);
                                     ^~~~~
/home/user/cp210x/cp210x.c:389:42: note: expected ‘unsigned int *’ but argument is of type ‘u16 *’ {aka ‘short unsigned int *’}
     u8 request, int value, unsigned int *data, unsigned int size) {
                            ~~~~~~~~~~~~~~^~~~
/home/user/cp210x/cp210x.c:982:37: error: passing argument 5 of ‘cp210x_get_config’ from incompatible pointer type [-Werror=incompatible-pointer-types]
             CP210X_GET_LINE_CTL, 0, &bits, 2);
                                     ^~~~~
/home/user/cp210x/cp210x.c:389:42: note: expected ‘unsigned int *’ but argument is of type ‘u16 *’ {aka ‘short unsigned int *’}
     u8 request, int value, unsigned int *data, unsigned int size) {
                            ~~~~~~~~~~~~~~^~~~
/home/user/cp210x/cp210x.c:1009:37: error: passing argument 5 of ‘cp210x_get_config’ from incompatible pointer type [-Werror=incompatible-pointer-types]
             CP210X_GET_LINE_CTL, 0, &bits, 2);
                                     ^~~~~
/home/user/cp210x/cp210x.c:389:42: note: expected ‘unsigned int *’ but argument is of type ‘u16 *’ {aka ‘short unsigned int *’}
     u8 request, int value, unsigned int *data, unsigned int size) {
                            ~~~~~~~~~~~~~~^~~~
/home/user/cp210x/cp210x.c: In function ‘cp210x_tiocmget’:
/home/user/cp210x/cp210x.c:1099:31: error: passing argument 5 of ‘cp210x_get_config’ from incompatible pointer type [-Werror=incompatible-pointer-types]
         CP210X_GET_MDMSTS, 0, &control, 1);
                               ^~~~~~~~
/home/user/cp210x/cp210x.c:389:42: note: expected ‘unsigned int *’ but argument is of type ‘u8 *’ {aka ‘unsigned char *’}
     u8 request, int value, unsigned int *data, unsigned int size) {
                            ~~~~~~~~~~~~~~^~~~
/home/user/cp210x/cp210x.c: In function ‘cp210x_process_read_urb’:
/home/user/cp210x/cp210x.c:1238:20: warning: unused variable ‘max_packet_size’ [-Wunused-variable]
     unsigned short max_packet_size = 128;
                    ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-headers-4.19.0-10-common/scripts/Makefile.build:315: /home/user/cp210x/cp210x.o] Error 1
make[3]: *** [/usr/src/linux-headers-4.19.0-10-common/Makefile:1545: _module_/home/user/cp210x] Error 2
make[2]: *** [Makefile:146: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.0-10-amd64'
make: *** [Makefile:5: all] Error 2

Could you please help me to make it compile successfully?

therealbstern commented 3 years ago

Please try the most recent commits (as in, update to the new HEAD here).

Najsr commented 3 years ago

Hey, thanks for the fixes. The code compiles fine but the driver does not seem to do anything. DCD pin is always HIGH. I tried to monitor the port with ldattach 18 but the connection times out. I tried to manually change the DCD signal while monitoring via the ldattach and I get the same result.

therealbstern commented 3 years ago

I suspect the underlying USB serial code has changed too much. I'll see if I can lift the changes against the old driver to the new driver instead.

therealbstern commented 3 years ago

Please try the HEAD of the 4.19.154!

Najsr commented 3 years ago

Hey, sorry for the late response. The driver still does not work even with the correct branch

Najsr commented 3 years ago

I tried to send data with it and it works OK, but receiving does not work so there could be the core issue

therealbstern commented 3 years ago

:frowning_face: I'm sorry to hear it. There's obviously something the matter; if you're willing to keep trying, I can crank up some debugging information, but I don't want you to waste your time.

I don't have any of this hardware right now, so I can't test the changes myself.

Najsr commented 3 years ago

I don't really mind testing it. I'll leave it up to you if you want to continue tinkering with the driver.

therealbstern commented 3 years ago

I haven't forgotten this, I've just been swamped at work.

therealbstern commented 3 years ago

Still swamped, still intending to get to as soon as practical.

therealbstern commented 3 years ago

Still swamped but this is a real problem that deserves attention.