WebUSB Test Harness
Inspect USB devices, claim interfaces, send control, bulk and interrupt transfers, and script the device in JavaScript.
Requires Chrome or Edge (desktop or Android). Interfaces of protected classes (HID, mass storage, audio, video) cannot be claimed. On Windows the device must use the WinUSB driver.
This browser doesn't support WebUSB (or the page isn't in a secure context). Try desktop Chrome or Edge over HTTPS.
Device
Paired
| No device selected. |
Interfaces & endpoints
Click an endpoint to target it below
Open a device to claim interfaces.
Control transfer
Bulk / interrupt transfer
Name
Script API reference
device: the selected USBDevice (or null); usb: navigator.usb
await open() / close(): open (and select config 1) / close
await claim(n) / release(n) / selectAlternate(n, alt)
await send(ep, data) → bytes written (bulk/interrupt OUT)
await recv(ep, length = 64) → Uint8Array (bulk/interrupt IN)
await controlIn({ type, recipient, request, value, index }, length) → Uint8Array
await controlOut({ type, recipient, request, value, index }, data)
type: 'vendor' (default) | 'class' | 'standard'; recipient: 'device' (default) | 'interface' | 'endpoint'
await clearHalt('in' | 'out', ep), await reset()
data can be a hex string ("01 02 ff"), an array of numbers, a typed array, or utf8("text\r\n")
bytes(x) → Uint8Array; hex(bytes) → "01 02 FF"; text(bytes) → UTF-8 string
u16(bytes, offset, le = true), u32(…): read integers
log(...values): print to the log (bytes print as hex, objects as JSON)
await sleep(ms); stopped() → true after Stop; assert(cond, msg)
Top-level await works; a returned value is printed. Stop takes effect at the next API call.
Log