Go to file
2019-01-04 23:05:25 +00:00
gadget Add gadget mode for retro-bit GENERATIONS 2018-08-17 01:54:09 +09:00
hid_opp.c initial commit 2017-11-14 02:24:28 +09:00
input2gpio.c input2gpio: minor mod 2017-05-27 02:39:34 +00:00
input2gpio.service input2gpio: fix service config 2019-01-04 23:05:25 +00:00
input2gpio.sh input2gpio: minor mod 2017-05-27 02:39:34 +00:00
LICENSE Initial commit 2017-11-14 02:12:41 +09:00
Makefile Add uin_oppj to use the "TV Mahjong Game" controller 2018-11-27 03:38:48 +09:00
rc.local.example initial commit 2017-11-14 02:24:28 +09:00
README.md Create README.md 2017-11-15 01:46:03 +09:00
uin_oppd.c Add shutdown feature 2018-07-28 17:17:15 +09:00
uin_oppj.c Add uin_oppj to use the "TV Mahjong Game" controller 2018-11-27 03:38:48 +09:00
xboxd.sh Add /dev/input/event* to GPIO bridge utility for 2G-OIT 2018-01-10 04:53:09 +09:00

==== Orange Pi as a Game Pad =========================
_______     _____________    ________       _________
__  __ \    ___  __ \__(_)   ___  __ \_____ ______  /
_  / / /    __  /_/ /_  /    __  /_/ /  __ `/  __  / 
/ /_/ /     _  ____/_  /     _  ____// /_/ // /_/ /  
\____/      /_/     /_/      /_/     \__,_/ \__,_/   

What?

This is a project to use Orange Pi One as a gamepad. You can connect your own arcade controller to the Pi's GPIO, and allow Linux to recognize it as a joystick (e.g., /dev/js0).

Also, the project includes a USB Gadget API driver to expose the controller to PC as a USB gamepad.

You may be able to run it on other Orange Pi series or Raspberry Pi Zero (W) with small code modifications.

GPIO pin assign (an example)

This is an exmplae pin assign for Hori Fighting Stick EX (Xbox 360). You can modify source code to customize it.

3.3V 1 2 5V
BACK 3 4 5V
START 5 6 GND
UP 7 8 RB
GND 9 10 LB
DOWN 11 12 (PD14)
LEFT 13 14 GND
RIGHT 15 16 (PC4)
3.3V 17 18 (PC7)
(PC0) 19 20 GND
(PC1) 21 22 Xbox
(PC2) 23 24 (PC3)
GND 25 26 (PA21)
A 27 28 (PA18)
B 29 30 GND
X 31 32 (PG8)
Y 33 34 GND
RT 35 36 (PG9)
LT 37 38 (PG6)
GND 39 40 (PG7)

Hardware

Button/Stick circuit

   ___ ... GPIO pin (w/ internal pull-up)
  |
 \
  \
  |
__|__
///// GND

Install

On Armbian, or Retrorange Pi 3,

% cd /opt
% git clone https://github.com/toyoshim/opipad.git
% cd opipad
% make
% cat rc.local.example >> /etc/rc.local

On Armbian for Orange Pi Zero, you will need to disable other USB Gadget modules, such as g_serial. You can disable it by commenting it out in /etc/modules.

If the system does not have /lib/modules/3.4.113-sub8i/build (maybe happen on Retrorange Pi 3), you need to create a symlink from /usr/src/linux-headers-3.4.113-sun8i to compile drivers.

How to use

Once the applications are built, and the hardware is set up, it just works after the next reboot. Pressing Xbox button will switch the running mode. The first mode is local controller mode, and the second one is USB gamepad mode.