recalbox-config.sh 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/recalbox-config.sh 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/recalbox-config.sh is run.
cat /recalbox/share/system/logs/recalbox.log | grep gpioIf 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.62I also tried my methods below successful with the other package I downloaded (those bundled with game roms)
4.14.62-v7I made two posts that you can reference, one for my 2.2" TFT + custom GPIO button set up.
https://forum.recalbox.com/topic/16295/recalbox-2018-xmas-beta-using-2-2-tft-lcd-and-gpio-buttonsAnother one for the setup for the custom GPIO pins that comes with the waveshare game hat
https://forum.recalbox.com/topic/16307/recalbox-on-waveshare-game-hatI 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.enabled=1
controllers.gpio.arg=map=4 gpio=5,6,13,19,21,4,26,12,23,20,16,18,-1Then edit the script file (/recalbox/scripts/recalbox-config.sh) to also pass the second parameter to mk_arcade_joystick_rpi.ko.
mount -o remount, rw /
vi /recalbox/scripts/recalbox-config.sh
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.
extra3=“$5”
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,-1Hope this help.
-
@cheungbx Thanks for your description! Tried that with
4.4.13-v7
and always receive asegmentation 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?