diff options
| author | 2009-04-30 05:52:10 +0200 | |
|---|---|---|
| committer | 2009-04-30 05:52:10 +0200 | |
| commit | 49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6 (patch) | |
| tree | d42281bbc3b17af0f92daa5d35429f46bdd2130f /usb.h | |
| parent | 53fb582e7729d5b7ed40ff04d912fcf5add7ce1c (diff) | |
| download | usbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.gz usbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.bz2 | |
too much stuff and it WORKS
Diffstat (limited to 'usb.h')
| -rw-r--r-- | usb.h | 21 |
1 files changed, 19 insertions, 2 deletions
| @@ -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; | |||
| 41 | int usb_init(void); | 56 | int usb_init(void); |
| 42 | void usb_shutdown(void); | 57 | void usb_shutdown(void); |
| 43 | const char *usb_get_serial(struct usb_device *dev); | 58 | const char *usb_get_serial(struct usb_device *dev); |
| 44 | int usb_get_location(struct usb_device *dev); | 59 | uint32_t usb_get_location(struct usb_device *dev); |
| 60 | uint16_t usb_get_pid(struct usb_device *dev); | ||
| 45 | void usb_get_fds(struct fdlist *list); | 61 | void usb_get_fds(struct fdlist *list); |
| 46 | int usb_get_timeout(void); | 62 | int usb_get_timeout(void); |
| 47 | int usb_send(struct usb_device *dev, const unsigned char *buf, int length); | 63 | int usb_send(struct usb_device *dev, const unsigned char *buf, int length); |
| 48 | int usb_process(void); | 64 | int usb_process(void); |
| 65 | int usb_process_timeout(int msec); | ||
| 49 | 66 | ||
| 50 | #endif | 67 | #endif |
