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
00034 #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002
00035
00039 typedef struct _PTP_USB PTP_USB;
00040 struct _PTP_USB {
00041 usb_dev_handle* handle;
00042 int interface;
00043 int inep;
00044 int inep_maxpacket;
00045 int outep;
00046 int outep_maxpacket;
00047 int intep;
00049 int callback_active;
00050 uint64_t current_transfer_total;
00051 uint64_t current_transfer_complete;
00052 LIBMTP_progressfunc_t current_transfer_callback;
00053 void const * current_transfer_callback_data;
00055 uint32_t device_flags;
00056 };
00057
00058 int get_device_list(LIBMTP_device_entry_t ** const devices, int * const numdevs);
00059 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00060 void dump_usbinfo(PTP_USB *ptp_usb);
00061 void close_device (PTP_USB *ptp_usb, PTPParams *params, uint8_t interfaceNumber);
00062 uint16_t connect_first_device(PTPParams *params, PTP_USB *ptp_usb, uint8_t *interfaceNumber);
00063
00064
00065 #define PTP_CD_RC_CONNECTED 0
00066 #define PTP_CD_RC_NO_DEVICES 1
00067 #define PTP_CD_RC_ERROR_CONNECTING 2