Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 1 | /* |
Linus Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 2 | * libusb-glue.h |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 3 | * |
| 4 | * Created by Richard Low on 24/12/2005. |
Linus Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 5 | * Modified by Linus Walleij |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 6 | * |
| 7 | */ |
| 8 | |
Linus Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 9 | #include "ptp.h" |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 10 | #include <usb.h> |
Linus Walleij | 15e344f | 2006-03-06 15:15:00 +0000 | [diff] [blame] | 11 | #include "libmtp.h" |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 12 | |
| 13 | #define USB_BULK_READ usb_bulk_read |
| 14 | #define USB_BULK_WRITE usb_bulk_write |
| 15 | |
Linus Walleij | 2d411db | 2006-03-22 12:13:09 +0000 | [diff] [blame] | 16 | /** |
| 17 | * Internal USB struct (TODO: discard for device struct?) |
| 18 | */ |
| 19 | typedef struct _PTP_USB PTP_USB; |
| 20 | struct _PTP_USB { |
Linus Walleij | c6210fb | 2006-05-08 11:11:41 +0000 | [diff] [blame^] | 21 | usb_dev_handle* handle; |
| 22 | int interface; |
| 23 | int inep; |
| 24 | int inep_maxpacket; |
| 25 | int outep; |
| 26 | int outep_maxpacket; |
| 27 | int intep; |
Linus Walleij | 2d411db | 2006-03-22 12:13:09 +0000 | [diff] [blame] | 28 | }; |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 29 | |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 30 | int get_device_list(LIBMTP_device_entry_t ** const devices, int * const numdevs); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 31 | int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev); |
Linus Walleij | c6210fb | 2006-05-08 11:11:41 +0000 | [diff] [blame^] | 32 | void dump_usbinfo(PTP_USB *ptp_usb); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 33 | void close_device (PTP_USB *ptp_usb, PTPParams *params, uint8_t interfaceNumber); |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 34 | uint16_t connect_first_device(PTPParams *params, PTP_USB *ptp_usb, uint8_t *interfaceNumber); |
| 35 | |
| 36 | /* connect_first_device return codes */ |
| 37 | #define PTP_CD_RC_CONNECTED 0 |
| 38 | #define PTP_CD_RC_NO_DEVICES 1 |
| 39 | #define PTP_CD_RC_ERROR_CONNECTING 2 |