
The Linux USB gadget kernel driver released a patch today to expose the device landing page as part of the WebUSB specification. WebUSB is an industry standard for providing a JavaScript API for securely accessing USB devices from web pages, and is already supported by Google Chrome, Microsoft Edge, and others.
WebUSB enables access to USB hardware devices from web pages and is supported by W3C. WebUSB works cross-platform and is already available on Linux, such as Google Chrome.
The patch submitted today for the Linux USB gadget driver hopes to announce the device’s page and expose a “landing page” URL to describe the gadget’s JavaScript interface. The WebUSB device landing page is exposed via sysfs and lsusb device output. WebUSB already works on Linux with a supported web browser, but this kernel patch is just to allow the associated landing page to be exposed.
This specification is published under the W3C Community Contributor Agreement, specifically allowing implementation of the specification without royalties.
This specification allows USB gadgets to announce URLs to landing pages and describes a Javascript interface for websites to interact with USB gadgets if the user allows it. It is currently supported by Chromium-based browsers such as Chrome, Edge and Opera on all major operating systems including Linux.
This patch adds optional support for Linux-based USB gadgets that wish to publish such landing pages.
During device enumeration, the host sees that the announced USB version is at least 2.01. This means that there are BOS descriptors available. This device announces WebUSB support using platform device capabilities. It contains vendor code that can retrieve landing page URLs using vendor-specific requests.
Please see the kernel mailing list for details on WebUSB support patches for this USB gadget code. Those interested in the WebUSB API can find the current specification on GitHub.