0

I'm currently trying to build the libmtp version 1.1.8 using the lib usb-1 (1.0.19) and usb-compat(0.1.5) on mac OS X to generate a dynamic lib.

I'm not sure if libmtp really support USB1 lib mainly because I have an issue in building libusb-glue.c. In the config.h, I have :

#undef HAVE_LIBUSB0
#define HAVE_LIBUSB1 /**/

The limbs-glue.c is for example doing :

result = USB_BULK_READ(ptp_usb->handle,
               ptp_usb->inep,
               (char*) bytes,
               toread,
               ptp_usb->timeout);

There is no flag to add parameter when moving to usb1 instead of usb0

As I have the flag USB1 enable and USB0 disable, the limbs-glue.h is defined like this

#ifdef HAVE_LIBUSB1
#define USB_BULK_READ libusb_bulk_transfer
#define USB_BULK_WRITE libusb_bulk_transfer
#endif
#ifdef HAVE_LIBUSB0
#define USB_BULK_READ usb_bulk_read
#define USB_BULK_WRITE usb_bulk_write
#endif
#ifdef HAVE_LIBOPENUSB
#define USB_BULK_READ openusb_bulk_xfer
#define USB_BULK_WRITE openusb_bulk_xfer
#endif

As defined in the sync.c file of the libusb-1 file which take 6 arguments

int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
    unsigned char endpoint, unsigned char *data, int length, int *transferred,
    unsigned int timeout)
{
    return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
        transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK);
}

What is strange is the the USB_BULK_READ/WRITE is not flagged with also the USB0 or USB1 support to add/remove the missing parameter for USB1 support

any idea or do you know if I should better use the lib usb1 or lib usb0. Perhaps it's better to build lib-usb0 + libusb-compat instead of using the usb1

Thanks

Seb
  • 2,929
  • 4
  • 30
  • 73

1 Answers1

0

My suggestion is to use homebrew to get libmtp on your OSX development box. homebrew will get you libusb, libusb-compat, and leave you with a dynamic and static library of libmtp.

Unless you're doing libmtp development this is the fastest way to use libmtp.

Jason Harrison
  • 922
  • 9
  • 27