libmtp: libusb-glue.h File Reference

libmtp 1.1.22

Data Structures | Macros | Typedefs | Functions
libusb-glue.h File Reference
`#include "ptp.h"`
`#include "libmtp.h"`
`#include "device-flags.h"`

Go to the source code of this file.

## Data Structures
struct | _PTP_USB

## Macros
#define | LIBMTP_USB_DEBUG(format, args...)
#define | LIBMTP_USB_DATA(buffer, length, base)
#define | FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(a)
#define | FLAG_UNLOAD_DRIVER(a)
#define | FLAG_BROKEN_MTPGETOBJPROPLIST(a)
#define | FLAG_NO_ZERO_READS(a)
#define | FLAG_IRIVER_OGG_ALZHEIMER(a)
#define | FLAG_ONLY_7BIT_FILENAMES(a)
#define | FLAG_NO_RELEASE_INTERFACE(a)
#define | FLAG_IGNORE_HEADER_ERRORS(a)
#define | FLAG_BROKEN_SET_OBJECT_PROPLIST(a)
#define | FLAG_OGG_IS_UNKNOWN(a)
#define | FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(a)
#define | FLAG_ALWAYS_PROBE_DESCRIPTOR(a)
#define | FLAG_PLAYLIST_SPL_V1(a)
#define | FLAG_PLAYLIST_SPL_V2(a)
#define | FLAG_PLAYLIST_SPL(a)
#define | FLAG_CANNOT_HANDLE_DATEMODIFIED(a)
#define | FLAG_BROKEN_SEND_OBJECT_PROPLIST(a)
#define | FLAG_BROKEN_BATTERY_LEVEL(a)
#define | FLAG_FLAC_IS_UNKNOWN(a)
#define | FLAG_UNIQUE_FILENAMES(a)
#define | FLAG_SWITCH_MODE_BLACKBERRY(a)
#define | FLAG_LONG_TIMEOUT(a)
#define | FLAG_FORCE_RESET_ON_CLOSE(a)
#define | PTP_CD_RC_CONNECTED 0
#define | PTP_CD_RC_NO_DEVICES 1
#define | PTP_CD_RC_ERROR_CONNECTING 2

## Typedefs
typedef struct _PTP_USB | PTP_USB

## Functions
void | dump_usbinfo (PTP_USB *ptp_usb)
const char * | get_playlist_extension (PTP_USB *ptp_usb)
void | close_device (PTP_USB *ptp_usb, PTPParams *params)
LIBMTP_error_number_t | configure_usb_device (LIBMTP_raw_device_t *device, PTPParams *params, void **usbinfo)
void | set_usb_device_timeout (PTP_USB *ptp_usb, int timeout)
void | get_usb_device_timeout (PTP_USB *ptp_usb, int *timeout)
int | guess_usb_speed (PTP_USB *ptp_usb)

## Detailed Description

Low-level USB interface glue towards libusb.

Copyright (C) 2005-2007 Richard A. Low richa.nosp@m.rd@w.nosp@m.entne.nosp@m.t.co.nosp@m.m Copyright (C) 2005-2012 Linus Walleij triad.nosp@m.@df..nosp@m.lth.s.nosp@m.e Copyright (C) 2006-2011 Marcus Meissner Copyright (C) 2007 Ted Bullock Copyright (C) 2008 Chris Bagwell chris.nosp@m.@cnp.nosp@m.bagwe.nosp@m.ll.c.nosp@m.om

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Created by Richard Low on 24/12/2005. Modified by Linus Walleij

## Macro Definition Documentation

## ◆ FLAG_ALWAYS_PROBE_DESCRIPTOR

#define FLAG_ALWAYS_PROBE_DESCRIPTOR | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR)
DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR
#define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR
Definition device-flags.h:172

## ◆ FLAG_BROKEN_BATTERY_LEVEL

#define FLAG_BROKEN_BATTERY_LEVEL | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_BATTERY_LEVEL)
DEVICE_FLAG_BROKEN_BATTERY_LEVEL
#define DEVICE_FLAG_BROKEN_BATTERY_LEVEL
Definition device-flags.h:210

