Open DRAgon734465502 opened 6 years ago
Hi
I also have this Problem and spend hours to fix it. Badly I couldn't find a solution. Mk Arcade Joystick doesn't work with Retropie from 4.14.
KMS: build completed. Error! echo Your kernel headers for kernel 4.14.21+ cannot be found at /lib/modules/4.14.21+/build or /lib/modules/4.14.21+/source. Error! echo Your kernel headers for kernel 4.14.21-v7+ cannot be found at /lib/modules/4.14.21-v7+/build or /lib/modules/4.14.21-v7+/source.
The problem is related to this change in kernel form 4.14 version: https://lwn.net/Articles/735887/
@gallochri thanks for the tip. Got it working with this:
pi@retropie:~ $ diff -u mk_arcade_joystick_rpi.c.broken mk_arcade_joystick_rpi.c
--- mk_arcade_joystick_rpi.c.broken 2019-05-25 00:28:44.860354625 +0000
+++ mk_arcade_joystick_rpi.c 2019-05-25 00:27:48.827657572 +0000
@@ -366,8 +366,8 @@
* mk_timer() initiates reads of console pads data.
*/
-static void mk_timer(unsigned long private) {
- struct mk *mk = (void *) private;
+static void mk_timer(struct timer_list *t) {
+ struct mk *mk = from_timer(mk, t, timer);
mk_process_packet(mk);
mod_timer(&mk->timer, jiffies + MK_REFRESH_TIME);
}
@@ -545,7 +545,7 @@
}
mutex_init(&mk->mutex);
- setup_timer(&mk->timer, mk_timer, (long) mk);
+ timer_setup(&mk->timer, mk_timer, 0);
for (i = 0; i < n_pads && i < MK_MAX_DEVICES; i++) {
if (!pads[i])
Great! could you make a pull request?
@gallochri I haven't done any driver code before, but I assume I'd have to wrap the differences in a macro like the one that was mentioned here right?: https://stackoverflow.com/questions/53839625/adaptation-from-old-init-timer-to-new-timer-setup
If I wrap that then do a PR, you think that will keep it working for all kernels without any breaking changes?
I've never written kernel modules to, but I think it's the right way. If you will do the PR someone will evaluate better...
@gallochri thanks for the tip. Got it working with this:
pi@retropie:~ $ diff -u mk_arcade_joystick_rpi.c.broken mk_arcade_joystick_rpi.c --- mk_arcade_joystick_rpi.c.broken 2019-05-25 00:28:44.860354625 +0000 +++ mk_arcade_joystick_rpi.c 2019-05-25 00:27:48.827657572 +0000 @@ -366,8 +366,8 @@ * mk_timer() initiates reads of console pads data. */ -static void mk_timer(unsigned long private) { - struct mk *mk = (void *) private; +static void mk_timer(struct timer_list *t) { + struct mk *mk = from_timer(mk, t, timer); mk_process_packet(mk); mod_timer(&mk->timer, jiffies + MK_REFRESH_TIME); } @@ -545,7 +545,7 @@ } mutex_init(&mk->mutex); - setup_timer(&mk->timer, mk_timer, (long) mk); + timer_setup(&mk->timer, mk_timer, 0); for (i = 0; i < n_pads && i < MK_MAX_DEVICES; i++) { if (!pads[i])
This worked a treat!
@gallochri thanks for the tip. Got it working with this:
pi@retropie:~ $ diff -u mk_arcade_joystick_rpi.c.broken mk_arcade_joystick_rpi.c --- mk_arcade_joystick_rpi.c.broken 2019-05-25 00:28:44.860354625 +0000 +++ mk_arcade_joystick_rpi.c 2019-05-25 00:27:48.827657572 +0000 @@ -366,8 +366,8 @@ * mk_timer() initiates reads of console pads data. */ -static void mk_timer(unsigned long private) { - struct mk *mk = (void *) private; +static void mk_timer(struct timer_list *t) { + struct mk *mk = from_timer(mk, t, timer); mk_process_packet(mk); mod_timer(&mk->timer, jiffies + MK_REFRESH_TIME); } @@ -545,7 +545,7 @@ } mutex_init(&mk->mutex); - setup_timer(&mk->timer, mk_timer, (long) mk); + timer_setup(&mk->timer, mk_timer, 0); for (i = 0; i < n_pads && i < MK_MAX_DEVICES; i++) { if (!pads[i])
Hi Could you share how to execute this ? I copied and pasted and just got a whole bunch of errors. Guessing I'm doing to wrong :-)
@gallochri thanks for the tip. Got it working with this:
pi@retropie:~ $ diff -u mk_arcade_joystick_rpi.c.broken mk_arcade_joystick_rpi.c --- mk_arcade_joystick_rpi.c.broken 2019-05-25 00:28:44.860354625 +0000 +++ mk_arcade_joystick_rpi.c 2019-05-25 00:27:48.827657572 +0000 @@ -366,8 +366,8 @@ * mk_timer() initiates reads of console pads data. */ -static void mk_timer(unsigned long private) { - struct mk *mk = (void *) private; +static void mk_timer(struct timer_list *t) { + struct mk *mk = from_timer(mk, t, timer); mk_process_packet(mk); mod_timer(&mk->timer, jiffies + MK_REFRESH_TIME); } @@ -545,7 +545,7 @@ } mutex_init(&mk->mutex); - setup_timer(&mk->timer, mk_timer, (long) mk); + timer_setup(&mk->timer, mk_timer, 0); for (i = 0; i < n_pads && i < MK_MAX_DEVICES; i++) { if (!pads[i])
Hi Could you share how to execute this ? I copied and pasted and just got a whole bunch of errors. Guessing I'm doing to wrong :-)
Open up the mk_arcade_joystick_rpi file and do the following:
REPLACE: static void mk_timer(unsigned long private) { struct mk mk = (void ) private; WITH: static void mk_timer(struct timer_list t) { struct mk mk = from_timer(mk, t, timer);
REPLACE: setup_timer(&mk->timer, mk_timer, (long) mk); WITH: timer_setup(&mk->timer, mk_timer, 0);
Thanks for this. I eventually figured that i needed to replace the mentioned lines. Works perfectly with retro pi.
I follow the step https://github.com/recalbox/mk_arcade_joystick_rpi -->Manual Installation-->3.b - Or compile and install with dkms:
I get the error
pi@retropie:~/mk_arcade_joystick_rpi-master $ sudo cp -a * /usr/src/mk_arcade_joystick_rpi-0.1.5/ pi@retropie:~/mk_arcade_joystick_rpi-master $ export MKVERSION=0.1.5 pi@retropie:~/mk_arcade_joystick_rpi-master $ sudo -E dkms build -m mk_arcade_joystick_rpi -v 0.1.5
Creating symlink /var/lib/dkms/mk_arcade_joystick_rpi/0.1.5/source -> /usr/src/mk_arcade_joystick_rpi-0.1.5
DKMS: add completed.
Kernel preparation unnecessary for this kernel. Skipping...
Building module: cleaning build area.... make -j4 KERNELRELEASE=4.14.30-v7+ all KVERSION=4.14.30-v7+....(bad exit status: 2) Error! Bad return status for module build on kernel: 4.14.30-v7+ (armv7l) Consult /var/lib/dkms/mk_arcade_joystick_rpi/0.1.5/build/make.log for more information.
It can work fine at old Retropie 4.3 version but when I try it at Retropie 4.3 get the error
Error! Bad return status for module build on kernel: 4.14.30-v7+ (armv7l)