cannot pass the 2nd parameter for custom GPIO mapping to mk_arcade_joystick_rpi.ko

  • Re: [Testers wanted: major system upgrade (Pi3b+](KODI 17 and much more ...))

    I happened to encounter a GPIO issues with both the 2018 Xmas beta and the version before that as well.
    There is a bug in the boot up script /recalbox/scripts/ that did not pass the second parameter in the recalbox.conf file to the mk_arcade_joystick_rpi.ko.
    You can ssh into the recalbox and type this command to check what parameters have been passed to the mk_arcade_joystick_rpi.ko module when the /recalbox/scripts/ is run.
    cat /recalbox/share/system/logs/recalbox.log | grep gpio

    If the parameters are correctly passed, you will see something like this (taken from my recalbox with the waveshare game hat).
    loading module mk_arcade_joystick_rpi args = map=4 gpio=5,6,13,19,21,4,26,12,23,20,16,18,-1
    But if the parameters are not successfully passed, the module will log an error in this log file.

    What version of recalbox are you using ?
    you can type this command to find out
    uname -r
    mine is 4.14.62

    I also tried my methods below successful with the other package I downloaded (those bundled with game roms)

    I made two posts that you can reference, one for my 2.2" TFT + custom GPIO button set up.

    Another one for the setup for the custom GPIO pins that comes with the waveshare game hat

    I don't have to load another version of the mk_arcade_joystick_rpi.ko. I just use the one that comes bundled with the version of recalbox released.
    Then edit the recalbox.conf to put in the mapping commands.
    e.g. for my waveshare game hat I use the following:

    controllers.gpio.arg=map=4 gpio=5,6,13,19,21,4,26,12,23,20,16,18,-1

    Then edit the script file (/recalbox/scripts/ to also pass the second parameter to mk_arcade_joystick_rpi.ko.

    mount -o remount, rw /

    vi /recalbox/scripts/

    While in Vi Search for the line with extra2=“$4” using the command /extra2=“ , then press ENTER and a to add a line after it.


    Then Search for the line with map="$extra2” using the command /map=“
    Then change it to
    map="$extra2 $extra3”

    After that, reboot the recall box to take effect of the changes by typing

    shutdown –r now

    If you just want to test if it works before changing all the files, you can SSH into your recalbox, then manually load the mk_arcade_joystick_rpi.ko module with the parameters for the custom GPIO pins using the following commands:

    #unload the GPIO controller module
    rmmod mk_arcade_joystick_rpi
    #load it with the custom gpio mapping of waveshare game hat,note replace 4.14.62 with the version name you found in command 'uname -r'
    insmod /lib/modules/4.14.62/extra/mk_arcade_joystick_rpi.ko map=4 gpio=5,6,13,19,21,4,26,12,23,20,16,18,-1

    Hope this help.

  • @cheungbx Thanks for your description! Tried that with 4.4.13-v7and always receive a segmentation fault after this:

    # rmmod mk_arcade_joystick_rpi
    # insmod /lib/modules/4.4.13-v7/extra/mk_arcade_joystick_rpi.ko map=4 gpio=5,4,14,22,13,18,21,16,6,20,26,12,18

    Have a Pi 3b.

    Any ideas?

Want to support us ?