Field note 16 · input

The Gamepad Pairs and the Page Never Sees It

Bluetooth pad · Gamepad API · H5 on Android

I borrowed a cheap Bluetooth pad to play H5 games without my thumbs covering half the screen. It paired in seconds, the light went solid, and the browser stayed still. The page was looking in the wrong place.

Android exposes pads through the Gamepad API, but a slot appears only after a button press and stays listed while the pad sleeps. A page loaded before the pad wakes has to be nudged: press a face button, then the axes report. Until then every control reads zero, which looks like a dead controller.

The other half is the mode switch. Most cheap pads boot in a keyboard mode, where the d-pad sends arrow keys and the sticks send nothing. I use two pages as a test: rpvip2 answers the left stick only, so a keyboard-mode pad looks broken there, while ina777 also takes the d-pad.

Sticks drift. A resting pad can report 0.03 to 0.08 on both axes. A deadzone near 0.15 settles it, and a remap settles the triggers, which some pads send as buttons and others as the last two axes. h5.idrgame clamps both, so a pad behaves the same in Chrome and in its installed build.

Inside an APK wrapper the host activity sees key events first, and a pad that works in the browser can die in the app. rsnvip6 lost its d-pad that way after an update: the page was fine, the wrapper was eating the input.

When a pad looks broken, open a page that prints raw button state, such as rpvip5. A solid light with no movement is almost always a mode or a missed gesture, not a dead battery.