Access HID devices via WebHID.

Synopsis

hid <subcommand> [options]

Description

Talks to Human Interface Devices (keyboards, gamepads, custom USB HID gear) through the browser's WebHID API.

Options

list List currently-granted devices.

request [--vid 0x.. --pid 0x.. --usage-page N --usage N] Open the device picker; prints a handle.

open <handle> Open a device.

close <handle> Close a device.

send <handle> <report-id> Send an output report (payload from stdin).

query <handle> <report-id> Send an output report and await one input report (VIA-style request/response).

feature-send <handle> <report-id> Send a feature report (payload from stdin).

feature-get <handle> <report-id> <length> Receive a feature report.

watch <handle> Stream input reports as hex until Ctrl+C.

--raw Emit raw bytes (feature-get, query); default is hex dump.

--timeout <ms> query: wait this long for an input report (default 1000).

Examples

$ hid request

Open the browser's HID device picker.

$ hid list

List devices already granted to this origin.

$ hid watch <handle>

Stream input reports from a device.

Notes

Requires WebHID support and a user gesture for the device picker. Report payloads are capped at 4194304 bytes (4 MiB).

See Also

usb, serial, esptool