libmtp 1.0.3

- Main Page
- Modules
- Data Structures
- Files
- Directories
- Examples

- File List
- Globals

# 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 /* Make functions available for C++ */
    00039 #ifdef __cplusplus
    00040 extern "C" {
    00041 #endif /* __cplusplus */
    00042
    00046 #define LIBMTP_USB_DEBUG(format, args...) \
    00047   do { \
    00048     if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) \
    00049       fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
    00050   } while (0)
    00051
    00052 #define LIBMTP_USB_DATA(buffer, length, base) \
    00053   do { \
    00054     if ((LIBMTP_debug & LIBMTP_DEBUG_DATA) != 0) \
    00055       data_dump_ascii (stdout, buffer, length, base); \
    00056   } while (0)
    00057
    00058
    00059 #define USB_BULK_READ usb_bulk_read
    00060 #define USB_BULK_WRITE usb_bulk_write
    00061
    00065 typedef struct _PTP_USB PTP_USB;
    00066 struct _PTP_USB {
    00067   PTPParams *params;
    00068   usb_dev_handle* handle;
    00069   uint8_t interface;
    00070   int inep;
    00071   int inep_maxpacket;
    00072   int outep;
    00073   int outep_maxpacket;
    00074   int intep;
    00075   int timeout;
    00077   int callback_active;
    00078   uint64_t current_transfer_total;
    00079   uint64_t current_transfer_complete;
    00080   LIBMTP_progressfunc_t current_transfer_callback;
    00081   void const * current_transfer_callback_data;
    00083   LIBMTP_raw_device_t rawdevice;
    00084 };
    00085
    00086 int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
    00087 void dump_usbinfo(PTP_USB *ptp_usb);
    00088 const char *get_playlist_extension(PTP_USB *ptp_usb);
    00089 void close_device(PTP_USB *ptp_usb, PTPParams *params);
    00090 LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device,
    00091                                            PTPParams *params,
    00092                                            void **usbinfo);
    00093 void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout);
    00094 void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout);
    00095
    00096 /* Flag check macros */
    00097 #define FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(a) \
    00098   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL)
    00099 #define FLAG_UNLOAD_DRIVER(a) \
    00100   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNLOAD_DRIVER)
    00101 #define FLAG_BROKEN_MTPGETOBJPROPLIST(a) \
    00102   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST)
    00103 #define FLAG_NO_ZERO_READS(a) \
    00104   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_ZERO_READS)
    00105 #define FLAG_IRIVER_OGG_ALZHEIMER(a) \
    00106   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IRIVER_OGG_ALZHEIMER)
    00107 #define FLAG_ONLY_7BIT_FILENAMES(a) \
    00108   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES)
    00109 #define FLAG_NO_RELEASE_INTERFACE(a) \
    00110   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE)
    00111 #define FLAG_IGNORE_HEADER_ERRORS(a) \
    00112   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS)
    00113 #define FLAG_BROKEN_SET_OBJECT_PROPLIST(a) \
    00114   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST)
    00115 #define FLAG_OGG_IS_UNKNOWN(a) \
    00116   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_OGG_IS_UNKNOWN)
    00117 #define FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(a) \
    00118   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS)
    00119 #define FLAG_ALWAYS_PROBE_DESCRIPTOR(a) \
    00120   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR)
    00121 #define FLAG_PLAYLIST_SPL_V1(a) \
    00122   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V1)
    00123 #define FLAG_PLAYLIST_SPL_V2(a) \
    00124   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V2)
    00125 #define FLAG_PLAYLIST_SPL(a) \
    00126   ((a)->rawdevice.device_entry.device_flags & (DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_PLAYLIST_SPL_V2))
    00127 #define FLAG_CANNOT_HANDLE_DATEMODIFIED(a) \
    00128   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED)
    00129 #define FLAG_BROKEN_SEND_OBJECT_PROPLIST(a) \
    00130   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST)
    00131 #define FLAG_BROKEN_BATTERY_LEVEL(a) \
    00132   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_BATTERY_LEVEL)
    00133 #define FLAG_FLAC_IS_UNKNOWN(a) \
    00134   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FLAC_IS_UNKNOWN)
    00135 #define FLAG_UNIQUE_FILENAMES(a) \
    00136   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNIQUE_FILENAMES)
    00137 #define FLAG_SWITCH_MODE_BLACKBERRY(a) \
    00138   ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_SWITCH_MODE_BLACKBERRY)
    00139
    00140 /* connect_first_device return codes */
    00141 #define PTP_CD_RC_CONNECTED     0
    00142 #define PTP_CD_RC_NO_DEVICES    1
    00143 #define PTP_CD_RC_ERROR_CONNECTING      2
    00144
    00145 #ifdef __cplusplus
    00146 }
    00147 #endif /* __cplusplus */
    00148
    00149 #endif //  LIBUSB-GLUE_H