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

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: Rebase of PS10 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/extensions/api_test/usb/list_interfaces/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/api/usb.idl
diff --git a/chrome/common/extensions/api/usb.idl b/chrome/common/extensions/api/usb.idl
index b651d7c93ec035d68047df65a460f9d8156ac462..89a0e608e1564835df27b18048ed2f1240acdf1b 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);
callback ResetDeviceCallback = void(boolean result);
@@ -118,6 +149,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.
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/extensions/api_test/usb/list_interfaces/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698