libusb-glue.h
Go to the documentation of this file.00001
00030 #ifndef LIBUSB_GLUE_H
00031 #define LIBUSB_GLUE_H
00032
00033 #include "ptp.h"
00034 #include <usb.h>
00035 #include "libmtp.h"
00036 #include "device-flags.h"
00037
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00043 #define USB_BULK_READ usb_bulk_read
00044 #define USB_BULK_WRITE usb_bulk_write
00045
00049 typedef struct _PTP_USB PTP_USB;
00050 struct _PTP_USB {
00051 PTPParams *params;
00052 usb_dev_handle* handle;
00053 uint8_t interface;
00054 int inep;
00055 int inep_maxpacket;
00056 int outep;
00057 int outep_maxpacket;
00058 int intep;
00059 int timeout;
00061 int callback_active;
00062 uint64_t current_transfer_total;
00063 uint64_t current_transfer_complete;
00064 LIBMTP_progressfunc_t current_transfer_callback;
00065 void const * current_transfer_callback_data;
00067 LIBMTP_raw_device_t rawdevice;
00068 };
00069
00070 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
00071 void dump_usbinfo(PTP_USB *ptp_usb);
00072 const char *get_playlist_extension(PTP_USB *ptp_usb);
00073 void close_device(PTP_USB *ptp_usb, PTPParams *params);
00074 LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device,
00075 PTPParams *params,
00076 void **usbinfo);
00077 void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout);
00078 void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout);
00079
00080
00081 #define FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(a) \
00082 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL)
00083 #define FLAG_UNLOAD_DRIVER(a) \
00084 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNLOAD_DRIVER)
00085 #define FLAG_BROKEN_MTPGETOBJPROPLIST(a) \
00086 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST)
00087 #define FLAG_NO_ZERO_READS(a) \
00088 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_ZERO_READS)
00089 #define FLAG_IRIVER_OGG_ALZHEIMER(a) \
00090 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IRIVER_OGG_ALZHEIMER)
00091 #define FLAG_ONLY_7BIT_FILENAMES(a) \
00092 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES)
00093 #define FLAG_NO_RELEASE_INTERFACE(a) \
00094 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE)
00095 #define FLAG_IGNORE_HEADER_ERRORS(a) \
00096 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS)
00097 #define FLAG_BROKEN_SET_OBJECT_PROPLIST(a) \
00098 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST)
00099 #define FLAG_OGG_IS_UNKNOWN(a) \
00100 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_OGG_IS_UNKNOWN)
00101 #define FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(a) \
00102 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS)
00103 #define FLAG_ALWAYS_PROBE_DESCRIPTOR(a) \
00104 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR)
00105 #define FLAG_PLAYLIST_SPL_V1(a) \
00106 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V1)
00107 #define FLAG_PLAYLIST_SPL_V2(a) \
00108 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V2)
00109 #define FLAG_PLAYLIST_SPL(a) \
00110 ((a)->rawdevice.device_entry.device_flags & (DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_PLAYLIST_SPL_V2))
00111 #define FLAG_CANNOT_HANDLE_DATEMODIFIED(a) \
00112 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED)
00113 #define FLAG_BROKEN_SEND_OBJECT_PROPLIST(a) \
00114 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST)
00115 #define FLAG_BROKEN_BATTERY_LEVEL(a) \
00116 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_BATTERY_LEVEL)
00117 #define FLAG_FLAC_IS_UNKNOWN(a) \
00118 ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FLAC_IS_UNKNOWN)
00119
00120
00121 #define PTP_CD_RC_CONNECTED 0
00122 #define PTP_CD_RC_NO_DEVICES 1
00123 #define PTP_CD_RC_ERROR_CONNECTING 2
00124
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128
00129 #endif // LIBUSB-GLUE_H