canlab-cz / triple

Linux SocketCAN driver for USB2CAN Triple from Canlab s.r.o.

Home Page:http://www.rs.canlab.cz/?q=cs/node/123

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with kernel 5.16

martin-vitek opened this issue · comments

I'm using Fedora 35 with kernel 5.16.11, but unfortunately, driver does not compile with this kernel version. I tried to fix it (see commit 97d4bc0), and I fixed compilation problems, but when executing candump, the whole system froze, so there is some other problem as well.

Commited some fixes, tested on 5.13... hopefully not much changed in 5.16 :)

Tested with triple firmware 1.32
...

Unfortunately, it is not compiling:

Log
[martinv@martinv triple_orig]$ make
make[1]: Vstupuje se do adresáře „/home/martinv/Repos/triple_orig/driver“
make -C/lib/modules/`uname -r`/build M=/home/martinv/Repos/triple_orig/driver modules
make[2]: Vstupuje se do adresáře „/usr/src/kernels/5.16.18-200.fc35.x86_64“
  CC [M]  /home/martinv/Repos/triple_orig/driver/main.o
/home/martinv/Repos/triple_orig/driver/main.c:112:19: error: initialization of ‘void (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  112 |         .hangup = triple_hangup,
      |                   ^~~~~~~~~~~~~
/home/martinv/Repos/triple_orig/driver/main.c:112:19: note: (near initialization for ‘triple_ldisc.hangup’)
/home/martinv/Repos/triple_orig/driver/main.c:114:24: error: initialization of ‘void (*)(struct tty_struct *, const unsigned char *, const char *, int)’ from incompatible pointer type ‘void (*)(struct tty_struct *, const unsigned char *, char *, int)’ [-Werror=incompatible-pointer-types]
  114 |         .receive_buf = triple_receive_buf,
      |                        ^~~~~~~~~~~~~~~~~~
/home/martinv/Repos/triple_orig/driver/main.c:114:24: note: (near initialization for ‘triple_ldisc.receive_buf’)
/home/martinv/Repos/triple_orig/driver/main.c: In function ‘triple_init’:
/home/martinv/Repos/triple_orig/driver/main.c:65:18: warning: passing argument 1 of ‘tty_register_ldisc’ makes pointer from integer without a cast [-Wint-conversion]
   65 | #define N_TRIPLE (NR_LDISCS - 1)
      |                  ^~~~~~~~~~~~~~~
      |                  |
      |                  int
/home/martinv/Repos/triple_orig/driver/main.c:161:31: note: in expansion of macro ‘N_TRIPLE’
  161 |   status = tty_register_ldisc(N_TRIPLE, &triple_ldisc);
      |                               ^~~~~~~~
In file included from ./include/linux/tty.h:11,
                 from /home/martinv/Repos/triple_orig/driver/main.c:43:
./include/linux/tty_ldisc.h:233:46: note: expected ‘struct tty_ldisc_ops *’ but argument is of type ‘int’
  233 | int tty_register_ldisc(struct tty_ldisc_ops *new_ldisc);
      |                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/martinv/Repos/triple_orig/driver/main.c:161:12: error: too many arguments to function ‘tty_register_ldisc’
  161 |   status = tty_register_ldisc(N_TRIPLE, &triple_ldisc);
      |            ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/tty.h:11,
                 from /home/martinv/Repos/triple_orig/driver/main.c:43:
./include/linux/tty_ldisc.h:233:5: note: declared here
  233 | int tty_register_ldisc(struct tty_ldisc_ops *new_ldisc);
      |     ^~~~~~~~~~~~~~~~~~
/home/martinv/Repos/triple_orig/driver/main.c: In function ‘triple_exit’:
/home/martinv/Repos/triple_orig/driver/main.c:65:18: warning: passing argument 1 of ‘tty_unregister_ldisc’ makes pointer from integer without a cast [-Wint-conversion]
   65 | #define N_TRIPLE (NR_LDISCS - 1)
      |                  ^~~~~~~~~~~~~~~
      |                  |
      |                  int
/home/martinv/Repos/triple_orig/driver/main.c:249:24: note: in expansion of macro ‘N_TRIPLE’
  249 |   tty_unregister_ldisc(N_TRIPLE);
      |                        ^~~~~~~~
In file included from ./include/linux/tty.h:11,
                 from /home/martinv/Repos/triple_orig/driver/main.c:43:
./include/linux/tty_ldisc.h:234:49: note: expected ‘struct tty_ldisc_ops *’ but argument is of type ‘int’
  234 | void tty_unregister_ldisc(struct tty_ldisc_ops *ldisc);
      |                           ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/martinv/Repos/triple_orig/driver/main.c: In function ‘triple_ioctl’:
/home/martinv/Repos/triple_orig/driver/main.c:471:32: warning: passing argument 2 of ‘tty_mode_ioctl’ makes integer from pointer without a cast [-Wint-conversion]
  471 |     return tty_mode_ioctl(tty, file, cmd, arg);
      |                                ^~~~
      |                                |
      |                                struct file *
In file included from /home/martinv/Repos/triple_orig/driver/main.c:43:
./include/linux/tty.h:372:57: note: expected ‘unsigned int’ but argument is of type ‘struct file *’
  372 | int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
      |                                            ~~~~~~~~~~~~~^~~
/home/martinv/Repos/triple_orig/driver/main.c:471:12: error: too many arguments to function ‘tty_mode_ioctl’
  471 |     return tty_mode_ioctl(tty, file, cmd, arg);
      |            ^~~~~~~~~~~~~~
In file included from /home/martinv/Repos/triple_orig/driver/main.c:43:
./include/linux/tty.h:372:5: note: declared here
  372 | int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
      |     ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:287: /home/martinv/Repos/triple_orig/driver/main.o] Chyba 1
make[2]: *** [Makefile:1850: /home/martinv/Repos/triple_orig/driver] Chyba 2
make[2]: Opouští se adresář „/usr/src/kernels/5.16.18-200.fc35.x86_64“
make[1]: *** [Makefile:14: default] Chyba 2
make[1]: Opouští se adresář „/home/martinv/Repos/triple_orig/driver“
make: *** [Makefile:4: all] Chyba 2

I fixed it with the following changes: martin-vitek@113b98c, and now I can send CAN FD messages.

Closing as resolved, done some testing with newer distros and driver itself is capable of sending and receiving can 2.0 messages ...
Some issues with CAN FD still remain somehow buggy, but that not subject of this issue