00001
00030 #include "ptp.h"
00031 #include <usb.h>
00032 #include "libmtp.h"
00033 #include "device-flags.h"
00034
00035 #define USB_BULK_READ usb_bulk_read
00036 #define USB_BULK_WRITE usb_bulk_write
00037
00041 typedef struct _PTP_USB PTP_USB;
00042 struct _PTP_USB {
00043 PTPParams *params;
00044 usb_dev_handle* handle;
00045 uint8_t interface;
00046 int inep;
00047 int inep_maxpacket;
00048 int outep;
00049 int outep_maxpacket;
00050 int intep;
00052 int callback_active;
00053 uint64_t current_transfer_total;
00054 uint64_t current_transfer_complete;
00055 LIBMTP_progressfunc_t current_transfer_callback;
00056 void const * current_transfer_callback_data;
00058 LIBMTP_raw_device_t rawdevice;
00059 };
00060
00061 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00062 void dump_usbinfo(PTP_USB *ptp_usb);
00063 char const * const get_playlist_extension(PTP_USB *ptp_usb);
00064 void close_device(PTP_USB *ptp_usb, PTPParams *params);
00065 LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device,
00066 PTPParams *params,
00067 void **usbinfo);
00068
00069
00070 #define FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(a) \
00071 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL)
00072 #define FLAG_UNLOAD_DRIVER(a) \
00073 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNLOAD_DRIVER)
00074 #define FLAG_BROKEN_MTPGETOBJPROPLIST(a) \
00075 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST)
00076 #define FLAG_NO_ZERO_READS(a) \
00077 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_ZERO_READS)
00078 #define FLAG_IRIVER_OGG_ALZHEIMER(a) \
00079 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IRIVER_OGG_ALZHEIMER)
00080 #define FLAG_ONLY_7BIT_FILENAMES(a) \
00081 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES)
00082 #define FLAG_NO_RELEASE_INTERFACE(a) \
00083 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE)
00084 #define FLAG_IGNORE_HEADER_ERRORS(a) \
00085 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS)
00086 #define FLAG_BROKEN_SET_OBJECT_PROPLIST(a) \
00087 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST)
00088 #define FLAG_OGG_IS_UNKNOWN(a) \
00089 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_OGG_IS_UNKNOWN)
00090 #define FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(a) \
00091 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS)
00092 #define FLAG_ALWAYS_PROBE_DESCRIPTOR(a) \
00093 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR)
00094
00095
00096 #define PTP_CD_RC_CONNECTED 0
00097 #define PTP_CD_RC_NO_DEVICES 1
00098 #define PTP_CD_RC_ERROR_CONNECTING 2