diff options
author | Benjamin-Dobell <benjamin.dobell+github@glassechidna.com.au> | 2010-12-21 13:43:54 +0100 |
---|---|---|
committer | Benjamin-Dobell <benjamin.dobell+github@glassechidna.com.au> | 2010-12-21 13:43:54 +0100 |
commit | f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113 (patch) | |
tree | c6b42466d2ef4d1c50122a2ccaa289603b75176f /libusb-1.0/libusb | |
parent | Ran make distclean for libusb and universal binary support to heimdall-frontend (diff) | |
download | Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar.gz Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar.bz2 Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar.lz Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar.xz Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.tar.zst Heimdall-f93ed08599fd104e3b8d0f5f1f0b1a6421ce4113.zip |
Diffstat (limited to 'libusb-1.0/libusb')
-rwxr-xr-x | libusb-1.0/libusb/libusb_version.h | 29 | ||||
-rw-r--r-- | libusb-1.0/libusb/os/windows_usb.c | 40 |
2 files changed, 38 insertions, 31 deletions
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); |