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