Classic Xbox Controller Programming

This document describes the Xbox controller as a USB device. Readers are expected to have working knowledge on USB 1.1 and USB HID class.

Throughout this document, the term “controller” refers to the whole controller product and “gamepad” refers to the gamepad portion thereof (excluding the integrated hub and the memory unit slots).

Overview

The Xbox controller is in brief a USB compound device that consists of a USB gamepad and a two-port USB hub. The hub internally has three ports, to one of which the gamepad is attached. The other two ports are the memory unit slots; it means the memory unit is also a USB device (mass storage class). The USB cable and the memory unit connector carries five signals, four of which are standard USB signals and the rest is a clock signal(?). The extra signal is not used by the gamepad and the memory unit; it seems to be provided for upcoming expansion devices.

You can connect the controller to a PC by ripping the cable and soldering a USB connector. However, the controller does not work either with the generic USB joystick driver or with the generic mass storage driver, because the interface class/subclass values are strange, the HID descriptor and the HID report descriptor are missing, and so on.

USB Device Model

Here are descriptor dumps of the hub, the gamepad and the memory unit.

Vendor / Product IDs

The vendor ID is 0x045e (Microsoft). Product IDs are as follows:

ID product
0x001c integrated hub
0x0202 gamepad (American)
0x0280 memory unit
0x0284 DVD remote receiver
0x0285 gamepad (Japanese)

It is not recommended to distinguish Xbox gamepads by vendor/product IDs because third-party controllers may have their own vendor/product IDs.

Device Class

The gamepad has interface class 0x58 (‘X’), subclass 0x42 (‘B’), protocol 0x00. I believe this should be also common to third-party controllers, but I have no evidence. In fact the gamepad conforms to the HID class and behaves like a USB HID gamepad except that it lacks the HID descriptor and the HID report descriptor.

The memory unit has interface class 0x08 (mass storage), subclass 0x42 (‘B’=???), protocol 0x50 (bulk-only). It seems to conform to the mass storage device class with bulk-only transport, though the “true” subclass must be revealed to access the unit.

HID Report Format

The input report is 20-byte.

offset data
+0 0x00
+1 0x14 (size of the whole report)
+2 digital buttons
bit0 D-pad up
bit1 D-pad down
bit2 D-pad left
bit3 D-pad right
bit4 start button
bit5 back button
bit6 left stick press
bit7 right stick press
+3 0x00 (reserved for more digital buttons?)
+4 A button (*)
+5 B button (*)
+6 X button (*)
+7 Y button (*)
+8 black button (*)
+9 white button (*)
+10 L trigger (*)
+11 R trigger (*)
+12 left stick x (**)
+14 left stick y (**)
+16 right stick x (**)
+18 right stick y (**)
  • (*) unsigned 8-bit
  • (**) signed 16-bit, little-endian, north/east positive

Output Report

The output report (rumble control) is 6-byte.

offset data
+0 0x00
+1 0x06 (size of the whole report)
+2 0x00
+3 left actuator (*)
+4 0x00
+5 right actuator (*)

(*) unsigned 8-bit

Example of the HID Report Descriptor

The Xbox gamepad lacks the HID report descriptor that describes the input/output report formats. Based on the above report formats I have tried writing the report descriptor for your information. This is a mere example; neither official nor verified. Accuracy is not guaranteed.

*For convenience, the text files have been included with the XBCD driver on the download page.

This page is an archive of the original post found here.

 

Related posts

FSR 4.1 Black Flag Resynced | Driver Update Disaster

The Steam Leveling Trick Nobody Knows

This DualSense PC Controller Setup Replaces Steam Controller