USBDevice
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
TheUSBDevice interface of theWebUSB API provides access to metadata about a paired USB device and methods for controlling it.
In this article
Instance properties
USBDevice.configurationRead onlyExperimentalA
USBConfigurationobject for the currently selected interface for a paired USB device.USBDevice.configurationsRead onlyExperimentalAn
arrayof device-specific interfaces for controlling a paired USB device.USBDevice.deviceClassRead onlyExperimentalOne 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 onlyExperimentalOne 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 onlyExperimentalOne 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 onlyExperimentalThe major version number of the device in a semantic versioning scheme.
USBDevice.deviceVersionMinorRead onlyExperimentalThe minor version number of the device in a semantic versioning scheme.
USBDevice.deviceVersionSubminorRead onlyExperimentalThe patch version number of the device in a semantic versioning scheme.
USBDevice.manufacturerNameRead onlyExperimentalThe name of the organization that manufactured the USB device.
USBDevice.openedRead onlyExperimentalIndicates whether a session has been started with a paired USB device.
USBDevice.productIdRead onlyExperimentalThe manufacturer-defined code that identifies a USB device.
USBDevice.productNameRead onlyExperimentalThe manufacturer-defined name that identifies a USB device.
USBDevice.serialNumberRead onlyExperimentalThe manufacturer-defined serial number for the specific USB device.
USBDevice.usbVersionMajorRead onlyExperimentalOne of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMinorandUSBDevice.usbVersionSubminor.USBDevice.usbVersionMinorRead onlyExperimentalOne of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMajorandUSBDevice.usbVersionSubminor.USBDevice.usbVersionSubminorRead onlyExperimentalOne of three properties that declare the USB protocol version supported by the device. The other two properties are
USBDevice.usbVersionMajorandUSBDevice.usbVersionMinor.USBDevice.vendorIdRead onlyExperimentalThe official usb.org-assigned vendor ID.
Instance methods
USBDevice.claimInterface()ExperimentalReturns a
Promisethat resolves when the requested interface is claimed for exclusive access.USBDevice.clearHalt()ExperimentalReturns a
Promisethat resolves when a halt condition is cleared.USBDevice.controlTransferIn()ExperimentalReturns a
Promisethat resolves with aUSBInTransferResultwhen a command or status operation has been transmitted to the USB device.USBDevice.controlTransferOut()ExperimentalReturns a
Promisethat resolves with aUSBOutTransferResultwhen a command or status operation has been transmitted from the USB device.USBDevice.close()ExperimentalReturns a
Promisethat resolves when all open interfaces are released and the device session has ended.USBDevice.forget()ExperimentalReturns a
Promisethat resolves after all open interfaces are released, the device session has ended, and the permission is reset.USBDevice.isochronousTransferIn()ExperimentalReturns a
Promisethat resolves with aUSBIsochronousInTransferResultwhen time sensitive information has been transmitted to the USB device.USBDevice.isochronousTransferOut()ExperimentalReturns a
Promisethat resolves with aUSBIsochronousOutTransferResultwhen time sensitive information has been transmitted from the USB device.USBDevice.open()ExperimentalReturns a
Promisethat resolves when a device session has started.USBDevice.releaseInterface()ExperimentalReturns a
Promisethat resolves when a claimed interface is released from exclusive access.USBDevice.reset()ExperimentalReturns a
Promisethat resolves when the device is reset and all app operations canceled and their promises rejected.USBDevice.selectAlternateInterface()ExperimentalReturns a
Promisethat resolves when the specified alternative endpoint is selected.USBDevice.selectConfiguration()ExperimentalReturns a
Promisethat resolves when the specified configuration is selected.USBDevice.transferIn()ExperimentalReturns a
Promisethat resolves with aUSBInTransferResultwhen bulk or interrupt data is received from the USB device.USBDevice.transferOut()ExperimentalReturns a
Promisethat resolves with aUSBOutTransferResultwhen bulk or interrupt data is sent to the USB device.
Specifications
| Specification |
|---|
| WebUSB API> # device-usage> |