summaryrefslogtreecommitdiffstats
path: root/usb.h
diff options
context:
space:
mode:
authorGravatar Hector Martin2009-04-30 05:52:10 +0200
committerGravatar Hector Martin2009-04-30 05:52:10 +0200
commit49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6 (patch)
treed42281bbc3b17af0f92daa5d35429f46bdd2130f /usb.h
parent53fb582e7729d5b7ed40ff04d912fcf5add7ce1c (diff)
downloadusbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.gz
usbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.bz2
too much stuff and it WORKS
Diffstat (limited to 'usb.h')
-rw-r--r--usb.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/usb.h b/usb.h
index 2a29d2f..8a48308 100644
--- a/usb.h
+++ b/usb.h
@@ -21,12 +21,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21#ifndef __USB_H__ 21#ifndef __USB_H__
22#define __USB_H__ 22#define __USB_H__
23 23
24#include <stdint.h>
24#include "utils.h" 25#include "utils.h"
25 26
26#define BULK_IN 0x85 27#define BULK_IN 0x85
27#define BULK_OUT 0x04 28#define BULK_OUT 0x04
28 29
29#define USB_MTU 65536 30// libusb fragments packets larger than this (usbfs limitation)
31// on input, this creates race conditions and other issues
32// I don't think the device uses larger packets
33// if it does then we're going to have to implement proper framing...
34#define USB_MRU 16384
35
36// max transmission packet size
37// libusb fragments these too, but doesn't send ZLPs so we're safe
38// but maybe we need to send a ZLP ourselves at the end (see usb-linux.h)
39// we're using 3 * 16384 to optimize for the fragmentation
40// this results in three URBs per full transfer, 32 USB packets each
41// if there are ZLP issues this should make them show up too
42#define USB_MTU (3 * 16384)
43
44#define USB_PACKET_SIZE 512
30 45
31#define VID_APPLE 0x5ac 46#define VID_APPLE 0x5ac
32#define PID_IPHONE2G 0x1290 47#define PID_IPHONE2G 0x1290
@@ -41,10 +56,12 @@ struct usb_device;
41int usb_init(void); 56int usb_init(void);
42void usb_shutdown(void); 57void usb_shutdown(void);
43const char *usb_get_serial(struct usb_device *dev); 58const char *usb_get_serial(struct usb_device *dev);
44int usb_get_location(struct usb_device *dev); 59uint32_t usb_get_location(struct usb_device *dev);
60uint16_t usb_get_pid(struct usb_device *dev);
45void usb_get_fds(struct fdlist *list); 61void usb_get_fds(struct fdlist *list);
46int usb_get_timeout(void); 62int usb_get_timeout(void);
47int usb_send(struct usb_device *dev, const unsigned char *buf, int length); 63int usb_send(struct usb_device *dev, const unsigned char *buf, int length);
48int usb_process(void); 64int usb_process(void);
65int usb_process_timeout(int msec);
49 66
50#endif 67#endif