Based on The Raspberry Pi GPIO Joystick Driver
Modified by Vanni Bruto
Looks like a quick & dirty GPIO banger for Pandora's Box 6 "Aus" 3H / 3A / Whatever it's an Orangi pi clone. :) I didn't make this but it's here at github for safekeeping.
The joystick driver is based on the gamecon_gpio_rpi driver by marqs
It is written for 4 directions joysticks and 8 buttons per player.
It can read one joystick + buttons wired on RPi GPIOs (two sticks and 13(?) buttons for the Pandora's box revision).
It uses internal pull-ups of the H3 GPIO ports, so all switches must be directly connected to its corresponding GPIO and to the ground.
Tested to compile on 3.4.113 default Sunxi kernel.
Get a USB-lan adapter. ADMTek pegasus II confirmed to work. Plug into internal port and connect to your LAN. Get a USB keyboard. Plug it into the 'outside left' port. Closest to the short side. Boot up Retr0rangePi 4.2, press F4 to drop to shell. Use 'ifconfig' to get the ip of the device.
Download the installation script :
sudo apt install linux-headers-$(uname-r)
sudo make
sudo insmod mk_arcade_joystick_rpi.ko
Check with dmesg to see the driver is loaded.
If this doesn't work, compile, or complains about unable to download headers, use dhclient eth2 or whatever the USB lan adapter is. It will set the default route for you :) (Add the dhclient command to /etc/rc.local to avoid this in the future.)
Copy the compiled kernel module to a safe place, and load it from rc.local for example:
insmod /home/pi/mk_arcade_joystick_rpi.ko
Use the following command to test joysticks inputs :
jstest /dev/input/js0
(Might need "sudo apt install joystick" if the jstest command is missing.)
The MCP23017 is not supported by this version of the driver, and it's very unlikely i'll port it over. Sorry.
- Coin button not working at the moment.
- Doesn't compile on current mainline. (todo!)
- gamecon_gpio_rpi by marqs
- RetroPie-Setup by petRockBlog
- Low Level Programming of the Raspberry Pi in C by Pieter-Jan
- Vanni Bruto
- RedboX for the initial Japb Jamma driver that never got a public release.