USBDevice
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The USBDevice interface of the WebUSB API provides access to metadata about a paired USB device and methods for controlling it.
Properties
-
USBDevice.configurationRead only -
A
USBConfigurationobject for the currently selected interface for a paired USB device. -
USBDevice.configurationsRead only -
An
arrayof device-specific interfaces for controlling a paired USB device. -
USBDevice.deviceClassRead only -
One of three properties that identify USB devices for the purpose of loading a USB driver that will work with that device. The other two properties are
USBDevice.deviceSubclassandUSBDevice.deviceProtocol. -
USBDevice.deviceProtocolRead only -
One of three properties that identify USB devices for the purpose of loading a USB driver that will work with that device. The other two properties are
USBDevice.deviceClassandUSBDevice.deviceSubclass. -
USBDevice.deviceSubclassRead only -
One of three properties that identify USB devices for the purpose of loading a USB driver that will work with that device. The other two properties are
USBDevice.deviceClassandUSBDevice.deviceProtocol. -
USBDevice.deviceVersionMajorRead only -
The major version number of the device in a semantic versioning scheme.
-
USBDevice.deviceVersionMinorRead only -
The minor version number of the device in a semantic versioning scheme.
-
USBDevice.deviceVersionSubminorRead only -
The patch version number of the device in a semantic versioning scheme.
-
USBDevice.manufacturerNameRead only -
The of the organization that manufactured the USB device.
-
USBDevice.openedRead only -
Indicates whether a session has been started with a paired USB device.
-
USBDevice.productIdRead only -
The manufacturer-defined code that identifies a USB device.
-
USBDevice.productNameRead only -
The manufacturer-defined name that identifies a USB device.
-
USBDevice.serialNumberRead only -
The manufacturer-defined serial number for the specific USB device.
-
USBDevice.usbVersionMajorRead only -
One of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMinorandUSBDevice.usbVersionSubminor. -
USBDevice.usbVersionMinorRead only -
One of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMajorandUSBDevice.usbVersionSubminor. -
USBDevice.usbVersionSubminorRead only -
One of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMajorandUSBDevice.usbVersionMinor. -
USBDevice.vendorIdRead only -
The official usg.org-assigned vendor ID.
Methods
USBDevice.claimInterface()-
Returns a
Promisethat resolves when the requested interface is claimed for exclusive access. USBDevice.clearHalt()-
Returns a
Promisethat resolves when a halt condition is cleared. USBDevice.controlTransferIn()-
Returns a
Promisethat resolves with aUSBTransferInResultwhen a command or status operation has been transmitted to the USB device. USBDevice.controlTransferOut()-
Returns a
Promisethat resolves with aUSBTransferOutResultwhen a command or status operation has been transmitted from the USB device. USBDevice.close()-
Returns a
Promisethat resolves when all open interfaces are released and the device session has ended. USBDevice.isochronousTransferIn()-
Returns a
Promisethat resolves with aUSBIsochronousInTransferResultwhen time sensitive information has been transmitted to the USB device. USBDevice.isochronousTransferOut()-
Returns a
Promisethat resolves with aUSBIsochronousOutTransferResultwhen time sensitive information has been transmitted from the USB device. USBDevice.open()-
Returns a
Promisethat resolves when a device session has started. USBDevice.releaseInterface()-
Returns a
Promisethat resolves when a cliamed interface is released from exclusive access. USBDevice.reset()-
Returns a
Promisethat resolves when the device is reset and all app operations canceled and their promises rejected. USBDevice.selectAlternateInterface()-
Returns a
Promisethat resolves when the specified alternative endpoint is selected. USBDevice.selectConfiguration()-
Returns a
Promisethat resolves when the specified configuration is selected. USBDevice.transferIn()-
Returns a
Promisethat resolves with aUSBTransferInResultwhen bulk or interrupt data is received from the USB device. USBDevice.transferOut()-
Returns a
Promisethat resolves with aUSBTransferOutResultwhen bulk or interrupt data is sent to the USB device.
Specifications
| Specification |
|---|
| WebUSB API # device-usage |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
USBDevice |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
claimInterface |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
clearHalt |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
close |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
configuration |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
configurations |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
controlTransferIn |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
controlTransferOut |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceClass |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceProtocol |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceSubclass |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceVersionMajor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceVersionMinor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
deviceVersionSubminor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
isochronousTransferIn |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
isochronousTransferOut |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
manufacturerName |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
open |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
opened |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
productId |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
productName |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
releaseInterface |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
reset |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
selectAlternateInterface |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
selectConfiguration |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
serialNumber |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
transferIn |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
transferOut |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
usbVersionMajor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
usbVersionMinor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
usbVersionSubminor |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
vendorId |
61 |
79 |
No |
No |
48 |
No |
No |
61 |
No |
45 |
No |
8.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/USBDevice