这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

USBDevice 接口的 WebUSB API provides access to metadata about a paired USB device and methods for controlling it.

特性

USBDevice.configuration 只读
USBConfiguration object for the currently selected interface for a paired USB device.
USBDevice.configurations 只读
array of device-specific interfaces for controlling a paired USB device.
USBDevice.deviceClass 只读
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.deviceSubclass and USBDevice.deviceprotocol .
USBDevice.deviceProtocol 只读
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.deviceClass and USBDevice.deviceSubclass .
USBDevice.deviceSubclass 只读
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.deviceClass and USBDevice.deviceProtocol .
USBDevice.deviceVersionMajor 只读

The major version number of the device in a semantic versioning scheme.

USBDevice.deviceVersionMinor 只读

The minor version number of the device in a semantic versioning scheme.

USBDevice.deviceVersionSubminor 只读

The patch version number of the device in a semantic versioning scheme.

USBDevice.manufacturerName 只读

The of the organization that manufactured the USB device.

USBDevice.opened 只读

Indicates whether a session has been started with a paired USB device.

USBDevice.productId 只读

The manufacturer-defined code that identifies a USB device.

USBDevice.productName 只读

The manufacturer-defined name that identifies a USB device.

USBDevice.serialNumber 只读

The manufacturer-defined serial number for the specific USB device.

USBDevice.usbVersionMajor 只读
One of three properties that declare the USB protocol version supported by the device. The other two properties are USBDevice.usbVersionMinor and USBDevice.usbVersionSubminor .
USBDevice.usbVersionMinor 只读
One of three properties that declare the USB protocol version supported by the device. The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionSubminor .
USBDevice.usbVersionSubminor 只读
One of three properties that declare the USB protocol version supported by the device. The other two properties are USBDevice.usbVersionMajor and USBDevice.usbVersionMinor .
USBDevice.vendorId 只读

The official usg.org-assigned vendor ID.

方法

USBDevice.claimInterface()
返回 Promise that resolves when the requested interface is claimed for exclusive access.
USBDevice.clearHalt()
返回 Promise that resolves when a halt condition is cleared.
USBDevice.controlTransferIn()
返回 Promise that resolves with a USBTransferInResult when a command or status operation has been transmitted to the USB device.
USBDevice.controlTransferOut()
返回 Promise that resolves with a USBTransferOutResult when a command or status operation has been transmitted from the USB device.
USBDevice.close()
返回 Promise that resolves when all open interfaces are released and the device session has ended.
USBDevice.isochronousTransferIn()
返回 Promise that resolves with a USBIsochronousInTransferResult when time sensitive information has been transmitted to the USB device.
USBDevice.isochronousTransferOut()
返回 Promise that resolves with a USBIsochronousOutTransferResult when time sensitive information has been transmitted from the USB device.
USBDevice.open()
返回 Promise that resolves when a device session has started.
USBDevice.releaseInterface()
返回 Promise that resolves when a cliamed interface is released from exclusive access.
USBDevice.reset()
返回 Promise that resolves when the device is reset and all app operations canceled and their promises rejected.
USBDevice.selectAlternateInterface()
返回 Promise that resolves when the specified alternative endpoint is selected.
USBDevice.selectConfiguration()
返回 Promise that resolves when the specified configuration is selected.
USBDevice.transferIn()
返回 Promise that resolves with a USBTransferInResult when bulk or interrupt data is received from the USB device.
USBDevice.transferOut()
返回 Promise that resolves with a USBTransferOutResult when bulk or interrupt data is sent to the USB device.

规范

规范 状态 注释
WebUSB
The definition of 'USBDevice' in that specification.
草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
USBDevice Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
claimInterface Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
clearHalt Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
close Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
configuration Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
configurations Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
controlTransferIn Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
controlTransferOut Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceClass Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceProtocol Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceSubclass Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceVersionMajor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceVersionMinor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
deviceVersionSubminor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
isochronousTransferIn Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
isochronousTransferOut Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
manufacturerName Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
open Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
opened Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
productId Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
productName Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
releaseInterface Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
reset Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
selectAlternateInterface Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
selectConfiguration Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
serialNumber Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
transferIn Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
transferOut Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
usbVersionMajor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
usbVersionMinor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
usbVersionSubminor Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0
vendorId Chrome 61 Edge 79 Firefox No IE No Opera 48 Safari No WebView Android No Chrome Android 61 Firefox Android No Opera Android 45 Safari iOS No Samsung Internet Android 8.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

元数据

  • 最后修改: