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
00055 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001
00056
00068 #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002
00069
00074 #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004
00075
00090 #define DEVICE_FLAG_NO_ZERO_READS 0x00000008
00091
00102 #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010
00103
00111 #define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020
00112
00119 #define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040
00120
00131 #define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080
00132
00136 typedef struct _PTP_USB PTP_USB;
00137 struct _PTP_USB {
00138 PTPParams *params;
00139 usb_dev_handle* handle;
00140 uint8_t interface;
00141 int inep;
00142 int inep_maxpacket;
00143 int outep;
00144 int outep_maxpacket;
00145 int intep;
00147 int callback_active;
00148 uint64_t current_transfer_total;
00149 uint64_t current_transfer_complete;
00150 LIBMTP_progressfunc_t current_transfer_callback;
00151 void const * current_transfer_callback_data;
00153 uint32_t device_flags;
00154 };
00155
00156 struct mtpdevice_list_struct {
00157 struct usb_device *libusb_device;
00158 PTPParams *params;
00159 PTP_USB *ptp_usb;
00160 struct mtpdevice_list_struct *next;
00161 };
00162 typedef struct mtpdevice_list_struct mtpdevice_list_t;
00163
00164 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00165 void dump_usbinfo(PTP_USB *ptp_usb);
00166 void close_device (PTP_USB *ptp_usb, PTPParams *params);
00167 LIBMTP_error_number_t find_usb_devices(mtpdevice_list_t **devlist);
00168 void free_mtpdevice_list(mtpdevice_list_t *devlist);
00169
00170
00171 #define PTP_CD_RC_CONNECTED 0
00172 #define PTP_CD_RC_NO_DEVICES 1
00173 #define PTP_CD_RC_ERROR_CONNECTING 2