summaryrefslogtreecommitdiffstats
path: root/libusb-1.0
diff options
context:
space:
mode:
Diffstat (limited to 'libusb-1.0')
-rwxr-xr-xlibusb-1.0/.gitattributes8
-rwxr-xr-xlibusb-1.0/_testing.test5
-rw-r--r--libusb-1.0/configure.ac2
-rwxr-xr-xlibusb-1.0/libusb/libusb_version.h29
-rw-r--r--libusb-1.0/libusb/os/windows_usb.c40
5 files changed, 52 insertions, 32 deletions
diff --git a/libusb-1.0/.gitattributes b/libusb-1.0/.gitattributes
new file mode 100755
index 0000000..bfef1a2
--- /dev/null
+++ b/libusb-1.0/.gitattributes
@@ -0,0 +1,8 @@
+*.sh -crlf
+*.ac -crlf
+*.am -crlf
+*.dsw -crlf
+*.dsp -crlf
+*.sln -crlf
+*.vcproj -crlf
+*.test -crlf
diff --git a/libusb-1.0/_testing.test b/libusb-1.0/_testing.test
new file mode 100755
index 0000000..7d3b103
--- /dev/null
+++ b/libusb-1.0/_testing.test
@@ -0,0 +1,5 @@
+[INTERNAL - TESTING]
+
+This is a CRLF file
+to test line ending
+conversion in git.
diff --git a/libusb-1.0/configure.ac b/libusb-1.0/configure.ac
index 39daa13..2685e2c 100644
--- a/libusb-1.0/configure.ac
+++ b/libusb-1.0/configure.ac
@@ -1,7 +1,7 @@
m4_define(LIBUSB_MAJOR, [1])
m4_define(LIBUSB_MINOR, [0])
m4_define(LIBUSB_MICRO, [8])
-m4_define(LIBUSB_NANO, [10323])
+m4_define(LIBUSB_NANO, [10325])
AC_INIT([libusb], LIBUSB_MAJOR.LIBUSB_MINOR.LIBUSB_MICRO, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
diff --git a/libusb-1.0/libusb/libusb_version.h b/libusb-1.0/libusb/libusb_version.h
new file mode 100755
index 0000000..c1d870f
--- /dev/null
+++ b/libusb-1.0/libusb/libusb_version.h
@@ -0,0 +1,29 @@
+/*
+ * Version header for libusb
+ * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
+ * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ *
+ * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __LIBUSB_VERSION_H__
+#define __LIBUSB_VERSION_H__
+
+#define LIBUSB_VERSION_MAJOR 1
+#define LIBUSB_VERSION_MINOR 0
+#define LIBUSB_VERSION_MICRO 8
+#define LIBUSB_VERSION_NANO 10325
+
+#endif
diff --git a/libusb-1.0/libusb/os/windows_usb.c b/libusb-1.0/libusb/os/windows_usb.c
index 6ad6229..9223afb 100644
--- a/libusb-1.0/libusb/os/windows_usb.c
+++ b/libusb-1.0/libusb/os/windows_usb.c
@@ -571,6 +571,7 @@ unsigned long htab_hash(char* str)
/*
* Returns the session ID of a device's nth level ancestor
+ * If there's no device at the nth level, return 0
*/
static unsigned long get_ancestor_session_id(DWORD devinst, unsigned level)
{
@@ -590,11 +591,6 @@ static unsigned long get_ancestor_session_id(DWORD devinst, unsigned level)
if (CM_Get_Device_IDA(devinst, path, MAX_PATH_LENGTH, 0) != CR_SUCCESS) {
return 0;
}
- // Return a special invalid session ID if the GP is not USB (as can be the case for HID)
- if ((level == 2) && (path[0] != 'U') && (path[1] != 'S') && (path[2] != 'B')) {
- usbi_dbg("detected non USB parent '%s'", path);
- return ~0;
- }
// TODO (post hotplug): try without sanitizing
sanitized_path = sanitize_path(path);
if (sanitized_path == NULL) {
@@ -1267,7 +1263,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
#define DEV_PASS 3
#define HID_PASS 4
int r = LIBUSB_SUCCESS;
- unsigned int nb_guids, pass, i, j;
+ unsigned int nb_guids, pass, i, j, ancestor;
char path[MAX_PATH_LENGTH];
char strbuf[MAX_PATH_LENGTH];
struct libusb_device *dev, *parent_dev;
@@ -1456,35 +1452,17 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
case HUB_PASS:
break;
default:
- session_id = get_ancestor_session_id(dev_info_data.DevInst, 1);
- if (session_id == 0) {
- usbi_err(ctx, "program assertion failed: orphan device '%s'", dev_id_path);
- LOOP_BREAK(LIBUSB_ERROR_NO_DEVICE);
- }
- parent_dev = usbi_get_device_by_session_id(ctx, session_id);
- // Composite HID devices have double indirection => Check grandparent
- if (pass == HID_PASS) {
- session_id = get_ancestor_session_id(dev_info_data.DevInst, 2);
+ // Go through the ancestors until we see a face we recognize
+ parent_dev = NULL;
+ for (ancestor = 1; parent_dev == NULL; ancestor++) {
+ session_id = get_ancestor_session_id(dev_info_data.DevInst, ancestor);
if (session_id == 0) {
- usbi_err(ctx, "program assertion failed: no grandparent for '%s'", dev_id_path);
- LOOP_BREAK(LIBUSB_ERROR_NO_DEVICE);
- } else if (session_id == ~0) {
- usbi_dbg("skipping non USB HID interface '%s'", dev_id_path);
- continue;
- }
- dev = usbi_get_device_by_session_id(ctx, session_id);
- if (dev == NULL) {
- usbi_err(ctx, "program assertion failed: unlisted grandparent for '%s'", dev_id_path);
- LOOP_BREAK(LIBUSB_ERROR_NO_DEVICE);
- }
- if (__device_priv(dev)->apib->id == USB_API_COMPOSITE) {
- parent_dev = dev;
+ break;
}
+ parent_dev = usbi_get_device_by_session_id(ctx, session_id);
}
if (parent_dev == NULL) {
- // This can occur if the OS only reports a newly plugged device after we started enum,
- // eg. HID parent not listed on GEN pass, but children listed on HID pass
- usbi_warn(ctx, "unlisted parent for '%s' (newly connected device?) - ignoring", dev_id_path);
+ usbi_dbg("unlisted ancestor for '%s' (non USB HID, newly connected, etc.) - ignoring", dev_id_path);
continue;
}
parent_priv = __device_priv(parent_dev);