device_uhid_gamepad_state
Set gamepad state via UHID (id=3). On first call, CREATE is sent automatically. lx/ly/rx/ry are u16 LE stick axes (0-65535, center=32767); lt/rt are u16 LE triggers (0-32767, 0=released). dpad is a u8 hat (1=N,2=NE,3=E,4=SE,5=S,6=SW,7=W,8=NW,0=center). buttons is a u16 LE bitmask. The pad presents as a DualShock 4, so the bit order is that controller's, NOT the browser Gamepad API order: bit0=X/square, bit1=A/cross, bit2=B/circle, bit3=Y/triangle, bit4=L1, bit5=R1, bit6=L2, bit7=R2, bit8=share/select, bit9=options/start, bit10=L3, bit11=R3, bit12=PS/guide, bit13=touchpad. Note the face buttons are rotated: square is bit0 and cross is bit1. Bits 14-15 have no effect. device_gamepad_state is the higher-level twin — W3C standard button/axis arrays plus a selectable controller profile, with the bit packing done for you. Prefer it unless you specifically need to send this exact raw report.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lt | No | Left trigger (0-32767, default 0) | |
| lx | No | Left stick X (default 32767 = center) | |
| ly | No | Left stick Y (default 32767 = center) | |
| rt | No | Right trigger (0-32767, default 0) | |
| rx | No | Right stick X (default 32767 = center) | |
| ry | No | Right stick Y (default 32767 = center) | |
| dpad | No | D-pad hat value 0-8 (default 0 = center) | |
| udid | Yes | Device serial number (UDID) | |
| buttons | No | Button bitmask u16 (default 0) |