summaryrefslogtreecommitdiffstats
path: root/device/usb/usb_device_handle.h
diff options
context:
space:
mode:
authorreillyg <reillyg@chromium.org>2016-02-01 16:56:15 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-02 00:58:06 +0000
commit051c98e9d3e843295d659b5676fcfa9dc1be5da6 (patch)
tree54414ed43e166fb91bcfb3d6413157ad9cf27fe6 /device/usb/usb_device_handle.h
parentea6d840e4d96f6df739f55a89ccf69daa3569a77 (diff)
downloadchromium_src-051c98e9d3e843295d659b5676fcfa9dc1be5da6.zip
chromium_src-051c98e9d3e843295d659b5676fcfa9dc1be5da6.tar.gz
chromium_src-051c98e9d3e843295d659b5676fcfa9dc1be5da6.tar.bz2
Update device/usb and its Mojo interface for variable size ISO packets.
To support the WebUSB API our underlying USB library needs to support isochronous transfers with full control over the packet size. We also need to know the completion status of each packet which was previously not available. This patch updates the interface to match that provided by libusb and the underlying platform specific APIs. BUG=492204 Review URL: https://codereview.chromium.org/1618393004 Cr-Commit-Position: refs/heads/master@{#372844}
Diffstat (limited to 'device/usb/usb_device_handle.h')
-rw-r--r--device/usb/usb_device_handle.h32
1 files changed, 23 insertions, 9 deletions
diff --git a/device/usb/usb_device_handle.h b/device/usb/usb_device_handle.h
index a97dddc..b206cf1 100644
--- a/device/usb/usb_device_handle.h
+++ b/device/usb/usb_device_handle.h
@@ -40,9 +40,18 @@ enum UsbTransferStatus {
// UsbDeviceHandle class provides basic I/O related functionalities.
class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
public:
+ struct IsochronousPacket {
+ uint32_t length;
+ uint32_t transferred_length;
+ UsbTransferStatus status;
+ };
+
using ResultCallback = base::Callback<void(bool)>;
using TransferCallback = base::Callback<
void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>;
+ using IsochronousTransferCallback =
+ base::Callback<void(scoped_refptr<net::IOBuffer>,
+ const std::vector<IsochronousPacket>& packets)>;
enum TransferRequestType { STANDARD, CLASS, VENDOR, RESERVED };
enum TransferRecipient { DEVICE, INTERFACE, ENDPOINT, OTHER };
@@ -81,17 +90,21 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
unsigned int timeout,
const TransferCallback& callback) = 0;
- virtual void IsochronousTransfer(UsbEndpointDirection direction,
- uint8_t endpoint,
- scoped_refptr<net::IOBuffer> buffer,
- size_t length,
- unsigned int packets,
- unsigned int packet_length,
- unsigned int timeout,
- const TransferCallback& callback) = 0;
+ virtual void IsochronousTransferIn(
+ uint8_t endpoint_number,
+ const std::vector<uint32_t>& packet_lengths,
+ unsigned int timeout,
+ const IsochronousTransferCallback& callback) = 0;
+
+ virtual void IsochronousTransferOut(
+ uint8_t endpoint_number,
+ scoped_refptr<net::IOBuffer> buffer,
+ const std::vector<uint32_t>& packet_lengths,
+ unsigned int timeout,
+ const IsochronousTransferCallback& callback) = 0;
virtual void GenericTransfer(UsbEndpointDirection direction,
- uint8_t endpoint,
+ uint8_t endpoint_number,
scoped_refptr<net::IOBuffer> buffer,
size_t length,
unsigned int timeout,
@@ -109,6 +122,7 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
virtual ~UsbDeviceHandle();
+ private:
DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandle);
};