Skip to content

Input Options

Jannik Vogel edited this page Jul 27, 2015 · 9 revisions

Input Options

The Xbox uses so called Xbox Input Devices (XID). The hardware side is USB with a different plug while the software side is USB without HID-descriptors. Technicly a XID is a USB-hub for the Memory-Units and the XBL Communicator. The XID Gamepad USB-Device is internally connected to that hub.

To connect a device you must specify the driver for the emulated USB device and the port the device should connect to. You also need to specify "-usb" on the command line to add usb functionality.

The ports which can be used in XQEMU are:

Xbox Port XQEMU USB-Port
Player 1 bus=usb-bus.0,port=3
Player 2 bus=usb-bus.0,port=4
Player 3 bus=usb-bus.0,port=1
Player 4 bus=usb-bus.0,port=2

The XID is usually connected to Port 2 of the XID-hub. So if you have a hub for Player 1 at bus=usb-bus.0,port=3, your gamepad-device would connect to bus=usb-bus.0,port=3.2.

Emulated XID

There is XID emulation in XQEMU which emulates a very basic Duke Xbox Controller [VID: 0x045e, PID: 0x0202]. The input can't be configured at the moment but the following buttons are mapped:

Xbox Button PC Keyboard
A Z
B X
X A
Y S
Start Backspace
Back Return
DPad-Up Arrow-Up-Key
DPad-Down Arrow-Down-Key
DPad-Left Arrow-Left-Key
DPad-Right Arrow-Right-Key

No other buttons or analog controls are currently mapped! There is no force feedback indicator either.

To recreate the internal XID hub we use the existing QEMU "usb-hub" device. The actual XID emulation is provided by the "xbox-gamepad" device.

Example: -usb -device usb-hub,bus=usb-bus.0,port=3 -device usb-xbox-gamepad,bus=usb-bus.0,port=3.2

USB Forwarding

QEMU has the option to forward USB Devices from the host to the guest. The input might be delayed but it will support all features you'd expect. In theory even memory units or the communicator should work! You have 2 options to forward the xbox gamepad.

You can either forward the hub or just the gamepad.

To be able to forward any of the host devices you must take the following steps:

  1. Have an adapter cable (this one has not been tested yet!) or build one yourself*
  2. Have libusb installed
  3. Find the VID:PID (Vendor and Product ID) of the XID-Hub and/or the internal Gamepad device
  4. Make sure that libusb has the necessary permissions

* Please do not destroy original Controllers. Instead buy a cheap break-away or extension cable. By cutting it in half you can create 2 USB Adapters: 1. USB to Xbox + 2. Xbox to USB. You can still use your adapters as an extension cable for most XIDs (not working with Lightguns).

On Linux you can use "lsusb" for step 2. Step 3 involves adding a udev rule on most linux distributions. The udev rule (/etc/udev/rules.d/999-xbox-gamepad.rules) for a Controller-S could look like this:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0288", GROUP="users", MODE="660" # Hub
SUBSYSTEMS=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0289", GROUP="users", MODE="660" # Gamepad

Hub-Forwarding

To forward the entire hub of the controller we simply have to forward the hub to the emulated xbox.

Example: -usb -device usb-host,bus=usb-bus.0,port=3,vendorid=0x45e,productid=0x288

Gamepad-Forwarding

For Gamepad forwarding we create a virtual hub using QEMU and connect the XID gamepad device to port 2 of the emulated hub.

Example: -usb -device usb-hub,bus=usb-bus.0,port=3 -device usb-host,vendorid=0x45e,productid=0x289,bus=usb-bus.0,port=3.2

Contribute

If you are a developer you can also check out the XID emulation source code. You could write a new driver to turn connected Xbox 360 Gamepads into original Xbox XIDs for example.

Clone this wiki locally