Please do not post a support request without first reading and following the advice in

gamecon_gpio_rpi 1.3 (kernel 4.9 build fix)

  • Global Moderator

    Update: the original author has updated the official packages to incorporate the build fix. Please update your RetroPie-Setup script and reinstall the gamecondriver. No need to follow the instructions below!

    Hi folks,

    Due to changes in kernel source, the current upstream gamecon_gpio_rpi package will not build on kernel 4.9. I'm offering an updated package that includes a workaround to allow building.

    First make sure to follow the official instructions on installing the gamecon driver via the RetroPie-Setup script: This is necessary as the script does more than simply install a single deb package.

    Download the updated package here: (link removed - see updated note!)
    You need to install via a terminal command, like so (replace /path/to/ with the actual location):

    sudo dpkg -i /path/to/gamecon-gpio-rpi-dkms_1.3_all.deb

    Pay attention to any errors. A successful installation and build should produce the following output:

    Selecting previously unselected package gamecon-gpio-rpi-dkms.
    (Reading database ... 99733 files and directories currently installed.)
    Preparing to unpack ../gamecon-gpio-rpi-dkms_1.3_all.deb ...
    Unpacking gamecon-gpio-rpi-dkms (1.3) ...
    Setting up gamecon-gpio-rpi-dkms (1.3) ...
    Loading new gamecon_gpio_rpi-1.3 DKMS files...
    First Installation: checking all kernels...
    dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
    It is likely that 4.9.35-v7+ belongs to a chroot's host
    Building for architecture armv7l
    Building initial module for 4.9.35-v7+
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/4.9.35-v7+/updates/dkms/
    DKMS: install completed.

    Please note: I can't test the module myself due to lacking any GPIO-connected controllers. Although the patch is not ideal (using hardcoded defines), it should work fine on all current Pi revisions. If a Pi 4 is released that has a different GPIO base or ARM core revision, it will probably break.

    Source: (extracted from the deb package via deb-dpkg, as I couldn't find an upstream source repository).

  • Global Moderator

    Update: I had to update the package since posting this thread. The previous version I posted (1.2-1) seemed to be confusing DKMS install/uninstall due to the hypen. Please try the new package version 1.3 - OP updated with new link.

  • Oh man I hope this works! I've been unable to use my controllers for two months now x.x I'll be able to try this hopefully this weekend :)

  • @psyke83 After 2 months...a fix. Seems to work fine. Thanks!

  • Just curious if there is a trick to getting the driver to show inside RetroPie-Setup. The installation completed successfully but the gamecon driver does not show up in the list of installed packages -- and I cannot seem to configure it.

    I am guessing I am missing an easy step somewhere :)? Any idea what I can try?


  • @lbrockman Actually I spoke too soon. I updated the RetroPie-Setup Script and I now see the gamecon configuartion under the Configuration / Tools menu.

    Sorry for the confusion. And thanks for the fix :D

  • I didn't get a chance to try this but I did have one question. If I start with a fresh install is this file a complete install or do I need to install gamecon driver through RetroPie-Setup and then patch it with this?

  • Global Moderator


    It's recommended that you do, because the script does additional configuration beyond installing a .deb package. See:

    Install the gamecondriver from RetroPie-Setup, ignore the errors related to the 1.2 module not being built, then install my package. Then go back into the RetroPie-Setup script to access the configuration menu.

    Also keep in mind that either reinstalling gamecondriver from the script or updating all packages will cause the 1.2 package to be installed again.

  • @psyke83 Awesome thanks!

  • I just installled your package. I have a pi Zero with NES controller inputs wired to GPIO. I am testing now.
    Will report back

  • This worked like a charm! Thanks for your work! BTW I made this splashscreen image for my "NesPi," setup. Feel free to use it!0_1501795319232_NesPi.png

  • @psyke83
    Thank you! It´s working perfectly.
    Do you have knowledge how to change which GPIO pins that are used for player 5 and 6?

    I have tried to edit gamecon_gpio_rpi.c to the following code without success:

    /* GPIO pins 0, 1, 4, 7, 22, 23 */
    static const int gc_status_bit[] = { 0x01, 0x02, 0x10, 0x80, (1<<22), (1<<23) };
    static const int gc_gpio_ids[] = { 0, 1, 4, 7, 22, 23 };

    I want to be able to use GPIO02 and GPIO03 for power and reset buttons. And to use 2 nes controllers and 2 snes controllers via gamecon gpio.

  • Nice to see this is a quite recent topic. Hey y'all!

    Thanks for helping rewrite the code to work in the latest Retropie, psyke83! - I can successfully install your package, but when I configure the controller through the commandline, "modprobe --first-time db0_gpio_rpi map 4,4" - it throws out an error ... (re: finding a modfile or db9 etc)

    Is there a way around this?

    Thanks in advance
    Tim (with a pi primed with 2 sets of wired db9 connectors all ready to go)

    --- slightly unrelated, but if I set up both to megadrive connectors, would the amiga / atari work also? I remember megadrive pads working fine in the amiga, so any thoughts?

  • Global Moderator


    The RetroPie script's gamecon driver installation consists of two packages that build kernel modules - db9_gpio_rpi and gamecon_gpio_rpi. The package that I provided is only for one, and not the one you need.

    I'm guessing that you tried installing my updated package without first following the installation instructions, which is why the db9 package (and driver) is not present.

  • The original developer, marqs, has updated both drivers to build properly:

    Do those repos need to be added by @BuZz to retropie?

  • Global Moderator

    @darksavior said in gamecon_gpio_rpi 1.3 (kernel 4.9 build fix):

    The original developer, marqs, has updated both drivers to build properly:

    Do those repos need to be added by @BuZz to retropie?

    Great news. I see that marqs has already sent a PR to update the RetroPie-Setup script, so nothing needs to be done. I've added a note to the top of this thread.

  • Global Moderator


    I didn't realize that the db9_gpio_rpi driver also needed patching with the same build fix, but the original author has done it now. If you update your script and reinstall the official drivers, your controllers should work.

  • Aye, thanks for the update... Will give it a shot now

  • when configuring with modprobe:
    "modprobe: ERROR: could not insert 'db9_gpio_rpi': Invalid argument"


  • Sussed it! Updated everything using the command lines- reinstalled. then needed to add "SUDO" to the "modprobe --first-time gamecon_gpio_rpi map 4,4"

    All working! Thanks for the help!

Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.