00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ptp.h"
00010 #include <usb.h>
00011 #include "libmtp.h"
00012
00013 #define USB_BULK_READ usb_bulk_read
00014 #define USB_BULK_WRITE usb_bulk_write
00015
00022 #define DEVICE_FLAG_NONE 0x00000000
00023
00028 #define DEVICE_FLAG_DUALMODE 0x00000001
00029
00033 typedef struct _PTP_USB PTP_USB;
00034 struct _PTP_USB {
00035 usb_dev_handle* handle;
00036 int interface;
00037 int inep;
00038 int inep_maxpacket;
00039 int outep;
00040 int outep_maxpacket;
00041 int intep;
00043 int callback_active;
00044 uint64_t current_transfer_total;
00045 uint64_t current_transfer_complete;
00046 LIBMTP_progressfunc_t current_transfer_callback;
00047 void const * current_transfer_callback_data;
00049 uint32_t device_flags;
00050 };
00051
00052 int get_device_list(LIBMTP_device_entry_t ** const devices, int * const numdevs);
00053 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00054 void dump_usbinfo(PTP_USB *ptp_usb);
00055 void close_device (PTP_USB *ptp_usb, PTPParams *params, uint8_t interfaceNumber);
00056 uint16_t connect_first_device(PTPParams *params, PTP_USB *ptp_usb, uint8_t *interfaceNumber);
00057
00058
00059 #define PTP_CD_RC_CONNECTED 0
00060 #define PTP_CD_RC_NO_DEVICES 1
00061 #define PTP_CD_RC_ERROR_CONNECTING 2