## ◆ FLAG_BROKEN_MTPGETOBJPROPLIST

#define FLAG_BROKEN_MTPGETOBJPROPLIST | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST)
DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST
#define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST
Definition device-flags.h:73

## ◆ FLAG_BROKEN_MTPGETOBJPROPLIST_ALL

#define FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL)
DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL
#define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL
Definition device-flags.h:53

## ◆ FLAG_BROKEN_SEND_OBJECT_PROPLIST

#define FLAG_BROKEN_SEND_OBJECT_PROPLIST | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST)
DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST
#define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST
Definition device-flags.h:205

## ◆ FLAG_BROKEN_SET_OBJECT_PROPLIST

#define FLAG_BROKEN_SET_OBJECT_PROPLIST | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST)
DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST
#define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST
Definition device-flags.h:143

## ◆ FLAG_BROKEN_SET_SAMPLE_DIMENSIONS

#define FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS)
DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS
#define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS
Definition device-flags.h:166

## ◆ FLAG_CANNOT_HANDLE_DATEMODIFIED

#define FLAG_CANNOT_HANDLE_DATEMODIFIED | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED)
DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED
#define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED
Definition device-flags.h:196

## ◆ FLAG_FLAC_IS_UNKNOWN

#define FLAG_FLAC_IS_UNKNOWN | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FLAC_IS_UNKNOWN)
DEVICE_FLAG_FLAC_IS_UNKNOWN
#define DEVICE_FLAG_FLAC_IS_UNKNOWN
Definition device-flags.h:255

## ◆ FLAG_FORCE_RESET_ON_CLOSE

#define FLAG_FORCE_RESET_ON_CLOSE | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FORCE_RESET_ON_CLOSE)
DEVICE_FLAG_FORCE_RESET_ON_CLOSE
#define DEVICE_FLAG_FORCE_RESET_ON_CLOSE
Definition device-flags.h:276

## ◆ FLAG_IGNORE_HEADER_ERRORS

#define FLAG_IGNORE_HEADER_ERRORS | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS)
DEVICE_FLAG_IGNORE_HEADER_ERRORS
#define DEVICE_FLAG_IGNORE_HEADER_ERRORS
Definition device-flags.h:135

## ◆ FLAG_IRIVER_OGG_ALZHEIMER

#define FLAG_IRIVER_OGG_ALZHEIMER | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IRIVER_OGG_ALZHEIMER)
DEVICE_FLAG_IRIVER_OGG_ALZHEIMER
#define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER
Definition device-flags.h:105

## ◆ FLAG_LONG_TIMEOUT

#define FLAG_LONG_TIMEOUT | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_LONG_TIMEOUT)
DEVICE_FLAG_LONG_TIMEOUT
#define DEVICE_FLAG_LONG_TIMEOUT
Definition device-flags.h:270

## ◆ FLAG_NO_RELEASE_INTERFACE

#define FLAG_NO_RELEASE_INTERFACE | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE)
DEVICE_FLAG_NO_RELEASE_INTERFACE
#define DEVICE_FLAG_NO_RELEASE_INTERFACE
Definition device-flags.h:122

## ◆ FLAG_NO_ZERO_READS

#define FLAG_NO_ZERO_READS | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_ZERO_READS)
DEVICE_FLAG_NO_ZERO_READS
#define DEVICE_FLAG_NO_ZERO_READS
Definition device-flags.h:89

## ◆ FLAG_OGG_IS_UNKNOWN

#define FLAG_OGG_IS_UNKNOWN | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_OGG_IS_UNKNOWN)
DEVICE_FLAG_OGG_IS_UNKNOWN
#define DEVICE_FLAG_OGG_IS_UNKNOWN
Definition device-flags.h:158

## ◆ FLAG_ONLY_7BIT_FILENAMES

#define FLAG_ONLY_7BIT_FILENAMES | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES)
DEVICE_FLAG_ONLY_7BIT_FILENAMES
#define DEVICE_FLAG_ONLY_7BIT_FILENAMES
Definition device-flags.h:114

## ◆ FLAG_PLAYLIST_SPL

