GPIO Controller Input (as keyboard or joystick)



  • I have a system that uses GPIO for input. I would like to map them to a joystick or keyboard.

    ---JOYSTICK---
    To map the GPIOs as a joystick, I have used mk_arcade_joystick_rpi, but my GPIO aren't set up the same as what is shown in https://github.com/recalbox/recalbox-os/wiki/GPIO-controllers-(EN)
    The 0.1.5 version of mk_arcade_joystick_rpi should allow a custom map, but that doesn't seem to be included in Recalbox. In fact, I would prefer to use the version at https://github.com/TheFlav/mk_arcade_joystick_rpi, but I would really prefer to not mess with adding a driver unless it's quite easy for others to add. Is there an easy way for a user to add a newer version of mk_arcade_joystick_rpi to their Recalbox?

    ---KEYBOARD---

    If not, the alternate plan could be to use GPIO as a keyboard. While some may think that this causes the same problem, it's actually not widely known that all you really need is a .dtbo and some config.txt entries like
    #left
    dtoverlay=gpio-key,gpio=6,keycode=105
    #right
    dtoverlay=gpio-key,gpio=5,keycode=106
    #up
    dtoverlay=gpio-key,gpio=4,keycode=103
    #down
    dtoverlay=gpio-key,gpio=17,keycode=108
    #a = a = OK
    dtoverlay=gpio-key,gpio=16,keycode=30
    ...

    After that, you can easily navigate the menu system, but the mappings do not seem to work inside of any emulator or Kodi. I wonder if it is because each GPIO button is acting as a separate keyboard. If I run evtest, it looks like this.

    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0: 17.button
    /dev/input/event1: e.button
    /dev/input/event2: 12.button
    /dev/input/event3: f.button
    /dev/input/event4: 1a.button
    /dev/input/event5: 13.button
    /dev/input/event6: 18.button
    /dev/input/event7: 10.button
    /dev/input/event8: 11.button
    /dev/input/event9: 4.button
    /dev/input/event10: 5.button
    /dev/input/event11: 6.button


    I guess I'm looking for ideas here. Is there an easy way for me to build a version of https://github.com/TheFlav/mk_arcade_joystick_rpi and add it to a Recalbox install? Is there a pre-built version of mk_arcade_joystick_rpi v0.1.5 available somewhere? Is there a way to get the keyboard input working?


  • Moderator
    Team

    @flavor we haven't switched to the configurable GPIO branch because, as far as I remember, it doesn't support the hotkey button.

    To compile it, i think you can do it from raspbian but you must have the same kernel branch as us (which is 4.4 for now, should bump to 4.9 once i'm done upgrading all boards).

    Adding your branch ... no

    I'm used to buildroot, so it's rather easy for me to compile it from there. It's not that hard to understand : it's a bunch of makefiles, most of it



Want to support us ?

Join us on :

398
Online

25349
Users

13306
Topics

100819
Posts

Looks like your connection to Recalbox Forum was lost, please wait while we try to reconnect.