A GameSir T1d Has No HID Profile, and That Is a Protocol Problem, Not a Hardware One
At rest, with no thumb on it, the left stick reported 1023 for twenty consecutive seconds. Not drifting near the top of its range — pinned to it, the exact...
At rest, with no thumb on it, the left stick reported 1023 for twenty consecutive seconds. Not drifting near the top of its range — pinned to it, the exact ceiling of a 10-bit ADC, while the controller sat on a table. That number tells you what kind of problem you have: not a calibration offset, but an input that has stopped existing.
The controller is a GameSir T1d, the Bluetooth pad shipped with the Ryze/DJI Tello drone, labelled FCC ID: 2AF9ST1D. Power it on next to a Linux desktop and nothing happens: no pairing prompt, no /dev/input/event* node, no entry in Steam. Same on Windows, Android and SteamOS.
It is not broken. It is a BLE peripheral speaking a vendor GATT protocol instead of the Bluetooth SIG's HID profile, and no OS has a reason to guess what that means. A userspace bridge reads its input notifications and registers a virtual Xbox 360 pad through /dev/uinput, so every game that already talks to a wired controller keeps working.
Two of the three problems here are the ones you meet in any adapter layer: a wire format packed for the transmitter's convenience, and a sensor whose failure signature looks exactly like normal data unless you know where the rails are.
The controller has no HID service, so the OS will never enumerate it
Bluetooth gamepads normally work through HID over GATT (HOGP). The device exposes the standard HID service 0x1812 carrying a Report Map — the same report-descriptor language USB HID has used for decades — plus one characteristic per Input, Output and Feature report, each tagged with a Report Reference descriptor stating its (Report ID, Report Type) pair.
Because HOGP is a standard profile, the host claims it on the kernel's behalf. BlueZ's input plugin recognises the device and bridges it through uhid, producing /dev/hidraw*, /dev/input/event* and /dev/input/js* nodes, and udev tags the result ID_INPUT_JOYSTICK=1.
That path is also a security boundary, not just routing. If any paired GATT client could write report characteristics, any application could inject keystrokes or gamepad input without passing the OS's input permission model. Funnelling HID through one kernel-mediated path is what makes a BLE pad subject to the same access controls as a USB one — and why the reports of a real HOGP pad are invisible to bleak or gatttool once paired.
The T1d is the inverse case. It has no HID service to claim, so there is nothing to bridge and nothing to classify. No udev rule, no xpad quirk and no SDL mapping can reach it, because the device never presents an interface they can match on.
When a device has no profile the kernel recognises, the only insertion point is userspace: read the vendor protocol, write the standard one. That is an anti-corruption layer, and it belongs above /dev/uinput, not inside a kernel driver.
A 20-byte report with four 10-bit axes packed MSB-first
The controller advertises as Gamesir-T1d-XXXX after power-on and accepts a plain BLE connection with no pairing and no bonding. State arrives as notifications on characteristic 00008651-0000-1000-8000-00805f9b34fb, under service 00008650-0000-1000-8000-00805f9b34fb, 20 bytes at a time.
PACKET_INPUT = b"\xa1\xc5"
PACKET_STATUS = b"\xc9\xc6"
CHAR_INPUT = "00008651-0000-1000-8000-00805f9b34fb"
def decode(report: bytes) -> dict | None:
if len(report) != 20:
return None
if report[0:2] == PACKET_STATUS:
return None # heartbeat every ~5s, not player input
if report[0:2] != PACKET_INPUT:
return None
# Four 10-bit axes packed MSB-first: LX, LY, RX, RY, 0..1023, centre 512.
bits = int.from_bytes(report[2:7], "big")
return {
"lx": (bits >> 30) & 0x3FF,
"ly": (bits >> 20) & 0x3FF,
"rx": (bits >> 10) & 0x3FF,
"ry": bits & 0x3FF,
"l2": report[7], "r2": report[8],
"buttons": report[9] | (report[10] << 8),
"dpad": report[11],
"seq": int.from_bytes(report[18:20], "big"),
}
Two details account for most bugs. The c9 c6 status packet arrives every five seconds and must be dropped, because it is not laid out like an input report and interpreting it as one makes both sticks jump. And the packing is MSB-first across five bytes, because the firmware's author was saving bandwidth, not designing for a reader — fields do not fall on byte boundaries, so an off-by-one in the shift produces axes that are individually plausible and jointly wrong.
The bit names are not the obvious ones either. Byte 9 holds A (0x01), B (0x02), Home (0x04), X (0x08), Y (0x10), L1 (0x40), R1 (0x80). Byte 10 holds digital L2/R2 (0x01, 0x02), C1/C2 (0x04, 0x08), and stick clicks L3 (0x20), R3 (0x40). The D-pad is a direction code, not a bitfield: 0 none, 1 up, 3 right, 5 down, 7 left.
Three transport properties shaped the design more than the wire format:
- Reports only arrive on change. An untouched controller sends nothing but the five-second status packet, so code assuming a steady stream needs a timer to synthesise rest state.
- Every axis reads exactly 512 after power-on. The firmware zeroes the sticks at boot, so packet one is a default, not a rest position. Sampling centre from it is fabricated calibration.
- Reports come at most every 14 ms while values change — roughly 71 Hz, behind a USB pad's 125 Hz polling but well inside the range where a human notices nothing.
That 14 ms is derived, not chosen. BLE peers exchange packets only at connection-interval boundaries, and 7.5 ms is the floor of the 1.25 ms-multiple range. Running two intervals, the budget is stack overhead in the low hundreds of microseconds plus one or two intervals waiting for the next anchor point.
Virtual devices are trusted by whatever metadata you declare
uinput lets a userspace process register an input device exactly as a driver would. The device is created from a struct uinput_user_dev plus capability ioctls; once written, the kernel allocates an event node and routes events into the normal input subsystem.
int cap(int fd, unsigned long req, int val) { return ioctl(fd, req, val); }
int make_pad(void) {
int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
if (fd < 0) return -1;
cap(fd, UI_SET_EVBIT, EV_KEY);
cap(fd, UI_SET_EVBIT, EV_ABS);
for (int b = BTN_SOUTH; b <= BTN_THUMBR; b++) cap(fd, UI_SET_KEYBIT, b);
static const int axes[] = {ABS_X, ABS_Y, ABS_RX, ABS_RY};
for (int i = 0; i < 4; i++) {
cap(fd, UI_SET_ABSBIT, axes[i]);
struct uinput_abs_setup s = {
.code = axes[i],
.absinfo = {.minimum = -32768, .maximum = 32767, .flat = 128, .fuzz = 16},
};
if (ioctl(fd, UI_ABS_SETUP, &s) < 0) { close(fd); return -1; }
}
cap(fd, UI_SET_ABSBIT, ABS_HAT0X);
cap(fd, UI_SET_ABSBIT, ABS_HAT0Y);
struct uinput_abs_setup hat = {
.code = ABS_HAT0X, .absinfo = {.minimum = -1, .maximum = 1},
};
ioctl(fd, UI_ABS_SETUP, &hat);
hat.code = ABS_HAT0Y;
ioctl(fd, UI_ABS_SETUP, &hat);
struct uinput_user_dev dev = {0};
snprintf(dev.name, UINPUT_MAX_NAME_SIZE, "Gamesir T1d (bridge)");
dev.id.bustype = BUS_USB;
dev.id.vendor = 0x045e; // Microsoft
dev.id.product = 0x028e; // Xbox 360 wired pad
dev.id.version = 0x0110;
write(fd, &dev, sizeof(dev));
return ioctl(fd, UI_DEV_CREATE) == 0 ? fd : -1;
}
The vendor and product fields are the load-bearing part. SDL derives a joystick GUID from bustype, a CRC16 of the device name, the vendor/product/version triple and capability masks, then looks that GUID up in its controller database. Declaring 0x045e:0x028e resolves as an Xbox 360 pad — the most-mapped controller in existence — so every SDL game, including everything shipped through Proton, gets a correct layout, working triggers and rumble semantics it already understands.
That is why --generic-ids exists as a degraded mode: declaring the real hardware identity produces an honest device no mapping database knows, so games fall back to raw axes in kernel order. Impersonation is pragmatic, and it is lock-in worth naming — the bridge depends on that vendor/product pair staying in SDL's database.
Permissions are the other half. Creating an input device needs write access to /dev/uinput, root-only by default. The udev rule tags the node uaccess so the logged-in desktop user gets an ACL:
# /etc/udev/rules.d/60-t1d-bridge-uinput.rules
KERNEL=="uinput", SUBSYSTEM=="misc", MODE="0660", GROUP="input", TAG+="uaccess"
Strictly better than group membership or sudo: the ACL is granted to the session and removed at logout, so no standing privilege persists.
A wiper leaving its track looks like data, not like a fault
Every stick axis is a carbon-track potentiometer: a metal wiper slides along a resistive track and the position taps a voltage an ADC samples. Two pots per stick module, one per axis. No magnet, no optical encoder, and no feedback telling the firmware contact was lost.
At rest, the unit read 714/317 (left) and 764/512 (right) instead of 512/512. A naive reading says "drift, add a dead zone." A dead zone cannot fix what the logging showed next: with no thumb on it, left Y crept from 823 to 1023 over four seconds, then held at exactly 1023 — the top of the ADC range — for twenty seconds.
An input parked at its rail while nothing touches it is not travel. It is a floating ADC input, pulled to the supply rail when the wiper lost contact with the track. The same pot reached only about 720 when pushed fully down, because that end of the track was worn from being the Tello's throttle. Shaking the controller scraped the wiper onto carbon and worked briefly, which is the confirmation.
This generalises past gamepads. A worn sensor does not report "I am broken." It reports the extreme of its valid range, which is a legal value, and every layer above treats it as intent. On the drone, a floating wiper commands full stick.
A rail value is ambiguous by construction: deliberate full deflection or a disconnected sensor. You cannot resolve it from one sample, only from the time series and from what the mechanism can physically do.
Four mitigations, each against a different part of that ambiguity:
- Centre sampled at each connect from the first full second the sticks are still; re-sampled by holding C1 + C2 for 1.5 s, or fixed with
--center LX,LY,RX,RY. - Range learned per side, per axis, so a pot topping out at 720 still yields full output. The limits 0 and 1023 are never learned as range: on a worn pot those are contact dropouts, not travel.
- Dead zone radial at 15%, with remaining travel rescaled to full output.
- Rail timeout (
--rail-timeout 2) treats an axis stuck at its limit for two seconds as centred. Off by default: it cannot distinguish a spurious rail from a deliberate full-stick hold.
The range-learning exclusion is what took measurement to get right: learning [0, 1023] from observations is the obvious implementation and is actively harmful on worn hardware, because the worn endpoint is exactly the value you must exclude.
DEADZONE = 0.15
def build_scale(low_samples: list[int], high_samples: list[int], centre: int) -> tuple[float, float]:
# Samples pinned to the rails are contact dropouts on a worn pot
# (floating ADC), not real travel.
clean_lo = [v for v in low_samples if v > 8]
clean_hi = [v for v in high_samples if v < 1015]
if not clean_lo or not clean_hi:
return float(centre), float(centre)
low, high = min(clean_lo), max(clean_hi)
if high - low < 256: # implausible travel: refuse to learn
return float(centre), float(centre)
return float(low), float(high)
def normalise(raw: int, low: float, high: float, centre: int) -> float:
outward = -1.0 if raw < centre else 1.0
span = abs(centre - (low if raw < centre else high))
if span < 1.0:
return 0.0
magnitude = abs(raw - centre) / span
if magnitude < DEADZONE:
return 0.0
return outward * min((magnitude - DEADZONE) / (1.0 - DEADZONE), 1.0)
The high - low < 256 guard matters more than it looks. A calibration pass where the user never reached a corner yields a range a few units wide, and dividing by that span amplifies ADC noise into full-scale output. Refusing to learn a degenerate range and falling back to the factory centre is the difference between "needs recalibration" and "unusable."
The repair decision is a cost comparison, and the software side loses
Worn pots are a hardware problem, and no bridging fixes them. Two repairs, cheapest first: spray plastic-safe contact cleaner (DeoxIT D5-class, not WD-40) into each potentiometer's slot and work the stick in circles for thirty seconds — fifteen minutes, good for months, treating the symptom without removing the wear; or replace the modules, where hall-effect parts in the common ALPS footprint have no track to wear. Either way it is fourteen through-hole pins per module to desolder, and module height and pin spacing vary between revisions, so measure before ordering.
Which raises the question every adapter project eventually faces: why not fix the controller instead? The Device Information service reports a PnP ID of vendor 0x000D (Texas Instruments), product 0x0000, version 0x0110 — the defaults of TI's BLE stack sample code. That points at a CC2540 or CC2541, an 8051-core part, and the four pads labelled CLK, DIO, GND, VDD beside it are its two-wire debug port. Custom firmware means IAR's 8051 compiler, TI's BLE-Stack, a CC Debugger, and no public source — a project, not a patch, reimplementing the protocol the bridge already reads.
The counter-argument is legitimate: the bridge only exists on Linux, needs a running session, and adds a process whose lifetime must be managed. A USB dongle removes all three — an ESP32-S3 as the BLE peer, presenting itself over USB as an ordinary HID gamepad, so a Steam Deck or TV box sees a wired controller with nothing to install. The BLE half already exists in ESP-IDF; the USB HID half is the open work. Either way you pay: in processes, or in a second embedded codebase with its own flashing story.
The durable lesson is smaller than either choice. An input device's identity is metadata you assert, not a fact you discover, and the layers above trust whatever you assert — which is what makes a dongle, a uinput node and a real Xbox pad indistinguishable to a game, and why declaring a device you are not is a maintenance liability rather than a trick.