blob: 81af49e200b1a4811a7a894cd804c89d4507ac44 [file] [log] [blame]
Brian Silverman395d6252013-09-13 20:58:14 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2//
Brian Silverman14a7b1a2013-10-11 21:34:03 -07003// Modified by FRC Team 971.
4//
Brian Silverman395d6252013-09-13 20:58:14 -07005// Alternative libusb call to do transfers that quits when
6// a notification is notified.
7
8#ifndef _GLIBUSB_GLIBUSB_TRANSFER_H_
9#define _GLIBUSB_GLIBUSB_TRANSFER_H_
10
11extern "C" {
12struct libusb_context;
13struct libusb_device_handle;
14}
15
16class Notification;
17
18namespace glibusb {
19
Brian Silverman14a7b1a2013-10-11 21:34:03 -070020// Transfer code cribbed from libusb1/sync.c and modified.
21// It supports bulk, isochronous, and interrupt transfers.
Brian Silverman395d6252013-09-13 20:58:14 -070022// The difference between this and the original code is that the
23// transfer now accepts a notification to poll for the quit message.
24// When it receives a quit message on the notification, it cancels the transfer.
25// The provided API's don't support better reuse of the existing code from what
Brian Silverman14a7b1a2013-10-11 21:34:03 -070026// I can tell. It has also been modified to support isochronous transfers.
27int do_sync_transfer(
Brian Silverman395d6252013-09-13 20:58:14 -070028 struct libusb_context *context,
29 struct libusb_device_handle *dev_handle,
30 unsigned char endpoint, unsigned char *buffer, int length,
31 int *transferred, unsigned int timeout, unsigned char type,
32 Notification *quit);
33
34} // namespace glibusb
35
36#endif // _GLIBUSB_GLIBUSB_TRANSFER_H_