summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@me.com>2014-05-06 02:35:44 -0600
committerNathan Hjelm <hjelmn@me.com>2014-05-06 02:50:23 -0600
commitb4c2ed575aca012955e97b89cf64e81b058cb0cf (patch)
treea2a5da11bc450352f5a3c2faa102a7115105770e
parent2687fde18a9e6befb10f70945509d85fd6a108c1 (diff)
downloadlibusb-b4c2ed575aca012955e97b89cf64e81b058cb0cf.tar.gz
darwin: correct endpoint address calculation
The backend was incorrectly calculating the addresses of endpoints with directions other than kUSBIn and kUSBOut. This primarily affects devices with multiple control endpoints. This commit should correct the issue by only setting the direction bit when the direction is kUSBIn. Thanks to Jean-Etienne for identifying the issue. Signed-off-by: Nathan Hjelm <hjelmn@me.com>
-rw-r--r--libusb/os/darwin_usb.c4
-rw-r--r--libusb/version_nano.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index cf7673d..0607c70 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode:nil -*- */
/*
* darwin backend for libusb 1.0
- * Copyright © 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
+ * Copyright © 2008-2014 Nathan Hjelm <hjelmn@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1127,7 +1127,7 @@ static int get_endpoints (struct libusb_device_handle *dev_handle, int iface) {
usbi_dbg ("interface: %i pipe %i: dir: %i number: %i", iface, i, direction, number);
- cInterface->endpoint_addrs[i - 1] = ((direction << 7 & LIBUSB_ENDPOINT_DIR_MASK) | (number & LIBUSB_ENDPOINT_ADDRESS_MASK));
+ cInterface->endpoint_addrs[i - 1] = (((kUSBIn == direction) << kUSBRqDirnShift) | (number & LIBUSB_ENDPOINT_ADDRESS_MASK));
}
cInterface->num_endpoints = numep;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 2588755..51c00b2 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10884
+#define LIBUSB_NANO 10885