Compiling PEAK Linux driver on kernel 4.15

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
mloebach
Posts: 2
Joined: Fri 27. Apr 2018, 15:23

Compiling PEAK Linux driver on kernel 4.15

Post by mloebach » Fri 27. Apr 2018, 15:41

I have issues compiling the PEAK Linux driver on kernel 4.15, it seems as if the time function has been deprecated in current kernel versions.

Is there already a fix for this, searching for this problem on the web yields a lot of similar results. The change I that introduces the problem might be explained here, if my current lead turns out to be correct: https://lwn.net/Articles/735887/

Do you have any knowledge about this and yes is there a fix already available?

The error message:

Code: Select all

  CC [M]  peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.o
peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.c: In function ‘pccard_start_activity_scanner’:
peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.c:369:2: error: implicit declaration of function ‘init_timer’ [-Werror=implicit-function-declaration]
  init_timer(&card->activity_timer);
  ^
peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.c:370:32: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
  card->activity_timer.function = pccard_activity_scanner;
                                ^
peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.c:371:22: error: ‘struct timer_list’ has no member named ‘data’
  card->activity_timer.data = (unsigned long)card;
                      ^
cc1: some warnings being treated as errors
scripts/Makefile.build:332: recipe for target 'peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.o' failed
make[3]: *** [peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.o] Error 1
Makefile:1552: recipe for target '_module_/peak-linux-driver-8.5.1/driver' failed
The make command output on the shell:

Code: Select all

make -C /usr/src/linux-headers-4.15.0-15-generic  SUBDIRS=peak-linux-driver-8.5.1/driver        EXTRA_CFLAGS="-Ipeak-linux-driver-8.5.1/driver        -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO_NETDEV_SUPPORT	 -DNO_RT  -Wno-date-time" V=0 modules

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: Compiling PEAK Linux driver on kernel 4.15

Post by M.Maidhof » Fri 27. Apr 2018, 16:32

Hi,

please try to compile without PC card option

make PCC=NO

regards

Michael

mloebach
Posts: 2
Joined: Fri 27. Apr 2018, 15:23

Re: Compiling PEAK Linux driver on kernel 4.15

Post by mloebach » Wed 2. May 2018, 09:40

Thanks for the quick reply, the compilation works now.

peterkvt80
Posts: 1
Joined: Fri 25. May 2018, 14:34

Re: Compiling PEAK Linux driver on kernel 4.15

Post by peterkvt80 » Fri 25. May 2018, 14:41

I had a go at hacking the code in pcan_pccard_core.c. This is how far I got. I'm not sure if this is working as this is my first time using the PCAN.
First redefine this parameter:

Code: Select all

/* activity scanner to control LEDs */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
static void pccard_activity_scanner(unsigned long ptr)
#else
static void pccard_activity_scanner(struct timer_list *ptr)
#endif
Then change the timer call

Code: Select all

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
	init_timer(&card->activity_timer);
	card->activity_timer.function = pccard_activity_scanner;
	card->activity_timer.data = (unsigned long)card;
#else
	timer_setup(&card->activity_timer, pccard_activity_scanner, 0);
#endif
Last edited by M.Gerber on Mon 28. May 2018, 09:45, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

Post Reply