// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://wicg.github.io/webusb/#transfers
enum USBTransferStatus {
"ok",
"stall",
"babble"
};
// https://wicg.github.io/webusb/#device-usage
[
Exposed(DedicatedWorker WebUSBOnDedicatedWorkers,
ServiceWorker WebUSBOnServiceWorkers,
Window WebUSB),
SecureContext
] interface USBDevice {
readonly attribute octet usbVersionMajor;
readonly attribute octet usbVersionMinor;
readonly attribute octet usbVersionSubminor;
readonly attribute octet deviceClass;
readonly attribute octet deviceSubclass;
readonly attribute octet deviceProtocol;
readonly attribute unsigned short vendorId;
readonly attribute unsigned short productId;
readonly attribute octet deviceVersionMajor;
readonly attribute octet deviceVersionMinor;
readonly attribute octet deviceVersionSubminor;
readonly attribute DOMString? manufacturerName;
readonly attribute DOMString? productName;
readonly attribute DOMString? serialNumber;
readonly attribute USBConfiguration? configuration;
readonly attribute FrozenArray<USBConfiguration> configurations;
readonly attribute boolean opened;
[CallWith=ScriptState, MeasureAs=UsbDeviceOpen, RaisesException] Promise<undefined> open();
[CallWith=ScriptState, MeasureAs=UsbDeviceClose, RaisesException] Promise<undefined> close();
[CallWith=ScriptState, MeasureAs=UsbDeviceForget, RaisesException] Promise<undefined> forget();
[CallWith=ScriptState, MeasureAs=UsbDeviceSelectConfiguration, RaisesException] Promise<undefined> selectConfiguration(octet configurationValue);
[CallWith=ScriptState, MeasureAs=UsbDeviceClaimInterface, RaisesException] Promise<undefined> claimInterface(octet interfaceNumber);
[CallWith=ScriptState, MeasureAs=UsbDeviceReleaseInterface, RaisesException] Promise<undefined> releaseInterface(octet interfaceNumber);
[CallWith=ScriptState, MeasureAs=UsbDeviceSelectAlternateInterface, RaisesException] Promise<undefined> selectAlternateInterface(octet interfaceNumber, octet alternateSetting);
[CallWith=ScriptState, MeasureAs=UsbDeviceControlTransferIn, RaisesException] Promise<USBInTransferResult> controlTransferIn(USBControlTransferParameters setup, unsigned short length);
[CallWith=ScriptState, MeasureAs=UsbDeviceControlTransferOut, RaisesException] Promise<USBOutTransferResult> controlTransferOut(USBControlTransferParameters setup, optional BufferSource data);
[CallWith=ScriptState, MeasureAs=UsbDeviceClearHalt, RaisesException] Promise<undefined> clearHalt(USBDirection direction, octet endpointNumber);
[CallWith=ScriptState, MeasureAs=UsbDeviceTransferIn, RaisesException] Promise<USBInTransferResult> transferIn(octet endpointNumber, unsigned long length);
[CallWith=ScriptState, MeasureAs=UsbDeviceTransferOut, RaisesException] Promise<USBOutTransferResult> transferOut(octet endpointNumber, BufferSource data);
[CallWith=ScriptState, MeasureAs=UsbDeviceIsochronousTransferIn, RaisesException] Promise<USBIsochronousInTransferResult> isochronousTransferIn(octet endpointNumber, sequence<unsigned long> packetLengths);
[CallWith=ScriptState, MeasureAs=UsbDeviceIsochronousTransferOut, RaisesException] Promise<USBIsochronousOutTransferResult> isochronousTransferOut(octet endpointNumber, BufferSource data, sequence<unsigned long> packetLengths);
[CallWith=ScriptState, MeasureAs=UsbDeviceReset, RaisesException] Promise<undefined> reset();
};