aboutsummaryrefslogtreecommitdiff
path: root/src/libusb-glue.h
diff options
context:
space:
mode:
authorLinus Walleij <triad@df.lth.se>2011-11-17 19:19:51 +0100
committerLinus Walleij <triad@df.lth.se>2011-11-17 19:19:51 +0100
commitfbbef8b16876568f760986e4ff8f4921b8373fd5 (patch)
tree80b6ebdcc7df75d0dbfad0b509e0bbe6c27904aa /src/libusb-glue.h
parent7cf02643117f11ab3c7d11dd49c1fc9d1776ba4e (diff)
downloadlibmtp-fbbef8b16876568f760986e4ff8f4921b8373fd5.tar.gz
Make libusb 1.0 and libusb 0.x coexist, merge Marcus' libusb 1.0
support. This makes autoconf select between libusb 1.0 and libusb 0.x at configure-time, use a common libusb-glue.h for both but split implementation files: libusb1-glue.c is the new one for libusb 1.0 and libusb-glue.c is the old one, which will hopefully be phased out one day. Signed-off-by: Linus Walleij <triad@df.lth.se>
Diffstat (limited to 'src/libusb-glue.h')
-rw-r--r--src/libusb-glue.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libusb-glue.h b/src/libusb-glue.h
index 75cefd4..b94d560 100644
--- a/src/libusb-glue.h
+++ b/src/libusb-glue.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2005-2007 Richard A. Low <richard@wentnet.com>
* Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se>
- * Copyright (C) 2006-2007 Marcus Meissner
+ * Copyright (C) 2006-2011 Marcus Meissner
* Copyright (C) 2007 Ted Bullock
* Copyright (C) 2008 Chris Bagwell <chris@cnpbagwell.com>
*
@@ -31,7 +31,12 @@
#define LIBUSB_GLUE_H
#include "ptp.h"
+#ifdef HAVE_LIBUSB1
+#include <libusb-1.0/libusb.h>
+#endif
+#ifdef HAVE_LIBUSB0
#include <usb.h>
+#endif
#include "libmtp.h"
#include "device-flags.h"
@@ -55,9 +60,14 @@ extern "C" {
data_dump_ascii (stdout, buffer, length, base); \
} while (0)
-
+#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
/**
* Internal USB struct.
@@ -65,7 +75,12 @@ extern "C" {
typedef struct _PTP_USB PTP_USB;
struct _PTP_USB {
PTPParams *params;
+#ifdef HAVE_LIBUSB1
+ libusb_device_handle* handle;
+#endif
+#ifdef HAVE_LIBUSB0
usb_dev_handle* handle;
+#endif
uint8_t interface;
int inep;
int inep_maxpacket;