Expand description
GIP (Gaming Input Protocol) host class driver.
Supports Xbox One, Xbox Series X|S, and compatible controllers using Microsoft’s Gaming Input Protocol (MS-GIPUSB) over USB.
§Architecture
GipHost handles the common GIP protocol framing — headers, ACKs,
sequence numbers, Hello handshake, and channel management.
Device-specific behavior (init sequences, input parsing quirks) is
delegated to a GipDevice trait implementation.
A built-in XboxOneSGamepad covers the Xbox One S controller and
is broadly compatible with other standard GIP gamepads.
§GIP lifecycle
After USB enumeration, GipHost::try_register performs the full GIP
handshake:
- The controller enters the Arrival state and sends Hello (0x02) messages every ~500 ms.
- The driver responds with the device-specific init packets from
GipDevice::init_packets(e.g., power-on). - Remaining handshake traffic (ACKs, status) is drained until the controller transitions to the Active state.
Once try_register returns successfully, the driver is ready for
GipHost::poll.
§Example
Rumble while the A button is held:
ⓘ
use embassy_usb_host::class::gip::{GipHost, XboxOneSGamepad, GipEvent, RumbleCommand};
let mut gip = GipHost::<_, XboxOneSGamepad>::try_register(
&bus,
&config_buf[..config_len],
addr,
dev_desc.vendor_id,
dev_desc.product_id,
).await?;
let mut rumbling = false;
loop {
match gip.poll().await? {
GipEvent::Input(report) => {
if report.a && !rumbling {
gip.set_rumble(&RumbleCommand {
strong: 128,
weak: 64,
..Default::default()
}).await?;
rumbling = true;
} else if !report.a && rumbling {
gip.stop_rumble().await?;
rumbling = false;
}
}
_ => {}
}
}Structs§
- Gamepad
Report - Parsed gamepad input report from a GIP controller.
- GipHost
- GIP host class driver.
- GipInterface
Info - Information about a GIP data interface found in a configuration descriptor.
- Rumble
Command - Rumble motor intensities.
- Xbox
OneS Gamepad - GIP device implementation for the Xbox One S controller.
Enums§
- GipError
- GIP host class driver error.
- GipEvent
- Event produced by
GipHost::poll.
Constants§
- GIP_
MAX_ PACKET - Maximum GIP packet size (matches the Command/Low-Latency MTU).
Traits§
- GipDevice
- Trait for GIP device-specific behavior.
Functions§
- build_
standard_ rumble - Build a standard GIP rumble packet (message type 0x09, 9-byte payload).
- find_
gip - Locate the GIP data interface in a configuration descriptor.
- parse_
standard_ input - Parse a standard GIP gamepad input report (message type 0x20).