USBAlternateInterface

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The USBAlternateInterface interface of the WebUSB API provides information about a particular configuration of an interface provided by the USB device. An interface includes one or more alternate settings which can configure a set of endpoints based on the operating mode of the device.

Constructor

USBAlternateInterface() Experimental

Creates a new USBAlternateInterface object which will be populated with information about the alternate interface of the provided USBInterface with the given alternate setting number.

Instance properties

USBAlternateInterface.alternateSetting Read only Experimental

Returns the alternate setting number of this interface. This is equal to the bAlternateSetting field of the interface descriptor defining this interface.

USBAlternateInterface.interfaceClass Read only Experimental

Returns the class of this interface. This is equal to the bInterfaceClass field of the interface descriptor defining this interface. Standardized values for this field are defined by the USB Implementers Forum. A value of 0xFF indicates a vendor-defined interface.

USBAlternateInterface.interfaceSubclass Read only Experimental

Returns the subclass of this interface. This is equal to the bInterfaceSubClass field of the interface descriptor defining this interface. The meaning of this value depends on the interfaceClass field.

USBAlternateInterface.interfaceProtocol Read only Experimental

Returns the protocol supported by this interface. This is equal to the bInterfaceProtocol field of the interface descriptor defining this interface. The meaning of this value depends on the interfaceClass and interfaceSubclass fields.

USBAlternateInterface.interfaceName Read only Experimental

Returns the name of the interface, if one is provided by the device. This is the value of the string descriptor with the index specified by the iInterface field of the interface descriptor defining this interface.

USBAlternateInterface.endpoints Read only Experimental

Returns an array containing instances of the USBEndpoint interface describing each of the endpoints that are part of this interface.

Specifications

Specification
WebUSB API
# usbalternateinterface

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
USBAlternateInterface
Experimental
USBAlternateInterface() constructor
Experimental
alternateSetting
Experimental
endpoints
Experimental
interfaceClass
Experimental
interfaceName
Experimental
interfaceProtocol
Experimental
interfaceSubclass
Experimental
Available in workers
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
Has more compatibility info.