awesome-webhid
awesome-webhid copied to clipboard
Curated list of resources relating to the WebHID (Human Interface Device) API
Awesome WebHID
Curated list of resources relating to the WebHID (Human Interface Device) API
WebHID is a browser API (navigator.hid
) that provides access to HID input/output devices. It's a higher level of abstraction than the WebUSB and Web Bluetooth APIs, but lower than the Gamepad API and basic input (pointer/keyboard).
Contributions welcome. Add links through pull requests or create an issue to start a discussion. See contribution guidelines.
Contents
- Status
- Good to know
- Specification & documentation
- Blogs & articles
- Talks & videos
- Devices
- Tools
- Bluetooth, USB, & HID reference
- Libraries
- Demos, experiments & hacks
- Real-world applications
- Inspiration from elsewhere
- Ideas
- Forums & discussion
- Miscellaneous
- Related
Status
Enabled by default since Chrome 89 (March 2021).
Good to know
- WebHID is not a W3C Standard nor is it on the W3C Standards Track(ref).
- Devices that generate trusted input (e.g. keyboards, mice, security keys) will not be accessible. Such devices define their reports in top-level HID collections that will be considered protected usages(ref1), (ref2).
- Access to a device must be granted by the user via a chooser dialog provided by the browser, similarly to WebUSB and Web Bluetooth. Launching the chooser must be done from the context of a user gesture (e.g. a mouse click).
- Neither the WebUSB(ref) or Web Bluetooth(ref) APIs allow access to HID-class devices.
Specification & documentation
- WebHID API Specification (Web Platform Incubator Community Group (WICG)) - Including introduction, motivating applications, and security/privacy.
- WebHID Explainer - The what & why in a nutshell, including basic terminology and an example. Some API details outdated.
- WebHID (Human Interface Device) - Chrome Platform Status
- Chromium implementation tracking bug: WebHID API - Labelled with targeted & stable release versions; see the development/release calendar.
Blogs & articles
- Upcoming WebHID API - access Bluetooth/USB HID devices in web applications - An introduction to WebHID with an example showing how to open, listen for input and send output to a device.
Talks & videos
None yet.
Devices
Devices that work well with WebHID, and device-specific abstraction libraries. Do also file an issue to inform others of devices that don't. Not all devices in the USB HID device class will communicate using the high-level abstractions.
- Blink(1) - notification light (see demos section, and prior art node-blink1).
- BlinkStick - light devices and controllers (see demos section, and prior art blinkstick)
- Elgato Stream Deck - programmable button panel (see demos, and libraries)
- Razer Kraken Kitty Edition Headset - headset with customizable LED lighting
- Sony DualShock 4 - controller for PlayStation 4 (see libraries section)
Candidates
- Cleware - sensors, switches, and lights (see clewarecontrol, sniner/cleware)
- Espruino Pico board - has an USB HID mode, might also be useful as an emulator?
- Jabra headsets (see Standard USB HID Specification)
- Nintendo Switch Pro Controller(ref)
- Sony DualShock 3(ref)
- X-keys - keyboards, switches, analog controls, and pedals (see HID Data Reports, Integration, xkeys, node-xkeys)
- Xbox Wireless Controller(ref)
Tools
Software that aids working with devices.
- USBDeview - View device information.
- USB Device Tree Viewer - View device information including interface and HID descriptors.
- node-hid - Cross-platform library for accessing USB HID devices from Node.js or Electron.
Bluetooth, USB, & HID reference
Information about the underlying technologies, including specifications and explanations.
- Human Interface Devices (HID) Information (USB Implementers Forum (USB-IF)) - Including the device class definition, and usage tables.
- Human Interface Device Profile specification (Bluetooth Special Interest Group (SIG)) - "An adaptation of the USB HID Specification to operate over a Bluetooth wireless link."
- A Closer Look at HID Class - Explanation of USB HID, with enough detail yet easy to follow.
- Understanding HID report descriptors - Understanding devices' descriptions of themselves.
Libraries
- TheBITLINK/WebHID-DS4 - using a DualShock 4 controller.
- @elgato-stream-deck/webhid - using the Elgato Stream Deck (see demos).
Demos, experiments & hacks
- todbot/blink1-webhid - using the blink(1).
- Elgato StreamDeck - using the Elgato Stream Deck (via @elgato-stream-deck/webhid).
- robatwilliams/webhid-demos - using the BlinkStick Strip.
Real-world applications
- Ergometer Space - Track your indoor rowing exercise, alone or with other online users.
- Kraken Kitty Edition Controller - Control the LED lighting on your Razer Kraken Kitty Edition headset.
- Remap - Customize a keyboard's keymap (see remap-keys/remap).
Inspiration from elsewhere
Transferrable inspiration from related areas such as general Bluetooth/USB HID, Web Bluetooth, and WebUSB.
- chrome.hid API sample - Generic input/output Chrome App sample.
- blink(1) using the chrome.hid API - Chrome App sample that controls a Blink(1) notification LED.
- Interacting with USB HID devices from web apps - Using a Chrome App as a go-between between a dictation foot pedal and a web application (2015).
- Web Bluetooth Demos (Web Bluetooth Community Group) - Various, plus links to others.
- Griffin Powermate Playground - Using WebUSB.
- node-hid examples - Despite the name, most directly use low-level read/write operations rather than HID abstractions.
Ideas
Great idea, no time or no device? File an issue to share.
- Device explorer tool - Web tool for conveniently viewing device info, monitoring input reports, and sending output/feature reports; something in the style of this one for Web Bluetooth.
Forums & discussion
- Human Interface Device (HID) API (WICG Discourse) - Introduction by the editor of the specification, and answers to questions.
- Intent to Implement: WebHID (Human Interface Device) (chromium.org blink-dev) - Introduction by the editor of the specification, and answers to questions.
Miscellaneous
None yet.
Related
- Web Bluetooth API (MDN)
- WebUSB API (MDN)
- chrome.hid API - For Chrome Apps.
- Web Serial API
- Specification (WICG)
- Discussion (WICG Discourse)
- Chromium implementation tracking bug: Web Serial API