Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8554)

Unified Diff: chrome/common/extensions/api/usb.idl

Issue 12471013: Add chrome.usb.listInterfaces API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to Bei's PS1 comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/usb.idl
diff --git a/chrome/common/extensions/api/usb.idl b/chrome/common/extensions/api/usb.idl
index cba100a6731c3a0370087179f36322827030f73b..c4ec69c1c99fe1ac3323461656dab134dc649275 100644
--- a/chrome/common/extensions/api/usb.idl
+++ b/chrome/common/extensions/api/usb.idl
@@ -4,11 +4,17 @@
namespace usb {
- // Direction, Recipient and RequestType all map to their namesakes within the
- // USB specification.
+ // Direction, Recipient, RequestType, and TransferType all map to their
+ // namesakes within the USB specification.
enum Direction {in, out};
enum Recipient {device, _interface, endpoint, other};
enum RequestType {standard, class, vendor, reserved};
+ enum TransferType {control, interrupt, isochronous, bulk};
+
+ // For isochronous mode, SynchronizationType and UsageType map to their
+ // namesakes within the USB specification.
+ enum SynchronizationType {asynchronous, adaptive, synchronous};
+ enum UsageType {data, feedback, explicitFeedback};
// A Device encapsulates everything that is needed to communicate with a USB
// device. They are returned by findDevice calls and have all of their
@@ -19,6 +25,30 @@ namespace usb {
long productId;
};
+ dictionary EndpointDescriptor {
+ long address;
+ TransferType type;
+ Direction direction;
+ long maximumPacketSize;
+
+ // Used for isochronous mode.
+ SynchronizationType? synchronization;
+ UsageType? usage;
+
+ // If this is an interrupt endpoint, this will be 1-255
+ long? pollingInterval;
+ };
+
+ dictionary InterfaceDescriptor {
+ long interfaceNumber;
+ long alternateSetting;
+ long interfaceClass;
+ long interfaceSubclass;
+ long interfaceProtocol;
+ DOMString? description;
+ EndpointDescriptor[] endpoints;
+ };
+
// ControlTransferInfo represents that parameters to a single USB control
// transfer.
dictionary ControlTransferInfo {
@@ -97,6 +127,7 @@ namespace usb {
callback VoidCallback = void ();
callback FindDevicesCallback = void (Device[] device);
+ callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors);
callback CloseDeviceCallback = void ();
callback TransferCallback = void (TransferResultInfo info);
@@ -117,6 +148,12 @@ namespace usb {
static void closeDevice(Device device,
optional CloseDeviceCallback callback);
+ // Lists all the interfaces on the USB device.
+ // |device|: The device from which the interfaces should be listed.
+ // |callback|: The callback to invoke when the interfaces are enumerated.
+ static void listInterfaces(Device device,
+ ListInterfacesCallback callback);
+
// Claims an interface on the specified USB device.
// |device|: The device on which the interface is to be claimed.
// |interface|: The interface number to be claimed.

Powered by Google App Engine
This is Rietveld 408576698