00001
00030 #include "ptp.h"
00031 #include <usb.h>
00032 #include "libmtp.h"
00033
00034 #define USB_BULK_READ usb_bulk_read
00035 #define USB_BULK_WRITE usb_bulk_write
00036
00043 #define DEVICE_FLAG_NONE 0x00000000
00044
00053 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001
00054
00066 #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002
00067
00072 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004
00073
00088 #define DEVICE_FLAG_NO_ZERO_READS 0x00000008
00089
00100 #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010
00101
00105 typedef struct _PTP_USB PTP_USB;
00106 struct _PTP_USB {
00107 usb_dev_handle* handle;
00108 int interface;
00109 int inep;
00110 int inep_maxpacket;
00111 int outep;
00112 int outep_maxpacket;
00113 int intep;
00115 int callback_active;
00116 uint64_t current_transfer_total;
00117 uint64_t current_transfer_complete;
00118 LIBMTP_progressfunc_t current_transfer_callback;
00119 void const * current_transfer_callback_data;
00121 uint32_t device_flags;
00122 };
00123
00124 struct mtpdevice_list_struct {
00125 struct usb_device *libusb_device;
00126 PTPParams *params;
00127 PTP_USB *ptp_usb;
00128 uint8_t interface_number;
00129 struct mtpdevice_list_struct *next;
00130 };
00131 typedef struct mtpdevice_list_struct mtpdevice_list_t;
00132
00133 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00134 void dump_usbinfo(PTP_USB *ptp_usb);
00135 void close_device (PTP_USB *ptp_usb, PTPParams *params, uint8_t interfaceNumber);
00136 LIBMTP_error_number_t find_usb_devices(mtpdevice_list_t **devlist);
00137 void free_mtpdevice_list(mtpdevice_list_t *devlist);
00138
00139
00140 #define PTP_CD_RC_CONNECTED 0
00141 #define PTP_CD_RC_NO_DEVICES 1
00142 #define PTP_CD_RC_ERROR_CONNECTING 2