#define FLAG_PLAYLIST_SPL | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & (DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_PLAYLIST_SPL_V2))
DEVICE_FLAG_PLAYLIST_SPL_V2
#define DEVICE_FLAG_PLAYLIST_SPL_V2
Definition device-flags.h:189
DEVICE_FLAG_PLAYLIST_SPL_V1
#define DEVICE_FLAG_PLAYLIST_SPL_V1
Definition device-flags.h:180

## ◆ FLAG_PLAYLIST_SPL_V1

#define FLAG_PLAYLIST_SPL_V1 | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V1)

## ◆ FLAG_PLAYLIST_SPL_V2

#define FLAG_PLAYLIST_SPL_V2 | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V2)

## ◆ FLAG_SWITCH_MODE_BLACKBERRY

#define FLAG_SWITCH_MODE_BLACKBERRY | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_SWITCH_MODE_BLACKBERRY)
DEVICE_FLAG_SWITCH_MODE_BLACKBERRY
#define DEVICE_FLAG_SWITCH_MODE_BLACKBERRY
Definition device-flags.h:265

## ◆ FLAG_UNIQUE_FILENAMES

#define FLAG_UNIQUE_FILENAMES | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNIQUE_FILENAMES)
DEVICE_FLAG_UNIQUE_FILENAMES
#define DEVICE_FLAG_UNIQUE_FILENAMES
Definition device-flags.h:260

## ◆ FLAG_UNLOAD_DRIVER

#define FLAG_UNLOAD_DRIVER | ( |  | a | ) |

Value:
((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNLOAD_DRIVER)
DEVICE_FLAG_UNLOAD_DRIVER
#define DEVICE_FLAG_UNLOAD_DRIVER
Definition device-flags.h:66

## ◆ LIBMTP_USB_DATA

#define LIBMTP_USB_DATA | ( |  | buffer,
|  |  | length,
|  |  | base )

Value:
do { \
if ((LIBMTP_debug & LIBMTP_DEBUG_DATA) != 0) \
data_dump_ascii (stdout, buffer, length, base); \
} while (0)
LIBMTP_debug
int LIBMTP_debug
Definition libmtp.c:89

## ◆ LIBMTP_USB_DEBUG

#define LIBMTP_USB_DEBUG | ( |  | format,
|  |  | args... )

Value:
do { \
if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) \
fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
} while (0)

Debug macro

## Typedef Documentation

## ◆ PTP_USB

typedef struct _PTP_USB PTP_USB

Internal USB struct.

## Function Documentation

## ◆ configure_usb_device()

LIBMTP_error_number_t configure_usb_device | ( | LIBMTP_raw_device_t * | device,
|  | PTPParams * | params,
|  | void ** | usbinfo )

This function assigns params and usbinfo given a raw device as input.

Parameters

  device | the device to be assigned.
  params | current session parameters for this device.
  usbinfo | a pointer to the new usbinfo.

Returns
  an error code.

References LIBMTP_raw_device_struct::device_entry, LIBMTP_device_entry_struct::product_id, _PTP_USB::rawdevice, and LIBMTP_device_entry_struct::vendor_id.

## ◆ dump_usbinfo()

void dump_usbinfo | ( | PTP_USB * | ptp_usb | ) |

This routine just dumps out low-level USB information about the current device.

Parameters

  ptp_usb | the USB device to get information from.

References LIBMTP_raw_device_struct::bus_location, LIBMTP_raw_device_struct::device_entry, LIBMTP_device_entry_struct::device_flags, LIBMTP_raw_device_struct::devnum, LIBMTP_device_entry_struct::product, LIBMTP_device_entry_struct::product_id, _PTP_USB::rawdevice, LIBMTP_device_entry_struct::vendor, and LIBMTP_device_entry_struct::vendor_id.

## ◆ get_playlist_extension()

const char * get_playlist_extension | ( | PTP_USB * | ptp_usb | ) |

Retrieve the appropriate playlist extension for this device. Rather hacky at the moment. This is probably desired by the managing software, but when creating lists on the device itself you notice certain preferences.

Parameters

  ptp_usb | the USB device to get suggestion for.

Returns
  the suggested playlist extension.