raspberry-switch-control
raspberry-switch-control copied to clipboard
Emulate Nintendo Switch USB Controller with Raspberry Pi
raspberry-switch-control
Emulate Nintendo Switch USB Controller with Raspberry Pi
Credit: This project heavily relies on https://github.com/mzyy94/nscon.
Hardware requirements
- Raspberry Pi Zero W (Supposedly, it works with a regular pi 4, via the USB-C port.)
Set up Raspberry Pi Zero
-
Install libcomposites for the USB gadget mode. (From https://github.com/milador/RaspberryPi-Joystick)
echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt echo "dwc2" | sudo tee -a /etc/modules echo "libcomposite" | sudo tee -a /etc/modules -
Install on the raspberry pi
go get -v -u -t github.com/omakoto/raspberry-switch-control/nscontroller/cmd/... -
Create the USB gadget. Do it once after every reboot.
sudo $HOME/go/src/github.com/omakoto/raspberry-switch-control/scripts/switch-controller-gadget
Control Nintendo Switch with Joystick on a PC (via Raspberry Pi)
-
Plug in the Raspberry Pi to the Switch. If using a Pi Zero, just connect via the micro-USB cable.
-
Connect a joystick (only the following ones are supported and tested) to a host PC.
- Nintendo Pro controller
- X-Box One controller
- PS4 controller
-
On the host PC, install the software:
go get -v -u -t github.com/omakoto/raspberry-switch-control/nscontroller/cmd/... -
On the host PC, run it:
nsfrontend -j /dev/input/js0 -o >(ssh pi@$PI_ADDRESS go/bin/nsbackend) -
Press
[enter]on the console to finish.
TODOs
- Autofire on/off
- Macro
References
- Control switch from a smart phone
- https://mzyy94.com/blog/2020/03/20/nintendo-switch-pro-controller-usb-gadget/
- https://github.com/mzyy94/nscon
- https://gist.github.com/mzyy94/60ae253a45e2759451789a117c59acf9#file-add_procon_gadget-sh
- https://www.kernel.org/doc/html/v4.13/driver-api/usb/gadget.html
- https://github.com/milador/RaspberryPi-Joystick
- https://www.rmedgar.com/blog/using-rpi-zero-as-keyboard-setup-and-device-definition
- https://github.com/wchill/SwitchInputEmulator
- https://sourceforge.net/projects/linuxconsole/
- https://github.com/progmem/Switch-Fightstick
- https://sourceforge.net/p/linuxconsole/code/ci/master/tree/utils/jstest.c
- http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/group___group___std_descriptors.html