PlayStation 1/2 joypads via SPI interface Driver for Linux
May 22, 2017
I wrote PlayStation 1/2 joypads via SPI interface Driver for Linux.
(for Enbedded Linux board has SPI, Raspberry Pi, Beagle, Panda, 96board, Armadillo, etc)
It is installed in Linux kernel 4.12.
- PSX pad can be connect directly to SPI bus.(polling 60-120fps, low latency!!)
- All PSX pad can be gotten digital keys state.(PSXPAD_KEYSTATE_DIGITAL)
- PS1(with analog) pad can be gotten analog stick value.(PSXPAD_KEYSTATE_ANALOG1)
- PS1(with analog) and PS2 pad can rumble motors.(need 9V power)
How to use Raspberry Pi
To use this driver to Raspbian, You must recompile a Raspbian kernel. (RetroPie too)
To recompile kernel, see KERNEL BUILDING
And need this patch files
In kernel recomple, you get Raspbian kernel source, then use patch.
$ patch -p1 -d linux < psxpad-spi_rp.patch
This patch is include:
- PSX pad SPI bus driver
- SPI in Device Tree(DT) use "sony,psxpad-spi" from "spidev"
Then menuconfig, enable driver.
$ cd linux $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig[Device Drivers] -> [Input device support] -> [Joysticks/Gamepads] ->
<M> PlayStation 1/2 joypads via SPI interface
[*] PlayStation 1/2 joypads force feedback (rumble) support
and [Save], and [Exit].
If you can recompile Raspbian kernel, install to SD card.
Then connect PSX(PS1/2) pad wire to Raspberry Pi, upper figure.
To connect pad jack pin(thick), you can use dupon(QI) connector.
(I made 4-ways special multi tap device ...)
(Appendix) Raspberry Pi's SPI bus have two CS. Other than Attention pin, wire is common. 2nd pad's Attention wire to GPIO7 SPI0_CS1_N.
Thanks to guidance and fixies from Dmitry Torokhov.
And Thanks to pointing out from Linux kernel mailing list members too.
PSX pads test program. not need kernel rebuild. spidev_psxpad.tar.xz