Home

Awesome

360-w-raw-gadget

360 controller wireless receiver raw USB gadget. (WIP)

This project aims to allow emulating multiple controllers over USB. This works by using the UDC hardware, usually found on small SOC's like a raspberry pi zero.

Initially tried this using functionfs in both python and Rust, but this only worked on *nix hosts. The reason for this is that functionfs/gadgetfs only allows for well-defined USB classes/well-formed descriptors. After the interface descriptor, e.g. Windows expects a vendor-specific descriptor, which is not supported by functionfs.

Thus, we're using raw-gadget + C here.

(First project using C, so don't judge too hard)

Originally, I made this for 1 controller at first, this would be a bit more close to the hardware. You can find that here.

Small disclaimer: This doesn't actually properly emulate the receiver, it's a bit of a cursed mix of various descriptors of both the receiver + the xbox controller. It's just to trick various drivers to pick up multiple input xbox controllers.

Functionality

For now only the input endpoints are implemented, which allows for controller input to be sent to the host.

Rumble/led feedback is on the todo list, but will be left out for now.

Building for Specific Hardware

This project supports a range of hardware configurations, as listed below. You can build the project for your specific device using the appropriate make target.

HardwareBuild TargetDriverDevice
Raspberry Pi Zero (default target)make20980000.usb20980000.usb (dwc2)
Raspberry Pi Zero 2make rpi0_23f980000.usb3f980000.usb (dwc2)
Raspberry Pi 4make rpi4fe980000.usbfe980000.usb (dwc2)
Raspberry Pi 5make rpi51000480000.usb1000480000.usb (dwc2)
USB Armory Mk IImake usb-armory-mk22184000.usbci_hdrc.0
Orange Pi PCmake orange-pi-pcmusb-hdrcmusb-hdrc.4.auto
Khadas VIM1make khadas-vim1c9100000.usbc9100000.usb
ThinkPad X1 Carbon Gen 6make thinkpad-x1dwc3-gadgetdwc3.1.auto
NXP i.MX8MPmake nxp-imx8mpdwc3-gadget38100000.usb
BeagleBone Blackmake beaglebone-blackmusb-hdrcmusb-hdrc.0
BeagleBone AImake beaglebone-aidwc3-gadget48380000.usb
EC3380-ABmake ec3380-abnet22800000:04:00.0
Odroid C2make odroid-c2dwc_otg_pcddwc2_a
Generic hardwaremake genericdummy_udcdummy_udc.0

(Table is taken from the raw-gadget repository)

To build for your device, use the corresponding target, for example:

make rpi4

For the Raspberry Pi Zero / Zero 2, you can use the default target:

make

Running

To run the gadget, you need to load the kernel module for raw-gadget and then run the gadget binary.

For the raw-gadget module, you can follow the instructions in the raw-gadget repo, e.g. for raspberry pi's: setup_raspberry-pi.md

After loading the module, you can run the gadget example binary:

sudo ./example

This will run the example function, which activates the A button every second for 4 controllers at the same time.

For more input control, take a look at the partsnotincluded link in the sources section.

Static lib

If you want to use this in other projects, you can edit the makefile CFLAGS. More info the makefile. Afterwards you can link the functions found in 360-w-gadget.h via the lib360wgadget.a static lib.

Issues;

TODO:

Sources

useful links/sources:

More sources (old):