summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 18:11:18 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 18:11:18 +0000
commitb42ba23eb748ffb77206ba075b7c0fe56d938498 (patch)
treee3ed3883d8224127152ea62ca449a9ee40883e47
parent714cec2293f38c50caf2f98360061e283d05898e (diff)
downloadchromium_src-b42ba23eb748ffb77206ba075b7c0fe56d938498.zip
chromium_src-b42ba23eb748ffb77206ba075b7c0fe56d938498.tar.gz
chromium_src-b42ba23eb748ffb77206ba075b7c0fe56d938498.tar.bz2
Revert "Update libusb 1.0.9 to libusbx 1.0.16."
Original CL: https://codereview.chromium.org/19713005 TBR=scheib@chromium.org BUG=223817 Review URL: https://codereview.chromium.org/19821003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212602 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/libusb/README.chromium6
-rw-r--r--third_party/libusb/libusb.gyp66
-rw-r--r--third_party/libusb/src/AUTHORS43
-rw-r--r--third_party/libusb/src/ChangeLog174
-rw-r--r--third_party/libusb/src/INSTALL_WIN.txt73
-rw-r--r--third_party/libusb/src/Makefile.am15
-rw-r--r--third_party/libusb/src/NEWS67
-rw-r--r--third_party/libusb/src/PORTING27
-rw-r--r--third_party/libusb/src/README32
-rw-r--r--third_party/libusb/src/README.git29
-rw-r--r--third_party/libusb/src/RELEASE-NOTES35
-rw-r--r--third_party/libusb/src/THANKS5
-rw-r--r--third_party/libusb/src/TODO11
-rwxr-xr-xthird_party/libusb/src/autogen.sh21
-rwxr-xr-xthird_party/libusb/src/bootstrap.sh19
-rw-r--r--third_party/libusb/src/configure.ac75
-rw-r--r--third_party/libusb/src/doc/Makefile.am3
-rw-r--r--third_party/libusb/src/doc/doxygen.cfg.in40
-rw-r--r--third_party/libusb/src/doc/libusbx.pngbin2923 -> 0 bytes
-rw-r--r--third_party/libusb/src/examples/Makefile.am20
-rw-r--r--third_party/libusb/src/examples/dpfp.c9
-rw-r--r--third_party/libusb/src/examples/dpfp_threaded.c9
-rw-r--r--third_party/libusb/src/examples/ezusb.c796
-rw-r--r--third_party/libusb/src/examples/ezusb.h120
-rw-r--r--third_party/libusb/src/examples/fxload.c287
-rw-r--r--third_party/libusb/src/examples/getopt/getopt.c1060
-rw-r--r--third_party/libusb/src/examples/getopt/getopt.h180
-rw-r--r--third_party/libusb/src/examples/getopt/getopt1.c188
-rw-r--r--third_party/libusb/src/examples/hotplugtest.c97
-rw-r--r--third_party/libusb/src/examples/listdevs.c21
-rw-r--r--third_party/libusb/src/examples/sam3u_benchmark.c193
-rw-r--r--third_party/libusb/src/examples/xusb.c1093
-rw-r--r--third_party/libusb/src/libusb-1.0.pc.in7
-rw-r--r--third_party/libusb/src/libusb/Makefile.am43
-rw-r--r--third_party/libusb/src/libusb/core.c837
-rw-r--r--third_party/libusb/src/libusb/descriptor.c745
-rw-r--r--third_party/libusb/src/libusb/hotplug.c320
-rw-r--r--third_party/libusb/src/libusb/hotplug.h82
-rw-r--r--third_party/libusb/src/libusb/interrupt.c4
-rw-r--r--third_party/libusb/src/libusb/interrupt.h2
-rw-r--r--third_party/libusb/src/libusb/io.c642
-rw-r--r--third_party/libusb/src/libusb/libusb-1.0.def40
-rw-r--r--third_party/libusb/src/libusb/libusb-1.0.rc13
-rw-r--r--third_party/libusb/src/libusb/libusb.h640
-rw-r--r--third_party/libusb/src/libusb/libusbi.h299
-rw-r--r--third_party/libusb/src/libusb/os/darwin_usb.c1115
-rw-r--r--third_party/libusb/src/libusb/os/darwin_usb.h89
-rw-r--r--third_party/libusb/src/libusb/os/linux_netlink.c254
-rw-r--r--third_party/libusb/src/libusb/os/linux_udev.c273
-rw-r--r--third_party/libusb/src/libusb/os/linux_usbfs.c1288
-rw-r--r--third_party/libusb/src/libusb/os/linux_usbfs.h46
-rw-r--r--third_party/libusb/src/libusb/os/openbsd_usb.c17
-rw-r--r--third_party/libusb/src/libusb/os/poll_posix.c51
-rw-r--r--third_party/libusb/src/libusb/os/poll_posix.h3
-rw-r--r--third_party/libusb/src/libusb/os/poll_windows.c201
-rw-r--r--third_party/libusb/src/libusb/os/poll_windows.h18
-rw-r--r--third_party/libusb/src/libusb/os/threads_posix.c42
-rw-r--r--third_party/libusb/src/libusb/os/threads_posix.h6
-rw-r--r--third_party/libusb/src/libusb/os/threads_windows.c29
-rw-r--r--third_party/libusb/src/libusb/os/threads_windows.h7
-rw-r--r--third_party/libusb/src/libusb/os/wince_usb.c1015
-rw-r--r--third_party/libusb/src/libusb/os/wince_usb.h131
-rw-r--r--third_party/libusb/src/libusb/os/windows_common.h108
-rw-r--r--third_party/libusb/src/libusb/os/windows_usb.c2110
-rw-r--r--third_party/libusb/src/libusb/os/windows_usb.h532
-rw-r--r--third_party/libusb/src/libusb/strerror.c184
-rw-r--r--third_party/libusb/src/libusb/sync.c87
-rw-r--r--third_party/libusb/src/libusb/version.h4
-rw-r--r--third_party/libusb/src/libusb/version_nano.h1
-rw-r--r--third_party/libusb/src/msvc/config.h31
-rw-r--r--third_party/libusb/src/msvc/ddk_build.cmd105
-rw-r--r--third_party/libusb/src/msvc/errno.h102
-rw-r--r--third_party/libusb/src/msvc/fxload_2010.vcxproj170
-rw-r--r--third_party/libusb/src/msvc/fxload_2010.vcxproj.filters25
-rw-r--r--third_party/libusb/src/msvc/fxload_2012.vcxproj174
-rw-r--r--third_party/libusb/src/msvc/fxload_2012.vcxproj.filters25
-rw-r--r--third_party/libusb/src/msvc/fxload_sources23
-rw-r--r--third_party/libusb/src/msvc/getopt_2005.vcproj288
-rw-r--r--third_party/libusb/src/msvc/getopt_2010.vcxproj131
-rw-r--r--third_party/libusb/src/msvc/getopt_2010.vcxproj.filters26
-rw-r--r--third_party/libusb/src/msvc/getopt_2012.vcxproj135
-rw-r--r--third_party/libusb/src/msvc/getopt_2012.vcxproj.filters26
-rw-r--r--third_party/libusb/src/msvc/getopt_sources20
-rw-r--r--third_party/libusb/src/msvc/hotplugtest_2010.vcxproj163
-rw-r--r--third_party/libusb/src/msvc/hotplugtest_2010.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/hotplugtest_2012.vcxproj167
-rw-r--r--third_party/libusb/src/msvc/hotplugtest_2012.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/hotplugtest_sources20
-rw-r--r--third_party/libusb/src/msvc/libusb.dsw (renamed from third_party/libusb/src/msvc/libusbx.dsw)127
-rw-r--r--third_party/libusb/src/msvc/libusb_dll.dsp384
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_2005.vcproj436
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_2010.vcxproj170
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_2010.vcxproj.filters81
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_2012.vcxproj175
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_2012.vcxproj.filters84
-rw-r--r--third_party/libusb/src/msvc/libusb_dll_wince.vcproj1243
-rw-r--r--third_party/libusb/src/msvc/libusb_sources2
-rw-r--r--third_party/libusb/src/msvc/libusb_static.dsp344
-rw-r--r--third_party/libusb/src/msvc/libusb_static_2005.vcproj362
-rw-r--r--third_party/libusb/src/msvc/libusb_static_2010.vcxproj156
-rw-r--r--third_party/libusb/src/msvc/libusb_static_2010.vcxproj.filters74
-rw-r--r--third_party/libusb/src/msvc/libusb_static_2012.vcxproj160
-rw-r--r--third_party/libusb/src/msvc/libusb_static_2012.vcxproj.filters74
-rw-r--r--third_party/libusb/src/msvc/libusb_static_wince.vcproj1185
-rw-r--r--third_party/libusb/src/msvc/libusbx_2005.sln95
-rw-r--r--third_party/libusb/src/msvc/libusbx_2010.sln94
-rw-r--r--third_party/libusb/src/msvc/libusbx_2012.sln94
-rw-r--r--third_party/libusb/src/msvc/libusbx_wince.sln246
-rw-r--r--third_party/libusb/src/msvc/listdevs.dsp206
-rw-r--r--third_party/libusb/src/msvc/listdevs_2005.vcproj360
-rw-r--r--third_party/libusb/src/msvc/listdevs_2010.vcxproj165
-rw-r--r--third_party/libusb/src/msvc/listdevs_2010.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/listdevs_2012.vcxproj169
-rw-r--r--third_party/libusb/src/msvc/listdevs_2012.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/listdevs_wince.vcproj1120
-rw-r--r--third_party/libusb/src/msvc/missing.c80
-rw-r--r--third_party/libusb/src/msvc/missing.h32
-rw-r--r--third_party/libusb/src/msvc/stress_2005.vcproj390
-rw-r--r--third_party/libusb/src/msvc/stress_2010.vcxproj167
-rw-r--r--third_party/libusb/src/msvc/stress_2010.vcxproj.filters25
-rw-r--r--third_party/libusb/src/msvc/stress_2012.vcxproj171
-rw-r--r--third_party/libusb/src/msvc/stress_2012.vcxproj.filters25
-rw-r--r--third_party/libusb/src/msvc/stress_wince.vcproj1128
-rw-r--r--third_party/libusb/src/msvc/xusb.dsp102
-rw-r--r--third_party/libusb/src/msvc/xusb_2005.vcproj344
-rw-r--r--third_party/libusb/src/msvc/xusb_2010.vcxproj163
-rw-r--r--third_party/libusb/src/msvc/xusb_2010.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/xusb_2012.vcxproj167
-rw-r--r--third_party/libusb/src/msvc/xusb_2012.vcxproj.filters14
-rw-r--r--third_party/libusb/src/msvc/xusb_sources20
-rw-r--r--third_party/libusb/src/msvc/xusb_wince.vcproj1120
-rw-r--r--third_party/libusb/src/tests/Makefile.am6
-rw-r--r--third_party/libusb/src/tests/libusbx_testlib.h107
-rw-r--r--third_party/libusb/src/tests/stress.c159
-rw-r--r--third_party/libusb/src/tests/testlib.c276
-rw-r--r--third_party/libusb/windows-build.patch75
136 files changed, 3495 insertions, 26482 deletions
diff --git a/third_party/libusb/README.chromium b/third_party/libusb/README.chromium
index b0df5e9..61f6e40 100644
--- a/third_party/libusb/README.chromium
+++ b/third_party/libusb/README.chromium
@@ -1,12 +1,12 @@
-Name: libusbx
+Name: libusb
URL: http://libusb.org
-Version: 1.0.16
+Version: 1.0.9
License: LGPL 2.1
License File: src/COPYING
Security Critical: yes
Description:
-libusbx provides a platform-agnostic API for accessing the USB subsystem on Mac,
+libusb provides a platform-agnostic API for accessing the USB subsystem on Mac,
Windows, and Linux systems.
Local Modifications:
diff --git a/third_party/libusb/libusb.gyp b/third_party/libusb/libusb.gyp
index f769ff1..46e9e6f 100644
--- a/third_party/libusb/libusb.gyp
+++ b/third_party/libusb/libusb.gyp
@@ -9,18 +9,15 @@
'type': 'static_library',
'sources': [
'src/config.h',
+ 'src/libusb/libusb.h',
+ 'src/libusb/libusbi.h',
'src/libusb/core.c',
'src/libusb/descriptor.c',
- 'src/libusb/hotplug.c',
- 'src/libusb/hotplug.h',
- 'src/libusb/interrupt.c',
- 'src/libusb/interrupt.h',
'src/libusb/io.c',
- 'src/libusb/libusb.h',
- 'src/libusb/libusbi.h',
'src/libusb/sync.c',
'src/libusb/version.h',
- 'src/libusb/version_nano.h',
+ 'src/libusb/interrupt.c',
+ 'src/libusb/interrupt.h',
],
'include_dirs': [
'src',
@@ -33,9 +30,10 @@
],
},
'conditions': [
- [ 'OS == "linux" or OS == "android" or OS == "mac"', {
+ [ 'OS == "linux" or OS == "android"', {
'sources': [
- 'src/libusb/os/poll_posix.c',
+ 'src/libusb/os/linux_usbfs.c',
+ 'src/libusb/os/linux_usbfs.h',
'src/libusb/os/poll_posix.h',
'src/libusb/os/threads_posix.c',
'src/libusb/os/threads_posix.h',
@@ -45,40 +43,19 @@
'HAVE_GETTIMEOFDAY=1',
'HAVE_POLL_H=1',
'HAVE_SYS_TIME_H=1',
- 'LIBUSB_DESCRIBE="1.0.16"',
+ 'LIBUSB_DESCRIBE="1.0.9"',
+ 'OS_LINUX=1',
'POLL_NFDS_TYPE=nfds_t',
'THREADS_POSIX=1',
- ],
- }],
- [ 'OS == "linux" or OS == "android"', {
- 'sources': [
- 'src/libusb/os/linux_udev.c',
- 'src/libusb/os/linux_usbfs.c',
- 'src/libusb/os/linux_usbfs.h',
- ],
- 'defines': [
- 'HAVE_LIBUDEV=1',
- 'OS_LINUX=1',
- 'USE_UDEV=1',
'_GNU_SOURCE=1',
],
}],
- [ 'OS == "mac"', {
- 'sources': [
- 'src/libusb/os/darwin_usb.c',
- 'src/libusb/os/darwin_usb.h',
- ],
- 'defines': [
- 'OS_DARWIN=1',
- ],
- }],
- [ 'OS == "win"', {
+ ['OS == "win"', {
'sources': [
'src/libusb/os/poll_windows.c',
'src/libusb/os/poll_windows.h',
'src/libusb/os/threads_windows.c',
'src/libusb/os/threads_windows.h',
- 'src/libusb/os/windows_common.h',
'src/libusb/os/windows_usb.c',
'src/libusb/os/windows_usb.h',
'src/msvc/config.h',
@@ -90,8 +67,31 @@
],
'include_dirs': [
'src/msvc',
+ ],
+ 'defines': [
+ 'DDKBUILD=1',
]
}],
+ ['OS == "mac"', {
+ 'sources': [
+ 'src/libusb/os/darwin_usb.c',
+ 'src/libusb/os/darwin_usb.h',
+ 'src/libusb/os/poll_posix.h',
+ 'src/libusb/os/threads_posix.c',
+ 'src/libusb/os/threads_posix.h',
+ ],
+ 'defines': [
+ 'DEFAULT_VISIBILITY=',
+ 'HAVE_GETTIMEOFDAY=1',
+ 'HAVE_POLL_H=1',
+ 'HAVE_SYS_TIME_H=1',
+ 'LIBUSB_DESCRIBE="1.0.9"',
+ 'OS_DARWIN=1',
+ 'POLL_NFDS_TYPE=nfds_t',
+ 'THREADS_POSIX=1',
+ '_GNU_SOURCE=1',
+ ],
+ }],
],
},
],
diff --git a/third_party/libusb/src/AUTHORS b/third_party/libusb/src/AUTHORS
index 6c29e21..b43d995 100644
--- a/third_party/libusb/src/AUTHORS
+++ b/third_party/libusb/src/AUTHORS
@@ -1,60 +1,45 @@
-Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
-Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
-Copyright © 2010-2012 Peter Stuge <peter@stuge.se>
-Copyright © 2008-2011 Nathan Hjelm <hjelmn@users.sourceforge.net>
-Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
-Copyright © 2009-2012 Ludovic Rousseau <ludovic.rousseau@gmail.com>
-Copyright © 2010-2012 Michael Plante <michael.plante@gmail.com>
-Copyright © 2011-2012 Hans de Goede <hdegoede@redhat.com>
-Copyright © 2012 Martin Pieuchot <mpi@openbsd.org>
-Copyright © 2012-2013 Toby Gray <toby.gray@realvnc.com>
+Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
+Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
+Copyright (C) 2008-2012 Nathan Hjelm <hjelmn@users.sourceforge.net>
+Copyright (C) 2009-2012 Pete Batard <pete@akeo.ie>
+Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
+Copyright (C) 2010-2012 Peter Stuge <peter@stuge.se>
+Copyright (C) 2011-2012 Hans de Goede <hdegoede@redhat.com>
+Copyright (C) 2012 Martin Pieuchot <mpi@openbsd.org>
Other contributors:
Alan Ott
Alan Stern
Alex Vatchenko
-Anthony Clay
Artem Egorkine
Aurelien Jarno
Bastien Nocera
-Benjamin Dobell
-Chris Dickens
-Colin Walters
-Dave Camarillo
+Brian Shirley
David Engraf
David Moore
-Davidlohr Bueso
-Federico Manzan
Felipe Balbi
-Francesco Montorsi
Graeme Gill
+Hans de Goede
Hans Ulrich Niedermann
Hector Martin
Hoi-Ho Chan
-Ilya Konstantinov
James Hanko
Konrad Rzepecki
-Lars Wirzenius
-Luca Longinotti
+Ludovic Rousseau
Martin Koegler
-Matthias Bolte
+Martin Pieuchot
Mike Frysinger
Mikhail Gusarov
-Nicholas Corgan
Orin Eman
Pekka Nikander
+Peter Stuge
Rob Walker
Sean McBride
Sebastian Pipping
-Simon Haggett
+Stephan Meyer
Thomas Röfer
-Tim Roberts
Toby Peterson
Trygve Laugstøl
-Uri Lublin
Vasily Khoruzhick
-Vegard Storheil Eriksen
Vitali Lovich
Xiaofan Chen
-Zoltán Kovács
-Роман Донченко
diff --git a/third_party/libusb/src/ChangeLog b/third_party/libusb/src/ChangeLog
deleted file mode 100644
index a3304a6..0000000
--- a/third_party/libusb/src/ChangeLog
+++ /dev/null
@@ -1,174 +0,0 @@
-For detailed information about the changes below, please see the git log or
-visit: http://log.libusbx.org
-
-2013-07-11: v1.0.16
-* Add hotplug support for Darwin and Linux (#9)
-* Add superspeed endpoint companion descriptor support (#15)
-* Add BOS descriptor support (#15)
-* Make descriptor parsing code more robust
-* New libusb_get_port_numbers API, this is libusb_get_port_path without
- the unnecessary context parameter, libusb_get_port_path is now deprecated
-* New libusb_strerror API (#14)
-* New libusb_set_auto_detach_kernel_driver API (#17)
-* Improve topology API docs (#95)
-* Logging now use a single write call per log-message, avoiding log-message
- "interlacing" when using multiple threads.
-* Android: use Android logging when building on Android (#101)
-* Darwin: make libusb_reset reenumerate device on descriptors change (#89)
-* Darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET flag (#91)
-* Darwin: add a device cache (#112, #114)
-* Examples: Add sam3u_benchmark isochronous example by Harald Welte (#109)
-* Many other bug fixes and improvements
-The (#xx) numbers are libusbx issue numbers, see ie:
-https://github.com/libusbx/libusbx/issues/9
-
-2013-04-15: v1.0.15
-* Improve transfer cancellation and avoid short read failures on broken descriptors
-* Filter out 8-bit characters in libusb_get_string_descriptor_ascii()
-* Add WinCE support
-* Add library stress tests
-* Add Cypress FX3 firmware upload support for fxload sample
-* Add HID and kernel driver detach support capabilities detection
-* Add SuperSpeed detection on OS X
-* Fix bInterval value interpretation on OS X
-* Fix issues with autoclaim, composite HID devices, interface autoclaim and
- early abort in libusb_close() on Windows. Also add VS2012 solution files.
-* Improve fd event handling on Linux
-* Other bug fixes and improvements
-
-2012-09-26: v1.0.14
-* Reverts the previous API change with regards to bMaxPower.
- If this doesn't matter to you, you are encouraged to keep using v1.0.13,
- as it will use the same attribute as v2.0, to be released soon.
-* Note that LIBUSBX_API_VERSION is *decreased* to 0x010000FF and the previous
- guidelines with regards to concurrent use of MaxPower/bMaxPower still apply.
-
-2012-09-20: v1.0.13
-* [MAJOR] Fix a typo in the API with struct libusb_config_descriptor where
- MaxPower was used instead of bMaxPower, as defined in the specs. If your
- application was accessing the MaxPower attribute, and you need to maintain
- compatibility with libusb or older versions, see APPENDIX A below.
-* Fix broken support for the 0.1 -> 1.0 libusb-compat layer
-* Fix unwanted cancellation of pending timeouts as well as major timeout related bugs
-* Fix handling of HID and composite devices on Windows
-* Introduce LIBUSBX_API_VERSION macro
-* Add Cypress FX/FX2 firmware upload sample, based on fxload from
- http://linux-hotplug.sourceforge.net
-* Add libusb0 (libusb-win32) and libusbK driver support on Windows. Note that while
- the drivers allow it, isochronous transfers are not supported yet in libusbx. Also
- not supported yet is the use of libusb-win32 filter drivers on composite interfaces
-* Add support for the new get_capabilities ioctl on Linux and avoid unnecessary
- splitting of bulk transfers
-* Improve support for newer Intel and Renesas USB 3.0 controllers on Windows
-* Harmonize the device number for root hubs across platforms
-* Other bug fixes and improvements
-
-2012-06-15: v1.0.12
-* Fix a potential major regression with pthread on Linux
-* Fix missing thread ID from debug log output on cygwin
-* Fix possible crash when using longjmp and MinGW's gcc 4.6
-* Add topology calls: libusb_get_port_number(), libusb_get_parent() & libusb_get_port_path()
-* Add toggleable debug, using libusb_set_debug() or the LIBUSB_DEBUG environment variable
-* Define log levels in libusb.h and set timestamp origin to first libusb_init() call
-* All logging is now sent to to stderr (info was sent to stdout previously)
-* Update log messages severity and avoid polluting log output on OS-X
-* Add HID driver support on Windows
-* Enable interchangeability of MSVC and MinGW DLLs
-* Additional bug fixes and improvements
-
-2012-05-08: v1.0.11
-* Revert removal of critical Windows event handling that was introduced in 1.0.10
-* Fix a possible deadlock in Windows when submitting transfers
-* Add timestamped logging
-* Add NetBSD support (experimental) and BSD libusb_get_device_speed() data
-* Add bootstrap.sh alongside autogen.sh (bootstrap.sh doesn't invoke configure)
-* Search for device nodes in /dev for Android support
-* Other bug fixes
-
-2012-04-17: v1.0.10
-* Public release
-* Add libusb_get_version
-* Add Visual Studio 2010 project files
-* Some Windows code cleanup
-* Fix xusb sample warnings
-
-2012-04-02: v1.0.9
-* First libusbx release
-* Add libusb_get_device_speed (all, except BSD) and libusb_error_name
-* Add Windows support (WinUSB driver only)
-* Add OpenBSD support
-* Add xusb sample
-* Tons of bug fixes
-
-2010-05-07: v1.0.8
-* Bug fixes
-
-2010-04-19: v1.0.7
-* Bug fixes and documentation tweaks
-* Add more interface class definitions
-
-2009-11-22: v1.0.6
-* Bug fixes
-* Increase libusb_handle_events() timeout to 60s for powersaving
-
-2009-11-15: v1.0.5
- * Use timerfd when available for timer management
- * Small fixes/updates
-
-2009-11-06: v1.0.4 release
- * Bug fixes including transfer locking to fix some potential threading races
- * More flexibility with clock types on Linux
- * Use new bulk continuation tracking in Linux 2.6.32 for improved handling
- of short/failed transfers
-
-2009-08-27: v1.0.3 release
- * Bug fixes
- * Add libusb_get_max_iso_packet_size()
-
-2009-06-13: v1.0.2 release
- * Bug fixes
-
-2009-05-12: v1.0.1 release
- * Bug fixes
- * Darwin backend
-
-2008-12-13: v1.0.0 release
- * Bug fixes
-
-2008-11-21: v0.9.4 release
- * Bug fixes
- * Add libusb_attach_kernel_driver()
-
-2008-08-23: v0.9.3 release
- * Bug fixes
-
-2008-07-19: v0.9.2 release
- * Bug fixes
-
-2008-06-28: v0.9.1 release
- * Bug fixes
- * Introduce contexts to the API
- * Compatibility with new Linux kernel features
-
-2008-05-25: v0.9.0 release
- * First libusb-1.0 beta release
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-APPENDIX A - How to maintain code compatibility with versions of libusb and
-libusbx that use MaxPower:
-
-If you must to maintain compatibility with versions of the library that aren't
-using the bMaxPower attribute in struct libusb_config_descriptor, the
-recommended way is to use the new LIBUSBX_API_VERSION macro with an #ifdef.
-For instance, if your code was written as follows:
-
- if (dev->config[0].MaxPower < 250)
-
-Then you should modify it to have:
-
-#if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x01000100)
- if (dev->config[0].bMaxPower < 250)
-#else
- if (dev->config[0].MaxPower < 250)
-#endif
diff --git a/third_party/libusb/src/INSTALL_WIN.txt b/third_party/libusb/src/INSTALL_WIN.txt
deleted file mode 100644
index de117c1..0000000
--- a/third_party/libusb/src/INSTALL_WIN.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-Installation Instructions for Windows
-*************************************
-
-If you are compiling for MinGW or cygwin, please refer to the INSTALL file.
-
-If you are using Microsoft Visual Studio:
-- Open the relevant solution file in /msvc:
- libusb.dsw for MSVC6, libusbx_2005.sln for Visual Studio 2005 or 2008,
- libusbx_2010.sln for Visual Studio 2010,
- libusbx_2012.sln for Visual Studio 2012 or later,
- libusbx_wince.sln for Windows CE support in Visual Studio 2005.
-- If you want to debug the library, uncomment the ENABLE_DEBUG_LOGGING define
- in msvc\config.h
-- Select your configuration and compile the project
-
-Note that if you are using Visual Studio Express, you may have to install the
-Windows SDK to be able to compile the 64 bit version of the library.
-
-If you are using the freely available Windows DDK/WDK (Driver Development Kit)
-- If you want to debug the library, uncomment the ENABLE_DEBUG_LOGGING define
- in msvc\config.h
-- Open one of the relevant Free Build or Checked Build prompt for your target
- platform
-- Navigate to the msvc\ directory where the ddk_build.cmd file is located, and
- run 'ddk_build'
-- To produce a DLL rather than a static library, use: 'ddk_build DLL'
-- To produce a static library that uses LIBCMT[d] instead of MSVCRT[d] (/MT[d]
- vs /MD[d] in Visual Studio) use: 'ddk_build /MT'
-
-Note that using the Windows DDK, it is possible to compile both the 32 and 64
-bit versions of the library.
-
-If you are building for Windows CE then you will need the Windows CE Standard 5.00 SDK.
-
-Destination directories
-***********************
-
-The 32 bit binaries compiled either from Visual Studio or the DDK are placed in
-a Win32\ directory at the root of the library
-The 64 bit binaries are placed in an x64\ directory
-Windows CE binaries are placed in one of the following directories, depending
-on the target processor: ARMV4I, MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP, SH4 or x86.
-
-
-Troubleshooting
-***************
-
-If the compilation process complains about missing libraries, ensure that the
-default library paths for your project points to the relevant directories.
-If needed, these libraries can be obtained by installing either the latest
-Windows SDK or the DDK (Links provided at the end of this file).
-
-For Windows CE it is necessary to install the CE USB Kernel Wrapper driver for
-libusbx to function on a device.
-
-Links
-*****
-
-Additional information related to the Windows backend:
- http://windows.libusbx.org
-
-Latest Windows Driver (Development) Kit (WDK):
- http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff
-
-Latest Microsoft Windows SDK:
- http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505
-
-Windows CE Standard 5.00 SDK:
- http://www.microsoft.com/en-gb/download/details.aspx?id=17310
-
-Windows CE USB Kernel Wrapper Driver:
- https://github.com/RealVNC/CEUSBKWrapper
-
diff --git a/third_party/libusb/src/Makefile.am b/third_party/libusb/src/Makefile.am
index 93ce941..ce7b7e2 100644
--- a/third_party/libusb/src/Makefile.am
+++ b/third_party/libusb/src/Makefile.am
@@ -1,22 +1,22 @@
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = libusb-1.0.pc
-EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \
- examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h
+MAINTAINERCLEANFILES = ChangeLog
+EXTRA_DIST = TODO PORTING msvc
SUBDIRS = libusb doc
if BUILD_EXAMPLES
SUBDIRS += examples
endif
-if BUILD_TESTS
-SUBDIRS += tests
-endif
-
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libusb-1.0.pc
-.PHONY: dist-up
+.PHONY: ChangeLog dist-up
+ChangeLog:
+ git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
+
+dist-hook: ChangeLog
reldir = .release/$(distdir)
dist-up: dist
@@ -25,3 +25,4 @@ dist-up: dist
cp $(distdir).tar.bz2 $(reldir)
rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
rm -rf $(reldir)
+
diff --git a/third_party/libusb/src/NEWS b/third_party/libusb/src/NEWS
index 9c04694..f948700 100644
--- a/third_party/libusb/src/NEWS
+++ b/third_party/libusb/src/NEWS
@@ -1,2 +1,65 @@
-For the latest libusbx news, please refer to the ChangeLog file, or visit:
-http://libusbx.org
+This file lists notable changes in each release. For the full history of all
+changes, see ChangeLog.
+
+2012-04-20: 1.0.9
+* Numerous bug fixes and improvements
+* Backend for Windows, for devices using the WinUSB.sys driver
+* Backend for OpenBSD and NetBSD, for devices using the ugen driver
+* Add libusb_get_device_speed()
+* Add libusb_has_capability()
+* Add libusb_error_name()
+* Add libusb_get_version()
+
+2010-05-07: v1.0.8
+* Bug fixes
+
+2010-04-19: v1.0.7
+* Bug fixes and documentation tweaks
+* Add more interface class definitions
+
+2009-11-22: v1.0.6
+* Bug fixes
+* Increase libusb_handle_events() timeout to 60s for powersaving
+
+2009-11-15: v1.0.5
+ * Use timerfd when available for timer management
+ * Small fixes/updates
+
+2009-11-06: v1.0.4 release
+ * Bug fixes including transfer locking to fix some potential threading races
+ * More flexibility with clock types on Linux
+ * Use new bulk continuation tracking in Linux 2.6.32 for improved handling
+ of short/failed transfers
+
+2009-08-27: v1.0.3 release
+ * Bug fixes
+ * Add libusb_get_max_iso_packet_size()
+
+2009-06-13: v1.0.2 release
+ * Bug fixes
+
+2009-05-12: v1.0.1 release
+ * Bug fixes
+ * Darwin backend
+
+2008-12-13: v1.0.0 release
+ * Bug fixes
+
+2008-11-21: v0.9.4 release
+ * Bug fixes
+ * Add libusb_attach_kernel_driver()
+
+2008-08-23: v0.9.3 release
+ * Bug fixes
+
+2008-07-19: v0.9.2 release
+ * Bug fixes
+
+2008-06-28: v0.9.1 release
+ * Bug fixes
+ * Introduce contexts to the API
+ * Compatibility with new Linux kernel features
+
+2008-05-25: v0.9.0 release
+ * First libusb-1.0 beta release
+
diff --git a/third_party/libusb/src/PORTING b/third_party/libusb/src/PORTING
index 9185c37..7070784 100644
--- a/third_party/libusb/src/PORTING
+++ b/third_party/libusb/src/PORTING
@@ -1,15 +1,15 @@
-PORTING LIBUSBX TO OTHER PLATFORMS
+PORTING LIBUSB TO OTHER PLATFORMS
Introduction
============
-This document is aimed at developers wishing to port libusbx to unsupported
-platforms. I believe the libusbx API is OS-independent, so by supporting
+This document is aimed at developers wishing to port libusb to unsupported
+platforms. I believe the libusb API is OS-independent, so by supporting
multiple operating systems we pave the way for cross-platform USB device
drivers.
Implementation-wise, the basic idea is that you provide an interface to
-libusbx's internal "backend" API, which performs the appropriate operations on
+libusb's internal "backend" API, which performs the appropriate operations on
your target platform.
In terms of USB I/O, your backend provides functionality to submit
@@ -27,16 +27,16 @@ e.g. setting configuration, obtaining descriptors, etc.
File descriptors for I/O polling
================================
-For libusbx to work, your event handling function obviously needs to be called
+For libusb to work, your event handling function obviously needs to be called
at various points in time. Your backend must provide a set of file descriptors
-which libusbx and its users can pass to poll() or select() to determine when
+which libusb and its users can pass to poll() or select() to determine when
it is time to call the event handling function.
On Linux, this is easy: the usbfs kernel interface exposes a file descriptor
which can be passed to poll(). If something similar is not true for your
platform, you can emulate this using an internal library thread to reap I/O as
necessary, and a pipe() with the main library to raise events. The file
-descriptor of the pipe can then be provided to libusbx as an event source.
+descriptor of the pipe can then be provided to libusb as an event source.
Interface semantics and documentation
@@ -46,7 +46,7 @@ Documentation of the backend interface can be found in libusbi.h inside the
usbi_os_backend structure definition.
Your implementations of these functions will need to call various internal
-libusbx functions, prefixed with "usbi_". Documentation for these functions
+libusb functions, prefixed with "usbi_". Documentation for these functions
can be found in the .c files where they are implemented.
You probably want to skim over *all* the documentation before starting your
@@ -72,18 +72,18 @@ right usbi_backend for your platform.
4. Produce and test your implementation.
-5. Send your implementation to libusbx-devel mailing list.
+5. Send your implementation to libusb-devel mailing list.
Implementation difficulties? Questions?
=======================================
-If you encounter difficulties porting libusbx to your platform, please raise
-these issues on the libusbx-devel mailing list. Where possible and sensible, I
-am interested in solving problems preventing libusbx from operating on other
+If you encounter difficulties porting libusb to your platform, please raise
+these issues on the libusb-devel mailing list. Where possible and sensible, I
+am interested in solving problems preventing libusb from operating on other
platforms.
-The libusbx-devel mailing list is also a good place to ask questions and
+The libusb-devel mailing list is also a good place to ask questions and
make suggestions about the internal API. Hopefully we can produce some
better documentation based on your questions and other input.
@@ -92,3 +92,4 @@ some infrastructure additions/modifications to better support your platform,
you are encouraged to make such changes (in cleanly distinct patch
submissions). Even if you do not make such changes yourself, please do raise
the issues on the mailing list at the very minimum.
+
diff --git a/third_party/libusb/src/README b/third_party/libusb/src/README
index 3add731..08ae169 100644
--- a/third_party/libusb/src/README
+++ b/third_party/libusb/src/README
@@ -1,28 +1,22 @@
-libusbx
-=======
+libusb
+======
-libusbx is a library for USB device access from Linux, Mac OS X,
-Windows and OpenBSD/NetBSD userspace, with OpenBSD/NetBSD, and to a
-lesser extent some of the newest features of Windows (such as libusbK
-and libusb-win32 driver support) being EXPERIMENTAL.
-It is written in C and licensed under the GNU Lesser General Public
-License version 2.1 or, at your option, any later version (see COPYING).
+libusb is a library for USB device access from Linux, Mac OS X,
+OpenBSD, NetBSD, and Windows userspace.
+It is written in C and licensed under the LGPL-2.1 (see COPYING).
-libusbx is abstracted internally in such a way that it can hopefully
-be ported to other operating systems. Please see the PORTING file
-for more information.
+libusb is abstracted internally in such a way that it can hopefully
+be ported to other operating systems. See the PORTING file for some
+information, if you fancy a challenge. :)
-libusbx homepage:
-http://libusbx.org/
+libusb homepage:
+http://libusb.org/
Developers will wish to consult the API documentation:
-http://api.libusbx.org
+http://libusb.sourceforge.net/api-1.0/
Use the mailing list for questions, comments, etc:
-http://mailing-list.libusbx.org
+http://libusb.org/wiki/MailingList
-- Pete Batard <pete@akeo.ie>
-- Hans de Goede <hdegoede@redhat.com>
-- Xiaofan Chen <xiaofanc@gmail.com>
-- Ludovic Rousseau <ludovic.rousseau@gmail.com>
+- Peter Stuge <peter@stuge.se>
(use the mailing list rather than mailing developers directly)
diff --git a/third_party/libusb/src/README.git b/third_party/libusb/src/README.git
deleted file mode 100644
index 6d7db42..0000000
--- a/third_party/libusb/src/README.git
+++ /dev/null
@@ -1,29 +0,0 @@
-Notes related to git compilation:
---------------------------------
-
-If you retrieved the libusbx repository from git and are using a gcc based
-toolchain, be mindful that you should have the autotools installed (autoconf,
-automake) and will need to run either ./autogen.sh or ./bootstrap.sh to produce
-the configure file.
-
-The difference between autogen.sh and bootstrap.sh is that the former invokes
-configure with a default set of options, and will therefore generate a Makefile,
-whereas the latter does not invoke configure at all. If using autogen.sh, note
-that you can also append options, that will be passed as is to configure.
-
-
-Notes related to submitting new developments:
---------------------------------------------
-
-If you submit a new development to libusbx (eg: new backend), that is unlikely
-to fit in a couple of small patches, we would kindly suggest that you create a
-public account on github, if you don't have one already, and then fork a new
-libusbx repository under this account from https://github.com/libusbx/libusbx.
-
-Then you can create a git branch for your work, that we will be able to better
-reference and test.
-
-We also suggest that, if you are planning to bring in a large development, you
-try to involve the libusbx community early by letting the mailing list know, as
-you may find that other people might be eager to help you out.
-See http://mailing-list.libusbx.org for details on how to join the mailing list. \ No newline at end of file
diff --git a/third_party/libusb/src/RELEASE-NOTES b/third_party/libusb/src/RELEASE-NOTES
new file mode 100644
index 0000000..b8fe795
--- /dev/null
+++ b/third_party/libusb/src/RELEASE-NOTES
@@ -0,0 +1,35 @@
+libusb 1.0.9
+
+This release has taken much too long to finish, but this also means that it
+has a long list of bugs fixes and many other improvements.
+
+Perhaps the most exciting improvement is the addition of the backend for
+Microsoft Windows, which closes ticket #1.
+
+A very special thanks goes to Pete Batard, Michael Plante, Tim Roberts,
+Orin Eman, Graeme Gill, and everyone else in the community who help work
+on the Windows support!
+
+Because Windows is a peculiar beast you may encounter some bugs when using
+this first release with the Windows backend. In that case, please get in
+touch with the libusb community so that we can help resolve them. File a
+ticket at http://libusb.org/newticket or let us know via email or on IRC.
+Visit http://libusb.org/ for all contact details.
+
+Another exciting improvement is the new OpenBSD backend, which also works
+on NetBSD systems.
+
+All known downstream bugs and all known severe bugs reported directly to
+libusb.org have been fixed in this release, so please report new ones!
+
+
+This release would not have been what it is without help, code, reports,
+and advice from friends like these:
+
+ Alan Ott, Alan Stern, Brian Shirley, Dave Camarillo, Graeme Gill,
+ Hans de Goede, Hector Martin, James Hanko, Konrad Rzepecki,
+ Ludovic Rousseau, Martin Pieuchot, Mike Frysinger, Orin Eman,
+ Pekka Nikander, Pete Batard, Sean McBride, Sebastian Pipping,
+ Stephan Meyer, Thomas Röfer, Trygve Laugstøl, Vitali Lovich, Xiaofan Chen
+
+ Thanks!
diff --git a/third_party/libusb/src/THANKS b/third_party/libusb/src/THANKS
index 4189af2..d926126 100644
--- a/third_party/libusb/src/THANKS
+++ b/third_party/libusb/src/THANKS
@@ -1,5 +1,6 @@
-Development contributors are listed in the AUTHORS file. Community members who
-have also made significant contributions in other areas are listed below:
+Development contributors are listed in the AUTHORS file. Other community
+members who have made significant contributions in other areas are listed
+in this file:
Alan Stern
Ludovic Rousseau
diff --git a/third_party/libusb/src/TODO b/third_party/libusb/src/TODO
index e64b279..6c162a3 100644
--- a/third_party/libusb/src/TODO
+++ b/third_party/libusb/src/TODO
@@ -1,2 +1,9 @@
-Please see the libusbx roadmap by visiting:
-https://github.com/libusbx/libusbx/issues/milestones?direction=asc&sort=due_date \ No newline at end of file
+for 1.1 or future
+==================
+optional timerfd support (runtime detection)
+notifications of hotplugged/unplugged devices
+offer API to create/destroy handle_events thread
+isochronous sync I/O?
+exposing of parent-child device relationships
+"usb primer" introduction docs
+more examples
diff --git a/third_party/libusb/src/autogen.sh b/third_party/libusb/src/autogen.sh
index ab87fb3..c7bb679 100755
--- a/third_party/libusb/src/autogen.sh
+++ b/third_party/libusb/src/autogen.sh
@@ -1,8 +1,19 @@
#!/bin/sh
-set -e
-
-./bootstrap.sh
-if test -z "$NOCONFIGURE"; then
- exec ./configure --enable-maintainer-mode --enable-examples-build --enable-tests-build "$@"
+# use libtoolize if available, otherwise look for glibtoolize (darwin)
+if (libtoolize --version) < /dev/null > /dev/null 2>&1; then
+ LIBTOOLIZE=libtoolize
+elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
+ LIBTOOLIZE=glibtoolize
+else
+ echo "libtoolize or glibtoolize was not found! Please install libtool."
+ exit
fi
+
+$LIBTOOLIZE --copy --force || exit 1
+aclocal || exit 1
+autoheader || exit 1
+autoconf || exit 1
+automake -a -c || exit 1
+./configure --enable-maintainer-mode --enable-debug-log \
+ --enable-examples-build $*
diff --git a/third_party/libusb/src/bootstrap.sh b/third_party/libusb/src/bootstrap.sh
deleted file mode 100755
index 8b2b2c0..0000000
--- a/third_party/libusb/src/bootstrap.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# use libtoolize if available, otherwise look for glibtoolize (darwin)
-if (libtoolize --version) < /dev/null > /dev/null 2>&1; then
- LIBTOOLIZE=libtoolize
-elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
- LIBTOOLIZE=glibtoolize
-else
- echo "libtoolize or glibtoolize was not found! Please install libtool." 1>&2
- exit 1
-fi
-
-$LIBTOOLIZE --copy --force || exit 1
-aclocal || exit 1
-autoheader || exit 1
-autoconf || exit 1
-automake -a -c || exit 1
diff --git a/third_party/libusb/src/configure.ac b/third_party/libusb/src/configure.ac
index 6d6b35d..f9e648e 100644
--- a/third_party/libusb/src/configure.ac
+++ b/third_party/libusb/src/configure.ac
@@ -8,14 +8,14 @@ m4_define([LU_DEFINE_VERSION_RC_ATOM],
[^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
dnl The m4_bregexp() returns (only) the numbers following the #define named
dnl in the first macro parameter. m4_define() then defines the name for use
-dnl in AC_INIT.
+dnl in AC_INIT().
LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
-AC_INIT([libusbx],[LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC],[libusbx-devel@lists.sourceforge.net],[libusbx],[http://libusbx.org])
+AC_INIT([libusb], LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
# Library versioning
# These numbers should be tweaked on every release. Read carefully:
@@ -31,12 +31,12 @@ AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([libusb/core.c])
AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADERS([config.h])
+AM_CONFIG_HEADER([config.h])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREREQ([2.50])
AC_PROG_CC
-LT_INIT
+AC_PROG_LIBTOOL
LT_LANG([Windows Resource])
AC_C_INLINE
AM_PROG_CC_C_O
@@ -45,34 +45,26 @@ AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
LTLDFLAGS="${LTLDFLAGS} -no-undefined"
AC_MSG_CHECKING([operating system])
-
case $host in
*-linux*)
AC_MSG_RESULT([Linux])
backend="linux"
- threads="posix"
;;
*-darwin*)
AC_MSG_RESULT([Darwin/Mac OS X])
backend="darwin"
- threads="posix"
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD])
- backend="bsd"
- threads="posix"
+ backend="openbsd"
;;
*-netbsd*)
AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
- backend="bsd"
- threads="posix"
+ backend="openbsd"
;;
*-mingw*)
AC_MSG_RESULT([Windows])
backend="windows"
- threads="windows"
- create_import_lib="yes"
- AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
;;
*-cygwin*)
AC_MSG_RESULT([Cygwin (using Windows backend)])
@@ -82,33 +74,22 @@ case $host in
*)
AC_MSG_ERROR([unsupported operating system])
esac
-
case $backend in
linux)
AC_DEFINE(OS_LINUX, 1, [Linux backend])
AC_SUBST(OS_LINUX)
- AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
- AC_ARG_ENABLE([udev],
- [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended, default: yes)])],
- [], [enable_udev="yes"])
- if test "x$enable_udev" = "xyes" ; then
- # system has udev. use it or fail!
- AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
- AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
- AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
- else
- AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])])
- fi
- AC_SUBST(USE_UDEV)
+ AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
+ threads="posix"
THREAD_CFLAGS="-pthread"
- LIBS="${LIBS} -pthread"
+ PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
darwin)
AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
AC_SUBST(OS_DARWIN)
- LIBS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
+ threads="posix"
+ PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
AC_CHECK_HEADERS([poll.h])
AC_CHECK_TYPE([nfds_t],
@@ -116,32 +97,32 @@ darwin)
[AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
[#include <poll.h>])
;;
-bsd)
- AC_DEFINE(OS_OPENBSD, 1, [OpenBSD/NetBSD backend])
+openbsd)
+ AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
AC_SUBST(OS_OPENBSD)
+ threads="posix"
THREAD_CFLAGS="-pthread"
- LIBS="-pthread"
+ PC_LIBS_PRIVATE="-pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
windows)
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
AC_SUBST(OS_WINDOWS)
- LIBS=""
+ PC_LIBS_PRIVATE=""
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
esac
-
-AC_SUBST(LIBS)
+AC_SUBST(THREAD_CFLAGS)
+AC_SUBST(PC_LIBS_PRIVATE)
+LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
-AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd)
+AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
-AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
-AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
if test "$threads" = posix; then
AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
fi
@@ -185,11 +166,11 @@ if test "x$log_enabled" != "xno"; then
fi
AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
- [start with debug message logging enabled (default n)])],
+ [enable debug logging (default n)])],
[debug_log_enabled=$enableval],
[debug_log_enabled='no'])
if test "x$debug_log_enabled" != "xno"; then
- AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Start with debug message logging enabled])
+ AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
fi
# Examples build
@@ -199,13 +180,6 @@ AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
[build_examples='no'])
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
-# Tests build
-AC_ARG_ENABLE([tests-build], [AS_HELP_STRING([--enable-tests-build],
- [build test applications (default n)])],
- [build_tests=$enableval],
- [build_tests='no'])
-AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != "xno"])
-
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
saved_cflags="$CFLAGS"
# -Werror required for cygwin
@@ -232,10 +206,10 @@ AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
# headers not available on all platforms but required on others
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_HEADERS([signal.h])
-AM_CFLAGS="${AM_CFLAGS} -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
+AM_CFLAGS="-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
+AC_SUBST(VISIBILITY_CFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(LTLDFLAGS)
@@ -243,7 +217,6 @@ AC_CONFIG_FILES([libusb-1.0.pc])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libusb/Makefile])
AC_CONFIG_FILES([examples/Makefile])
-AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([doc/doxygen.cfg])
AC_OUTPUT
diff --git a/third_party/libusb/src/doc/Makefile.am b/third_party/libusb/src/doc/Makefile.am
index 544a281..931a7c0 100644
--- a/third_party/libusb/src/doc/Makefile.am
+++ b/third_party/libusb/src/doc/Makefile.am
@@ -5,5 +5,6 @@ docs: doxygen.cfg
docs-upload: docs
ln -s html api-1.0
- scp -r api-1.0 pbatard@web.sourceforge.net:/home/project-web/libusbx/htdocs
+ rsync -av api-1.0/ web.sourceforge.net:htdocs/api-1.0/
rm -f api-1.0
+
diff --git a/third_party/libusb/src/doc/doxygen.cfg.in b/third_party/libusb/src/doc/doxygen.cfg.in
index 05f984a..128e1de 100644
--- a/third_party/libusb/src/doc/doxygen.cfg.in
+++ b/third_party/libusb/src/doc/doxygen.cfg.in
@@ -25,26 +25,13 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME =
+PROJECT_NAME = libusb
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF = "eXpand your USB potential"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included
-# in the documentation. The maximum height of the logo should not exceed 55
-# pixels and the maximum width should not exceed 200 pixels. Doxygen will
-# copy the logo to the output directory.
-
-PROJECT_LOGO = libusbx.png
+PROJECT_NUMBER =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -167,6 +154,13 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
@@ -407,6 +401,12 @@ MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from the
# version control system). Doxygen will invoke the program by executing (via
@@ -424,7 +424,7 @@ FILE_VERSION_FILTER =
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
-QUIET = YES
+QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
@@ -505,7 +505,7 @@ RECURSIVE = NO
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE = @top_srcdir@/libusb/libusbi.h @top_srcdir@/libusb/hotplug.h
+EXCLUDE = @top_srcdir@/libusb/libusbi.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
@@ -701,6 +701,12 @@ HTML_FOOTER =
HTML_STYLESHEET =
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
diff --git a/third_party/libusb/src/doc/libusbx.png b/third_party/libusb/src/doc/libusbx.png
deleted file mode 100644
index de69d1e..0000000
--- a/third_party/libusb/src/doc/libusbx.png
+++ /dev/null
Binary files differ
diff --git a/third_party/libusb/src/examples/Makefile.am b/third_party/libusb/src/examples/Makefile.am
index 8081927..c7630d2 100644
--- a/third_party/libusb/src/examples/Makefile.am
+++ b/third_party/libusb/src/examples/Makefile.am
@@ -1,19 +1,21 @@
-AM_CPPFLAGS = -I$(top_srcdir)/libusb
-LDADD = ../libusb/libusb-1.0.la
+INCLUDES = -I$(top_srcdir)/libusb
+noinst_PROGRAMS = listdevs
-noinst_PROGRAMS = listdevs xusb fxload hotplugtest
+listdevs_SOURCES = listdevs.c
+listdevs_LDADD = ../libusb/libusb-1.0.la
if HAVE_SIGACTION
+dpfp_SOURCES = dpfp.c
+dpfp_LDADD = ../libusb/libusb-1.0.la
noinst_PROGRAMS += dpfp
+endif
if THREADS_POSIX
-dpfp_threaded_CFLAGS = $(AM_CFLAGS)
+if HAVE_SIGACTION
+dpfp_threaded_SOURCES = dpfp_threaded.c
+dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
+dpfp_threaded_LDADD = ../libusb/libusb-1.0.la
noinst_PROGRAMS += dpfp_threaded
endif
-
-sam3u_benchmark_SOURCES = sam3u_benchmark.c
-noinst_PROGRAMS += sam3u_benchmark
endif
-fxload_SOURCES = ezusb.c ezusb.h fxload.c
-fxload_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
diff --git a/third_party/libusb/src/examples/dpfp.c b/third_party/libusb/src/examples/dpfp.c
index 3f41e0e..ecd5a92 100644
--- a/third_party/libusb/src/examples/dpfp.c
+++ b/third_party/libusb/src/examples/dpfp.c
@@ -1,6 +1,6 @@
/*
- * libusbx example program to manipulate U.are.U 4000B fingerprint scanner.
- * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
+ * libusb example program to manipulate U.are.U 4000B fingerprint scanner.
+ * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* Basic image capture program only, does not consider the powerup quirks or
* the fact that image encryption may be enabled. Not expected to work
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "libusb.h"
+#include <libusb.h>
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
@@ -164,7 +164,7 @@ static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
static int set_mode_async(unsigned char data)
{
- unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
+ unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
struct libusb_transfer *transfer;
if (!buf)
@@ -504,3 +504,4 @@ out:
libusb_exit(NULL);
return r >= 0 ? r : -r;
}
+
diff --git a/third_party/libusb/src/examples/dpfp_threaded.c b/third_party/libusb/src/examples/dpfp_threaded.c
index 6970dac..93de9d7 100644
--- a/third_party/libusb/src/examples/dpfp_threaded.c
+++ b/third_party/libusb/src/examples/dpfp_threaded.c
@@ -1,6 +1,6 @@
/*
- * libusbx example program to manipulate U.are.U 4000B fingerprint scanner.
- * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
+ * libusb example program to manipulate U.are.U 4000B fingerprint scanner.
+ * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* Basic image capture program only, does not consider the powerup quirks or
* the fact that image encryption may be enabled. Not expected to work
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "libusb.h"
+#include <libusb.h>
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
@@ -193,7 +193,7 @@ static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
static int set_mode_async(unsigned char data)
{
- unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
+ unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
struct libusb_transfer *transfer;
if (!buf)
@@ -542,3 +542,4 @@ out:
libusb_exit(NULL);
return r >= 0 ? r : -r;
}
+
diff --git a/third_party/libusb/src/examples/ezusb.c b/third_party/libusb/src/examples/ezusb.c
deleted file mode 100644
index 931a86a..0000000
--- a/third_party/libusb/src/examples/ezusb.c
+++ /dev/null
@@ -1,796 +0,0 @@
-/*
- * Copyright © 2001 Stephen Williams (steve@icarus.com)
- * Copyright © 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
- * Copyright © 2008 Roger Williams (rawqux@users.sourceforge.net)
- * Copyright © 2012 Pete Batard (pete@akeo.ie)
- * Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
- *
- * This source code is free software; you can redistribute it
- * and/or modify it in source code form under the terms of the GNU
- * General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "libusb.h"
-#include "ezusb.h"
-
-extern void logerror(const char *format, ...)
- __attribute__ ((format(printf, 1, 2)));
-
-/*
- * This file contains functions for uploading firmware into Cypress
- * EZ-USB microcontrollers. These chips use control endpoint 0 and vendor
- * specific commands to support writing into the on-chip SRAM. They also
- * support writing into the CPUCS register, which is how we reset the
- * processor after loading firmware (including the reset vector).
- *
- * These Cypress devices are 8-bit 8051 based microcontrollers with
- * special support for USB I/O. They come in several packages, and
- * some can be set up with external memory when device costs allow.
- * Note that the design was originally by AnchorChips, so you may find
- * references to that vendor (which was later merged into Cypress).
- * The Cypress FX parts are largely compatible with the Anchorhip ones.
- */
-
-int verbose = 1;
-
-/*
- * return true if [addr,addr+len] includes external RAM
- * for Anchorchips EZ-USB or Cypress EZ-USB FX
- */
-static bool fx_is_external(uint32_t addr, size_t len)
-{
- /* with 8KB RAM, 0x0000-0x1b3f can be written
- * we can't tell if it's a 4KB device here
- */
- if (addr <= 0x1b3f)
- return ((addr + len) > 0x1b40);
-
- /* there may be more RAM; unclear if we can write it.
- * some bulk buffers may be unused, 0x1b3f-0x1f3f
- * firmware can set ISODISAB for 2KB at 0x2000-0x27ff
- */
- return true;
-}
-
-/*
- * return true if [addr,addr+len] includes external RAM
- * for Cypress EZ-USB FX2
- */
-static bool fx2_is_external(uint32_t addr, size_t len)
-{
- /* 1st 8KB for data/code, 0x0000-0x1fff */
- if (addr <= 0x1fff)
- return ((addr + len) > 0x2000);
-
- /* and 512 for data, 0xe000-0xe1ff */
- else if (addr >= 0xe000 && addr <= 0xe1ff)
- return ((addr + len) > 0xe200);
-
- /* otherwise, it's certainly external */
- else
- return true;
-}
-
-/*
- * return true if [addr,addr+len] includes external RAM
- * for Cypress EZ-USB FX2LP
- */
-static bool fx2lp_is_external(uint32_t addr, size_t len)
-{
- /* 1st 16KB for data/code, 0x0000-0x3fff */
- if (addr <= 0x3fff)
- return ((addr + len) > 0x4000);
-
- /* and 512 for data, 0xe000-0xe1ff */
- else if (addr >= 0xe000 && addr <= 0xe1ff)
- return ((addr + len) > 0xe200);
-
- /* otherwise, it's certainly external */
- else
- return true;
-}
-
-
-/*****************************************************************************/
-
-/*
- * These are the requests (bRequest) that the bootstrap loader is expected
- * to recognize. The codes are reserved by Cypress, and these values match
- * what EZ-USB hardware, or "Vend_Ax" firmware (2nd stage loader) uses.
- * Cypress' "a3load" is nice because it supports both FX and FX2, although
- * it doesn't have the EEPROM support (subset of "Vend_Ax").
- */
-#define RW_INTERNAL 0xA0 /* hardware implements this one */
-#define RW_MEMORY 0xA3
-
-/*
- * Issues the specified vendor-specific write request.
- */
-static int ezusb_write(libusb_device_handle *device, const char *label,
- uint8_t opcode, uint32_t addr, const unsigned char *data, size_t len)
-{
- int status;
-
- if (verbose > 1)
- logerror("%s, addr 0x%08x len %4u (0x%04x)\n", label, addr, (unsigned)len, (unsigned)len);
- status = libusb_control_transfer(device,
- LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
- opcode, addr & 0xFFFF, addr >> 16,
- (unsigned char*)data, (uint16_t)len, 1000);
- if (status != len) {
- if (status < 0)
- logerror("%s: %s\n", label, libusb_error_name(status));
- else
- logerror("%s ==> %d\n", label, status);
- }
- return (status < 0) ? -EIO : 0;
-}
-
-/*
- * Issues the specified vendor-specific read request.
- */
-static int ezusb_read(libusb_device_handle *device, const char *label,
- uint8_t opcode, uint32_t addr, const unsigned char *data, size_t len)
-{
- int status;
-
- if (verbose > 1)
- logerror("%s, addr 0x%08x len %4u (0x%04x)\n", label, addr, (unsigned)len, (unsigned)len);
- status = libusb_control_transfer(device,
- LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
- opcode, addr & 0xFFFF, addr >> 16,
- (unsigned char*)data, (uint16_t)len, 1000);
- if (status != len) {
- if (status < 0)
- logerror("%s: %s\n", label, libusb_error_name(status));
- else
- logerror("%s ==> %d\n", label, status);
- }
- return (status < 0) ? -EIO : 0;
-}
-
-/*
- * Modifies the CPUCS register to stop or reset the CPU.
- * Returns false on error.
- */
-static bool ezusb_cpucs(libusb_device_handle *device, uint32_t addr, bool doRun)
-{
- int status;
- uint8_t data = doRun ? 0x00 : 0x01;
-
- if (verbose)
- logerror("%s\n", data ? "stop CPU" : "reset CPU");
- status = libusb_control_transfer(device,
- LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
- RW_INTERNAL, addr & 0xFFFF, addr >> 16,
- &data, 1, 1000);
- if ((status != 1) &&
- /* We may get an I/O error from libusbx as the device disappears */
- ((!doRun) || (status != LIBUSB_ERROR_IO)))
- {
- const char *mesg = "can't modify CPUCS";
- if (status < 0)
- logerror("%s: %s\n", mesg, libusb_error_name(status));
- else
- logerror("%s\n", mesg);
- return false;
- } else
- return true;
-}
-
-/*
- * Send an FX3 jumpt to address command
- * Returns false on error.
- */
-static bool ezusb_fx3_jump(libusb_device_handle *device, uint32_t addr)
-{
- int status;
-
- if (verbose)
- logerror("transfer execution to Program Entry at 0x%08x\n", addr);
- status = libusb_control_transfer(device,
- LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
- RW_INTERNAL, addr & 0xFFFF, addr >> 16,
- NULL, 0, 1000);
- /* We may get an I/O error from libusbx as the device disappears */
- if ((status != 0) && (status != LIBUSB_ERROR_IO))
- {
- const char *mesg = "failed to send jump command";
- if (status < 0)
- logerror("%s: %s\n", mesg, libusb_error_name(status));
- else
- logerror("%s\n", mesg);
- return false;
- } else
- return true;
-}
-
-/*****************************************************************************/
-
-/*
- * Parse an Intel HEX image file and invoke the poke() function on the
- * various segments to implement policies such as writing to RAM (with
- * a one or two stage loader setup, depending on the firmware) or to
- * EEPROM (two stages required).
- *
- * image - the hex image file
- * context - for use by poke()
- * is_external - if non-null, used to check which segments go into
- * external memory (writable only by software loader)
- * poke - called with each memory segment; errors indicated
- * by returning negative values.
- *
- * Caller is responsible for halting CPU as needed, such as when
- * overwriting a second stage loader.
- */
-static int parse_ihex(FILE *image, void *context,
- bool (*is_external)(uint32_t addr, size_t len),
- int (*poke) (void *context, uint32_t addr, bool external,
- const unsigned char *data, size_t len))
-{
- unsigned char data[1023];
- uint32_t data_addr = 0;
- size_t data_len = 0;
- int rc;
- int first_line = 1;
- bool external = false;
-
- /* Read the input file as an IHEX file, and report the memory segments
- * as we go. Each line holds a max of 16 bytes, but uploading is
- * faster (and EEPROM space smaller) if we merge those lines into larger
- * chunks. Most hex files keep memory segments together, which makes
- * such merging all but free. (But it may still be worth sorting the
- * hex files to make up for undesirable behavior from tools.)
- *
- * Note that EEPROM segments max out at 1023 bytes; the upload protocol
- * allows segments of up to 64 KBytes (more than a loader could handle).
- */
- for (;;) {
- char buf[512], *cp;
- char tmp, type;
- size_t len;
- unsigned idx, off;
-
- cp = fgets(buf, sizeof(buf), image);
- if (cp == NULL) {
- logerror("EOF without EOF record!\n");
- break;
- }
-
- /* EXTENSION: "# comment-till-end-of-line", for copyrights etc */
- if (buf[0] == '#')
- continue;
-
- if (buf[0] != ':') {
- logerror("not an ihex record: %s", buf);
- return -2;
- }
-
- /* ignore any newline */
- cp = strchr(buf, '\n');
- if (cp)
- *cp = 0;
-
- if (verbose >= 3)
- logerror("** LINE: %s\n", buf);
-
- /* Read the length field (up to 16 bytes) */
- tmp = buf[3];
- buf[3] = 0;
- len = strtoul(buf+1, NULL, 16);
- buf[3] = tmp;
-
- /* Read the target offset (address up to 64KB) */
- tmp = buf[7];
- buf[7] = 0;
- off = (int)strtoul(buf+3, NULL, 16);
- buf[7] = tmp;
-
- /* Initialize data_addr */
- if (first_line) {
- data_addr = off;
- first_line = 0;
- }
-
- /* Read the record type */
- tmp = buf[9];
- buf[9] = 0;
- type = (char)strtoul(buf+7, NULL, 16);
- buf[9] = tmp;
-
- /* If this is an EOF record, then make it so. */
- if (type == 1) {
- if (verbose >= 2)
- logerror("EOF on hexfile\n");
- break;
- }
-
- if (type != 0) {
- logerror("unsupported record type: %u\n", type);
- return -3;
- }
-
- if ((len * 2) + 11 > strlen(buf)) {
- logerror("record too short?\n");
- return -4;
- }
-
- /* FIXME check for _physically_ contiguous not just virtually
- * e.g. on FX2 0x1f00-0x2100 includes both on-chip and external
- * memory so it's not really contiguous */
-
- /* flush the saved data if it's not contiguous,
- * or when we've buffered as much as we can.
- */
- if (data_len != 0
- && (off != (data_addr + data_len)
- /* || !merge */
- || (data_len + len) > sizeof(data))) {
- if (is_external)
- external = is_external(data_addr, data_len);
- rc = poke(context, data_addr, external, data, data_len);
- if (rc < 0)
- return -1;
- data_addr = off;
- data_len = 0;
- }
-
- /* append to saved data, flush later */
- for (idx = 0, cp = buf+9 ; idx < len ; idx += 1, cp += 2) {
- tmp = cp[2];
- cp[2] = 0;
- data[data_len + idx] = (uint8_t)strtoul(cp, NULL, 16);
- cp[2] = tmp;
- }
- data_len += len;
- }
-
-
- /* flush any data remaining */
- if (data_len != 0) {
- if (is_external)
- external = is_external(data_addr, data_len);
- rc = poke(context, data_addr, external, data, data_len);
- if (rc < 0)
- return -1;
- }
- return 0;
-}
-
-/*
- * Parse a binary image file and write it as is to the target.
- * Applies to Cypress BIX images for RAM or Cypress IIC images
- * for EEPROM.
- *
- * image - the BIX image file
- * context - for use by poke()
- * is_external - if non-null, used to check which segments go into
- * external memory (writable only by software loader)
- * poke - called with each memory segment; errors indicated
- * by returning negative values.
- *
- * Caller is responsible for halting CPU as needed, such as when
- * overwriting a second stage loader.
- */
-static int parse_bin(FILE *image, void *context,
- bool (*is_external)(uint32_t addr, size_t len), int (*poke)(void *context,
- uint32_t addr, bool external, const unsigned char *data, size_t len))
-{
- unsigned char data[4096];
- uint32_t data_addr = 0;
- size_t data_len = 0;
- int rc;
- bool external = false;
-
- for (;;) {
- data_len = fread(data, 1, 4096, image);
- if (data_len == 0)
- break;
- if (is_external)
- external = is_external(data_addr, data_len);
- rc = poke(context, data_addr, external, data, data_len);
- if (rc < 0)
- return -1;
- data_addr += (uint32_t)data_len;
- }
- return feof(image)?0:-1;
-}
-
-/*
- * Parse a Cypress IIC image file and invoke the poke() function on the
- * various segments for writing to RAM
- *
- * image - the IIC image file
- * context - for use by poke()
- * is_external - if non-null, used to check which segments go into
- * external memory (writable only by software loader)
- * poke - called with each memory segment; errors indicated
- * by returning negative values.
- *
- * Caller is responsible for halting CPU as needed, such as when
- * overwriting a second stage loader.
- */
-static int parse_iic(FILE *image, void *context,
- bool (*is_external)(uint32_t addr, size_t len),
- int (*poke)(void *context, uint32_t addr, bool external, const unsigned char *data, size_t len))
-{
- unsigned char data[4096];
- uint32_t data_addr = 0;
- size_t data_len = 0, read_len;
- uint8_t block_header[4];
- int rc;
- bool external = false;
- long file_size, initial_pos = ftell(image);
-
- fseek(image, 0L, SEEK_END);
- file_size = ftell(image);
- fseek(image, initial_pos, SEEK_SET);
- for (;;) {
- /* Ignore the trailing reset IIC data (5 bytes) */
- if (ftell(image) >= (file_size - 5))
- break;
- if (fread(&block_header, 1, sizeof(block_header), image) != 4) {
- logerror("unable to read IIC block header\n");
- return -1;
- }
- data_len = (block_header[0] << 8) + block_header[1];
- data_addr = (block_header[2] << 8) + block_header[3];
- if (data_len > sizeof(data)) {
- /* If this is ever reported as an error, switch to using malloc/realloc */
- logerror("IIC data block too small - please report this error to libusbx.org\n");
- return -1;
- }
- read_len = fread(data, 1, data_len, image);
- if (read_len != data_len) {
- logerror("read error\n");
- return -1;
- }
- if (is_external)
- external = is_external(data_addr, data_len);
- rc = poke(context, data_addr, external, data, data_len);
- if (rc < 0)
- return -1;
- }
- return 0;
-}
-
-/* the parse call will be selected according to the image type */
-int (*parse[IMG_TYPE_MAX])(FILE *image, void *context, bool (*is_external)(uint32_t addr, size_t len),
- int (*poke)(void *context, uint32_t addr, bool external, const unsigned char *data, size_t len))
- = { parse_ihex, parse_iic, parse_bin };
-
-/*****************************************************************************/
-
-/*
- * For writing to RAM using a first (hardware) or second (software)
- * stage loader and 0xA0 or 0xA3 vendor requests
- */
-typedef enum {
- _undef = 0,
- internal_only, /* hardware first-stage loader */
- skip_internal, /* first phase, second-stage loader */
- skip_external /* second phase, second-stage loader */
-} ram_mode;
-
-struct ram_poke_context {
- libusb_device_handle *device;
- ram_mode mode;
- size_t total, count;
-};
-
-#define RETRY_LIMIT 5
-
-static int ram_poke(void *context, uint32_t addr, bool external,
- const unsigned char *data, size_t len)
-{
- struct ram_poke_context *ctx = (struct ram_poke_context*)context;
- int rc;
- unsigned retry = 0;
-
- switch (ctx->mode) {
- case internal_only: /* CPU should be stopped */
- if (external) {
- logerror("can't write %u bytes external memory at 0x%08x\n",
- (unsigned)len, addr);
- return -EINVAL;
- }
- break;
- case skip_internal: /* CPU must be running */
- if (!external) {
- if (verbose >= 2) {
- logerror("SKIP on-chip RAM, %u bytes at 0x%08x\n",
- (unsigned)len, addr);
- }
- return 0;
- }
- break;
- case skip_external: /* CPU should be stopped */
- if (external) {
- if (verbose >= 2) {
- logerror("SKIP external RAM, %u bytes at 0x%08x\n",
- (unsigned)len, addr);
- }
- return 0;
- }
- break;
- case _undef:
- default:
- logerror("bug\n");
- return -EDOM;
- }
-
- ctx->total += len;
- ctx->count++;
-
- /* Retry this till we get a real error. Control messages are not
- * NAKed (just dropped) so time out means is a real problem.
- */
- while ((rc = ezusb_write(ctx->device,
- external ? "write external" : "write on-chip",
- external ? RW_MEMORY : RW_INTERNAL,
- addr, data, len)) < 0
- && retry < RETRY_LIMIT) {
- if (rc != LIBUSB_ERROR_TIMEOUT)
- break;
- retry += 1;
- }
- return rc;
-}
-
-/*
- * Load a Cypress Image file into target RAM.
- * See http://www.cypress.com/?docID=41351 (AN76405 PDF) for more info.
- */
-static int fx3_load_ram(libusb_device_handle *device, const char *path)
-{
- uint32_t dCheckSum, dExpectedCheckSum, dAddress, i, dLen, dLength;
- uint32_t* dImageBuf;
- unsigned char *bBuf, hBuf[4], blBuf[4], rBuf[4096];
- FILE *image;
-
- image = fopen(path, "rb");
- if (image == NULL) {
- logerror("unable to open '%s' for input\n", path);
- return -2;
- } else if (verbose)
- logerror("open firmware image %s for RAM upload\n", path);
-
- // Read header
- if (fread(hBuf, sizeof(char), sizeof(hBuf), image) != sizeof(hBuf)) {
- logerror("could not read image header");
- return -3;
- }
-
- // check "CY" signature byte and format
- if ((hBuf[0] != 'C') || (hBuf[1] != 'Y')) {
- logerror("image doesn't have a CYpress signature\n");
- return -3;
- }
-
- // Check bImageType
- switch(hBuf[3]) {
- case 0xB0:
- if (verbose)
- logerror("normal FW binary %s image with checksum\n", (hBuf[2]&0x01)?"data":"executable");
- break;
- case 0xB1:
- logerror("security binary image is not currently supported\n");
- return -3;
- case 0xB2:
- logerror("VID:PID image is not currently supported\n");
- return -3;
- default:
- logerror("invalid image type 0x%02X\n", hBuf[3]);
- return -3;
- }
-
- // Read the bootloader version
- if (verbose) {
- if ((ezusb_read(device, "read bootloader version", RW_INTERNAL, 0xFFFF0020, blBuf, 4) < 0)) {
- logerror("Could not read bootloader version\n");
- return -8;
- }
- logerror("FX3 bootloader version: 0x%02X%02X%02X%02X\n", blBuf[3], blBuf[2], blBuf[1], blBuf[0]);
- }
-
- dCheckSum = 0;
- if (verbose)
- logerror("writing image...\n");
- while (1) {
- if ((fread(&dLength, sizeof(uint32_t), 1, image) != 1) || // read dLength
- (fread(&dAddress, sizeof(uint32_t), 1, image) != 1)) { // read dAddress
- logerror("could not read image");
- return -3;
- }
- if (dLength == 0)
- break; // done
-
- dImageBuf = calloc(dLength, sizeof(uint32_t));
- if (dImageBuf == NULL) {
- logerror("could not allocate buffer for image chunk\n");
- return -4;
- }
-
- // read sections
- if (fread(dImageBuf, sizeof(uint32_t), dLength, image) != dLength) {
- logerror("could not read image");
- free(dImageBuf);
- return -3;
- }
- for (i = 0; i < dLength; i++)
- dCheckSum += dImageBuf[i];
- dLength <<= 2; // convert to Byte length
- bBuf = (unsigned char*) dImageBuf;
-
- while (dLength > 0) {
- dLen = 4096; // 4K max
- if (dLen > dLength)
- dLen = dLength;
- if ((ezusb_write(device, "write firmware", RW_INTERNAL, dAddress, bBuf, dLen) < 0) ||
- (ezusb_read(device, "read firmware", RW_INTERNAL, dAddress, rBuf, dLen) < 0)) {
- logerror("R/W error\n");
- free(dImageBuf);
- return -5;
- }
- // Verify data: rBuf with bBuf
- for (i = 0; i < dLen; i++) {
- if (rBuf[i] != bBuf[i]) {
- logerror("verify error");
- free(dImageBuf);
- return -6;
- }
- }
-
- dLength -= dLen;
- bBuf += dLen;
- dAddress += dLen;
- }
- free(dImageBuf);
- }
-
- // read pre-computed checksum data
- if ((fread(&dExpectedCheckSum, sizeof(uint32_t), 1, image) != 1) ||
- (dCheckSum != dExpectedCheckSum)) {
- logerror("checksum error\n");
- return -7;
- }
-
- // transfer execution to Program Entry
- if (!ezusb_fx3_jump(device, dAddress)) {
- return -6;
- }
-
- return 0;
-}
-
-/*
- * Load a firmware file into target RAM. device is the open libusbx
- * device, and the path is the name of the source file. Open the file,
- * parse the bytes, and write them in one or two phases.
- *
- * If stage == 0, this uses the first stage loader, built into EZ-USB
- * hardware but limited to writing on-chip memory or CPUCS. Everything
- * is written during one stage, unless there's an error such as the image
- * holding data that needs to be written to external memory.
- *
- * Otherwise, things are written in two stages. First the external
- * memory is written, expecting a second stage loader to have already
- * been loaded. Then file is re-parsed and on-chip memory is written.
- */
-int ezusb_load_ram(libusb_device_handle *device, const char *path, int fx_type, int img_type, int stage)
-{
- FILE *image;
- uint32_t cpucs_addr;
- bool (*is_external)(uint32_t off, size_t len);
- struct ram_poke_context ctx;
- int status;
- uint8_t iic_header[8] = { 0 };
-
- if (fx_type == FX_TYPE_FX3)
- return fx3_load_ram(device, path);
-
- image = fopen(path, "rb");
- if (image == NULL) {
- logerror("%s: unable to open for input.\n", path);
- return -2;
- } else if (verbose > 1)
- logerror("open firmware image %s for RAM upload\n", path);
-
- if (img_type == IMG_TYPE_IIC) {
- if ( (fread(iic_header, 1, sizeof(iic_header), image) != sizeof(iic_header))
- || (((fx_type == FX_TYPE_FX2LP) || (fx_type == FX_TYPE_FX2)) && (iic_header[0] != 0xC2))
- || ((fx_type == FX_TYPE_AN21) && (iic_header[0] != 0xB2))
- || ((fx_type == FX_TYPE_FX1) && (iic_header[0] != 0xB6)) ) {
- logerror("IIC image does not contain executable code - cannot load to RAM.\n");
- return -1;
- }
- }
-
- /* EZ-USB original/FX and FX2 devices differ, apart from the 8051 core */
- switch(fx_type) {
- case FX_TYPE_FX2LP:
- cpucs_addr = 0xe600;
- is_external = fx2lp_is_external;
- break;
- case FX_TYPE_FX2:
- cpucs_addr = 0xe600;
- is_external = fx2_is_external;
- break;
- default:
- cpucs_addr = 0x7f92;
- is_external = fx_is_external;
- break;
- }
-
- /* use only first stage loader? */
- if (stage == 0) {
- ctx.mode = internal_only;
-
- /* if required, halt the CPU while we overwrite its code/data */
- if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, false))
- return -1;
-
- /* 2nd stage, first part? loader was already uploaded */
- } else {
- ctx.mode = skip_internal;
-
- /* let CPU run; overwrite the 2nd stage loader later */
- if (verbose)
- logerror("2nd stage: write external memory\n");
- }
-
- /* scan the image, first (maybe only) time */
- ctx.device = device;
- ctx.total = ctx.count = 0;
- status = parse[img_type](image, &ctx, is_external, ram_poke);
- if (status < 0) {
- logerror("unable to upload %s\n", path);
- return status;
- }
-
- /* second part of 2nd stage: rescan */
- // TODO: what should we do for non HEX images there?
- if (stage) {
- ctx.mode = skip_external;
-
- /* if needed, halt the CPU while we overwrite the 1st stage loader */
- if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, false))
- return -1;
-
- /* at least write the interrupt vectors (at 0x0000) for reset! */
- rewind(image);
- if (verbose)
- logerror("2nd stage: write on-chip memory\n");
- status = parse_ihex(image, &ctx, is_external, ram_poke);
- if (status < 0) {
- logerror("unable to completely upload %s\n", path);
- return status;
- }
- }
-
- if (verbose)
- logerror("... WROTE: %d bytes, %d segments, avg %d\n",
- (int)ctx.total, (int)ctx.count, (int)(ctx.total/ctx.count));
-
- /* if required, reset the CPU so it runs what we just uploaded */
- if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, true))
- return -1;
-
- return 0;
-}
diff --git a/third_party/libusb/src/examples/ezusb.h b/third_party/libusb/src/examples/ezusb.h
deleted file mode 100644
index cd0776d..0000000
--- a/third_party/libusb/src/examples/ezusb.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef __ezusb_H
-#define __ezusb_H
-/*
- * Copyright © 2001 Stephen Williams (steve@icarus.com)
- * Copyright © 2002 David Brownell (dbrownell@users.sourceforge.net)
- * Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
- *
- * This source code is free software; you can redistribute it
- * and/or modify it in source code form under the terms of the GNU
- * General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#if !defined(_MSC_VER)
-#include <stdbool.h>
-#else
-#define __attribute__(x)
-#if !defined(bool)
-#define bool int
-#endif
-#if !defined(true)
-#define true (1 == 1)
-#endif
-#if !defined(false)
-#define false (!true)
-#endif
-#if defined(_PREFAST_)
-#pragma warning(disable:28193)
-#endif
-#endif
-
-#define FX_TYPE_UNDEFINED -1
-#define FX_TYPE_AN21 0 /* Original AnchorChips parts */
-#define FX_TYPE_FX1 1 /* Updated Cypress versions */
-#define FX_TYPE_FX2 2 /* USB 2.0 versions */
-#define FX_TYPE_FX2LP 3 /* Updated FX2 */
-#define FX_TYPE_FX3 4 /* USB 3.0 versions */
-#define FX_TYPE_MAX 5
-#define FX_TYPE_NAMES { "an21", "fx", "fx2", "fx2lp", "fx3" }
-
-#define IMG_TYPE_UNDEFINED -1
-#define IMG_TYPE_HEX 0 /* Intel HEX */
-#define IMG_TYPE_IIC 1 /* Cypress 8051 IIC */
-#define IMG_TYPE_BIX 2 /* Cypress 8051 BIX */
-#define IMG_TYPE_IMG 3 /* Cypress IMG format */
-#define IMG_TYPE_MAX 4
-#define IMG_TYPE_NAMES { "Intel HEX", "Cypress 8051 IIC", "Cypress 8051 BIX", "Cypress IMG format" }
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Automatically identified devices (VID, PID, type, designation).
- * TODO: Could use some validation. Also where's the FX2?
- */
-typedef struct {
- uint16_t vid;
- uint16_t pid;
- int type;
- const char* designation;
-} fx_known_device;
-
-#define FX_KNOWN_DEVICES { \
- { 0x0547, 0x2122, FX_TYPE_AN21, "Cypress EZ-USB (2122S)" },\
- { 0x0547, 0x2125, FX_TYPE_AN21, "Cypress EZ-USB (2121S/2125S)" },\
- { 0x0547, 0x2126, FX_TYPE_AN21, "Cypress EZ-USB (2126S)" },\
- { 0x0547, 0x2131, FX_TYPE_AN21, "Cypress EZ-USB (2131Q/2131S/2135S)" },\
- { 0x0547, 0x2136, FX_TYPE_AN21, "Cypress EZ-USB (2136S)" },\
- { 0x0547, 0x2225, FX_TYPE_AN21, "Cypress EZ-USB (2225)" },\
- { 0x0547, 0x2226, FX_TYPE_AN21, "Cypress EZ-USB (2226)" },\
- { 0x0547, 0x2235, FX_TYPE_AN21, "Cypress EZ-USB (2235)" },\
- { 0x0547, 0x2236, FX_TYPE_AN21, "Cypress EZ-USB (2236)" },\
- { 0x04b4, 0x6473, FX_TYPE_FX1, "Cypress EZ-USB FX1" },\
- { 0x04b4, 0x8613, FX_TYPE_FX2LP, "Cypress EZ-USB FX2LP (68013A/68014A/68015A/68016A)" }, \
- { 0x04b4, 0x00f3, FX_TYPE_FX3, "Cypress FX3" },\
-}
-
-/*
- * This function uploads the firmware from the given file into RAM.
- * Stage == 0 means this is a single stage load (or the first of
- * two stages). Otherwise it's the second of two stages; the
- * caller having preloaded the second stage loader.
- *
- * The target processor is reset at the end of this upload.
- */
-extern int ezusb_load_ram(libusb_device_handle *device,
- const char *path, int fx_type, int img_type, int stage);
-
-/*
- * This function uploads the firmware from the given file into EEPROM.
- * This uses the right CPUCS address to terminate the EEPROM load with
- * a reset command where FX parts behave differently than FX2 ones.
- * The configuration byte is as provided here (zero for an21xx parts)
- * and the EEPROM type is set so that the microcontroller will boot
- * from it.
- *
- * The caller must have preloaded a second stage loader that knows
- * how to respond to the EEPROM write request.
- */
-extern int ezusb_load_eeprom(libusb_device_handle *device,
- const char *path, int fx_type, int img_type, int config);
-
-/* Verbosity level (default 1). Can be increased or decreased with options v/q */
-extern int verbose;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/third_party/libusb/src/examples/fxload.c b/third_party/libusb/src/examples/fxload.c
deleted file mode 100644
index 14226ca..0000000
--- a/third_party/libusb/src/examples/fxload.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright © 2001 Stephen Williams (steve@icarus.com)
- * Copyright © 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
- * Copyright © 2008 Roger Williams (rawqux@users.sourceforge.net)
- * Copyright © 2012 Pete Batard (pete@akeo.ie)
- * Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
- *
- * This source code is free software; you can redistribute it
- * and/or modify it in source code form under the terms of the GNU
- * General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <getopt.h>
-
-#include "libusb.h"
-#include "ezusb.h"
-
-#if !defined(_WIN32) || defined(__CYGWIN__ )
-#include <syslog.h>
-static bool dosyslog = false;
-#include <strings.h>
-#define _stricmp strcasecmp
-#endif
-
-#ifndef FXLOAD_VERSION
-#define FXLOAD_VERSION (__DATE__ " (libusbx)")
-#endif
-
-#ifndef ARRAYSIZE
-#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
-#endif
-
-void logerror(const char *format, ...)
- __attribute__ ((format (__printf__, 1, 2)));
-
-void logerror(const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
-
-#if !defined(_WIN32) || defined(__CYGWIN__ )
- if (dosyslog)
- vsyslog(LOG_ERR, format, ap);
- else
-#endif
- vfprintf(stderr, format, ap);
- va_end(ap);
-}
-
-static int print_usage(int error_code) {
- fprintf(stderr, "\nUsage: fxload [-v] [-V] [-t type] [-d vid:pid] [-p bus,addr] -i firmware\n");
- fprintf(stderr, " -i <path> -- Firmware to upload\n");
- fprintf(stderr, " -t <type> -- Target type: an21, fx, fx2, fx2lp, fx3\n");
- fprintf(stderr, " -d <vid:pid> -- Target device, as an USB VID:PID\n");
- fprintf(stderr, " -p <bus,addr> -- Target device, as a libusbx bus number and device address path\n");
- fprintf(stderr, " -v -- Increase verbosity\n");
- fprintf(stderr, " -q -- Decrease verbosity (silent mode)\n");
- fprintf(stderr, " -V -- Print program version\n");
- return error_code;
-}
-
-#define FIRMWARE 0
-#define LOADER 1
-int main(int argc, char*argv[])
-{
- fx_known_device known_device[] = FX_KNOWN_DEVICES;
- const char *path[] = { NULL, NULL };
- const char *device_id = NULL;
- const char *device_path = getenv("DEVICE");
- const char *type = NULL;
- const char *fx_name[FX_TYPE_MAX] = FX_TYPE_NAMES;
- const char *ext, *img_name[] = IMG_TYPE_NAMES;
- int fx_type = FX_TYPE_UNDEFINED, img_type[ARRAYSIZE(path)];
- int i, j, opt, status;
- unsigned vid = 0, pid = 0;
- unsigned busnum = 0, devaddr = 0, _busnum, _devaddr;
- libusb_device *dev, **devs;
- libusb_device_handle *device = NULL;
- struct libusb_device_descriptor desc;
-
- while ((opt = getopt(argc, argv, "qvV?hd:p:i:I:t:")) != EOF)
- switch (opt) {
-
- case 'd':
- device_id = optarg;
- if (sscanf(device_id, "%x:%x" , &vid, &pid) != 2 ) {
- fputs ("please specify VID & PID as \"vid:pid\" in hexadecimal format\n", stderr);
- return -1;
- }
- break;
-
- case 'p':
- device_path = optarg;
- if (sscanf(device_path, "%u,%u", &busnum, &devaddr) != 2 ) {
- fputs ("please specify bus number & device number as \"bus,dev\" in decimal format\n", stderr);
- return -1;
- }
- break;
-
- case 'i':
- case 'I':
- path[FIRMWARE] = optarg;
- break;
-
- case 'V':
- puts(FXLOAD_VERSION);
- return 0;
-
- case 't':
- type = optarg;
- break;
-
- case 'v':
- verbose++;
- break;
-
- case 'q':
- verbose--;
- break;
-
- case '?':
- case 'h':
- default:
- return print_usage(-1);
-
- }
-
- if (path[FIRMWARE] == NULL) {
- logerror("no firmware specified!\n");
- return print_usage(-1);
- }
- if ((device_id != NULL) && (device_path != NULL)) {
- logerror("only one of -d or -a can be specified\n");
- return print_usage(-1);
- }
-
- /* determine the target type */
- if (type != NULL) {
- for (i=0; i<FX_TYPE_MAX; i++) {
- if (strcmp(type, fx_name[i]) == 0) {
- fx_type = i;
- break;
- }
- }
- if (i >= FX_TYPE_MAX) {
- logerror("illegal microcontroller type: %s\n", type);
- return print_usage(-1);
- }
- }
-
- /* open the device using libusbx */
- status = libusb_init(NULL);
- if (status < 0) {
- logerror("libusb_init() failed: %s\n", libusb_error_name(status));
- return -1;
- }
- libusb_set_debug(NULL, verbose);
-
- /* try to pick up missing parameters from known devices */
- if ((type == NULL) || (device_id == NULL) || (device_path != NULL)) {
- if (libusb_get_device_list(NULL, &devs) < 0) {
- logerror("libusb_get_device_list() failed: %s\n", libusb_error_name(status));
- goto err;
- }
- for (i=0; (dev=devs[i]) != NULL; i++) {
- _busnum = libusb_get_bus_number(dev);
- _devaddr = libusb_get_device_address(dev);
- if ((type != NULL) && (device_path != NULL)) {
- // if both a type and bus,addr were specified, we just need to find our match
- if ((libusb_get_bus_number(dev) == busnum) && (libusb_get_device_address(dev) == devaddr))
- break;
- } else {
- status = libusb_get_device_descriptor(dev, &desc);
- if (status >= 0) {
- if (verbose >= 3) {
- logerror("examining %04x:%04x (%d,%d)\n",
- desc.idVendor, desc.idProduct, _busnum, _devaddr);
- }
- for (j=0; j<ARRAYSIZE(known_device); j++) {
- if ((desc.idVendor == known_device[j].vid)
- && (desc.idProduct == known_device[j].pid)) {
- if (// nothing was specified
- ((type == NULL) && (device_id == NULL) && (device_path == NULL)) ||
- // vid:pid was specified and we have a match
- ((type == NULL) && (device_id != NULL) && (vid == desc.idVendor) && (pid == desc.idProduct)) ||
- // bus,addr was specified and we have a match
- ((type == NULL) && (device_path != NULL) && (busnum == _busnum) && (devaddr == _devaddr)) ||
- // type was specified and we have a match
- ((type != NULL) && (device_id == NULL) && (device_path == NULL) && (fx_type == known_device[j].type)) ) {
- fx_type = known_device[j].type;
- vid = desc.idVendor;
- pid = desc.idProduct;
- busnum = _busnum;
- devaddr = _devaddr;
- break;
- }
- }
- }
- if (j < ARRAYSIZE(known_device)) {
- if (verbose)
- logerror("found device '%s' [%04x:%04x] (%d,%d)\n",
- known_device[j].designation, vid, pid, busnum, devaddr);
- break;
- }
- }
- }
- }
- if (dev == NULL) {
- libusb_free_device_list(devs, 1);
- logerror("could not find a known device - please specify type and/or vid:pid and/or bus,dev\n");
- return print_usage(-1);
- }
- status = libusb_open(dev, &device);
- if (status < 0) {
- logerror("libusb_open() failed: %s\n", libusb_error_name(status));
- goto err;
- }
- libusb_free_device_list(devs, 1);
- } else if (device_id != NULL) {
- device = libusb_open_device_with_vid_pid(NULL, (uint16_t)vid, (uint16_t)pid);
- if (device == NULL) {
- logerror("libusb_open() failed\n");
- goto err;
- }
- }
-
- /* We need to claim the first interface */
- libusb_set_auto_detach_kernel_driver(device, 1);
- status = libusb_claim_interface(device, 0);
- if (status != LIBUSB_SUCCESS) {
- logerror("libusb_claim_interface failed: %s\n", libusb_error_name(status));
- goto err;
- }
-
- if (verbose)
- logerror("microcontroller type: %s\n", fx_name[fx_type]);
-
- for (i=0; i<ARRAYSIZE(path); i++) {
- if (path[i] != NULL) {
- ext = path[i] + strlen(path[i]) - 4;
- if ((_stricmp(ext, ".hex") == 0) || (strcmp(ext, ".ihx") == 0))
- img_type[i] = IMG_TYPE_HEX;
- else if (_stricmp(ext, ".iic") == 0)
- img_type[i] = IMG_TYPE_IIC;
- else if (_stricmp(ext, ".bix") == 0)
- img_type[i] = IMG_TYPE_BIX;
- else if (_stricmp(ext, ".img") == 0)
- img_type[i] = IMG_TYPE_IMG;
- else {
- logerror("%s is not a recognized image type\n", path[i]);
- goto err;
- }
- }
- if (verbose && path[i] != NULL)
- logerror("%s: type %s\n", path[i], img_name[img_type[i]]);
- }
-
- /* single stage, put into internal memory */
- if (verbose > 1)
- logerror("single stage: load on-chip memory\n");
- status = ezusb_load_ram(device, path[FIRMWARE], fx_type, img_type[FIRMWARE], 0);
-
- libusb_release_interface(device, 0);
- libusb_close(device);
- libusb_exit(NULL);
- return status;
-err:
- libusb_exit(NULL);
- return -1;
-}
diff --git a/third_party/libusb/src/examples/getopt/getopt.c b/third_party/libusb/src/examples/getopt/getopt.c
deleted file mode 100644
index b7f26eb..0000000
--- a/third_party/libusb/src/examples/getopt/getopt.c
+++ /dev/null
@@ -1,1060 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to drepper@gnu.org
- before changing it!
- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C 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.
-
- The GNU C 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 the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-# ifndef const
-# define const
-# endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-# include <gnu-versions.h>
-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-# define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-# include <stdlib.h>
-# include <unistd.h>
-#endif /* GNU C library. */
-
-#ifdef VMS
-# include <unixlib.h>
-# if HAVE_STRING_H - 0
-# include <string.h>
-# endif
-#endif
-
-#ifndef _
-/* This is for other GNU distributions with internationalized messages. */
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# ifndef _
-# define _(msgid) gettext (msgid)
-# endif
-# else
-# define _(msgid) (msgid)
-# endif
-#endif
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* 1003.2 says this must be 1 before any call. */
-int optind = 1;
-
-/* Formerly, initialization of getopt depended on optind==0, which
- causes problems with re-calling getopt as programs generally don't
- know that. */
-
-int __getopt_initialized;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return -1 with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable. */
-static char *posixly_correct;
-
-#ifdef __GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
- because there are many ways it can cause trouble.
- On some systems, it contains special magic macros that don't work
- in GCC. */
-# include <string.h>
-# define my_index strchr
-#else
-
-# if HAVE_STRING_H
-# include <string.h>
-# else
-# include <strings.h>
-# endif
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-#ifndef getenv
-#ifdef _MSC_VER
-// DDK will complain if you don't use the stdlib defined getenv
-#include <stdlib.h>
-#else
-extern char *getenv ();
-#endif
-#endif
-
-static char *
-my_index (str, chr)
- const char *str;
- int chr;
-{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-# if (!defined __STDC__ || !__STDC__) && !defined strlen
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-# endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-#ifdef _LIBC
-/* Stored original parameters.
- XXX This is no good solution. We should rather copy the args so
- that we can compare them later. But we must not use malloc(3). */
-extern int __libc_argc;
-extern char **__libc_argv;
-
-/* Bash 2.0 gives us an environment variable containing flags
- indicating ARGV elements that should not be considered arguments. */
-
-# ifdef USE_NONOPTION_FLAGS
-/* Defined in getopt_init.c */
-extern char *__getopt_nonoption_flags;
-
-static int nonoption_flags_max_len;
-static int nonoption_flags_len;
-# endif
-
-# ifdef USE_NONOPTION_FLAGS
-# define SWAP_FLAGS(ch1, ch2) \
- if (nonoption_flags_len > 0) \
- { \
- char __tmp = __getopt_nonoption_flags[ch1]; \
- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
- __getopt_nonoption_flags[ch2] = __tmp; \
- }
-# else
-# define SWAP_FLAGS(ch1, ch2)
-# endif
-#else /* !_LIBC */
-# define SWAP_FLAGS(ch1, ch2)
-#endif /* _LIBC */
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-#if defined __STDC__ && __STDC__
-static void exchange (char **);
-#endif
-
-static void
-exchange (argv)
- char **argv;
-{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
- /* First make sure the handling of the `__getopt_nonoption_flags'
- string can work normally. Our top argument must be in the range
- of the string. */
- if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
- {
- /* We must extend the array. The user plays games with us and
- presents new arguments. */
- char *new_str = malloc (top + 1);
- if (new_str == NULL)
- nonoption_flags_len = nonoption_flags_max_len = 0;
- else
- {
- memset (__mempcpy (new_str, __getopt_nonoption_flags,
- nonoption_flags_max_len),
- '\0', top + 1 - nonoption_flags_max_len);
- nonoption_flags_max_len = top + 1;
- __getopt_nonoption_flags = new_str;
- }
- }
-#endif
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- SWAP_FLAGS (bottom + i, middle + i);
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made. */
-
-#if defined __STDC__ && __STDC__
-static const char *_getopt_initialize (int, char *const *, const char *);
-#endif
-static const char *
-_getopt_initialize (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- first_nonopt = last_nonopt = optind;
-
- nextchar = NULL;
-
- posixly_correct = getenv ("POSIXLY_CORRECT");
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (posixly_correct != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
- if (posixly_correct == NULL
- && argc == __libc_argc && argv == __libc_argv)
- {
- if (nonoption_flags_max_len == 0)
- {
- if (__getopt_nonoption_flags == NULL
- || __getopt_nonoption_flags[0] == '\0')
- nonoption_flags_max_len = -1;
- else
- {
- const char *orig_str = __getopt_nonoption_flags;
- int len = nonoption_flags_max_len = strlen (orig_str);
- if (nonoption_flags_max_len < argc)
- nonoption_flags_max_len = argc;
- __getopt_nonoption_flags =
- (char *) malloc (nonoption_flags_max_len);
- if (__getopt_nonoption_flags == NULL)
- nonoption_flags_max_len = -1;
- else
- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
- '\0', nonoption_flags_max_len - len);
- }
- }
- nonoption_flags_len = nonoption_flags_max_len;
- }
- else
- nonoption_flags_len = 0;
-#endif
-
- return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns -1.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- The elements of ARGV aren't really const, because we permute them.
- But we pretend they're const in the prototype to be compatible
- with other systems.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
-{
- int print_errors = opterr;
- if (optstring[0] == ':')
- print_errors = 0;
-
- if (argc < 1)
- return -1;
-
- optarg = NULL;
-
- if (optind == 0 || !__getopt_initialized)
- {
- if (optind == 0)
- optind = 1; /* Don't scan ARGV[0], the program name. */
- optstring = _getopt_initialize (argc, argv, optstring);
- __getopt_initialized = 1;
- }
-
- /* Test whether ARGV[optind] points to a non-option argument.
- Either it does not have option syntax, or there is an environment flag
- from the shell indicating it is not an option. The later information
- is only used when the used in the GNU libc. */
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
-#else
-# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#endif
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
-
- /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
- moved back by the user (who may also have changed the arguments). */
- if (last_nonopt > optind)
- last_nonopt = optind;
- if (first_nonopt > optind)
- first_nonopt = optind;
-
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc && NONOPTION_P)
- optind++;
- last_nonopt = optind;
- }
-
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return -1;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if (NONOPTION_P)
- {
- if (ordering == REQUIRE_ORDER)
- return -1;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- /* Decode the current option-ARGV-element. */
-
- /* Check whether the ARGV-element is a long option.
-
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
-
- This distinction seems to be the most useful approach. */
-
- if (longopts != NULL
- && (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = -1;
- int option_index;
-
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar)
- == (unsigned int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else if (long_only
- || pfound->has_arg != p->has_arg
- || pfound->flag != p->flag
- || pfound->val != p->val)
- /* Second or later nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (print_errors)
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- optopt = 0;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (print_errors)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
- }
-
- nextchar += strlen (nextchar);
-
- optopt = pfound->val;
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (print_errors)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- optopt = pfound->val;
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
-
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (print_errors)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- optopt = 0;
- return '?';
- }
- }
-
- /* Look at and handle the next short option-character. */
-
- {
- char c = *nextchar++;
- char *temp = my_index (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (print_errors)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
- else
- fprintf (stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- return '?';
- }
- /* Convenience. Treat POSIX -W foo same as long option --foo */
- if (temp[0] == 'W' && temp[1] == ';')
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = 0;
- int option_index;
-
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (print_errors)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- return c;
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
-
- /* optarg is now the argument, see if it's in the
- table of longopts. */
-
- for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p != NULL && p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar) == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
- if (ambig && !exact)
- {
- if (print_errors)
- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
- if (pfound != NULL)
- {
- option_index = indfound;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (print_errors)
- fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (print_errors)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- nextchar = NULL;
- return 'W'; /* Let the application handle it. */
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (print_errors)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-#endif /* Not ELIDE_CODE. */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == -1)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/third_party/libusb/src/examples/getopt/getopt.h b/third_party/libusb/src/examples/getopt/getopt.h
deleted file mode 100644
index a1b8dd6..0000000
--- a/third_party/libusb/src/examples/getopt/getopt.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C 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.
-
- The GNU C 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 the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _GETOPT_H
-
-#ifndef __need_getopt
-# define _GETOPT_H 1
-#endif
-
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
- standalone, or this is the first header included in the source file.
- If we are being used with glibc, we need to include <features.h>, but
- that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
- not defined, include <ctype.h>, which will pull in <features.h> for us
- if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
- doesn't flood the namespace with stuff the way some other headers do.) */
-#if !defined __GNU_LIBRARY__
-# include <ctype.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern int optopt;
-
-#ifndef __need_getopt
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
-# if (defined __STDC__ && __STDC__) || defined __cplusplus
- const char *name;
-# else
- char *name;
-# endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-# define no_argument 0
-# define required_argument 1
-# define optional_argument 2
-#endif /* need getopt */
-
-
-/* Get definitions and prototypes for functions to process the
- arguments in ARGV (ARGC of them, minus the program name) for
- options given in OPTS.
-
- Return the option character from OPTS just read. Return -1 when
- there are no more options. For unrecognized options, or options
- missing arguments, `optopt' is set to the option letter, and '?' is
- returned.
-
- The OPTS string is a list of characters which are recognized option
- letters, optionally followed by colons, specifying that that letter
- takes an argument, to be placed in `optarg'.
-
- If a letter in OPTS is followed by two colons, its argument is
- optional. This behavior is specific to the GNU `getopt'.
-
- The argument `--' causes premature termination of argument
- scanning, explicitly telling `getopt' that there are no more
- options.
-
- If OPTS begins with `--', then non-option arguments are treated as
- arguments to the option '\0'. This behavior is specific to the GNU
- `getopt'. */
-
-#if (defined __STDC__ && __STDC__) || defined __cplusplus
-# ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
-extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
-# else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-# endif /* __GNU_LIBRARY__ */
-
-# ifndef __need_getopt
-extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
- const struct option *__longopts, int *__longind);
-extern int getopt_long_only (int __argc, char *const *__argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind);
-
-/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int __argc, char *const *__argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind,
- int __long_only);
-# endif
-#else /* not __STDC__ */
-extern int getopt ();
-# ifndef __need_getopt
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-# endif
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Make sure we later can get all the definitions and declarations. */
-#undef __need_getopt
-
-#endif /* getopt.h */
diff --git a/third_party/libusb/src/examples/getopt/getopt1.c b/third_party/libusb/src/examples/getopt/getopt1.c
deleted file mode 100644
index 22a7efb..0000000
--- a/third_party/libusb/src/examples/getopt/getopt1.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C 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.
-
- The GNU C 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 the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined __STDC__ || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif /* Not ELIDE_CODE. */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == -1)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/third_party/libusb/src/examples/hotplugtest.c b/third_party/libusb/src/examples/hotplugtest.c
deleted file mode 100644
index fef01af..0000000
--- a/third_party/libusb/src/examples/hotplugtest.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
-/*
- * libusb example program for hotplug API
- * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.ccom>
- *
- * 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
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "libusb.h"
-
-int done = 0;
-libusb_device_handle *handle;
-
-static int LIBUSB_CALL hotplug_callback(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
-{
- struct libusb_device_descriptor desc;
- int rc;
-
- rc = libusb_get_device_descriptor(dev, &desc);
- if (LIBUSB_SUCCESS != rc) {
- fprintf (stderr, "Error getting device descriptor\n");
- }
-
- printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct);
-
- libusb_open (dev, &handle);
-
- done++;
-
- return 0;
-}
-
-static int LIBUSB_CALL hotplug_callback_detach(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
-{
- printf ("Device detached\n");
-
- libusb_close (handle);
-
- done++;
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- libusb_hotplug_callback_handle hp[2];
- int product_id, vendor_id, class_id;
- int rc;
-
- vendor_id = (argc > 1) ? strtol (argv[1], NULL, 0) : 0x045a;
- product_id = (argc > 2) ? strtol (argv[2], NULL, 0) : 0x5005;
- class_id = (argc > 3) ? strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
-
- libusb_init (NULL);
-
- if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) {
- printf ("Hotplug capabilites are not supported on this platform\n");
- libusb_exit (NULL);
- return EXIT_FAILURE;
- }
-
- rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, vendor_id,
- product_id, class_id, hotplug_callback, NULL, &hp[0]);
- if (LIBUSB_SUCCESS != rc) {
- fprintf (stderr, "Error registering callback 0\n");
- libusb_exit (NULL);
- return EXIT_FAILURE;
- }
-
- rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, vendor_id,
- product_id,class_id, hotplug_callback_detach, NULL, &hp[1]);
- if (LIBUSB_SUCCESS != rc) {
- fprintf (stderr, "Error registering callback 1\n");
- libusb_exit (NULL);
- return EXIT_FAILURE;
- }
-
- while (done < 2) {
- libusb_handle_events (NULL);
- }
-
- libusb_exit (NULL);
-}
diff --git a/third_party/libusb/src/examples/listdevs.c b/third_party/libusb/src/examples/listdevs.c
index 31ad26e..6ab8917 100644
--- a/third_party/libusb/src/examples/listdevs.c
+++ b/third_party/libusb/src/examples/listdevs.c
@@ -1,6 +1,6 @@
/*
- * libusbx example program to list devices on the bus
- * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
+ * libusb example program to list devices on the bus
+ * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,14 +18,14 @@
*/
#include <stdio.h>
+#include <sys/types.h>
-#include "libusb.h"
+#include <libusb.h>
static void print_devs(libusb_device **devs)
{
libusb_device *dev;
- int i = 0, j = 0;
- uint8_t path[8];
+ int i = 0;
while ((dev = devs[i++]) != NULL) {
struct libusb_device_descriptor desc;
@@ -35,17 +35,9 @@ static void print_devs(libusb_device **devs)
return;
}
- printf("%04x:%04x (bus %d, device %d)",
+ printf("%04x:%04x (bus %d, device %d)\n",
desc.idVendor, desc.idProduct,
libusb_get_bus_number(dev), libusb_get_device_address(dev));
-
- r = libusb_get_port_numbers(dev, path, sizeof(path));
- if (r > 0) {
- printf(" path: %d", path[0]);
- for (j = 1; j < r; j++)
- printf(".%d", path[j]);
- }
- printf("\n");
}
}
@@ -69,3 +61,4 @@ int main(void)
libusb_exit(NULL);
return 0;
}
+
diff --git a/third_party/libusb/src/examples/sam3u_benchmark.c b/third_party/libusb/src/examples/sam3u_benchmark.c
deleted file mode 100644
index 99d6b0f..0000000
--- a/third_party/libusb/src/examples/sam3u_benchmark.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * libusb example program to measure Atmel SAM3U isochronous performance
- * Copyright (C) 2012 Harald Welte <laforge@gnumonks.org>
- *
- * Copied with the author's permission under LGPL-2.1 from
- * http://git.gnumonks.org/cgi-bin/gitweb.cgi?p=sam3u-tests.git;a=blob;f=usb-benchmark-project/host/benchmark.c;h=74959f7ee88f1597286cd435f312a8ff52c56b7e
- *
- * An Atmel SAM3U test firmware is also available in the above repository.
- *
- * 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
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <libusb.h>
-
-
-#define EP_DATA_IN 0x82
-#define EP_ISO_IN 0x86
-
-static int do_exit = 0;
-static struct libusb_device_handle *devh = NULL;
-
-static unsigned long num_bytes = 0, num_xfer = 0;
-static struct timeval tv_start;
-
-static void LIBUSB_CALL cb_xfr(struct libusb_transfer *xfr)
-{
- unsigned int i;
-
- if (xfr->status != LIBUSB_TRANSFER_COMPLETED) {
- fprintf(stderr, "transfer status %d\n", xfr->status);
- libusb_free_transfer(xfr);
- exit(3);
- }
-
- if (xfr->type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS) {
- for (i = 0; i < xfr->num_iso_packets; i++) {
- struct libusb_iso_packet_descriptor *pack = &xfr->iso_packet_desc[i];
-
- if (pack->status != LIBUSB_TRANSFER_COMPLETED) {
- fprintf(stderr, "Error: pack %u status %d\n", i, pack->status);
- exit(5);
- }
-
- printf("pack%u length:%u, actual_length:%u\n", i, pack->length, pack->actual_length);
- }
- }
-
- printf("length:%u, actual_length:%u\n", xfr->length, xfr->actual_length);
- for (i = 0; i < xfr->actual_length; i++) {
- printf("%02x", xfr->buffer[i]);
- if (i % 16)
- printf("\n");
- else if (i % 8)
- printf(" ");
- else
- printf(" ");
- }
- num_bytes += xfr->actual_length;
- num_xfer++;
-
- if (libusb_submit_transfer(xfr) < 0) {
- fprintf(stderr, "error re-submitting URB\n");
- exit(1);
- }
-}
-
-static int benchmark_in(uint8_t ep)
-{
- static uint8_t buf[2048];
- static struct libusb_transfer *xfr;
- int num_iso_pack = 0;
-
- if (ep == EP_ISO_IN)
- num_iso_pack = 16;
-
- xfr = libusb_alloc_transfer(num_iso_pack);
- if (!xfr)
- return -ENOMEM;
-
- if (ep == EP_ISO_IN) {
- libusb_fill_iso_transfer(xfr, devh, ep, buf,
- sizeof(buf), num_iso_pack, cb_xfr, NULL, 0);
- libusb_set_iso_packet_lengths(xfr, sizeof(buf)/num_iso_pack);
- } else
- libusb_fill_bulk_transfer(xfr, devh, ep, buf,
- sizeof(buf), cb_xfr, NULL, 0);
-
- gettimeofday(&tv_start, NULL);
-
- /* NOTE: To reach maximum possible performance the program must
- * submit *multiple* transfers here, not just one.
- *
- * When only one transfer is submitted there is a gap in the bus
- * schedule from when the transfer completes until a new transfer
- * is submitted by the callback. This causes some jitter for
- * isochronous transfers and loss of throughput for bulk transfers.
- *
- * This is avoided by queueing multiple transfers in advance, so
- * that the host controller is always kept busy, and will schedule
- * more transfers on the bus while the callback is running for
- * transfers which have completed on the bus.
- */
-
- return libusb_submit_transfer(xfr);
-}
-
-static void measure(void)
-{
- struct timeval tv_stop;
- unsigned int diff_msec;
-
- gettimeofday(&tv_stop, NULL);
-
- diff_msec = (tv_stop.tv_sec - tv_start.tv_sec)*1000;
- diff_msec += (tv_stop.tv_usec - tv_start.tv_usec)/1000;
-
- printf("%lu transfers (total %lu bytes) in %u miliseconds => %lu bytes/sec\n",
- num_xfer, num_bytes, diff_msec, (num_bytes*1000)/diff_msec);
-}
-
-static void sig_hdlr(int signum)
-{
- switch (signum) {
- case SIGINT:
- measure();
- do_exit = 1;
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- int rc;
- struct sigaction sigact;
-
- sigact.sa_handler = sig_hdlr;
- sigemptyset(&sigact.sa_mask);
- sigact.sa_flags = 0;
- sigaction(SIGINT, &sigact, NULL);
-
- rc = libusb_init(NULL);
- if (rc < 0) {
- fprintf(stderr, "Error initializing libusb: %s\n", libusb_error_name(rc));
- exit(1);
- }
-
- devh = libusb_open_device_with_vid_pid(NULL, 0x16c0, 0x0763);
- if (!devh) {
- fprintf(stderr, "Error finding USB device\n");
- goto out;
- }
-
- rc = libusb_claim_interface(devh, 2);
- if (rc < 0) {
- fprintf(stderr, "Error claiming interface: %s\n", libusb_error_name(rc));
- goto out;
- }
-
- benchmark_in(EP_ISO_IN);
-
- while (!do_exit) {
- rc = libusb_handle_events(NULL);
- if (rc != LIBUSB_SUCCESS)
- break;
- }
-
- /* Measurement has already been done by the signal handler. */
-
- libusb_release_interface(devh, 0);
-out:
- if (devh)
- libusb_close(devh);
- libusb_exit(NULL);
- return rc;
-}
diff --git a/third_party/libusb/src/examples/xusb.c b/third_party/libusb/src/examples/xusb.c
deleted file mode 100644
index bdb9794..0000000
--- a/third_party/libusb/src/examples/xusb.c
+++ /dev/null
@@ -1,1093 +0,0 @@
-/*
- * xusb: Generic USB test program
- * Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
- * Contributions to Mass Storage by Alan Stern.
- *
- * 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
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "libusb.h"
-
-#if defined(_WIN32)
-#define msleep(msecs) Sleep(msecs)
-#else
-#include <unistd.h>
-#define msleep(msecs) usleep(1000*msecs)
-#endif
-
-#if !defined(bool)
-#define bool int
-#endif
-#if !defined(true)
-#define true (1 == 1)
-#endif
-#if !defined(false)
-#define false (!true)
-#endif
-
-// Future versions of libusbx will use usb_interface instead of interface
-// in libusb_config_descriptor => catter for that
-#define usb_interface interface
-
-// Global variables
-bool binary_dump = false;
-bool extra_info = false;
-const char* binary_name = NULL;
-
-static int perr(char const *format, ...)
-{
- va_list args;
- int r;
-
- va_start (args, format);
- r = vfprintf(stderr, format, args);
- va_end(args);
-
- return r;
-}
-
-#define ERR_EXIT(errcode) do { perr(" %s\n", libusb_strerror((enum libusb_error)errcode)); return -1; } while (0)
-#define CALL_CHECK(fcall) do { r=fcall; if (r < 0) ERR_EXIT(r); } while (0);
-#define B(x) (((x)!=0)?1:0)
-#define be_to_int32(buf) (((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|(buf)[3])
-
-#define RETRY_MAX 5
-#define REQUEST_SENSE_LENGTH 0x12
-#define INQUIRY_LENGTH 0x24
-#define READ_CAPACITY_LENGTH 0x08
-
-// HID Class-Specific Requests values. See section 7.2 of the HID specifications
-#define HID_GET_REPORT 0x01
-#define HID_GET_IDLE 0x02
-#define HID_GET_PROTOCOL 0x03
-#define HID_SET_REPORT 0x09
-#define HID_SET_IDLE 0x0A
-#define HID_SET_PROTOCOL 0x0B
-#define HID_REPORT_TYPE_INPUT 0x01
-#define HID_REPORT_TYPE_OUTPUT 0x02
-#define HID_REPORT_TYPE_FEATURE 0x03
-
-// Mass Storage Requests values. See section 3 of the Bulk-Only Mass Storage Class specifications
-#define BOMS_RESET 0xFF
-#define BOMS_GET_MAX_LUN 0xFE
-
-// Section 5.1: Command Block Wrapper (CBW)
-struct command_block_wrapper {
- uint8_t dCBWSignature[4];
- uint32_t dCBWTag;
- uint32_t dCBWDataTransferLength;
- uint8_t bmCBWFlags;
- uint8_t bCBWLUN;
- uint8_t bCBWCBLength;
- uint8_t CBWCB[16];
-};
-
-// Section 5.2: Command Status Wrapper (CSW)
-struct command_status_wrapper {
- uint8_t dCSWSignature[4];
- uint32_t dCSWTag;
- uint32_t dCSWDataResidue;
- uint8_t bCSWStatus;
-};
-
-static uint8_t cdb_length[256] = {
-// 0 1 2 3 4 5 6 7 8 9 A B C D E F
- 06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 0
- 06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 1
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 2
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 3
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 4
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, // 5
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // 6
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // 7
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, // 8
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, // 9
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, // A
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, // B
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // C
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // D
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // E
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, // F
-};
-
-enum test_type {
- USE_GENERIC,
- USE_PS3,
- USE_XBOX,
- USE_SCSI,
- USE_HID,
-} test_mode;
-uint16_t VID, PID;
-
-static void display_buffer_hex(unsigned char *buffer, unsigned size)
-{
- unsigned i, j, k;
-
- for (i=0; i<size; i+=16) {
- printf("\n %08x ", i);
- for(j=0,k=0; k<16; j++,k++) {
- if (i+j < size) {
- printf("%02x", buffer[i+j]);
- } else {
- printf(" ");
- }
- printf(" ");
- }
- printf(" ");
- for(j=0,k=0; k<16; j++,k++) {
- if (i+j < size) {
- if ((buffer[i+j] < 32) || (buffer[i+j] > 126)) {
- printf(".");
- } else {
- printf("%c", buffer[i+j]);
- }
- }
- }
- }
- printf("\n" );
-}
-
-static char* uuid_to_string(const uint8_t* uuid)
-{
- static char uuid_string[40];
- if (uuid == NULL) return NULL;
- sprintf(uuid_string, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
- return uuid_string;
-}
-
-// The PS3 Controller is really a HID device that got its HID Report Descriptors
-// removed by Sony
-static int display_ps3_status(libusb_device_handle *handle)
-{
- int r;
- uint8_t input_report[49];
- uint8_t master_bt_address[8];
- uint8_t device_bt_address[18];
-
- // Get the controller's bluetooth address of its master device
- CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, 0x03f5, 0, master_bt_address, sizeof(master_bt_address), 100));
- printf("\nMaster's bluetooth address: %02X:%02X:%02X:%02X:%02X:%02X\n", master_bt_address[2], master_bt_address[3],
- master_bt_address[4], master_bt_address[5], master_bt_address[6], master_bt_address[7]);
-
- // Get the controller's bluetooth address
- CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, 0x03f2, 0, device_bt_address, sizeof(device_bt_address), 100));
- printf("\nMaster's bluetooth address: %02X:%02X:%02X:%02X:%02X:%02X\n", device_bt_address[4], device_bt_address[5],
- device_bt_address[6], device_bt_address[7], device_bt_address[8], device_bt_address[9]);
-
- // Get the status of the controller's buttons via its HID report
- printf("\nReading PS3 Input Report...\n");
- CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, (HID_REPORT_TYPE_INPUT<<8)|0x01, 0, input_report, sizeof(input_report), 1000));
- switch(input_report[2]){ /** Direction pad plus start, select, and joystick buttons */
- case 0x01:
- printf("\tSELECT pressed\n");
- break;
- case 0x02:
- printf("\tLEFT 3 pressed\n");
- break;
- case 0x04:
- printf("\tRIGHT 3 pressed\n");
- break;
- case 0x08:
- printf("\tSTART presed\n");
- break;
- case 0x10:
- printf("\tUP pressed\n");
- break;
- case 0x20:
- printf("\tRIGHT pressed\n");
- break;
- case 0x40:
- printf("\tDOWN pressed\n");
- break;
- case 0x80:
- printf("\tLEFT pressed\n");
- break;
- }
- switch(input_report[3]){ /** Shapes plus top right and left buttons */
- case 0x01:
- printf("\tLEFT 2 pressed\n");
- break;
- case 0x02:
- printf("\tRIGHT 2 pressed\n");
- break;
- case 0x04:
- printf("\tLEFT 1 pressed\n");
- break;
- case 0x08:
- printf("\tRIGHT 1 presed\n");
- break;
- case 0x10:
- printf("\tTRIANGLE pressed\n");
- break;
- case 0x20:
- printf("\tCIRCLE pressed\n");
- break;
- case 0x40:
- printf("\tCROSS pressed\n");
- break;
- case 0x80:
- printf("\tSQUARE pressed\n");
- break;
- }
- printf("\tPS button: %d\n", input_report[4]);
- printf("\tLeft Analog (X,Y): (%d,%d)\n", input_report[6], input_report[7]);
- printf("\tRight Analog (X,Y): (%d,%d)\n", input_report[8], input_report[9]);
- printf("\tL2 Value: %d\tR2 Value: %d\n", input_report[18], input_report[19]);
- printf("\tL1 Value: %d\tR1 Value: %d\n", input_report[20], input_report[21]);
- printf("\tRoll (x axis): %d Yaw (y axis): %d Pitch (z axis) %d\n",
- //(((input_report[42] + 128) % 256) - 128),
- (int8_t)(input_report[42]),
- (int8_t)(input_report[44]),
- (int8_t)(input_report[46]));
- printf("\tAcceleration: %d\n\n", (int8_t)(input_report[48]));
- return 0;
-}
-// The XBOX Controller is really a HID device that got its HID Report Descriptors
-// removed by Microsoft.
-// Input/Output reports described at http://euc.jp/periphs/xbox-controller.ja.html
-static int display_xbox_status(libusb_device_handle *handle)
-{
- int r;
- uint8_t input_report[20];
- printf("\nReading XBox Input Report...\n");
- CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, (HID_REPORT_TYPE_INPUT<<8)|0x00, 0, input_report, 20, 1000));
- printf(" D-pad: %02X\n", input_report[2]&0x0F);
- printf(" Start:%d, Back:%d, Left Stick Press:%d, Right Stick Press:%d\n", B(input_report[2]&0x10), B(input_report[2]&0x20),
- B(input_report[2]&0x40), B(input_report[2]&0x80));
- // A, B, X, Y, Black, White are pressure sensitive
- printf(" A:%d, B:%d, X:%d, Y:%d, White:%d, Black:%d\n", input_report[4], input_report[5],
- input_report[6], input_report[7], input_report[9], input_report[8]);
- printf(" Left Trigger: %d, Right Trigger: %d\n", input_report[10], input_report[11]);
- printf(" Left Analog (X,Y): (%d,%d)\n", (int16_t)((input_report[13]<<8)|input_report[12]),
- (int16_t)((input_report[15]<<8)|input_report[14]));
- printf(" Right Analog (X,Y): (%d,%d)\n", (int16_t)((input_report[17]<<8)|input_report[16]),
- (int16_t)((input_report[19]<<8)|input_report[18]));
- return 0;
-}
-
-static int set_xbox_actuators(libusb_device_handle *handle, uint8_t left, uint8_t right)
-{
- int r;
- uint8_t output_report[6];
-
- printf("\nWriting XBox Controller Output Report...\n");
-
- memset(output_report, 0, sizeof(output_report));
- output_report[1] = sizeof(output_report);
- output_report[3] = left;
- output_report[5] = right;
-
- CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_OUT|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_SET_REPORT, (HID_REPORT_TYPE_OUTPUT<<8)|0x00, 0, output_report, 06, 1000));
- return 0;
-}
-
-static int send_mass_storage_command(libusb_device_handle *handle, uint8_t endpoint, uint8_t lun,
- uint8_t *cdb, uint8_t direction, int data_length, uint32_t *ret_tag)
-{
- static uint32_t tag = 1;
- uint8_t cdb_len;
- int i, r, size;
- struct command_block_wrapper cbw;
-
- if (cdb == NULL) {
- return -1;
- }
-
- if (endpoint & LIBUSB_ENDPOINT_IN) {
- perr("send_mass_storage_command: cannot send command on IN endpoint\n");
- return -1;
- }
-
- cdb_len = cdb_length[cdb[0]];
- if ((cdb_len == 0) || (cdb_len > sizeof(cbw.CBWCB))) {
- perr("send_mass_storage_command: don't know how to handle this command (%02X, length %d)\n",
- cdb[0], cdb_len);
- return -1;
- }
-
- memset(&cbw, 0, sizeof(cbw));
- cbw.dCBWSignature[0] = 'U';
- cbw.dCBWSignature[1] = 'S';
- cbw.dCBWSignature[2] = 'B';
- cbw.dCBWSignature[3] = 'C';
- *ret_tag = tag;
- cbw.dCBWTag = tag++;
- cbw.dCBWDataTransferLength = data_length;
- cbw.bmCBWFlags = direction;
- cbw.bCBWLUN = lun;
- // Subclass is 1 or 6 => cdb_len
- cbw.bCBWCBLength = cdb_len;
- memcpy(cbw.CBWCB, cdb, cdb_len);
-
- i = 0;
- do {
- // The transfer length must always be exactly 31 bytes.
- r = libusb_bulk_transfer(handle, endpoint, (unsigned char*)&cbw, 31, &size, 1000);
- if (r == LIBUSB_ERROR_PIPE) {
- libusb_clear_halt(handle, endpoint);
- }
- i++;
- } while ((r == LIBUSB_ERROR_PIPE) && (i<RETRY_MAX));
- if (r != LIBUSB_SUCCESS) {
- perr(" send_mass_storage_command: %s\n", libusb_strerror((enum libusb_error)r));
- return -1;
- }
-
- printf(" sent %d CDB bytes\n", cdb_len);
- return 0;
-}
-
-static int get_mass_storage_status(libusb_device_handle *handle, uint8_t endpoint, uint32_t expected_tag)
-{
- int i, r, size;
- struct command_status_wrapper csw;
-
- // The device is allowed to STALL this transfer. If it does, you have to
- // clear the stall and try again.
- i = 0;
- do {
- r = libusb_bulk_transfer(handle, endpoint, (unsigned char*)&csw, 13, &size, 1000);
- if (r == LIBUSB_ERROR_PIPE) {
- libusb_clear_halt(handle, endpoint);
- }
- i++;
- } while ((r == LIBUSB_ERROR_PIPE) && (i<RETRY_MAX));
- if (r != LIBUSB_SUCCESS) {
- perr(" get_mass_storage_status: %s\n", libusb_strerror((enum libusb_error)r));
- return -1;
- }
- if (size != 13) {
- perr(" get_mass_storage_status: received %d bytes (expected 13)\n", size);
- return -1;
- }
- if (csw.dCSWTag != expected_tag) {
- perr(" get_mass_storage_status: mismatched tags (expected %08X, received %08X)\n",
- expected_tag, csw.dCSWTag);
- return -1;
- }
- // For this test, we ignore the dCSWSignature check for validity...
- printf(" Mass Storage Status: %02X (%s)\n", csw.bCSWStatus, csw.bCSWStatus?"FAILED":"Success");
- if (csw.dCSWTag != expected_tag)
- return -1;
- if (csw.bCSWStatus) {
- // REQUEST SENSE is appropriate only if bCSWStatus is 1, meaning that the
- // command failed somehow. Larger values (2 in particular) mean that
- // the command couldn't be understood.
- if (csw.bCSWStatus == 1)
- return -2; // request Get Sense
- else
- return -1;
- }
-
- // In theory we also should check dCSWDataResidue. But lots of devices
- // set it wrongly.
- return 0;
-}
-
-static void get_sense(libusb_device_handle *handle, uint8_t endpoint_in, uint8_t endpoint_out)
-{
- uint8_t cdb[16]; // SCSI Command Descriptor Block
- uint8_t sense[18];
- uint32_t expected_tag;
- int size;
-
- // Request Sense
- printf("Request Sense:\n");
- memset(sense, 0, sizeof(sense));
- memset(cdb, 0, sizeof(cdb));
- cdb[0] = 0x03; // Request Sense
- cdb[4] = REQUEST_SENSE_LENGTH;
-
- send_mass_storage_command(handle, endpoint_out, 0, cdb, LIBUSB_ENDPOINT_IN, REQUEST_SENSE_LENGTH, &expected_tag);
- libusb_bulk_transfer(handle, endpoint_in, (unsigned char*)&sense, REQUEST_SENSE_LENGTH, &size, 1000);
- printf(" received %d bytes\n", size);
-
- if ((sense[0] != 0x70) && (sense[0] != 0x71)) {
- perr(" ERROR No sense data\n");
- } else {
- perr(" ERROR Sense: %02X %02X %02X\n", sense[2]&0x0F, sense[12], sense[13]);
- }
- // Strictly speaking, the get_mass_storage_status() call should come
- // before these perr() lines. If the status is nonzero then we must
- // assume there's no data in the buffer. For xusb it doesn't matter.
- get_mass_storage_status(handle, endpoint_in, expected_tag);
-}
-
-// Mass Storage device to test bulk transfers (non destructive test)
-static int test_mass_storage(libusb_device_handle *handle, uint8_t endpoint_in, uint8_t endpoint_out)
-{
- int r, size;
- uint8_t lun;
- uint32_t expected_tag;
- uint32_t i, max_lba, block_size;
- double device_size;
- uint8_t cdb[16]; // SCSI Command Descriptor Block
- uint8_t buffer[64];
- char vid[9], pid[9], rev[5];
- unsigned char *data;
- FILE *fd;
-
- printf("Reading Max LUN:\n");
- r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- BOMS_GET_MAX_LUN, 0, 0, &lun, 1, 1000);
- // Some devices send a STALL instead of the actual value.
- // In such cases we should set lun to 0.
- if (r == 0) {
- lun = 0;
- } else if (r < 0) {
- perr(" Failed: %s", libusb_strerror((enum libusb_error)r));
- }
- printf(" Max LUN = %d\n", lun);
-
- // Send Inquiry
- printf("Sending Inquiry:\n");
- memset(buffer, 0, sizeof(buffer));
- memset(cdb, 0, sizeof(cdb));
- cdb[0] = 0x12; // Inquiry
- cdb[4] = INQUIRY_LENGTH;
-
- send_mass_storage_command(handle, endpoint_out, lun, cdb, LIBUSB_ENDPOINT_IN, INQUIRY_LENGTH, &expected_tag);
- CALL_CHECK(libusb_bulk_transfer(handle, endpoint_in, (unsigned char*)&buffer, INQUIRY_LENGTH, &size, 1000));
- printf(" received %d bytes\n", size);
- // The following strings are not zero terminated
- for (i=0; i<8; i++) {
- vid[i] = buffer[8+i];
- pid[i] = buffer[16+i];
- rev[i/2] = buffer[32+i/2]; // instead of another loop
- }
- vid[8] = 0;
- pid[8] = 0;
- rev[4] = 0;
- printf(" VID:PID:REV \"%8s\":\"%8s\":\"%4s\"\n", vid, pid, rev);
- if (get_mass_storage_status(handle, endpoint_in, expected_tag) == -2) {
- get_sense(handle, endpoint_in, endpoint_out);
- }
-
- // Read capacity
- printf("Reading Capacity:\n");
- memset(buffer, 0, sizeof(buffer));
- memset(cdb, 0, sizeof(cdb));
- cdb[0] = 0x25; // Read Capacity
-
- send_mass_storage_command(handle, endpoint_out, lun, cdb, LIBUSB_ENDPOINT_IN, READ_CAPACITY_LENGTH, &expected_tag);
- CALL_CHECK(libusb_bulk_transfer(handle, endpoint_in, (unsigned char*)&buffer, READ_CAPACITY_LENGTH, &size, 1000));
- printf(" received %d bytes\n", size);
- max_lba = be_to_int32(&buffer[0]);
- block_size = be_to_int32(&buffer[4]);
- device_size = ((double)(max_lba+1))*block_size/(1024*1024*1024);
- printf(" Max LBA: %08X, Block Size: %08X (%.2f GB)\n", max_lba, block_size, device_size);
- if (get_mass_storage_status(handle, endpoint_in, expected_tag) == -2) {
- get_sense(handle, endpoint_in, endpoint_out);
- }
-
- data = (unsigned char*) calloc(1, block_size);
- if (data == NULL) {
- perr(" unable to allocate data buffer\n");
- return -1;
- }
-
- // Send Read
- printf("Attempting to read %d bytes:\n", block_size);
- memset(cdb, 0, sizeof(cdb));
-
- cdb[0] = 0x28; // Read(10)
- cdb[8] = 0x01; // 1 block
-
- send_mass_storage_command(handle, endpoint_out, lun, cdb, LIBUSB_ENDPOINT_IN, block_size, &expected_tag);
- libusb_bulk_transfer(handle, endpoint_in, data, block_size, &size, 5000);
- printf(" READ: received %d bytes\n", size);
- if (get_mass_storage_status(handle, endpoint_in, expected_tag) == -2) {
- get_sense(handle, endpoint_in, endpoint_out);
- } else {
- display_buffer_hex(data, size);
- if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) {
- if (fwrite(data, 1, (size_t)size, fd) != (unsigned int)size) {
- perr(" unable to write binary data\n");
- }
- fclose(fd);
- }
- }
- free(data);
-
- return 0;
-}
-
-// HID
-static int get_hid_record_size(uint8_t *hid_report_descriptor, int size, int type)
-{
- uint8_t i, j = 0;
- uint8_t offset;
- int record_size[3] = {0, 0, 0};
- int nb_bits = 0, nb_items = 0;
- bool found_record_marker;
-
- found_record_marker = false;
- for (i = hid_report_descriptor[0]+1; i < size; i += offset) {
- offset = (hid_report_descriptor[i]&0x03) + 1;
- if (offset == 4)
- offset = 5;
- switch (hid_report_descriptor[i] & 0xFC) {
- case 0x74: // bitsize
- nb_bits = hid_report_descriptor[i+1];
- break;
- case 0x94: // count
- nb_items = 0;
- for (j=1; j<offset; j++) {
- nb_items = ((uint32_t)hid_report_descriptor[i+j]) << (8*(j-1));
- }
- break;
- case 0x80: // input
- found_record_marker = true;
- j = 0;
- break;
- case 0x90: // output
- found_record_marker = true;
- j = 1;
- break;
- case 0xb0: // feature
- found_record_marker = true;
- j = 2;
- break;
- case 0xC0: // end of collection
- nb_items = 0;
- nb_bits = 0;
- break;
- default:
- continue;
- }
- if (found_record_marker) {
- found_record_marker = false;
- record_size[j] += nb_items*nb_bits;
- }
- }
- if ((type < HID_REPORT_TYPE_INPUT) || (type > HID_REPORT_TYPE_FEATURE)) {
- return 0;
- } else {
- return (record_size[type - HID_REPORT_TYPE_INPUT]+7)/8;
- }
-}
-
-static int test_hid(libusb_device_handle *handle, uint8_t endpoint_in)
-{
- int r, size, descriptor_size;
- uint8_t hid_report_descriptor[256];
- uint8_t *report_buffer;
- FILE *fd;
-
- printf("\nReading HID Report Descriptors:\n");
- descriptor_size = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_STANDARD|LIBUSB_RECIPIENT_INTERFACE,
- LIBUSB_REQUEST_GET_DESCRIPTOR, LIBUSB_DT_REPORT<<8, 0, hid_report_descriptor, sizeof(hid_report_descriptor), 1000);
- if (descriptor_size < 0) {
- printf(" Failed\n");
- return -1;
- }
- display_buffer_hex(hid_report_descriptor, descriptor_size);
- if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) {
- if (fwrite(hid_report_descriptor, 1, descriptor_size, fd) != descriptor_size) {
- printf(" Error writing descriptor to file\n");
- }
- fclose(fd);
- }
-
- size = get_hid_record_size(hid_report_descriptor, descriptor_size, HID_REPORT_TYPE_FEATURE);
- if (size <= 0) {
- printf("\nSkipping Feature Report readout (None detected)\n");
- } else {
- report_buffer = (uint8_t*) calloc(size, 1);
- if (report_buffer == NULL) {
- return -1;
- }
-
- printf("\nReading Feature Report (length %d)...\n", size);
- r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, (HID_REPORT_TYPE_FEATURE<<8)|0, 0, report_buffer, (uint16_t)size, 5000);
- if (r >= 0) {
- display_buffer_hex(report_buffer, size);
- } else {
- switch(r) {
- case LIBUSB_ERROR_NOT_FOUND:
- printf(" No Feature Report available for this device\n");
- break;
- case LIBUSB_ERROR_PIPE:
- printf(" Detected stall - resetting pipe...\n");
- libusb_clear_halt(handle, 0);
- break;
- default:
- printf(" Error: %s\n", libusb_strerror((enum libusb_error)r));
- break;
- }
- }
- free(report_buffer);
- }
-
- size = get_hid_record_size(hid_report_descriptor, descriptor_size, HID_REPORT_TYPE_INPUT);
- if (size <= 0) {
- printf("\nSkipping Input Report readout (None detected)\n");
- } else {
- report_buffer = (uint8_t*) calloc(size, 1);
- if (report_buffer == NULL) {
- return -1;
- }
-
- printf("\nReading Input Report (length %d)...\n", size);
- r = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
- HID_GET_REPORT, (HID_REPORT_TYPE_INPUT<<8)|0x00, 0, report_buffer, (uint16_t)size, 5000);
- if (r >= 0) {
- display_buffer_hex(report_buffer, size);
- } else {
- switch(r) {
- case LIBUSB_ERROR_TIMEOUT:
- printf(" Timeout! Please make sure you act on the device within the 5 seconds allocated...\n");
- break;
- case LIBUSB_ERROR_PIPE:
- printf(" Detected stall - resetting pipe...\n");
- libusb_clear_halt(handle, 0);
- break;
- default:
- printf(" Error: %s\n", libusb_strerror((enum libusb_error)r));
- break;
- }
- }
-
- // Attempt a bulk read from endpoint 0 (this should just return a raw input report)
- printf("\nTesting interrupt read using endpoint %02X...\n", endpoint_in);
- r = libusb_interrupt_transfer(handle, endpoint_in, report_buffer, size, &size, 5000);
- if (r >= 0) {
- display_buffer_hex(report_buffer, size);
- } else {
- printf(" %s\n", libusb_strerror((enum libusb_error)r));
- }
-
- free(report_buffer);
- }
- return 0;
-}
-
-// Read the MS WinUSB Feature Descriptors, that are used on Windows 8 for automated driver installation
-static void read_ms_winsub_feature_descriptors(libusb_device_handle *handle, uint8_t bRequest, int iface_number)
-{
-#define MAX_OS_FD_LENGTH 256
- int i, r;
- uint8_t os_desc[MAX_OS_FD_LENGTH];
- uint32_t length;
- void* le_type_punning_IS_fine;
- struct {
- const char* desc;
- uint8_t recipient;
- uint16_t index;
- uint16_t header_size;
- } os_fd[2] = {
- {"Extended Compat ID", LIBUSB_RECIPIENT_DEVICE, 0x0004, 0x10},
- {"Extended Properties", LIBUSB_RECIPIENT_INTERFACE, 0x0005, 0x0A}
- };
-
- if (iface_number < 0) return;
-
- for (i=0; i<2; i++) {
- printf("\nReading %s OS Feature Descriptor (wIndex = 0x%04d):\n", os_fd[i].desc, os_fd[i].index);
-
- // Read the header part
- r = libusb_control_transfer(handle, (uint8_t)(LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_VENDOR|os_fd[i].recipient),
- bRequest, (uint16_t)(((iface_number)<< 8)|0x00), os_fd[i].index, os_desc, os_fd[i].header_size, 1000);
- if (r < os_fd[i].header_size) {
- perr(" Failed: %s", (r<0)?libusb_strerror((enum libusb_error)r):"header size is too small");
- return;
- }
- le_type_punning_IS_fine = (void*)os_desc;
- length = *((uint32_t*)le_type_punning_IS_fine);
- if (length > MAX_OS_FD_LENGTH) {
- length = MAX_OS_FD_LENGTH;
- }
-
- // Read the full feature descriptor
- r = libusb_control_transfer(handle, (uint8_t)(LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_VENDOR|os_fd[i].recipient),
- bRequest, (uint16_t)(((iface_number)<< 8)|0x00), os_fd[i].index, os_desc, (uint16_t)length, 1000);
- if (r < 0) {
- perr(" Failed: %s", libusb_strerror((enum libusb_error)r));
- return;
- } else {
- display_buffer_hex(os_desc, r);
- }
- }
-}
-
-static void print_device_cap(struct libusb_bos_dev_capability_descriptor *dev_cap)
-{
- switch(dev_cap->bDevCapabilityType) {
- case LIBUSB_BT_USB_2_0_EXTENSION: {
- struct libusb_usb_2_0_extension_descriptor *usb_2_0_ext = NULL;
- libusb_get_usb_2_0_extension_descriptor(NULL, dev_cap, &usb_2_0_ext);
- if (usb_2_0_ext) {
- printf(" USB 2.0 extension:\n");
- printf(" attributes : %02X\n", usb_2_0_ext->bmAttributes);
- libusb_free_usb_2_0_extension_descriptor(usb_2_0_ext);
- }
- break;
- }
- case LIBUSB_BT_SS_USB_DEVICE_CAPABILITY: {
- struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap = NULL;
- libusb_get_ss_usb_device_capability_descriptor(NULL, dev_cap, &ss_usb_device_cap);
- if (ss_usb_device_cap) {
- printf(" USB 3.0 capabilities:\n");
- printf(" attributes : %02X\n", ss_usb_device_cap->bmAttributes);
- printf(" supported speeds : %04X\n", ss_usb_device_cap->wSpeedSupported);
- printf(" supported functionality: %02X\n", ss_usb_device_cap->bFunctionalitySupport);
- libusb_free_ss_usb_device_capability_descriptor(ss_usb_device_cap);
- }
- break;
- }
- case LIBUSB_BT_CONTAINER_ID: {
- struct libusb_container_id_descriptor *container_id = NULL;
- libusb_get_container_id_descriptor(NULL, dev_cap, &container_id);
- if (container_id) {
- printf(" Container ID:\n %s\n", uuid_to_string(container_id->ContainerID));
- libusb_free_container_id_descriptor(container_id);
- }
- break;
- }
- default:
- printf(" Unknown BOS device capability %02x:\n", dev_cap->bDevCapabilityType);
- }
-}
-
-static int test_device(uint16_t vid, uint16_t pid)
-{
- libusb_device_handle *handle;
- libusb_device *dev;
- uint8_t bus, port_path[8];
- struct libusb_bos_descriptor *bos_desc;
- struct libusb_config_descriptor *conf_desc;
- const struct libusb_endpoint_descriptor *endpoint;
- int i, j, k, r;
- int iface, nb_ifaces, first_iface = -1;
- struct libusb_device_descriptor dev_desc;
- const char* speed_name[5] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
- "480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)"};
- char string[128];
- uint8_t string_index[3]; // indexes of the string descriptors
- uint8_t endpoint_in = 0, endpoint_out = 0; // default IN and OUT endpoints
-
- printf("Opening device %04X:%04X...\n", vid, pid);
- handle = libusb_open_device_with_vid_pid(NULL, vid, pid);
-
- if (handle == NULL) {
- perr(" Failed.\n");
- return -1;
- }
-
- dev = libusb_get_device(handle);
- bus = libusb_get_bus_number(dev);
- if (extra_info) {
- r = libusb_get_port_numbers(dev, port_path, sizeof(port_path));
- if (r > 0) {
- printf("\nDevice properties:\n");
- printf(" bus number: %d\n", bus);
- printf(" port path: %d", port_path[0]);
- for (i=1; i<r; i++) {
- printf("->%d", port_path[i]);
- }
- printf(" (from root hub)\n");
- }
- r = libusb_get_device_speed(dev);
- if ((r<0) || (r>4)) r=0;
- printf(" speed: %s\n", speed_name[r]);
- }
-
- printf("\nReading device descriptor:\n");
- CALL_CHECK(libusb_get_device_descriptor(dev, &dev_desc));
- printf(" length: %d\n", dev_desc.bLength);
- printf(" device class: %d\n", dev_desc.bDeviceClass);
- printf(" S/N: %d\n", dev_desc.iSerialNumber);
- printf(" VID:PID: %04X:%04X\n", dev_desc.idVendor, dev_desc.idProduct);
- printf(" bcdDevice: %04X\n", dev_desc.bcdDevice);
- printf(" iMan:iProd:iSer: %d:%d:%d\n", dev_desc.iManufacturer, dev_desc.iProduct, dev_desc.iSerialNumber);
- printf(" nb confs: %d\n", dev_desc.bNumConfigurations);
- // Copy the string descriptors for easier parsing
- string_index[0] = dev_desc.iManufacturer;
- string_index[1] = dev_desc.iProduct;
- string_index[2] = dev_desc.iSerialNumber;
-
- printf("\nReading BOS descriptor: ");
- if (libusb_get_bos_descriptor(handle, &bos_desc) == LIBUSB_SUCCESS) {
- printf("%d caps\n", bos_desc->bNumDeviceCaps);
- for (i = 0; i < bos_desc->bNumDeviceCaps; i++)
- print_device_cap(bos_desc->dev_capability[i]);
- libusb_free_bos_descriptor(bos_desc);
- } else {
- printf("no descriptor\n");
- }
-
- printf("\nReading first configuration descriptor:\n");
- CALL_CHECK(libusb_get_config_descriptor(dev, 0, &conf_desc));
- nb_ifaces = conf_desc->bNumInterfaces;
- printf(" nb interfaces: %d\n", nb_ifaces);
- if (nb_ifaces > 0)
- first_iface = conf_desc->usb_interface[0].altsetting[0].bInterfaceNumber;
- for (i=0; i<nb_ifaces; i++) {
- printf(" interface[%d]: id = %d\n", i,
- conf_desc->usb_interface[i].altsetting[0].bInterfaceNumber);
- for (j=0; j<conf_desc->usb_interface[i].num_altsetting; j++) {
- printf("interface[%d].altsetting[%d]: num endpoints = %d\n",
- i, j, conf_desc->usb_interface[i].altsetting[j].bNumEndpoints);
- printf(" Class.SubClass.Protocol: %02X.%02X.%02X\n",
- conf_desc->usb_interface[i].altsetting[j].bInterfaceClass,
- conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass,
- conf_desc->usb_interface[i].altsetting[j].bInterfaceProtocol);
- if ( (conf_desc->usb_interface[i].altsetting[j].bInterfaceClass == LIBUSB_CLASS_MASS_STORAGE)
- && ( (conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass == 0x01)
- || (conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass == 0x06) )
- && (conf_desc->usb_interface[i].altsetting[j].bInterfaceProtocol == 0x50) ) {
- // Mass storage devices that can use basic SCSI commands
- test_mode = USE_SCSI;
- }
- for (k=0; k<conf_desc->usb_interface[i].altsetting[j].bNumEndpoints; k++) {
- struct libusb_ss_endpoint_companion_descriptor *ep_comp = NULL;
- endpoint = &conf_desc->usb_interface[i].altsetting[j].endpoint[k];
- printf(" endpoint[%d].address: %02X\n", k, endpoint->bEndpointAddress);
- // Use the first interrupt or bulk IN/OUT endpoints as default for testing
- if ((endpoint->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) & (LIBUSB_TRANSFER_TYPE_BULK | LIBUSB_TRANSFER_TYPE_INTERRUPT)) {
- if (endpoint->bEndpointAddress & LIBUSB_ENDPOINT_IN) {
- if (!endpoint_in)
- endpoint_in = endpoint->bEndpointAddress;
- } else {
- if (!endpoint_out)
- endpoint_out = endpoint->bEndpointAddress;
- }
- }
- printf(" max packet size: %04X\n", endpoint->wMaxPacketSize);
- printf(" polling interval: %02X\n", endpoint->bInterval);
- libusb_get_ss_endpoint_companion_descriptor(NULL, endpoint, &ep_comp);
- if (ep_comp) {
- printf(" max burst: %02X (USB 3.0)\n", ep_comp->bMaxBurst);
- printf(" bytes per interval: %04X (USB 3.0)\n", ep_comp->wBytesPerInterval);
- libusb_free_ss_endpoint_companion_descriptor(ep_comp);
- }
- }
- }
- }
- libusb_free_config_descriptor(conf_desc);
-
- libusb_set_auto_detach_kernel_driver(handle, 1);
- for (iface = 0; iface < nb_ifaces; iface++)
- {
- printf("\nClaiming interface %d...\n", iface);
- r = libusb_claim_interface(handle, iface);
- if (r != LIBUSB_SUCCESS) {
- perr(" Failed.\n");
- }
- }
-
- printf("\nReading string descriptors:\n");
- for (i=0; i<3; i++) {
- if (string_index[i] == 0) {
- continue;
- }
- if (libusb_get_string_descriptor_ascii(handle, string_index[i], (unsigned char*)string, 128) >= 0) {
- printf(" String (0x%02X): \"%s\"\n", string_index[i], string);
- }
- }
- // Read the OS String Descriptor
- if (libusb_get_string_descriptor_ascii(handle, 0xEE, (unsigned char*)string, 128) >= 0) {
- printf(" String (0x%02X): \"%s\"\n", 0xEE, string);
- // If this is a Microsoft OS String Descriptor,
- // attempt to read the WinUSB extended Feature Descriptors
- if (strncmp(string, "MSFT100", 7) == 0)
- read_ms_winsub_feature_descriptors(handle, string[7], first_iface);
- }
-
- switch(test_mode) {
- case USE_PS3:
- CALL_CHECK(display_ps3_status(handle));
- break;
- case USE_XBOX:
- CALL_CHECK(display_xbox_status(handle));
- CALL_CHECK(set_xbox_actuators(handle, 128, 222));
- msleep(2000);
- CALL_CHECK(set_xbox_actuators(handle, 0, 0));
- break;
- case USE_HID:
- test_hid(handle, endpoint_in);
- break;
- case USE_SCSI:
- CALL_CHECK(test_mass_storage(handle, endpoint_in, endpoint_out));
- case USE_GENERIC:
- break;
- }
-
- printf("\n");
- for (iface = 0; iface<nb_ifaces; iface++) {
- printf("Releasing interface %d...\n", iface);
- libusb_release_interface(handle, iface);
- }
-
- printf("Closing device...\n");
- libusb_close(handle);
-
- return 0;
-}
-
-int main(int argc, char** argv)
-{
- bool show_help = false;
- bool debug_mode = false;
- const struct libusb_version* version;
- int j, r;
- size_t i, arglen;
- unsigned tmp_vid, tmp_pid;
- uint16_t endian_test = 0xBE00;
- char* error_lang = NULL;
-
- // Default to generic, expecting VID:PID
- VID = 0;
- PID = 0;
- test_mode = USE_GENERIC;
-
- if (((uint8_t*)&endian_test)[0] == 0xBE) {
- printf("Despite their natural superiority for end users, big endian\n"
- "CPUs are not supported with this program, sorry.\n");
- return 0;
- }
-
- if (argc >= 2) {
- for (j = 1; j<argc; j++) {
- arglen = strlen(argv[j]);
- if ( ((argv[j][0] == '-') || (argv[j][0] == '/'))
- && (arglen >= 2) ) {
- switch(argv[j][1]) {
- case 'd':
- debug_mode = true;
- break;
- case 'i':
- extra_info = true;
- break;
- case 'b':
- if ((j+1 >= argc) || (argv[j+1][0] == '-') || (argv[j+1][0] == '/')) {
- printf(" Option -b requires a file name\n");
- return 1;
- }
- binary_name = argv[++j];
- binary_dump = true;
- break;
- case 'l':
- if ((j+1 >= argc) || (argv[j+1][0] == '-') || (argv[j+1][0] == '/')) {
- printf(" Option -l requires an ISO 639-1 language parameter\n");
- return 1;
- }
- error_lang = argv[++j];
- break;
- case 'j':
- // OLIMEX ARM-USB-TINY JTAG, 2 channel composite device - 2 interfaces
- if (!VID && !PID) {
- VID = 0x15BA;
- PID = 0x0004;
- }
- break;
- case 'k':
- // Generic 2 GB USB Key (SCSI Transparent/Bulk Only) - 1 interface
- if (!VID && !PID) {
- VID = 0x0204;
- PID = 0x6025;
- }
- break;
- // The following tests will force VID:PID if already provided
- case 'p':
- // Sony PS3 Controller - 1 interface
- VID = 0x054C;
- PID = 0x0268;
- test_mode = USE_PS3;
- break;
- case 's':
- // Microsoft Sidewinder Precision Pro Joystick - 1 HID interface
- VID = 0x045E;
- PID = 0x0008;
- test_mode = USE_HID;
- break;
- case 'x':
- // Microsoft XBox Controller Type S - 1 interface
- VID = 0x045E;
- PID = 0x0289;
- test_mode = USE_XBOX;
- break;
- default:
- show_help = true;
- break;
- }
- } else {
- for (i=0; i<arglen; i++) {
- if (argv[j][i] == ':')
- break;
- }
- if (i != arglen) {
- if (sscanf(argv[j], "%x:%x" , &tmp_vid, &tmp_pid) != 2) {
- printf(" Please specify VID & PID as \"vid:pid\" in hexadecimal format\n");
- return 1;
- }
- VID = (uint16_t)tmp_vid;
- PID = (uint16_t)tmp_pid;
- } else {
- show_help = true;
- }
- }
- }
- }
-
- if ((show_help) || (argc == 1) || (argc > 7)) {
- printf("usage: %s [-h] [-d] [-i] [-k] [-b file] [-l lang] [-j] [-x] [-s] [-p] [vid:pid]\n", argv[0]);
- printf(" -h : display usage\n");
- printf(" -d : enable debug output\n");
- printf(" -i : print topology and speed info\n");
- printf(" -j : test composite FTDI based JTAG device\n");
- printf(" -k : test Mass Storage device\n");
- printf(" -b file : dump Mass Storage data to file 'file'\n");
- printf(" -p : test Sony PS3 SixAxis controller\n");
- printf(" -s : test Microsoft Sidewinder Precision Pro (HID)\n");
- printf(" -x : test Microsoft XBox Controller Type S\n");
- printf(" -l lang : language to report errors in (ISO 639-1)\n");
- printf("If only the vid:pid is provided, xusb attempts to run the most appropriate test\n");
- return 0;
- }
-
- version = libusb_get_version();
- printf("Using libusbx v%d.%d.%d.%d\n\n", version->major, version->minor, version->micro, version->nano);
- r = libusb_init(NULL);
- if (r < 0)
- return r;
-
- libusb_set_debug(NULL, debug_mode?LIBUSB_LOG_LEVEL_DEBUG:LIBUSB_LOG_LEVEL_INFO);
- if (error_lang != NULL) {
- r = libusb_setlocale(error_lang);
- if (r < 0)
- printf("Invalid or unsupported locale '%s': %s\n", error_lang, libusb_strerror((enum libusb_error)r));
- }
-
- test_device(VID, PID);
-
- libusb_exit(NULL);
-
- return 0;
-}
diff --git a/third_party/libusb/src/libusb-1.0.pc.in b/third_party/libusb/src/libusb-1.0.pc.in
index 7bc33c1..f26babc 100644
--- a/third_party/libusb/src/libusb-1.0.pc.in
+++ b/third_party/libusb/src/libusb-1.0.pc.in
@@ -3,9 +3,10 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: libusbx-1.0
-Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD/NetBSD userspace
+Name: libusb-1.0
+Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace
Version: @VERSION@
Libs: -L${libdir} -lusb-1.0
-Libs.private: @LIBS@
+Libs.private: @PC_LIBS_PRIVATE@
Cflags: -I${includedir}/libusb-1.0
+
diff --git a/third_party/libusb/src/libusb/Makefile.am b/third_party/libusb/src/libusb/Makefile.am
index 7f9c1f9..3316ebc 100644
--- a/third_party/libusb/src/libusb/Makefile.am
+++ b/third_party/libusb/src/libusb/Makefile.am
@@ -1,39 +1,25 @@
-all: libusb-1.0.la libusb-1.0.dll
-
lib_LTLIBRARIES = libusb-1.0.la
-POSIX_POLL_SRC = os/poll_posix.c
LINUX_USBFS_SRC = os/linux_usbfs.c
DARWIN_USB_SRC = os/darwin_usb.c
OPENBSD_USB_SRC = os/openbsd_usb.c
-WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc libusb-1.0.def
-WINCE_USB_SRC = os/wince_usb.c os/wince_usb.h
+WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \
+ libusb-1.0.def
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \
- $(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \
- $(POSIX_POLL_SRC) \
- os/threads_posix.c os/threads_windows.c \
- os/linux_udev.c os/linux_netlink.c
+ $(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c
if OS_LINUX
-
-if USE_UDEV
-OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
- os/linux_udev.c
-else
-OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \
- os/linux_netlink.c
-endif
-
+OS_SRC = $(LINUX_USBFS_SRC)
endif
if OS_DARWIN
-OS_SRC = $(DARWIN_USB_SRC) $(POSIX_POLL_SRC)
+OS_SRC = $(DARWIN_USB_SRC)
AM_CFLAGS_EXT = -no-cpp-precomp
endif
if OS_OPENBSD
-OS_SRC = $(OPENBSD_USB_SRC) $(POSIX_POLL_SRC)
+OS_SRC = $(OPENBSD_USB_SRC)
endif
if OS_WINDOWS
@@ -42,13 +28,7 @@ OS_SRC = $(WINDOWS_USB_SRC)
.rc.lo:
$(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
-libusb-1.0.rc: version.h version_nano.h
-endif
-
-libusb-1.0.dll: libusb-1.0.def
-if CREATE_IMPORT_LIB
-# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
- $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
+libusb-1.0.rc: version.h
endif
if THREADS_POSIX
@@ -57,11 +37,12 @@ else
THREADS_SRC = os/threads_windows.h os/threads_windows.c
endif
-libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
+libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) $(THREAD_CFLAGS) \
+ -DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\"
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
-libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c strerror.c sync.c \
- os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h os/windows_common.h \
- hotplug.h hotplug.c $(THREADS_SRC) $(OS_SRC) \
+libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \
+ os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \
+ $(THREADS_SRC) \
os/poll_posix.h os/poll_windows.h
hdrdir = $(includedir)/libusb-1.0
diff --git a/third_party/libusb/src/libusb/core.c b/third_party/libusb/src/libusb/core.c
index e29e8df..767dcbf 100644
--- a/third_party/libusb/src/libusb/core.c
+++ b/third_party/libusb/src/libusb/core.c
@@ -1,9 +1,7 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
/*
- * Core functions for libusbx
- * Copyright © 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
- * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ * Core functions for libusb
+ * Copyright (C) 2007-2008 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
@@ -20,26 +18,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "config.h"
+#include <config.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef __ANDROID__
-#include <android/log.h>
-#endif
-
#include "libusbi.h"
-#include "hotplug.h"
#if defined(OS_LINUX)
const struct usbi_os_backend * const usbi_backend = &linux_usbfs_backend;
@@ -49,41 +41,38 @@ const struct usbi_os_backend * const usbi_backend = &darwin_backend;
const struct usbi_os_backend * const usbi_backend = &openbsd_backend;
#elif defined(OS_WINDOWS)
const struct usbi_os_backend * const usbi_backend = &windows_backend;
-#elif defined(OS_WINCE)
-const struct usbi_os_backend * const usbi_backend = &wince_backend;
#else
#error "Unsupported OS"
#endif
+const struct libusb_version libusb_version_internal = {
+ LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO, LIBUSB_RC,
+ LIBUSB_DESCRIBE
+};
+
struct libusb_context *usbi_default_context = NULL;
-const struct libusb_version libusb_version_internal =
- { LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO,
- LIBUSB_RC, "http://libusbx.org" };
static int default_context_refcnt = 0;
static usbi_mutex_static_t default_context_lock = USBI_MUTEX_INITIALIZER;
-static struct timeval timestamp_origin = { 0, 0 };
-
-usbi_mutex_static_t active_contexts_lock = USBI_MUTEX_INITIALIZER;
-struct list_head active_contexts_list;
/**
- * \mainpage libusbx-1.0 API Reference
+ * \mainpage libusb-1.0 API Reference
*
* \section intro Introduction
*
- * libusbx is an open source library that allows you to communicate with USB
+ * libusb is an open source library that allows you to communicate with USB
* devices from userspace. For more info, see the
- * <a href="http://libusbx.org">libusbx homepage</a>.
+ * <a href="http://libusb.sourceforge.net">libusb homepage</a>.
*
* This documentation is aimed at application developers wishing to
* communicate with USB peripherals from their own software. After reviewing
* this documentation, feedback and questions can be sent to the
- * <a href="http://mailing-list.libusbx.org">libusbx-devel mailing list</a>.
+ * <a href="http://sourceforge.net/mail/?group_id=1674">libusb-devel mailing
+ * list</a>.
*
* This documentation assumes knowledge of how to operate USB devices from
* a software standpoint (descriptors, configurations, interfaces, endpoints,
* control/bulk/interrupt/isochronous transfers, etc). Full information
- * can be found in the <a href="http://www.usb.org/developers/docs/">USB 3.0
+ * can be found in the <a href="http://www.usb.org/developers/docs/">USB 2.0
* Specification</a> which is available for free download. You can probably
* find less verbose introductions by searching the web.
*
@@ -97,71 +86,67 @@ struct list_head active_contexts_list;
* usually won't need to thread)
* - Lightweight with lean API
* - Compatible with libusb-0.1 through the libusb-compat-0.1 translation layer
- * - Hotplug support (on some platforms). See \ref hotplug.
*
* \section gettingstarted Getting Started
*
* To begin reading the API documentation, start with the Modules page which
- * links to the different categories of libusbx's functionality.
+ * links to the different categories of libusb's functionality.
*
* One decision you will have to make is whether to use the synchronous
* or the asynchronous data transfer interface. The \ref io documentation
* provides some insight into this topic.
*
- * Some example programs can be found in the libusbx source distribution under
- * the "examples" subdirectory. The libusbx homepage includes a list of
- * real-life project examples which use libusbx.
+ * Some example programs can be found in the libusb source distribution under
+ * the "examples" subdirectory. The libusb homepage includes a list of
+ * real-life project examples which use libusb.
*
* \section errorhandling Error handling
*
- * libusbx functions typically return 0 on success or a negative error code
+ * libusb functions typically return 0 on success or a negative error code
* on failure. These negative error codes relate to LIBUSB_ERROR constants
* which are listed on the \ref misc "miscellaneous" documentation page.
*
* \section msglog Debug message logging
*
- * libusbx uses stderr for all logging. By default, logging is set to NONE,
- * which means that no output will be produced. However, unless the library
- * has been compiled with logging disabled, then any application calls to
- * libusb_set_debug(), or the setting of the environmental variable
- * LIBUSB_DEBUG outside of the application, can result in logging being
- * produced. Your application should therefore not close stderr, but instead
- * direct it to the null device if its output is undesireable.
+ * libusb does not log any messages by default. Your application is therefore
+ * free to close stdout/stderr and those descriptors may be reused without
+ * worry.
*
- * The libusb_set_debug() function can be used to enable logging of certain
- * messages. Under standard configuration, libusbx doesn't really log much
- * so you are advised to use this function to enable all error/warning/
- * informational messages. It will help debug problems with your software.
+ * The libusb_set_debug() function can be used to enable stdout/stderr logging
+ * of certain messages. Under standard configuration, libusb doesn't really
+ * log much at all, so you are advised to use this function to enable all
+ * error/warning/informational messages. It will help you debug problems with
+ * your software.
*
* The logged messages are unstructured. There is no one-to-one correspondence
* between messages being logged and success or failure return codes from
- * libusbx functions. There is no format to the messages, so you should not
+ * libusb functions. There is no format to the messages, so you should not
* try to capture or parse them. They are not and will not be localized.
- * These messages are not intended to being passed to your application user;
- * instead, you should interpret the error codes returned from libusbx functions
+ * These messages are not suitable for being passed to your application user;
+ * instead, you should interpret the error codes returned from libusb functions
* and provide appropriate notification to the user. The messages are simply
* there to aid you as a programmer, and if you're confused because you're
- * getting a strange error code from a libusbx function, enabling message
+ * getting a strange error code from a libusb function, enabling message
* logging may give you a suitable explanation.
*
* The LIBUSB_DEBUG environment variable can be used to enable message logging
- * at run-time. This environment variable should be set to a log level number,
- * which is interpreted the same as the libusb_set_debug() parameter. When this
+ * at run-time. This environment variable should be set to a number, which is
+ * interpreted the same as the libusb_set_debug() parameter. When this
* environment variable is set, the message logging verbosity level is fixed
* and libusb_set_debug() effectively does nothing.
*
- * libusbx can be compiled without any logging functions, useful for embedded
+ * libusb can be compiled without any logging functions, useful for embedded
* systems. In this case, libusb_set_debug() and the LIBUSB_DEBUG environment
* variable have no effects.
*
- * libusbx can also be compiled with verbose debugging messages always. When
- * the library is compiled in this way, all messages of all verbosities are
- * always logged. libusb_set_debug() and the LIBUSB_DEBUG environment variable
- * have no effects.
+ * libusb can also be compiled with verbose debugging messages. When the
+ * library is compiled in this way, all messages of all verbosities are always
+ * logged. libusb_set_debug() and the LIBUSB_DEBUG environment variable have
+ * no effects.
*
* \section remarks Other remarks
*
- * libusbx does have imperfections. The \ref caveats "caveats" page attempts
+ * libusb does have imperfections. The \ref caveats "caveats" page attempts
* to document these.
*/
@@ -176,7 +161,7 @@ struct list_head active_contexts_list;
* reset).
*
* The problem is that any other program could reset the device your program
- * is working with, at any time. libusbx does not offer a mechanism to inform
+ * is working with, at any time. libusb does not offer a mechanism to inform
* you when this has happened, so if someone else resets your device it will
* not be clear to your own program why the device state has changed.
*
@@ -199,9 +184,22 @@ struct list_head active_contexts_list;
* - Clearing of halt/stall condition (libusb_clear_halt())
* - Device resets (libusb_reset_device())
*
+ * \section nohotplug No hotplugging
+ *
+ * libusb-1.0 lacks functionality for providing notifications of when devices
+ * are added or removed. This functionality is planned to be implemented
+ * for libusb-1.1.
+ *
+ * That said, there is basic disconnection handling for open device handles:
+ * - If there are ongoing transfers, libusb's handle_events loop will detect
+ * disconnections and complete ongoing transfers with the
+ * LIBUSB_TRANSFER_NO_DEVICE status code.
+ * - Many functions such as libusb_set_configuration() return the special
+ * LIBUSB_ERROR_NO_DEVICE error code when the device has been disconnected.
+ *
* \section configsel Configuration selection and handling
*
- * When libusbx presents a device handle to an application, there is a chance
+ * When libusb presents a device handle to an application, there is a chance
* that the corresponding device may be in unconfigured state. For devices
* with multiple configurations, there is also a chance that the configuration
* currently selected is not the one that the application wants to use.
@@ -212,13 +210,13 @@ struct list_head active_contexts_list;
* -# If the device is already in the desired configuration, calling
* libusb_set_configuration() using the same configuration value will cause
* a lightweight device reset. This may not be desirable behaviour.
- * -# libusbx will be unable to change configuration if the device is in
+ * -# libusb will be unable to change configuration if the device is in
* another configuration and other programs or drivers have claimed
* interfaces under that configuration.
- * -# In the case where the desired configuration is already active, libusbx
+ * -# In the case where the desired configuration is already active, libusb
* may not even be able to perform a lightweight device reset. For example,
* take my USB keyboard with fingerprint reader: I'm interested in driving
- * the fingerprint reader interface through libusbx, but the kernel's
+ * the fingerprint reader interface through libusb, but the kernel's
* USB-HID driver will almost always have claimed the keyboard interface.
* Because the kernel has claimed an interface, it is not even possible to
* perform the lightweight device reset, so libusb_set_configuration() will
@@ -258,23 +256,50 @@ if (cfg != desired)
* considerations apply to Darwin or other platforms.
*
* When a transfer completes early (i.e. when less data is received/sent in
- * any one packet than the transfer buffer allows for) then libusbx is designed
+ * any one packet than the transfer buffer allows for) then libusb is designed
* to terminate the transfer immediately, not transferring or receiving any
* more data unless other transfers have been queued by the user.
*
- * On legacy platforms, libusbx is unable to do this in all situations. After
- * the incomplete packet occurs, "surplus" data may be transferred. For recent
- * versions of libusbx, this information is kept (the data length of the
- * transfer is updated) and, for device-to-host transfers, any surplus data was
- * added to the buffer. Still, this is not a nice solution because it loses the
- * information about the end of the short packet, and the user probably wanted
- * that surplus data to arrive in the next logical transfer.
- *
+ * On legacy platforms, libusb is unable to do this in all situations. After
+ * the incomplete packet occurs, "surplus" data may be transferred. Prior to
+ * libusb v1.0.2, this information was lost (and for device-to-host transfers,
+ * the corresponding data was discarded). As of libusb v1.0.3, this information
+ * is kept (the data length of the transfer is updated) and, for device-to-host
+ * transfers, any surplus data was added to the buffer. Still, this is not
+ * a nice solution because it loses the information about the end of the short
+ * packet, and the user probably wanted that surplus data to arrive in the next
+ * logical transfer.
+ *
+ * A previous workaround was to only ever submit transfers of size 16kb or
+ * less.
+ *
+ * As of libusb v1.0.4 and Linux v2.6.32, this is fixed. A technical
+ * explanation of this issue follows.
+ *
+ * When you ask libusb to submit a bulk transfer larger than 16kb in size,
+ * libusb breaks it up into a number of smaller subtransfers. This is because
+ * the usbfs kernel interface only accepts transfers of up to 16kb in size.
+ * The subtransfers are submitted all at once so that the kernel can queue
+ * them at the hardware level, therefore maximizing bus throughput.
+ *
+ * On legacy platforms, this caused problems when transfers completed early.
+ * Upon this event, the kernel would terminate all further packets in that
+ * subtransfer (but not any following ones). libusb would note this event and
+ * immediately cancel any following subtransfers that had been queued,
+ * but often libusb was not fast enough, and the following subtransfers had
+ * started before libusb got around to cancelling them.
+ *
+ * Thanks to an API extension to usbfs, this is fixed with recent kernel and
+ * libusb releases. The solution was to allow libusb to communicate to the
+ * kernel where boundaries occur between logical libusb-level transfers. When
+ * a short transfer (or other error) occurs, the kernel will cancel all the
+ * subtransfers until the boundary without allowing those transfers to start.
*
* \section zlp Zero length packets
*
- * - libusbx is able to send a packet of zero length to an endpoint simply by
- * submitting a transfer of zero length.
+ * - libusb is able to send a packet of zero length to an endpoint simply by
+ * submitting a transfer of zero length. On Linux, this did not work with
+ * libusb versions prior to 1.0.3 and kernel versions prior to 2.6.31.
* - The \ref libusb_transfer_flags::LIBUSB_TRANSFER_ADD_ZERO_PACKET
* "LIBUSB_TRANSFER_ADD_ZERO_PACKET" flag is currently only supported on Linux.
*/
@@ -282,24 +307,24 @@ if (cfg != desired)
/**
* \page contexts Contexts
*
- * It is possible that libusbx may be used simultaneously from two independent
+ * It is possible that libusb may be used simultaneously from two independent
* libraries linked into the same executable. For example, if your application
* has a plugin-like system which allows the user to dynamically load a range
* of modules into your program, it is feasible that two independently
- * developed modules may both use libusbx.
+ * developed modules may both use libusb.
*
- * libusbx is written to allow for these multiple user scenarios. The two
- * "instances" of libusbx will not interfere: libusb_set_debug() calls
+ * libusb is written to allow for these multiple user scenarios. The two
+ * "instances" of libusb will not interfere: libusb_set_debug() calls
* from one user will not affect the same settings for other users, other
- * users can continue using libusbx after one of them calls libusb_exit(), etc.
+ * users can continue using libusb after one of them calls libusb_exit(), etc.
*
- * This is made possible through libusbx's <em>context</em> concept. When you
+ * This is made possible through libusb's <em>context</em> concept. When you
* call libusb_init(), you are (optionally) given a context. You can then pass
- * this context pointer back into future libusbx functions.
+ * this context pointer back into future libusb functions.
*
* In order to keep things simple for more simplistic applications, it is
* legal to pass NULL to all functions requiring a context pointer (as long as
- * you're sure no other code will attempt to use libusbx from the same process).
+ * you're sure no other code will attempt to use libusb from the same process).
* When you pass NULL, the default context will be used. The default context
* is created the first time a process calls libusb_init() when no other
* context is alive. Contexts are destroyed during libusb_exit().
@@ -312,17 +337,17 @@ if (cfg != desired)
* reference count goes from 0 to 1, and is deinitialized and destroyed when
* its reference count goes from 1 to 0.
*
- * You may be wondering why only a subset of libusbx functions require a
- * context pointer in their function definition. Internally, libusbx stores
+ * You may be wondering why only a subset of libusb functions require a
+ * context pointer in their function definition. Internally, libusb stores
* context pointers in other objects (e.g. libusb_device instances) and hence
* can infer the context from those objects.
*/
/**
* @defgroup lib Library initialization/deinitialization
- * This page details how to initialize and deinitialize libusbx. Initialization
- * must be performed before using any libusbx functionality, and similarly you
- * must not call any libusbx functions after deinitialization.
+ * This page details how to initialize and deinitialize libusb. Initialization
+ * must be performed before using any libusb functionality, and similarly you
+ * must not call any libusb functions after deinitialization.
*/
/**
@@ -379,7 +404,7 @@ libusb_free_device_list(list, 1);
* device.
*
* \section devshandles Devices and device handles
- * libusbx has a concept of a USB device, represented by the
+ * libusb has a concept of a USB device, represented by the
* \ref libusb_device opaque type. A device represents a USB device that
* is currently or was previously connected to the system. Using a reference
* to a device, you can determine certain information about the device (e.g.
@@ -395,8 +420,8 @@ libusb_free_device_list(list, 1);
* using the device.
*
* When you've found a device that you'd like to operate, you must ask
- * libusbx to open the device using the libusb_open() function. Assuming
- * success, libusbx then returns you a <em>device handle</em>
+ * libusb to open the device using the libusb_open() function. Assuming
+ * success, libusb then returns you a <em>device handle</em>
* (a \ref libusb_device_handle pointer). All "real" I/O operations then
* operate on the handle rather than the original device pointer.
*
@@ -404,10 +429,10 @@ libusb_free_device_list(list, 1);
*
* Device discovery (i.e. calling libusb_get_device_list()) returns a
* freshly-allocated list of devices. The list itself must be freed when
- * you are done with it. libusbx also needs to know when it is OK to free
+ * you are done with it. libusb also needs to know when it is OK to free
* the contents of the list - the devices themselves.
*
- * To handle these issues, libusbx provides you with two separate items:
+ * To handle these issues, libusb provides you with two separate items:
* - A function to free the list itself
* - A reference counting system for the devices inside
*
@@ -475,7 +500,7 @@ struct discovered_devs *discovered_devs_append(
/* exceeded capacity, need to grow */
usbi_dbg("need to increase capacity");
capacity = discdevs->capacity + DISCOVERED_DEVICES_SIZE_STEP;
- discdevs = usbi_reallocf(discdevs,
+ discdevs = realloc(discdevs,
sizeof(*discdevs) + (sizeof(void *) * capacity));
if (discdevs) {
discdevs->capacity = capacity;
@@ -518,66 +543,12 @@ struct libusb_device *usbi_alloc_device(struct libusb_context *ctx,
dev->refcnt = 1;
dev->session_data = session_id;
dev->speed = LIBUSB_SPEED_UNKNOWN;
-
- if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- usbi_connect_device (dev);
- }
-
- return dev;
-}
-
-void usbi_connect_device(struct libusb_device *dev)
-{
- libusb_hotplug_message message;
- ssize_t ret;
-
- memset(&message, 0, sizeof(message));
- message.event = LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED;
- message.device = dev;
- dev->attached = 1;
-
- usbi_mutex_lock(&dev->ctx->usb_devs_lock);
- list_add(&dev->list, &dev->ctx->usb_devs);
- usbi_mutex_unlock(&dev->ctx->usb_devs_lock);
-
- /* Signal that an event has occurred for this device if we support hotplug AND
- * the hotplug pipe is ready. This prevents an event from getting raised during
- * initial enumeration. */
- if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_pipe[1] > 0) {
- ret = usbi_write(dev->ctx->hotplug_pipe[1], &message, sizeof(message));
- if (sizeof (message) != ret) {
- usbi_err(DEVICE_CTX(dev), "error writing hotplug message");
- }
- }
-}
-
-void usbi_disconnect_device(struct libusb_device *dev)
-{
- libusb_hotplug_message message;
- struct libusb_context *ctx = dev->ctx;
- ssize_t ret;
-
- memset(&message, 0, sizeof(message));
- message.event = LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT;
- message.device = dev;
- usbi_mutex_lock(&dev->lock);
- dev->attached = 0;
- usbi_mutex_unlock(&dev->lock);
-
- /* Signal that an event has occurred for this device if we support hotplug AND
- * the hotplug pipe is ready. This prevents an event from getting raised during
- * initial enumeration. libusb_handle_events will take care of dereferencing the
- * device. */
- if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && dev->ctx->hotplug_pipe[1] > 0) {
- ret = usbi_write(dev->ctx->hotplug_pipe[1], &message, sizeof(message));
- if (sizeof(message) != ret) {
- usbi_err(DEVICE_CTX(dev), "error writing hotplug message");
- }
- }
+ memset(&dev->os_priv, 0, priv_size);
usbi_mutex_lock(&ctx->usb_devs_lock);
- list_del(&dev->list);
+ list_add(&dev->list, &ctx->usb_devs);
usbi_mutex_unlock(&ctx->usb_devs_lock);
+ return dev;
}
/* Perform some final sanity checks on a newly discovered device. If this
@@ -586,13 +557,15 @@ void usbi_disconnect_device(struct libusb_device *dev)
int usbi_sanitize_device(struct libusb_device *dev)
{
int r;
+ unsigned char raw_desc[DEVICE_DESC_LENGTH];
uint8_t num_configurations;
+ int host_endian;
- r = usbi_device_cache_descriptor(dev);
+ r = usbi_backend->get_device_descriptor(dev, raw_desc, &host_endian);
if (r < 0)
return r;
- num_configurations = dev->device_descriptor.bNumConfigurations;
+ num_configurations = raw_desc[DEVICE_DESC_LENGTH - 1];
if (num_configurations > USB_MAXCONFIG) {
usbi_err(DEVICE_CTX(dev), "too many configurations");
return LIBUSB_ERROR_IO;
@@ -603,7 +576,7 @@ int usbi_sanitize_device(struct libusb_device *dev)
return 0;
}
-/* Examine libusbx's internal list of known devices, looking for one with
+/* Examine libusb's internal list of known devices, looking for one with
* a specific session ID. Returns the matching device if it was found, and
* NULL otherwise. */
struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
@@ -640,7 +613,7 @@ struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
* \param ctx the context to operate on, or NULL for the default context
* \param list output location for a list of devices. Must be later freed with
* libusb_free_device_list().
- * \returns the number of devices in the outputted list, or any
+ * \returns The number of devices in the outputted list, or any
* \ref libusb_error according to errors encountered by the backend.
*/
ssize_t API_EXPORTED libusb_get_device_list(libusb_context *ctx,
@@ -656,28 +629,7 @@ ssize_t API_EXPORTED libusb_get_device_list(libusb_context *ctx,
if (!discdevs)
return LIBUSB_ERROR_NO_MEM;
- if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- /* backend provides hotplug support */
- struct libusb_device *dev;
-
- if (usbi_backend->hotplug_poll)
- usbi_backend->hotplug_poll();
-
- usbi_mutex_lock(&ctx->usb_devs_lock);
- list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device) {
- discdevs = discovered_devs_append(discdevs, dev);
-
- if (!discdevs) {
- r = LIBUSB_ERROR_NO_MEM;
- break;
- }
- }
- usbi_mutex_unlock(&ctx->usb_devs_lock);
- } else {
- /* backend does not provide hotplug support */
- r = usbi_backend->get_device_list(ctx, &discdevs);
- }
-
+ r = usbi_backend->get_device_list(ctx, &discdevs);
if (r < 0) {
len = r;
goto out;
@@ -685,7 +637,7 @@ ssize_t API_EXPORTED libusb_get_device_list(libusb_context *ctx,
/* convert discovered_devs into a list */
len = discdevs->len;
- ret = calloc(len + 1, sizeof(struct libusb_device *));
+ ret = malloc(sizeof(void *) * (len + 1));
if (!ret) {
len = LIBUSB_ERROR_NO_MEM;
goto out;
@@ -737,87 +689,6 @@ uint8_t API_EXPORTED libusb_get_bus_number(libusb_device *dev)
}
/** \ingroup dev
- * Get the number of the port that a device is connected to.
- * Unless the OS does something funky, or you are hot-plugging USB extension cards,
- * the port number returned by this call is usually guaranteed to be uniquely tied
- * to a physical port, meaning that different devices plugged on the same physical
- * port should return the same port number.
- *
- * But outside of this, there is no guarantee that the port number returned by this
- * call will remain the same, or even match the order in which ports have been
- * numbered by the HUB/HCD manufacturer.
- *
- * \param dev a device
- * \returns the port number (0 if not available)
- */
-uint8_t API_EXPORTED libusb_get_port_number(libusb_device *dev)
-{
- return dev->port_number;
-}
-
-/** \ingroup dev
- * Get the list of all port numbers from root for the specified device
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- * \param dev a device
- * \param port_numbers the array that should contain the port numbers
- * \param port_numbers_len the maximum length of the array. As per the USB 3.0
- * specs, the current maximum limit for the depth is 7.
- * \returns the number of elements filled
- * \returns LIBUSB_ERROR_OVERFLOW if the array is too small
- */
-int API_EXPORTED libusb_get_port_numbers(libusb_device *dev,
- uint8_t* port_numbers, int port_numbers_len)
-{
- int i = port_numbers_len;
-
- while(dev) {
- // HCDs can be listed as devices and would have port #0
- // TODO: see how the other backends want to implement HCDs as parents
- if (dev->port_number == 0)
- break;
- i--;
- if (i < 0) {
- usbi_warn(DEVICE_CTX(dev),
- "port numbers array too small");
- return LIBUSB_ERROR_OVERFLOW;
- }
- port_numbers[i] = dev->port_number;
- dev = dev->parent_dev;
- }
- memmove(port_numbers, &port_numbers[i], port_numbers_len - i);
- return port_numbers_len - i;
-}
-
-/** \ingroup dev
- * Deprecated please use libusb_get_port_numbers instead.
- */
-int API_EXPORTED libusb_get_port_path(libusb_context *ctx, libusb_device *dev,
- uint8_t* port_numbers, uint8_t port_numbers_len)
-{
- UNUSED(ctx);
-
- return libusb_get_port_numbers(dev, port_numbers, port_numbers_len);
-}
-
-/** \ingroup dev
- * Get the the parent from the specified device.
- * \param dev a device
- * \returns the device parent or NULL if not available
- * You should issue a \ref libusb_get_device_list() before calling this
- * function and make sure that you only access the parent before issuing
- * \ref libusb_free_device_list(). The reason is that libusbx currently does
- * not maintain a permanent list of device instances, and therefore can
- * only guarantee that parents are fully instantiated within a
- * libusb_get_device_list() - libusb_free_device_list() block.
- */
-DEFAULT_VISIBILITY
-libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev)
-{
- return dev->parent_dev;
-}
-
-/** \ingroup dev
* Get the address of the device on the bus it is connected to.
* \param dev a device
* \returns the device address
@@ -906,7 +777,7 @@ int API_EXPORTED libusb_get_max_packet_size(libusb_device *dev,
* Calculate the maximum packet size which a specific endpoint is capable is
* sending or receiving in the duration of 1 microframe
*
- * Only the active configuration is examined. The calculation is based on the
+ * Only the active configution is examined. The calculation is based on the
* wMaxPacketSize field in the endpoint descriptor as described in section
* 9.6.6 in the USB 2.0 specifications.
*
@@ -949,7 +820,7 @@ int API_EXPORTED libusb_get_max_iso_packet_size(libusb_device *dev,
return LIBUSB_ERROR_NOT_FOUND;
val = ep->wMaxPacketSize;
- ep_type = (enum libusb_transfer_type) (ep->bmAttributes & 0x3);
+ ep_type = ep->bmAttributes & 0x3;
libusb_free_config_descriptor(config);
r = val & 0x07ff;
@@ -992,15 +863,12 @@ void API_EXPORTED libusb_unref_device(libusb_device *dev)
if (refcnt == 0) {
usbi_dbg("destroy device %d.%d", dev->bus_number, dev->device_address);
- libusb_unref_device(dev->parent_dev);
-
if (usbi_backend->destroy_device)
usbi_backend->destroy_device(dev);
- if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- /* backend does not support hotplug */
- usbi_disconnect_device(dev);
- }
+ usbi_mutex_lock(&dev->ctx->usb_devs_lock);
+ list_del(&dev->list);
+ usbi_mutex_unlock(&dev->ctx->usb_devs_lock);
usbi_mutex_destroy(&dev->lock);
free(dev);
@@ -1079,10 +947,6 @@ int API_EXPORTED libusb_open(libusb_device *dev,
int r;
usbi_dbg("open %d.%d", dev->bus_number, dev->device_address);
- if (!dev->attached) {
- return LIBUSB_ERROR_NO_DEVICE;
- }
-
_handle = malloc(sizeof(*_handle) + priv_size);
if (!_handle)
return LIBUSB_ERROR_NO_MEM;
@@ -1094,7 +958,6 @@ int API_EXPORTED libusb_open(libusb_device *dev,
}
_handle->dev = libusb_ref_device(dev);
- _handle->auto_detach_kernel_driver = 0;
_handle->claimed_interfaces = 0;
memset(&_handle->os_priv, 0, priv_size);
@@ -1115,7 +978,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
/* At this point, we want to interrupt any existing event handlers so
* that they realise the addition of the new device's poll fd. One
* example when this is desirable is if the user is running a separate
- * dedicated libusbx events handling thread, which is running with a long
+ * dedicated libusb events handling thread, which is running with a long
* or infinite timeout. We want to interrupt that iteration of the loop,
* so that it picks up the new fd, and then continues. */
usbi_fd_notification(ctx);
@@ -1126,7 +989,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
/** \ingroup dev
* Convenience function for finding a device with a particular
* <tt>idVendor</tt>/<tt>idProduct</tt> combination. This function is intended
- * for those scenarios where you are using libusbx to knock up a quick test
+ * for those scenarios where you are using libusb to knock up a quick test
* application - it allows you to avoid calling libusb_get_device_list() and
* worrying about traversing/freeing the list.
*
@@ -1189,7 +1052,7 @@ static void do_close(struct libusb_context *ctx,
/* safe iteration because transfers may be being deleted */
list_for_each_entry_safe(itransfer, tmp, &ctx->flying_transfers, list, struct usbi_transfer) {
struct libusb_transfer *transfer =
- USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
+ USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
if (transfer->dev_handle != dev_handle)
continue;
@@ -1377,14 +1240,7 @@ int API_EXPORTED libusb_get_configuration(libusb_device_handle *dev,
* endpoint halts cleared, toggles reset).
*
* You cannot change/reset configuration if your application has claimed
- * interfaces. It is advised to set the desired configuration before claiming
- * interfaces.
- *
- * Alternatively you can call libusb_release_interface() first. Note if you
- * do things this way you must ensure that auto_detach_kernel_driver for
- * <tt>dev</tt> is 0, otherwise the kernel driver will be re-attached when you
- * release the interface(s).
- *
+ * interfaces - you should free them with libusb_release_interface() first.
* You cannot change/reset configuration if other applications or drivers have
* claimed interfaces.
*
@@ -1406,7 +1262,6 @@ int API_EXPORTED libusb_get_configuration(libusb_device_handle *dev,
* \returns LIBUSB_ERROR_BUSY if interfaces are currently claimed
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failure
- * \see libusb_set_auto_detach_kernel_driver()
*/
int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev,
int configuration)
@@ -1420,10 +1275,7 @@ int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev,
* you wish to use before you can perform I/O on any of its endpoints.
*
* It is legal to attempt to claim an already-claimed interface, in which
- * case libusbx just returns 0 without doing anything.
- *
- * If auto_detach_kernel_driver is set to 1 for <tt>dev</tt>, the kernel driver
- * will be detached if necessary, on failure the detach error is returned.
+ * case libusb just returns 0 without doing anything.
*
* Claiming of interfaces is a purely logical operation; it does not cause
* any requests to be sent over the bus. Interface claiming is used to
@@ -1441,7 +1293,6 @@ int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev,
* interface
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns a LIBUSB_ERROR code on other failure
- * \see libusb_set_auto_detach_kernel_driver()
*/
int API_EXPORTED libusb_claim_interface(libusb_device_handle *dev,
int interface_number)
@@ -1452,9 +1303,6 @@ int API_EXPORTED libusb_claim_interface(libusb_device_handle *dev,
if (interface_number >= USB_MAXINTERFACES)
return LIBUSB_ERROR_INVALID_PARAM;
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
usbi_mutex_lock(&dev->lock);
if (dev->claimed_interfaces & (1 << interface_number))
goto out;
@@ -1475,9 +1323,6 @@ out:
* This is a blocking function. A SET_INTERFACE control request will be sent
* to the device, resetting interface state to the first alternate setting.
*
- * If auto_detach_kernel_driver is set to 1 for <tt>dev</tt>, the kernel
- * driver will be re-attached after releasing the interface.
- *
* \param dev a device handle
* \param interface_number the <tt>bInterfaceNumber</tt> of the
* previously-claimed interface
@@ -1485,7 +1330,6 @@ out:
* \returns LIBUSB_ERROR_NOT_FOUND if the interface was not claimed
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failure
- * \see libusb_set_auto_detach_kernel_driver()
*/
int API_EXPORTED libusb_release_interface(libusb_device_handle *dev,
int interface_number)
@@ -1541,11 +1385,6 @@ int API_EXPORTED libusb_set_interface_alt_setting(libusb_device_handle *dev,
return LIBUSB_ERROR_INVALID_PARAM;
usbi_mutex_lock(&dev->lock);
- if (!dev->dev->attached) {
- usbi_mutex_unlock(&dev->lock);
- return LIBUSB_ERROR_NO_DEVICE;
- }
-
if (!(dev->claimed_interfaces & (1 << interface_number))) {
usbi_mutex_unlock(&dev->lock);
return LIBUSB_ERROR_NOT_FOUND;
@@ -1576,9 +1415,6 @@ int API_EXPORTED libusb_clear_halt(libusb_device_handle *dev,
unsigned char endpoint)
{
usbi_dbg("endpoint %x", endpoint);
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
return usbi_backend->clear_halt(dev, endpoint);
}
@@ -1604,15 +1440,12 @@ int API_EXPORTED libusb_clear_halt(libusb_device_handle *dev,
int API_EXPORTED libusb_reset_device(libusb_device_handle *dev)
{
usbi_dbg("");
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
return usbi_backend->reset_device(dev);
}
/** \ingroup dev
* Determine if a kernel driver is active on an interface. If a kernel driver
- * is active, you cannot claim the interface, and libusbx will be unable to
+ * is active, you cannot claim the interface, and libusb will be unable to
* perform I/O.
*
* This functionality is not available on Windows.
@@ -1631,10 +1464,6 @@ int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev,
int interface_number)
{
usbi_dbg("interface %d", interface_number);
-
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
if (usbi_backend->kernel_driver_active)
return usbi_backend->kernel_driver_active(dev, interface_number);
else
@@ -1647,10 +1476,6 @@ int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev,
*
* This functionality is not available on Darwin or Windows.
*
- * Note that libusbx itself also talks to the device through a special kernel
- * driver, if this driver is already attached to the device, this call will
- * not detach it and return LIBUSB_ERROR_NOT_FOUND.
- *
* \param dev a device handle
* \param interface_number the interface to detach the driver from
* \returns 0 on success
@@ -1666,10 +1491,6 @@ int API_EXPORTED libusb_detach_kernel_driver(libusb_device_handle *dev,
int interface_number)
{
usbi_dbg("interface %d", interface_number);
-
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
if (usbi_backend->detach_kernel_driver)
return usbi_backend->detach_kernel_driver(dev, interface_number);
else
@@ -1700,68 +1521,36 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev,
int interface_number)
{
usbi_dbg("interface %d", interface_number);
-
- if (!dev->dev->attached)
- return LIBUSB_ERROR_NO_DEVICE;
-
if (usbi_backend->attach_kernel_driver)
return usbi_backend->attach_kernel_driver(dev, interface_number);
else
return LIBUSB_ERROR_NOT_SUPPORTED;
}
-/** \ingroup dev
- * Enable/disable libusbx's automatic kernel driver detachment. When this is
- * enabled libusbx will automatically detach the kernel driver on an interface
- * when claiming the interface, and attach it when releasing the interface.
- *
- * Automatic kernel driver detachment is disabled on newly opened device
- * handles by default.
- *
- * On platforms which do not have LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
- * this function will return LIBUSB_ERROR_NOT_SUPPORTED, and libusbx will
- * continue as if this function was never called.
- *
- * \param dev a device handle
- * \param enable whether to enable or disable auto kernel driver detachment
- *
- * \returns LIBUSB_SUCCESS on success
- * \returns LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality
- * is not available
- * \see libusb_claim_interface()
- * \see libusb_release_interface()
- * \see libusb_set_configuration()
- */
-int API_EXPORTED libusb_set_auto_detach_kernel_driver(
- libusb_device_handle *dev, int enable)
-{
- if (!(usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER))
- return LIBUSB_ERROR_NOT_SUPPORTED;
-
- dev->auto_detach_kernel_driver = enable;
- return LIBUSB_SUCCESS;
-}
-
/** \ingroup lib
- * Set log message verbosity.
- *
- * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever
- * printed. If you choose to increase the message verbosity level, ensure
- * that your application does not close the stdout/stderr file descriptors.
- *
- * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusbx is conservative
- * with its message logging and most of the time, will only log messages that
- * explain error conditions and other oddities. This will help you debug
- * your software.
- *
- * If the LIBUSB_DEBUG environment variable was set when libusbx was
+ * Set message verbosity.
+ * - Level 0: no messages ever printed by the library (default)
+ * - Level 1: error messages are printed to stderr
+ * - Level 2: warning and error messages are printed to stderr
+ * - Level 3: informational messages are printed to stdout, warning and error
+ * messages are printed to stderr
+ *
+ * The default level is 0, which means no messages are ever printed. If you
+ * choose to increase the message verbosity level, ensure that your
+ * application does not close the stdout/stderr file descriptors.
+ *
+ * You are advised to set level 3. libusb is conservative with its message
+ * logging and most of the time, will only log messages that explain error
+ * conditions and other oddities. This will help you debug your software.
+ *
+ * If the LIBUSB_DEBUG environment variable was set when libusb was
* initialized, this function does nothing: the message verbosity is fixed
* to the value in the environment variable.
*
- * If libusbx was compiled without any message logging, this function does
+ * If libusb was compiled without any message logging, this function does
* nothing: you'll never get any messages.
*
- * If libusbx was compiled with verbose debug message logging, this function
+ * If libusb was compiled with verbose debug message logging, this function
* does nothing: you'll always get messages from all levels.
*
* \param ctx the context to operate on, or NULL for the default context
@@ -1776,7 +1565,7 @@ void API_EXPORTED libusb_set_debug(libusb_context *ctx, int level)
/** \ingroup lib
* Initialize libusb. This function must be called before calling any other
- * libusbx function.
+ * libusb function.
*
* If you do not provide an output location for a context pointer, a default
* context will be created. If there was already a default context, it will
@@ -1789,18 +1578,11 @@ void API_EXPORTED libusb_set_debug(libusb_context *ctx, int level)
*/
int API_EXPORTED libusb_init(libusb_context **context)
{
- struct libusb_device *dev, *next;
char *dbg = getenv("LIBUSB_DEBUG");
struct libusb_context *ctx;
- static int first_init = 1;
int r = 0;
usbi_mutex_static_lock(&default_context_lock);
-
- if (!timestamp_origin.tv_sec) {
- usbi_gettimeofday(&timestamp_origin, NULL);
- }
-
if (!context && usbi_default_context) {
usbi_dbg("reusing default context");
default_context_refcnt++;
@@ -1808,15 +1590,12 @@ int API_EXPORTED libusb_init(libusb_context **context)
return 0;
}
- ctx = calloc(1, sizeof(*ctx));
+ ctx = malloc(sizeof(*ctx));
if (!ctx) {
r = LIBUSB_ERROR_NO_MEM;
goto err_unlock;
}
-
-#ifdef ENABLE_DEBUG_LOGGING
- ctx->debug = LIBUSB_LOG_LEVEL_DEBUG;
-#endif
+ memset(ctx, 0, sizeof(*ctx));
if (dbg) {
ctx->debug = atoi(dbg);
@@ -1824,70 +1603,47 @@ int API_EXPORTED libusb_init(libusb_context **context)
ctx->debug_fixed = 1;
}
- /* default context should be initialized before calling usbi_dbg */
- if (!usbi_default_context) {
- usbi_default_context = ctx;
- default_context_refcnt++;
- usbi_dbg("created default context");
- }
+ usbi_dbg("libusb-%d.%d.%d%s%s%s",
+ libusb_version_internal.major,
+ libusb_version_internal.minor,
+ libusb_version_internal.micro,
+ libusb_version_internal.rc,
+ libusb_version_internal.describe[0] ? " git:" : "",
+ libusb_version_internal.describe);
- usbi_dbg("libusbx v%d.%d.%d.%d", libusb_version_internal.major, libusb_version_internal.minor,
- libusb_version_internal.micro, libusb_version_internal.nano);
+ if (usbi_backend->init) {
+ r = usbi_backend->init(ctx);
+ if (r)
+ goto err_free_ctx;
+ }
usbi_mutex_init(&ctx->usb_devs_lock, NULL);
usbi_mutex_init(&ctx->open_devs_lock, NULL);
- usbi_mutex_init(&ctx->hotplug_cbs_lock, NULL);
list_init(&ctx->usb_devs);
list_init(&ctx->open_devs);
- list_init(&ctx->hotplug_cbs);
- usbi_mutex_static_lock(&active_contexts_lock);
- if (first_init) {
- first_init = 0;
- list_init (&active_contexts_list);
+ r = usbi_io_init(ctx);
+ if (r < 0) {
+ if (usbi_backend->exit)
+ usbi_backend->exit();
+ goto err_destroy_mutex;
}
- list_add (&ctx->list, &active_contexts_list);
- usbi_mutex_static_unlock(&active_contexts_lock);
- if (usbi_backend->init) {
- r = usbi_backend->init(ctx);
- if (r)
- goto err_free_ctx;
+ if (context) {
+ *context = ctx;
+ } else if (!usbi_default_context) {
+ usbi_dbg("created default context");
+ usbi_default_context = ctx;
+ default_context_refcnt++;
}
-
- r = usbi_io_init(ctx);
- if (r < 0)
- goto err_backend_exit;
-
usbi_mutex_static_unlock(&default_context_lock);
- if (context)
- *context = ctx;
-
return 0;
-err_backend_exit:
- if (usbi_backend->exit)
- usbi_backend->exit();
-err_free_ctx:
- if (ctx == usbi_default_context)
- usbi_default_context = NULL;
-
+err_destroy_mutex:
usbi_mutex_destroy(&ctx->open_devs_lock);
usbi_mutex_destroy(&ctx->usb_devs_lock);
- usbi_mutex_destroy(&ctx->hotplug_cbs_lock);
-
- usbi_mutex_static_lock(&active_contexts_lock);
- list_del (&ctx->list);
- usbi_mutex_static_unlock(&active_contexts_lock);
-
- usbi_mutex_lock(&ctx->usb_devs_lock);
- list_for_each_entry_safe(dev, next, &ctx->usb_devs, list, struct libusb_device) {
- list_del(&dev->list);
- libusb_unref_device(dev);
- }
- usbi_mutex_unlock(&ctx->usb_devs_lock);
-
+err_free_ctx:
free(ctx);
err_unlock:
usbi_mutex_static_unlock(&default_context_lock);
@@ -1901,15 +1657,13 @@ err_unlock:
*/
void API_EXPORTED libusb_exit(struct libusb_context *ctx)
{
- struct libusb_device *dev, *next;
-
usbi_dbg("");
USBI_GET_CONTEXT(ctx);
/* if working with default context, only actually do the deinitialization
* if we're the last user */
- usbi_mutex_static_lock(&default_context_lock);
if (ctx == usbi_default_context) {
+ usbi_mutex_static_lock(&default_context_lock);
if (--default_context_refcnt > 0) {
usbi_dbg("not destroying default context");
usbi_mutex_static_unlock(&default_context_lock);
@@ -1917,27 +1671,11 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx)
}
usbi_dbg("destroying default context");
usbi_default_context = NULL;
- }
- usbi_mutex_static_unlock(&default_context_lock);
-
- usbi_mutex_static_lock(&active_contexts_lock);
- list_del (&ctx->list);
- usbi_mutex_static_unlock(&active_contexts_lock);
-
- if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- usbi_hotplug_deregister_all(ctx);
- usbi_mutex_lock(&ctx->usb_devs_lock);
- list_for_each_entry_safe(dev, next, &ctx->usb_devs, list, struct libusb_device) {
- list_del(&dev->list);
- libusb_unref_device(dev);
- }
- usbi_mutex_unlock(&ctx->usb_devs_lock);
+ usbi_mutex_static_unlock(&default_context_lock);
}
- /* a few sanity checks. don't bother with locking because unless
- * there is an application bug, nobody will be accessing these. */
- if (!list_empty(&ctx->usb_devs))
- usbi_warn(ctx, "some libusb_devices were leaked");
+ /* a little sanity check. doesn't bother with open_devs locking because
+ * unless there is an application bug, nobody will be accessing this. */
if (!list_empty(&ctx->open_devs))
usbi_warn(ctx, "application left some devices open");
@@ -1947,29 +1685,21 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx)
usbi_mutex_destroy(&ctx->open_devs_lock);
usbi_mutex_destroy(&ctx->usb_devs_lock);
- usbi_mutex_destroy(&ctx->hotplug_cbs_lock);
free(ctx);
}
/** \ingroup misc
* Check at runtime if the loaded library has a given capability.
- * This call should be performed after \ref libusb_init(), to ensure the
- * backend has updated its capability set.
*
* \param capability the \ref libusb_capability to check for
- * \returns nonzero if the running library has the capability, 0 otherwise
+ * \returns 1 if the running library has the capability, 0 otherwise
*/
int API_EXPORTED libusb_has_capability(uint32_t capability)
{
- switch (capability) {
+ enum libusb_capability cap = capability;
+ switch (cap) {
case LIBUSB_CAP_HAS_CAPABILITY:
return 1;
- case LIBUSB_CAP_HAS_HOTPLUG:
- return !(usbi_backend->get_device_list);
- case LIBUSB_CAP_HAS_HID_ACCESS:
- return (usbi_backend->caps & USBI_CAP_HAS_HID_ACCESS);
- case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER:
- return (usbi_backend->caps & USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER);
}
return 0;
}
@@ -2002,152 +1732,85 @@ int API_EXPORTED libusb_has_capability(uint32_t capability)
#define _W32_FT_OFFSET (116444736000000000)
int usbi_gettimeofday(struct timeval *tp, void *tzp)
-{
- union {
- unsigned __int64 ns100; /* Time since 1 Jan 1601, in 100ns units */
- FILETIME ft;
- } _now;
- UNUSED(tzp);
-
- if(tp) {
-#if defined(OS_WINCE)
- SYSTEMTIME st;
- GetSystemTime(&st);
- SystemTimeToFileTime(&st, &_now.ft);
-#else
- GetSystemTimeAsFileTime (&_now.ft);
-#endif
- tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
- tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
- }
- /* Always return 0 as per Open Group Base Specifications Issue 6.
- Do not set errno on error. */
- return 0;
+ {
+ union {
+ unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
+ FILETIME ft;
+ } _now;
+
+ if(tp)
+ {
+ GetSystemTimeAsFileTime (&_now.ft);
+ tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
+ tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
+ }
+ /* Always return 0 as per Open Group Base Specifications Issue 6.
+ Do not set errno on error. */
+ return 0;
}
#endif
-static void usbi_log_str(struct libusb_context *ctx, const char * str)
-{
- UNUSED(ctx);
- fputs(str, stderr);
-}
-
-void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
+void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, va_list args)
{
- const char *prefix = "";
- char buf[USBI_MAX_LOG_LEN];
+ FILE *stream = stdout;
+ const char *prefix;
struct timeval now;
- int global_debug, header_len, text_len;
- static int has_debug_header_been_displayed = 0;
+ static struct timeval first = { 0, 0 };
-#ifdef ENABLE_DEBUG_LOGGING
- global_debug = 1;
- UNUSED(ctx);
-#else
+#ifndef ENABLE_DEBUG_LOGGING
USBI_GET_CONTEXT(ctx);
- if (ctx == NULL)
- return;
- global_debug = (ctx->debug == LIBUSB_LOG_LEVEL_DEBUG);
if (!ctx->debug)
return;
- if (level == LIBUSB_LOG_LEVEL_WARNING && ctx->debug < LIBUSB_LOG_LEVEL_WARNING)
- return;
- if (level == LIBUSB_LOG_LEVEL_INFO && ctx->debug < LIBUSB_LOG_LEVEL_INFO)
+ if (level == LOG_LEVEL_WARNING && ctx->debug < 2)
return;
- if (level == LIBUSB_LOG_LEVEL_DEBUG && ctx->debug < LIBUSB_LOG_LEVEL_DEBUG)
+ if (level == LOG_LEVEL_INFO && ctx->debug < 3)
return;
#endif
-#ifdef __ANDROID__
- int prio;
- switch (level) {
- case LOG_LEVEL_INFO:
- prio = ANDROID_LOG_INFO;
- break;
- case LOG_LEVEL_WARNING:
- prio = ANDROID_LOG_WARN;
- break;
- case LOG_LEVEL_ERROR:
- prio = ANDROID_LOG_ERROR;
- break;
- case LOG_LEVEL_DEBUG:
- prio = ANDROID_LOG_DEBUG;
- break;
- default:
- prio = ANDROID_LOG_UNKNOWN;
- break;
- }
-
- __android_log_vprint(prio, "LibUsb", format, args);
-#else
usbi_gettimeofday(&now, NULL);
- if ((global_debug) && (!has_debug_header_been_displayed)) {
- has_debug_header_been_displayed = 1;
- usbi_log_str(ctx, "[timestamp] [threadID] facility level [function call] <message>\n");
- usbi_log_str(ctx, "--------------------------------------------------------------------------------\n");
+ if (!first.tv_sec) {
+ first.tv_sec = now.tv_sec;
+ first.tv_usec = now.tv_usec;
}
- if (now.tv_usec < timestamp_origin.tv_usec) {
+ if (now.tv_usec < first.tv_usec) {
now.tv_sec--;
now.tv_usec += 1000000;
}
- now.tv_sec -= timestamp_origin.tv_sec;
- now.tv_usec -= timestamp_origin.tv_usec;
+ now.tv_sec -= first.tv_sec;
+ now.tv_usec -= first.tv_usec;
switch (level) {
- case LIBUSB_LOG_LEVEL_INFO:
+ case LOG_LEVEL_INFO:
prefix = "info";
break;
- case LIBUSB_LOG_LEVEL_WARNING:
+ case LOG_LEVEL_WARNING:
+ stream = stderr;
prefix = "warning";
break;
- case LIBUSB_LOG_LEVEL_ERROR:
+ case LOG_LEVEL_ERROR:
+ stream = stderr;
prefix = "error";
break;
- case LIBUSB_LOG_LEVEL_DEBUG:
+ case LOG_LEVEL_DEBUG:
+ stream = stderr;
prefix = "debug";
break;
- case LIBUSB_LOG_LEVEL_NONE:
- break;
default:
+ stream = stderr;
prefix = "unknown";
break;
}
- if (global_debug) {
- header_len = snprintf(buf, sizeof(buf),
- "[%2d.%06d] [%08x] libusbx: %s [%s] ",
- (int)now.tv_sec, (int)now.tv_usec, usbi_get_tid(), prefix, function);
- } else {
- header_len = snprintf(buf, sizeof(buf),
- "libusbx: %s [%s] ", prefix, function);
- }
+ fprintf(stream, "libusb: %d.%06d %s [%s] ",
+ (int)now.tv_sec, (int)now.tv_usec, prefix, function);
- if (header_len < 0 || header_len >= sizeof(buf)) {
- /* Somehow snprintf failed to write to the buffer,
- * remove the header so something useful is output. */
- header_len = 0;
- }
- /* Make sure buffer is NUL terminated */
- buf[header_len] = '\0';
- text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
- format, args);
- if (text_len < 0 || text_len + header_len >= sizeof(buf)) {
- /* Truncated log output. On some platforms a -1 return value means
- * that the output was truncated. */
- text_len = sizeof(buf) - header_len;
- }
- if (header_len + text_len + sizeof(USBI_LOG_LINE_END) >= sizeof(buf)) {
- /* Need to truncate the text slightly to fit on the terminator. */
- text_len -= (header_len + text_len + sizeof(USBI_LOG_LINE_END)) - sizeof(buf);
- }
- strcpy(buf + header_len + text_len, USBI_LOG_LINE_END);
+ vfprintf(stream, format, args);
- usbi_log_str(ctx, buf);
-#endif
+ fprintf(stream, "\n");
}
-void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
+void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, ...)
{
va_list args;
@@ -2158,18 +1821,19 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
}
/** \ingroup misc
- * Returns a constant NULL-terminated string with the ASCII name of a libusbx
- * error or transfer status code. The caller must not free() the returned
- * string.
+ * Returns a constant NULL-terminated string with the ASCII name of a libusb
+ * error code. The caller must not free() the returned string.
*
- * \param error_code The \ref libusb_error or libusb_transfer_status code to
- * return the name of.
+ * \param error_code The \ref libusb_error code to return the name of.
* \returns The error name, or the string **UNKNOWN** if the value of
- * error_code is not a known error / status code.
+ * error_code is not a known error code.
*/
DEFAULT_VISIBILITY const char * LIBUSB_CALL libusb_error_name(int error_code)
{
- switch (error_code) {
+ enum libusb_error error = error_code;
+ switch (error) {
+ case LIBUSB_SUCCESS:
+ return "LIBUSB_SUCCESS";
case LIBUSB_ERROR_IO:
return "LIBUSB_ERROR_IO";
case LIBUSB_ERROR_INVALID_PARAM:
@@ -2196,30 +1860,13 @@ DEFAULT_VISIBILITY const char * LIBUSB_CALL libusb_error_name(int error_code)
return "LIBUSB_ERROR_NOT_SUPPORTED";
case LIBUSB_ERROR_OTHER:
return "LIBUSB_ERROR_OTHER";
-
- case LIBUSB_TRANSFER_ERROR:
- return "LIBUSB_TRANSFER_ERROR";
- case LIBUSB_TRANSFER_TIMED_OUT:
- return "LIBUSB_TRANSFER_TIMED_OUT";
- case LIBUSB_TRANSFER_CANCELLED:
- return "LIBUSB_TRANSFER_CANCELLED";
- case LIBUSB_TRANSFER_STALL:
- return "LIBUSB_TRANSFER_STALL";
- case LIBUSB_TRANSFER_NO_DEVICE:
- return "LIBUSB_TRANSFER_NO_DEVICE";
- case LIBUSB_TRANSFER_OVERFLOW:
- return "LIBUSB_TRANSFER_OVERFLOW";
-
- case 0:
- return "LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED";
- default:
- return "**UNKNOWN**";
}
+ return "**UNKNOWN**";
}
/** \ingroup misc
* Returns a pointer to const struct libusb_version with the version
- * (major, minor, micro, nano and rc) of the running library.
+ * (major, minor, micro, rc, and nano) of the running library.
*/
DEFAULT_VISIBILITY
const struct libusb_version * LIBUSB_CALL libusb_get_version(void)
diff --git a/third_party/libusb/src/libusb/descriptor.c b/third_party/libusb/src/libusb/descriptor.c
index ba6d1467..e358e9e 100644
--- a/third_party/libusb/src/libusb/descriptor.c
+++ b/third_party/libusb/src/libusb/descriptor.c
@@ -1,8 +1,7 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
/*
- * USB descriptor handling functions for libusbx
- * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ * USB descriptor handling functions for libusb
+ * Copyright (C) 2007 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
@@ -40,14 +39,12 @@
/* set host_endian if the w values are already in host endian format,
* as opposed to bus endian. */
-int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
+int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
void *dest, int host_endian)
{
- const unsigned char *sp = source;
- unsigned char *dp = dest;
+ unsigned char *sp = source, *dp = dest;
uint16_t w;
const char *cp;
- uint32_t d;
for (cp = descriptor; *cp; cp++) {
switch (*cp) {
@@ -66,24 +63,6 @@ int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
sp += 2;
dp += 2;
break;
- case 'd': /* 32-bit word, convert from little endian to CPU */
- dp += ((uintptr_t)dp & 1); /* Align to word boundary */
-
- if (host_endian) {
- memcpy(dp, sp, 4);
- } else {
- d = (sp[3] << 24) | (sp[2] << 16) |
- (sp[1] << 8) | sp[0];
- *((uint32_t *)dp) = d;
- }
- sp += 4;
- dp += 4;
- break;
- case 'u': /* 16 byte UUID */
- memcpy(dp, sp, 16);
- sp += 16;
- dp += 16;
- break;
}
}
@@ -106,31 +85,25 @@ static int parse_endpoint(struct libusb_context *ctx,
int parsed = 0;
int len;
- if (size < DESC_HEADER_LENGTH) {
- usbi_err(ctx, "short endpoint descriptor read %d/%d",
- size, DESC_HEADER_LENGTH);
- return LIBUSB_ERROR_IO;
+ usbi_parse_descriptor(buffer, "bb", &header, 0);
+
+ /* Everything should be fine being passed into here, but we sanity */
+ /* check JIC */
+ if (header.bLength > size) {
+ usbi_err(ctx, "ran out of descriptors parsing");
+ return -1;
}
- usbi_parse_descriptor(buffer, "bb", &header, 0);
if (header.bDescriptorType != LIBUSB_DT_ENDPOINT) {
usbi_err(ctx, "unexpected descriptor %x (expected %x)",
header.bDescriptorType, LIBUSB_DT_ENDPOINT);
return parsed;
}
- if (header.bLength > size) {
- usbi_warn(ctx, "short endpoint descriptor read %d/%d",
- size, header.bLength);
- return parsed;
- }
+
if (header.bLength >= ENDPOINT_AUDIO_DESC_LENGTH)
usbi_parse_descriptor(buffer, "bbbbwbbb", endpoint, host_endian);
else if (header.bLength >= ENDPOINT_DESC_LENGTH)
usbi_parse_descriptor(buffer, "bbbbwb", endpoint, host_endian);
- else {
- usbi_err(ctx, "invalid endpoint bLength (%d)", header.bLength);
- return LIBUSB_ERROR_IO;
- }
buffer += header.bLength;
size -= header.bLength;
@@ -141,14 +114,10 @@ static int parse_endpoint(struct libusb_context *ctx,
begin = buffer;
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
- if (header.bLength < DESC_HEADER_LENGTH) {
- usbi_err(ctx, "invalid extra ep desc len (%d)",
- header.bLength);
- return LIBUSB_ERROR_IO;
- } else if (header.bLength > size) {
- usbi_warn(ctx, "short extra ep desc read %d/%d",
- size, header.bLength);
- return parsed;
+
+ if (header.bLength < 2) {
+ usbi_err(ctx, "invalid descriptor length %d", header.bLength);
+ return -1;
}
/* If we find another "proper" descriptor then we're done */
@@ -219,7 +188,6 @@ static int parse_interface(libusb_context *ctx,
int len;
int r;
int parsed = 0;
- int interface_number = -1;
size_t tmp;
struct usb_descriptor_header header;
struct libusb_interface_descriptor *ifp;
@@ -230,7 +198,7 @@ static int parse_interface(libusb_context *ctx,
while (size >= INTERFACE_DESC_LENGTH) {
struct libusb_interface_descriptor *altsetting =
(struct libusb_interface_descriptor *) usb_interface->altsetting;
- altsetting = usbi_reallocf(altsetting,
+ altsetting = realloc(altsetting,
sizeof(struct libusb_interface_descriptor) *
(usb_interface->num_altsetting + 1));
if (!altsetting) {
@@ -240,37 +208,12 @@ static int parse_interface(libusb_context *ctx,
usb_interface->altsetting = altsetting;
ifp = altsetting + usb_interface->num_altsetting;
- usbi_parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
- if (ifp->bDescriptorType != LIBUSB_DT_INTERFACE) {
- usbi_err(ctx, "unexpected descriptor %x (expected %x)",
- ifp->bDescriptorType, LIBUSB_DT_INTERFACE);
- return parsed;
- }
- if (ifp->bLength < INTERFACE_DESC_LENGTH) {
- usbi_err(ctx, "invalid interface bLength (%d)",
- ifp->bLength);
- r = LIBUSB_ERROR_IO;
- goto err;
- }
- if (ifp->bLength > size) {
- usbi_warn(ctx, "short intf descriptor read %d/%d",
- size, ifp->bLength);
- return parsed;
- }
- if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
- usbi_err(ctx, "too many endpoints (%d)", ifp->bNumEndpoints);
- r = LIBUSB_ERROR_IO;
- goto err;
- }
-
usb_interface->num_altsetting++;
+ usbi_parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
ifp->extra = NULL;
ifp->extra_length = 0;
ifp->endpoint = NULL;
- if (interface_number == -1)
- interface_number = ifp->bInterfaceNumber;
-
/* Skip over the interface */
buffer += ifp->bLength;
parsed += ifp->bLength;
@@ -281,17 +224,11 @@ static int parse_interface(libusb_context *ctx,
/* Skip over any interface, class or vendor descriptors */
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
- if (header.bLength < DESC_HEADER_LENGTH) {
- usbi_err(ctx,
- "invalid extra intf desc len (%d)",
- header.bLength);
+ if (header.bLength < 2) {
+ usbi_err(ctx, "invalid descriptor of length %d",
+ header.bLength);
r = LIBUSB_ERROR_IO;
goto err;
- } else if (header.bLength > size) {
- usbi_warn(ctx,
- "short extra intf desc read %d/%d",
- size, header.bLength);
- return parsed;
}
/* If we find another "proper" descriptor then we're done */
@@ -319,6 +256,21 @@ static int parse_interface(libusb_context *ctx,
ifp->extra_length = len;
}
+ /* Did we hit an unexpected descriptor? */
+ if (size >= DESC_HEADER_LENGTH) {
+ usbi_parse_descriptor(buffer, "bb", &header, 0);
+ if ((header.bDescriptorType == LIBUSB_DT_CONFIG) ||
+ (header.bDescriptorType == LIBUSB_DT_DEVICE)) {
+ return parsed;
+ }
+ }
+
+ if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
+ usbi_err(ctx, "too many endpoints (%d)", ifp->bNumEndpoints);
+ r = LIBUSB_ERROR_IO;
+ goto err;
+ }
+
if (ifp->bNumEndpoints > 0) {
struct libusb_endpoint_descriptor *endpoint;
tmp = ifp->bNumEndpoints * sizeof(struct libusb_endpoint_descriptor);
@@ -331,14 +283,18 @@ static int parse_interface(libusb_context *ctx,
memset(endpoint, 0, tmp);
for (i = 0; i < ifp->bNumEndpoints; i++) {
+ usbi_parse_descriptor(buffer, "bb", &header, 0);
+
+ if (header.bLength > size) {
+ usbi_err(ctx, "ran out of descriptors parsing");
+ r = LIBUSB_ERROR_IO;
+ goto err;
+ }
+
r = parse_endpoint(ctx, endpoint + i, buffer, size,
host_endian);
if (r < 0)
goto err;
- if (r == 0) {
- ifp->bNumEndpoints = (uint8_t)i;
- break;;
- }
buffer += r;
parsed += r;
@@ -350,7 +306,7 @@ static int parse_interface(libusb_context *ctx,
ifp = (struct libusb_interface_descriptor *) buffer;
if (size < LIBUSB_DT_INTERFACE_SIZE ||
ifp->bDescriptorType != LIBUSB_DT_INTERFACE ||
- ifp->bInterfaceNumber != interface_number)
+ !ifp->bAlternateSetting)
return parsed;
}
@@ -375,35 +331,18 @@ static void clear_configuration(struct libusb_config_descriptor *config)
static int parse_configuration(struct libusb_context *ctx,
struct libusb_config_descriptor *config, unsigned char *buffer,
- int size, int host_endian)
+ int host_endian)
{
int i;
int r;
+ int size;
size_t tmp;
struct usb_descriptor_header header;
struct libusb_interface *usb_interface;
- if (size < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(ctx, "short config descriptor read %d/%d",
- size, LIBUSB_DT_CONFIG_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
usbi_parse_descriptor(buffer, "bbwbbbbb", config, host_endian);
- if (config->bDescriptorType != LIBUSB_DT_CONFIG) {
- usbi_err(ctx, "unexpected descriptor %x (expected %x)",
- config->bDescriptorType, LIBUSB_DT_CONFIG);
- return LIBUSB_ERROR_IO;
- }
- if (config->bLength < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(ctx, "invalid config bLength (%d)", config->bLength);
- return LIBUSB_ERROR_IO;
- }
- if (config->bLength > size) {
- usbi_err(ctx, "short config descriptor read %d/%d",
- size, config->bLength);
- return LIBUSB_ERROR_IO;
- }
+ size = config->wTotalLength;
+
if (config->bNumInterfaces > USB_MAXINTERFACES) {
usbi_err(ctx, "too many interfaces (%d)", config->bNumInterfaces);
return LIBUSB_ERROR_IO;
@@ -432,18 +371,12 @@ static int parse_configuration(struct libusb_context *ctx,
while (size >= DESC_HEADER_LENGTH) {
usbi_parse_descriptor(buffer, "bb", &header, 0);
- if (header.bLength < DESC_HEADER_LENGTH) {
- usbi_err(ctx,
- "invalid extra config desc len (%d)",
- header.bLength);
+ if ((header.bLength > size) ||
+ (header.bLength < DESC_HEADER_LENGTH)) {
+ usbi_err(ctx, "invalid descriptor length of %d",
+ header.bLength);
r = LIBUSB_ERROR_IO;
goto err;
- } else if (header.bLength > size) {
- usbi_warn(ctx,
- "short extra config desc read %d/%d",
- size, header.bLength);
- config->bNumInterfaces = (uint8_t)i;
- return size;
}
/* If we find another "proper" descriptor then we're done */
@@ -478,10 +411,6 @@ static int parse_configuration(struct libusb_context *ctx,
r = parse_interface(ctx, usb_interface + i, buffer, size, host_endian);
if (r < 0)
goto err;
- if (r == 0) {
- config->bNumInterfaces = (uint8_t)i;
- break;
- }
buffer += r;
size -= r;
@@ -494,56 +423,11 @@ err:
return r;
}
-static int raw_desc_to_config(struct libusb_context *ctx,
- unsigned char *buf, int size, int host_endian,
- struct libusb_config_descriptor **config)
-{
- struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
- int r;
-
- if (!_config)
- return LIBUSB_ERROR_NO_MEM;
-
- r = parse_configuration(ctx, _config, buf, size, host_endian);
- if (r < 0) {
- usbi_err(ctx, "parse_configuration failed with error %d", r);
- free(_config);
- return r;
- } else if (r > 0) {
- usbi_warn(ctx, "still %d bytes of descriptor data left", r);
- }
-
- *config = _config;
- return LIBUSB_SUCCESS;
-}
-
-int usbi_device_cache_descriptor(libusb_device *dev)
-{
- int r, host_endian = 0;
-
- r = usbi_backend->get_device_descriptor(dev, (unsigned char *) &dev->device_descriptor,
- &host_endian);
- if (r < 0)
- return r;
-
- if (!host_endian) {
- dev->device_descriptor.bcdUSB = libusb_le16_to_cpu(dev->device_descriptor.bcdUSB);
- dev->device_descriptor.idVendor = libusb_le16_to_cpu(dev->device_descriptor.idVendor);
- dev->device_descriptor.idProduct = libusb_le16_to_cpu(dev->device_descriptor.idProduct);
- dev->device_descriptor.bcdDevice = libusb_le16_to_cpu(dev->device_descriptor.bcdDevice);
- }
-
- return LIBUSB_SUCCESS;
-}
-
/** \ingroup desc
* Get the USB device descriptor for a given device.
*
* This is a non-blocking function; the device descriptor is cached in memory.
*
- * Note since libusbx-1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102, this
- * function always succeeds.
- *
* \param dev the device
* \param desc output location for the descriptor data
* \returns 0 on success or a LIBUSB_ERROR code on failure
@@ -551,9 +435,22 @@ int usbi_device_cache_descriptor(libusb_device *dev)
int API_EXPORTED libusb_get_device_descriptor(libusb_device *dev,
struct libusb_device_descriptor *desc)
{
+ unsigned char raw_desc[DEVICE_DESC_LENGTH];
+ int host_endian = 0;
+ int r;
+
usbi_dbg("");
- memcpy((unsigned char *) desc, (unsigned char *) &dev->device_descriptor,
- sizeof (dev->device_descriptor));
+ r = usbi_backend->get_device_descriptor(dev, raw_desc, &host_endian);
+ if (r < 0)
+ return r;
+
+ memcpy((unsigned char *) desc, raw_desc, sizeof(raw_desc));
+ if (!host_endian) {
+ desc->bcdUSB = libusb_le16_to_cpu(desc->bcdUSB);
+ desc->idVendor = libusb_le16_to_cpu(desc->idVendor);
+ desc->idProduct = libusb_le16_to_cpu(desc->idProduct);
+ desc->bcdDevice = libusb_le16_to_cpu(desc->bcdDevice);
+ }
return 0;
}
@@ -574,33 +471,49 @@ int API_EXPORTED libusb_get_device_descriptor(libusb_device *dev,
int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
struct libusb_config_descriptor **config)
{
- struct libusb_config_descriptor _config;
- unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
+ struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
+ unsigned char tmp[8];
unsigned char *buf = NULL;
int host_endian = 0;
int r;
- r = usbi_backend->get_active_config_descriptor(dev, tmp,
- LIBUSB_DT_CONFIG_SIZE, &host_endian);
+ usbi_dbg("");
+ if (!_config)
+ return LIBUSB_ERROR_NO_MEM;
+
+ r = usbi_backend->get_active_config_descriptor(dev, tmp, sizeof(tmp),
+ &host_endian);
if (r < 0)
- return r;
- if (r < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(dev->ctx, "short config descriptor read %d/%d",
- r, LIBUSB_DT_CONFIG_SIZE);
- return LIBUSB_ERROR_IO;
- }
+ goto err;
- usbi_parse_descriptor(tmp, "bbw", &_config, host_endian);
- buf = malloc(_config.wTotalLength);
- if (!buf)
- return LIBUSB_ERROR_NO_MEM;
+ usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
+ buf = malloc(_config->wTotalLength);
+ if (!buf) {
+ r = LIBUSB_ERROR_NO_MEM;
+ goto err;
+ }
r = usbi_backend->get_active_config_descriptor(dev, buf,
- _config.wTotalLength, &host_endian);
- if (r >= 0)
- r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
+ _config->wTotalLength, &host_endian);
+ if (r < 0)
+ goto err;
+
+ r = parse_configuration(dev->ctx, _config, buf, host_endian);
+ if (r < 0) {
+ usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
+ goto err;
+ } else if (r > 0) {
+ usbi_warn(dev->ctx, "descriptor data still left");
+ }
free(buf);
+ *config = _config;
+ return 0;
+
+err:
+ free(_config);
+ if (buf)
+ free(buf);
return r;
}
@@ -623,8 +536,8 @@ int API_EXPORTED libusb_get_active_config_descriptor(libusb_device *dev,
int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
uint8_t config_index, struct libusb_config_descriptor **config)
{
- struct libusb_config_descriptor _config;
- unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
+ struct libusb_config_descriptor *_config;
+ unsigned char tmp[8];
unsigned char *buf = NULL;
int host_endian = 0;
int r;
@@ -633,27 +546,44 @@ int API_EXPORTED libusb_get_config_descriptor(libusb_device *dev,
if (config_index >= dev->num_configurations)
return LIBUSB_ERROR_NOT_FOUND;
+ _config = malloc(sizeof(*_config));
+ if (!_config)
+ return LIBUSB_ERROR_NO_MEM;
+
r = usbi_backend->get_config_descriptor(dev, config_index, tmp,
- LIBUSB_DT_CONFIG_SIZE, &host_endian);
+ sizeof(tmp), &host_endian);
if (r < 0)
- return r;
- if (r < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(dev->ctx, "short config descriptor read %d/%d",
- r, LIBUSB_DT_CONFIG_SIZE);
- return LIBUSB_ERROR_IO;
- }
+ goto err;
- usbi_parse_descriptor(tmp, "bbw", &_config, host_endian);
- buf = malloc(_config.wTotalLength);
- if (!buf)
- return LIBUSB_ERROR_NO_MEM;
+ usbi_parse_descriptor(tmp, "bbw", _config, host_endian);
+ buf = malloc(_config->wTotalLength);
+ if (!buf) {
+ r = LIBUSB_ERROR_NO_MEM;
+ goto err;
+ }
+ host_endian = 0;
r = usbi_backend->get_config_descriptor(dev, config_index, buf,
- _config.wTotalLength, &host_endian);
- if (r >= 0)
- r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
+ _config->wTotalLength, &host_endian);
+ if (r < 0)
+ goto err;
+
+ r = parse_configuration(dev->ctx, _config, buf, host_endian);
+ if (r < 0) {
+ usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
+ goto err;
+ } else if (r > 0) {
+ usbi_warn(dev->ctx, "descriptor data still left");
+ }
free(buf);
+ *config = _config;
+ return 0;
+
+err:
+ free(_config);
+ if (buf)
+ free(buf);
return r;
}
@@ -705,18 +635,8 @@ int usbi_get_config_index_by_value(struct libusb_device *dev,
int API_EXPORTED libusb_get_config_descriptor_by_value(libusb_device *dev,
uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
{
- int r, idx, host_endian;
- unsigned char *buf = NULL;
-
- if (usbi_backend->get_config_descriptor_by_value) {
- r = usbi_backend->get_config_descriptor_by_value(dev,
- bConfigurationValue, &buf, &host_endian);
- if (r < 0)
- return r;
- return raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
- }
-
- r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
+ int idx;
+ int r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
if (r < 0)
return r;
else if (idx == -1)
@@ -744,394 +664,6 @@ void API_EXPORTED libusb_free_config_descriptor(
}
/** \ingroup desc
- * Get an endpoints superspeed endpoint companion descriptor (if any)
- *
- * \param ctx the context to operate on, or NULL for the default context
- * \param endpoint endpoint descriptor from which to get the superspeed
- * endpoint companion descriptor
- * \param ep_comp output location for the superspeed endpoint companion
- * descriptor. Only valid if 0 was returned. Must be freed with
- * libusb_free_ss_endpoint_companion_descriptor() after use.
- * \returns 0 on success
- * \returns LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
- * \returns another LIBUSB_ERROR code on error
- */
-int API_EXPORTED libusb_get_ss_endpoint_companion_descriptor(
- struct libusb_context *ctx,
- const struct libusb_endpoint_descriptor *endpoint,
- struct libusb_ss_endpoint_companion_descriptor **ep_comp)
-{
- struct usb_descriptor_header header;
- int size = endpoint->extra_length;
- const unsigned char *buffer = endpoint->extra;
-
- *ep_comp = NULL;
-
- while (size >= DESC_HEADER_LENGTH) {
- usbi_parse_descriptor(buffer, "bb", &header, 0);
- if (header.bLength < 2 || header.bLength > size) {
- usbi_err(ctx, "invalid descriptor length %d",
- header.bLength);
- return LIBUSB_ERROR_IO;
- }
- if (header.bDescriptorType != LIBUSB_DT_SS_ENDPOINT_COMPANION) {
- buffer += header.bLength;
- size -= header.bLength;
- continue;
- }
- if (header.bLength < LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE) {
- usbi_err(ctx, "invalid ss-ep-comp-desc length %d",
- header.bLength);
- return LIBUSB_ERROR_IO;
- }
- *ep_comp = malloc(sizeof(**ep_comp));
- if (*ep_comp == NULL)
- return LIBUSB_ERROR_NO_MEM;
- usbi_parse_descriptor(buffer, "bbbbw", *ep_comp, 0);
- return LIBUSB_SUCCESS;
- }
- return LIBUSB_ERROR_NOT_FOUND;
-}
-
-/** \ingroup desc
- * Free a superspeed endpoint companion descriptor obtained from
- * libusb_get_ss_endpoint_companion_descriptor().
- * It is safe to call this function with a NULL ep_comp parameter, in which
- * case the function simply returns.
- *
- * \param ep_comp the superspeed endpoint companion descriptor to free
- */
-void API_EXPORTED libusb_free_ss_endpoint_companion_descriptor(
- struct libusb_ss_endpoint_companion_descriptor *ep_comp)
-{
- free(ep_comp);
-}
-
-static int parse_bos(struct libusb_context *ctx,
- struct libusb_bos_descriptor **bos,
- unsigned char *buffer, int size, int host_endian)
-{
- struct libusb_bos_descriptor bos_header, *_bos;
- struct libusb_bos_dev_capability_descriptor dev_cap;
- int i;
-
- if (size < LIBUSB_DT_BOS_SIZE) {
- usbi_err(ctx, "short bos descriptor read %d/%d",
- size, LIBUSB_DT_BOS_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
- usbi_parse_descriptor(buffer, "bbwb", &bos_header, host_endian);
- if (bos_header.bDescriptorType != LIBUSB_DT_BOS) {
- usbi_err(ctx, "unexpected descriptor %x (expected %x)",
- bos_header.bDescriptorType, LIBUSB_DT_BOS);
- return LIBUSB_ERROR_IO;
- }
- if (bos_header.bLength < LIBUSB_DT_BOS_SIZE) {
- usbi_err(ctx, "invalid bos bLength (%d)", bos_header.bLength);
- return LIBUSB_ERROR_IO;
- }
- if (bos_header.bLength > size) {
- usbi_err(ctx, "short bos descriptor read %d/%d",
- size, bos_header.bLength);
- return LIBUSB_ERROR_IO;
- }
-
- _bos = calloc (1,
- sizeof(*_bos) + bos_header.bNumDeviceCaps * sizeof(void *));
- if (!_bos)
- return LIBUSB_ERROR_NO_MEM;
-
- usbi_parse_descriptor(buffer, "bbwb", _bos, host_endian);
- buffer += bos_header.bLength;
- size -= bos_header.bLength;
-
- /* Get the device capability descriptors */
- for (i = 0; i < bos_header.bNumDeviceCaps; i++) {
- if (size < LIBUSB_DT_DEVICE_CAPABILITY_SIZE) {
- usbi_warn(ctx, "short dev-cap descriptor read %d/%d",
- size, LIBUSB_DT_DEVICE_CAPABILITY_SIZE);
- break;
- }
- usbi_parse_descriptor(buffer, "bbb", &dev_cap, host_endian);
- if (dev_cap.bDescriptorType != LIBUSB_DT_DEVICE_CAPABILITY) {
- usbi_warn(ctx, "unexpected descriptor %x (expected %x)",
- dev_cap.bDescriptorType, LIBUSB_DT_DEVICE_CAPABILITY);
- break;
- }
- if (dev_cap.bLength < LIBUSB_DT_DEVICE_CAPABILITY_SIZE) {
- usbi_err(ctx, "invalid dev-cap bLength (%d)",
- dev_cap.bLength);
- libusb_free_bos_descriptor(_bos);
- return LIBUSB_ERROR_IO;
- }
- if (dev_cap.bLength > size) {
- usbi_warn(ctx, "short dev-cap descriptor read %d/%d",
- size, dev_cap.bLength);
- break;
- }
-
- _bos->dev_capability[i] = malloc(dev_cap.bLength);
- if (!_bos->dev_capability[i]) {
- libusb_free_bos_descriptor(_bos);
- return LIBUSB_ERROR_NO_MEM;
- }
- memcpy(_bos->dev_capability[i], buffer, dev_cap.bLength);
- buffer += dev_cap.bLength;
- size -= dev_cap.bLength;
- }
- _bos->bNumDeviceCaps = (uint8_t)i;
- *bos = _bos;
-
- return LIBUSB_SUCCESS;
-}
-
-/** \ingroup desc
- * Get a Binary Object Store (BOS) descriptor
- * This is a BLOCKING function, which will send requests to the device.
- *
- * \param handle the handle of an open libusb device
- * \param bos output location for the BOS descriptor. Only valid if 0 was returned.
- * Must be freed with \ref libusb_free_bos_descriptor() after use.
- * \returns 0 on success
- * \returns LIBUSB_ERROR_NOT_FOUND if the device doesn't have a BOS descriptor
- * \returns another LIBUSB_ERROR code on error
- */
-int API_EXPORTED libusb_get_bos_descriptor(libusb_device_handle *handle,
- struct libusb_bos_descriptor **bos)
-{
- struct libusb_bos_descriptor _bos;
- uint8_t bos_header[LIBUSB_DT_BOS_SIZE] = {0};
- unsigned char *bos_data = NULL;
- const int host_endian = 0;
- int r;
-
- /* Read the BOS. This generates 2 requests on the bus,
- * one for the header, and one for the full BOS */
- r = libusb_get_descriptor(handle, LIBUSB_DT_BOS, 0, bos_header,
- LIBUSB_DT_BOS_SIZE);
- if (r < 0) {
- if (r != LIBUSB_ERROR_PIPE)
- usbi_err(handle->dev->ctx, "failed to read BOS (%d)", r);
- return r;
- }
- if (r < LIBUSB_DT_BOS_SIZE) {
- usbi_err(handle->dev->ctx, "short BOS read %d/%d",
- r, LIBUSB_DT_BOS_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
- usbi_parse_descriptor(bos_header, "bbwb", &_bos, host_endian);
- usbi_dbg("found BOS descriptor: size %d bytes, %d capabilities",
- _bos.wTotalLength, _bos.bNumDeviceCaps);
- bos_data = calloc(_bos.wTotalLength, 1);
- if (bos_data == NULL)
- return LIBUSB_ERROR_NO_MEM;
-
- r = libusb_get_descriptor(handle, LIBUSB_DT_BOS, 0, bos_data,
- _bos.wTotalLength);
- if (r >= 0)
- r = parse_bos(handle->dev->ctx, bos, bos_data, r, host_endian);
- else
- usbi_err(handle->dev->ctx, "failed to read BOS (%d)", r);
-
- free(bos_data);
- return r;
-}
-
-/** \ingroup desc
- * Free a BOS descriptor obtained from libusb_get_bos_descriptor().
- * It is safe to call this function with a NULL bos parameter, in which
- * case the function simply returns.
- *
- * \param bos the BOS descriptor to free
- */
-void API_EXPORTED libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos)
-{
- int i;
-
- if (!bos)
- return;
-
- for (i = 0; i < bos->bNumDeviceCaps; i++)
- free(bos->dev_capability[i]);
- free(bos);
-}
-
-/** \ingroup desc
- * Get an USB 2.0 Extension descriptor
- *
- * \param ctx the context to operate on, or NULL for the default context
- * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
- * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION
- * LIBUSB_BT_USB_2_0_EXTENSION
- * \param usb_2_0_extension output location for the USB 2.0 Extension
- * descriptor. Only valid if 0 was returned. Must be freed with
- * libusb_free_usb_2_0_extension_descriptor() after use.
- * \returns 0 on success
- * \returns a LIBUSB_ERROR code on error
- */
-int API_EXPORTED libusb_get_usb_2_0_extension_descriptor(
- struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension)
-{
- struct libusb_usb_2_0_extension_descriptor *_usb_2_0_extension;
- const int host_endian = 0;
-
- if (dev_cap->bDevCapabilityType != LIBUSB_BT_USB_2_0_EXTENSION) {
- usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
- dev_cap->bDevCapabilityType,
- LIBUSB_BT_USB_2_0_EXTENSION);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
- if (dev_cap->bLength < LIBUSB_BT_USB_2_0_EXTENSION_SIZE) {
- usbi_err(ctx, "short dev-cap descriptor read %d/%d",
- dev_cap->bLength, LIBUSB_BT_USB_2_0_EXTENSION_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
- _usb_2_0_extension = malloc(sizeof(*_usb_2_0_extension));
- if (!_usb_2_0_extension)
- return LIBUSB_ERROR_NO_MEM;
-
- usbi_parse_descriptor((unsigned char *)dev_cap, "bbbd",
- _usb_2_0_extension, host_endian);
-
- *usb_2_0_extension = _usb_2_0_extension;
- return LIBUSB_SUCCESS;
-}
-
-/** \ingroup desc
- * Free a USB 2.0 Extension descriptor obtained from
- * libusb_get_usb_2_0_extension_descriptor().
- * It is safe to call this function with a NULL usb_2_0_extension parameter,
- * in which case the function simply returns.
- *
- * \param usb_2_0_extension the USB 2.0 Extension descriptor to free
- */
-void API_EXPORTED libusb_free_usb_2_0_extension_descriptor(
- struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension)
-{
- free(usb_2_0_extension);
-}
-
-/** \ingroup desc
- * Get a SuperSpeed USB Device Capability descriptor
- *
- * \param ctx the context to operate on, or NULL for the default context
- * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
- * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
- * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
- * \param ss_usb_device_cap output location for the SuperSpeed USB Device
- * Capability descriptor. Only valid if 0 was returned. Must be freed with
- * libusb_free_ss_usb_device_capability_descriptor() after use.
- * \returns 0 on success
- * \returns a LIBUSB_ERROR code on error
- */
-int API_EXPORTED libusb_get_ss_usb_device_capability_descriptor(
- struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap)
-{
- struct libusb_ss_usb_device_capability_descriptor *_ss_usb_device_cap;
- const int host_endian = 0;
-
- if (dev_cap->bDevCapabilityType != LIBUSB_BT_SS_USB_DEVICE_CAPABILITY) {
- usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
- dev_cap->bDevCapabilityType,
- LIBUSB_BT_SS_USB_DEVICE_CAPABILITY);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
- if (dev_cap->bLength < LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) {
- usbi_err(ctx, "short dev-cap descriptor read %d/%d",
- dev_cap->bLength, LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
- _ss_usb_device_cap = malloc(sizeof(*_ss_usb_device_cap));
- if (!_ss_usb_device_cap)
- return LIBUSB_ERROR_NO_MEM;
-
- usbi_parse_descriptor((unsigned char *)dev_cap, "bbbbwbbw",
- _ss_usb_device_cap, host_endian);
-
- *ss_usb_device_cap = _ss_usb_device_cap;
- return LIBUSB_SUCCESS;
-}
-
-/** \ingroup desc
- * Free a SuperSpeed USB Device Capability descriptor obtained from
- * libusb_get_ss_usb_device_capability_descriptor().
- * It is safe to call this function with a NULL ss_usb_device_cap
- * parameter, in which case the function simply returns.
- *
- * \param ss_usb_device_cap the USB 2.0 Extension descriptor to free
- */
-void API_EXPORTED libusb_free_ss_usb_device_capability_descriptor(
- struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap)
-{
- free(ss_usb_device_cap);
-}
-
-/** \ingroup desc
- * Get a Container ID descriptor
- *
- * \param ctx the context to operate on, or NULL for the default context
- * \param dev_cap Device Capability descriptor with a bDevCapabilityType of
- * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID
- * LIBUSB_BT_CONTAINER_ID
- * \param container_id output location for the Container ID descriptor.
- * Only valid if 0 was returned. Must be freed with
- * libusb_free_container_id_descriptor() after use.
- * \returns 0 on success
- * \returns a LIBUSB_ERROR code on error
- */
-int API_EXPORTED libusb_get_container_id_descriptor(struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_container_id_descriptor **container_id)
-{
- struct libusb_container_id_descriptor *_container_id;
- const int host_endian = 0;
-
- if (dev_cap->bDevCapabilityType != LIBUSB_BT_CONTAINER_ID) {
- usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
- dev_cap->bDevCapabilityType,
- LIBUSB_BT_CONTAINER_ID);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
- if (dev_cap->bLength < LIBUSB_BT_CONTAINER_ID_SIZE) {
- usbi_err(ctx, "short dev-cap descriptor read %d/%d",
- dev_cap->bLength, LIBUSB_BT_CONTAINER_ID_SIZE);
- return LIBUSB_ERROR_IO;
- }
-
- _container_id = malloc(sizeof(*_container_id));
- if (!_container_id)
- return LIBUSB_ERROR_NO_MEM;
-
- usbi_parse_descriptor((unsigned char *)dev_cap, "bbbbu",
- _container_id, host_endian);
-
- *container_id = _container_id;
- return LIBUSB_SUCCESS;
-}
-
-/** \ingroup desc
- * Free a Container ID descriptor obtained from
- * libusb_get_container_id_descriptor().
- * It is safe to call this function with a NULL container_id parameter,
- * in which case the function simply returns.
- *
- * \param container_id the USB 2.0 Extension descriptor to free
- */
-void API_EXPORTED libusb_free_container_id_descriptor(
- struct libusb_container_id_descriptor *container_id)
-{
- free(container_id);
-}
-
-/** \ingroup desc
* Retrieve a string descriptor in C style ASCII.
*
* Wrapper around libusb_get_string_descriptor(). Uses the first language
@@ -1186,7 +718,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
if (di >= (length - 1))
break;
- if ((tbuf[si] & 0x80) || (tbuf[si + 1])) /* non-ASCII */
+ if (tbuf[si + 1]) /* high byte */
data[di++] = '?';
else
data[di++] = tbuf[si];
@@ -1195,3 +727,4 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
data[di] = 0;
return di;
}
+
diff --git a/third_party/libusb/src/libusb/hotplug.c b/third_party/libusb/src/libusb/hotplug.c
deleted file mode 100644
index 6b04342..0000000
--- a/third_party/libusb/src/libusb/hotplug.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
-/*
- * Hotplug functions for libusbx
- * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
- * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
- *
- * 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
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <assert.h>
-
-#include "libusbi.h"
-#include "hotplug.h"
-
-/**
- * @defgroup hotplug Device hotplug event notification
- * This page details how to use the libusb hotplug interface, where available.
- *
- * Be mindful that not all platforms currently implement hotplug notification and
- * that you should first call on \ref libusb_has_capability() with parameter
- * \ref LIBUSB_CAP_HAS_HOTPLUG to confirm that hotplug support is available.
- *
- * \page hotplug Device hotplug event notification
- *
- * \section intro Introduction
- *
- * Version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102, has added support
- * for hotplug events on <b>some</b> platforms (you should test if your platform
- * supports hotplug notification by calling \ref libusb_has_capability() with
- * parameter \ref LIBUSB_CAP_HAS_HOTPLUG).
- *
- * This interface allows you to request notification for the arrival and departure
- * of matching USB devices.
- *
- * To receive hotplug notification you register a callback by calling
- * \ref libusb_hotplug_register_callback(). This function will optionally return
- * a handle that can be passed to \ref libusb_hotplug_deregister_callback().
- *
- * A callback function must return an int (0 or 1) indicating whether the callback is
- * expecting additional events. Returning 0 will rearm the callback and 1 will cause
- * the callback to be deregistered.
- *
- * Callbacks for a particular context are automatically deregistered by libusb_exit().
- *
- * As of 1.0.16 there are two supported hotplug events:
- * - LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED: A device has arrived and is ready to use
- * - LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT: A device has left and is no longer available
- *
- * A hotplug event can listen for either or both of these events.
- *
- * Note: If you receive notification that a device has left and you have any
- * a libusb_device_handles for the device it is up to you to call libusb_close()
- * on each handle to free up any remaining resources associated with the device.
- * Once a device has left any libusb_device_handle associated with the device
- * are invalid and will remain so even if the device comes back.
- *
- * When handling a LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED event it is considered
- * safe to call any libusbx function that takes a libusb_device. On the other hand,
- * when handling a LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT event the only safe function
- * is libusb_get_device_descriptor().
- *
- * The following code provides an example of the usage of the hotplug interface:
-\code
-static int count = 0;
-
-int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
- libusb_hotplug_event event, void *user_data) {
- static libusb_device_handle *handle = NULL;
- struct libusb_device_descriptor desc;
- int rc;
-
- (void)libusb_get_device_descriptor(dev, &desc);
-
- if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
- rc = libusb_open(dev, &handle);
- if (LIBUSB_SUCCESS != rc) {
- printf("Could not open USB device\n");
- }
- } else if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
- if (handle) {
- libusb_close(handle);
- handle = NULL;
- }
- } else {
- printf("Unhandled event %d\n", event);
- }
- count++;
-
- return 0;
-}
-
-int main (void) {
- libusb_hotplug_callback_handle handle;
- int rc;
-
- libusb_init(NULL);
-
- rc = libusb_hotplug_register_callback(NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
- LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, 0x045a, 0x5005,
- LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, NULL,
- &handle);
- if (LIBUSB_SUCCESS != rc) {
- printf("Error creating a hotplug callback\n");
- libusb_exit(NULL);
- return EXIT_FAILURE;
- }
-
- while (count < 2) {
- usleep(10000);
- }
-
- libusb_hotplug_deregister_callback(handle);
- libusb_exit(NULL);
-
- return 0;
-}
-\endcode
- */
-
-static int usbi_hotplug_match_cb (struct libusb_context *ctx,
- struct libusb_device *dev, libusb_hotplug_event event,
- struct libusb_hotplug_callback *hotplug_cb)
-{
- /* Handle lazy deregistration of callback */
- if (hotplug_cb->needs_free) {
- /* Free callback */
- return 1;
- }
-
- if (!(hotplug_cb->events & event)) {
- return 0;
- }
-
- if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->vendor_id &&
- hotplug_cb->vendor_id != dev->device_descriptor.idVendor) {
- return 0;
- }
-
- if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->product_id &&
- hotplug_cb->product_id != dev->device_descriptor.idProduct) {
- return 0;
- }
-
- if (LIBUSB_HOTPLUG_MATCH_ANY != hotplug_cb->dev_class &&
- hotplug_cb->dev_class != dev->device_descriptor.bDeviceClass) {
- return 0;
- }
-
- return hotplug_cb->cb (ctx == usbi_default_context ? NULL : ctx,
- dev, event, hotplug_cb->user_data);
-}
-
-void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
- libusb_hotplug_event event)
-{
- struct libusb_hotplug_callback *hotplug_cb, *next;
- int ret;
-
- usbi_mutex_lock(&ctx->hotplug_cbs_lock);
-
- list_for_each_entry_safe(hotplug_cb, next, &ctx->hotplug_cbs, list, struct libusb_hotplug_callback) {
- usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
- ret = usbi_hotplug_match_cb (ctx, dev, event, hotplug_cb);
- usbi_mutex_lock(&ctx->hotplug_cbs_lock);
-
- if (ret) {
- list_del(&hotplug_cb->list);
- free(hotplug_cb);
- }
- }
-
- usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
-
- /* loop through and disconnect all open handles for this device */
- if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event) {
- struct libusb_device_handle *handle;
-
- usbi_mutex_lock(&ctx->open_devs_lock);
- list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
- if (dev == handle->dev) {
- usbi_handle_disconnect (handle);
- }
- }
- usbi_mutex_unlock(&ctx->open_devs_lock);
- }
-}
-
-int API_EXPORTED libusb_hotplug_register_callback(libusb_context *ctx,
- libusb_hotplug_event events, libusb_hotplug_flag flags,
- int vendor_id, int product_id, int dev_class,
- libusb_hotplug_callback_fn cb_fn, void *user_data,
- libusb_hotplug_callback_handle *handle)
-{
- libusb_hotplug_callback *new_callback;
- static int handle_id = 1;
-
- /* check for hotplug support */
- if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- return LIBUSB_ERROR_NOT_SUPPORTED;
- }
-
- /* check for sane values */
- if ((LIBUSB_HOTPLUG_MATCH_ANY != vendor_id && (~0xffff & vendor_id)) ||
- (LIBUSB_HOTPLUG_MATCH_ANY != product_id && (~0xffff & product_id)) ||
- (LIBUSB_HOTPLUG_MATCH_ANY != dev_class && (~0xff & dev_class)) ||
- !cb_fn) {
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- USBI_GET_CONTEXT(ctx);
-
- new_callback = (libusb_hotplug_callback *)calloc(1, sizeof (*new_callback));
- if (!new_callback) {
- return LIBUSB_ERROR_NO_MEM;
- }
-
- new_callback->ctx = ctx;
- new_callback->vendor_id = vendor_id;
- new_callback->product_id = product_id;
- new_callback->dev_class = dev_class;
- new_callback->flags = flags;
- new_callback->events = events;
- new_callback->cb = cb_fn;
- new_callback->user_data = user_data;
- new_callback->needs_free = 0;
-
- usbi_mutex_lock(&ctx->hotplug_cbs_lock);
-
- /* protect the handle by the context hotplug lock. it doesn't matter if the same handle
- * is used for different contexts only that the handle is unique for this context */
- new_callback->handle = handle_id++;
-
- list_add(&new_callback->list, &ctx->hotplug_cbs);
-
- if (flags & LIBUSB_HOTPLUG_ENUMERATE) {
- struct libusb_device *dev;
-
- usbi_mutex_lock(&ctx->usb_devs_lock);
-
- list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device) {
- (void) usbi_hotplug_match_cb (ctx, dev, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, new_callback);
- }
-
- usbi_mutex_unlock(&ctx->usb_devs_lock);
- }
-
- usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
-
- if (handle) {
- *handle = new_callback->handle;
- }
-
- return LIBUSB_SUCCESS;
-}
-
-void API_EXPORTED libusb_hotplug_deregister_callback (struct libusb_context *ctx,
- libusb_hotplug_callback_handle handle)
-{
- struct libusb_hotplug_callback *hotplug_cb;
- libusb_hotplug_message message;
- ssize_t ret;
-
- /* check for hotplug support */
- if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
- return;
- }
-
- USBI_GET_CONTEXT(ctx);
-
- usbi_mutex_lock(&ctx->hotplug_cbs_lock);
- list_for_each_entry(hotplug_cb, &ctx->hotplug_cbs, list,
- struct libusb_hotplug_callback) {
- if (handle == hotplug_cb->handle) {
- /* Mark this callback for deregistration */
- hotplug_cb->needs_free = 1;
- }
- }
- usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
-
- /* wakeup handle_events to do the actual free */
- memset(&message, 0, sizeof(message));
- ret = usbi_write(ctx->hotplug_pipe[1], &message, sizeof(message));
- if (sizeof(message) != ret) {
- usbi_err(ctx, "error writing hotplug message");
- }
-}
-
-void usbi_hotplug_deregister_all(struct libusb_context *ctx) {
- struct libusb_hotplug_callback *hotplug_cb, *next;
-
- usbi_mutex_lock(&ctx->hotplug_cbs_lock);
- list_for_each_entry_safe(hotplug_cb, next, &ctx->hotplug_cbs, list,
- struct libusb_hotplug_callback) {
- list_del(&hotplug_cb->list);
- free(hotplug_cb);
- }
-
- usbi_mutex_unlock(&ctx->hotplug_cbs_lock);
-}
diff --git a/third_party/libusb/src/libusb/hotplug.h b/third_party/libusb/src/libusb/hotplug.h
deleted file mode 100644
index 614ddbc..0000000
--- a/third_party/libusb/src/libusb/hotplug.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
-/*
- * Hotplug support for libusbx
- * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
- * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
- *
- * 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
- */
-
-#if !defined(USBI_HOTPLUG_H)
-#define USBI_HOTPLUG_H
-
-#ifndef LIBUSBI_H
-#include "libusbi.h"
-#endif
-
-/** \ingroup hotplug
- * The hotplug callback structure. The user populates this structure with
- * libusb_hotplug_prepare_callback() and then calls libusb_hotplug_register_callback()
- * to receive notification of hotplug events.
- */
-struct libusb_hotplug_callback {
- /** Context this callback is associated with */
- struct libusb_context *ctx;
-
- /** Vendor ID to match or LIBUSB_HOTPLUG_MATCH_ANY */
- int vendor_id;
-
- /** Product ID to match or LIBUSB_HOTPLUG_MATCH_ANY */
- int product_id;
-
- /** Device class to match or LIBUSB_HOTPLUG_MATCH_ANY */
- int dev_class;
-
- /** Hotplug callback flags */
- libusb_hotplug_flag flags;
-
- /** Event(s) that will trigger this callback */
- libusb_hotplug_event events;
-
- /** Callback function to invoke for matching event/device */
- libusb_hotplug_callback_fn cb;
-
- /** Handle for this callback (used to match on deregister) */
- libusb_hotplug_callback_handle handle;
-
- /** User data that will be passed to the callback function */
- void *user_data;
-
- /** Callback is marked for deletion */
- int needs_free;
-
- /** List this callback is registered in (ctx->hotplug_cbs) */
- struct list_head list;
-};
-
-typedef struct libusb_hotplug_callback libusb_hotplug_callback;
-
-struct libusb_hotplug_message {
- libusb_hotplug_event event;
- struct libusb_device *device;
-};
-
-typedef struct libusb_hotplug_message libusb_hotplug_message;
-
-void usbi_hotplug_deregister_all(struct libusb_context *ctx);
-void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev,
- libusb_hotplug_event event);
-
-#endif
diff --git a/third_party/libusb/src/libusb/interrupt.c b/third_party/libusb/src/libusb/interrupt.c
index 59221f5..addec78 100644
--- a/third_party/libusb/src/libusb/interrupt.c
+++ b/third_party/libusb/src/libusb/interrupt.c
@@ -1,9 +1,7 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdlib.h>
-
#include "libusbi.h"
int API_EXPORTED libusb_interrupt_handle_event(struct libusb_context* ctx) {
diff --git a/third_party/libusb/src/libusb/interrupt.h b/third_party/libusb/src/libusb/interrupt.h
index ac8d52d..73fd275 100644
--- a/third_party/libusb/src/libusb/interrupt.h
+++ b/third_party/libusb/src/libusb/interrupt.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/third_party/libusb/src/libusb/io.c b/third_party/libusb/src/libusb/io.c
index 4368b99..e9bd312 100644
--- a/third_party/libusb/src/libusb/io.c
+++ b/third_party/libusb/src/libusb/io.c
@@ -1,8 +1,7 @@
-/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
/*
- * I/O functions for libusbx
- * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ * I/O functions 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
@@ -19,34 +18,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "config.h"
+#include <config.h>
#include <errno.h>
+#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
+
#ifdef USBI_TIMERFD_AVAILABLE
#include <sys/timerfd.h>
#endif
#include "libusbi.h"
-#include "hotplug.h"
/**
* \page io Synchronous and asynchronous device I/O
*
* \section intro Introduction
*
- * If you're using libusbx in your application, you're probably wanting to
+ * If you're using libusb in your application, you're probably wanting to
* perform I/O with devices - you want to perform USB data transfers.
*
- * libusbx offers two separate interfaces for device I/O. This page aims to
+ * libusb offers two separate interfaces for device I/O. This page aims to
* introduce the two in order to help you decide which one is more suitable
* for your application. You can also choose to use both interfaces in your
* application by considering each transfer on a case-by-case basis.
@@ -76,7 +74,7 @@
* Data will arrive when the button is pressed by the user, which is
* potentially hours later.
*
- * libusbx offers both a synchronous and an asynchronous interface to performing
+ * libusb offers both a synchronous and an asynchronous interface to performing
* USB transfers. The main difference is that the synchronous interface
* combines both steps indicated above into a single function call, whereas
* the asynchronous interface separates them.
@@ -131,9 +129,9 @@ if (r == 0 && actual_length == sizeof(data)) {
* above.
*
* Instead of providing which functions that block until the I/O has complete,
- * libusbx's asynchronous interface presents non-blocking functions which
+ * libusb's asynchronous interface presents non-blocking functions which
* begin a transfer and then return immediately. Your application passes a
- * callback function pointer to this non-blocking function, which libusbx will
+ * callback function pointer to this non-blocking function, which libusb will
* call with the results of the transaction when it has completed.
*
* Transfers which have been submitted through the non-blocking functions
@@ -144,12 +142,12 @@ if (r == 0 && actual_length == sizeof(data)) {
* to use threads.
*
* This added flexibility does come with some complications though:
- * - In the interest of being a lightweight library, libusbx does not create
+ * - In the interest of being a lightweight library, libusb does not create
* threads and can only operate when your application is calling into it. Your
- * application must call into libusbx from it's main loop when events are ready
- * to be handled, or you must use some other scheme to allow libusbx to
+ * application must call into libusb from it's main loop when events are ready
+ * to be handled, or you must use some other scheme to allow libusb to
* undertake whatever work needs to be done.
- * - libusbx also needs to be called into at certain fixed points in time in
+ * - libusb also needs to be called into at certain fixed points in time in
* order to accurately handle transfer timeouts.
* - Memory handling becomes more complex. You cannot use stack memory unless
* the function with that stack is guaranteed not to return until the transfer
@@ -159,7 +157,7 @@ if (r == 0 && actual_length == sizeof(data)) {
* results are handled. This becomes particularly obvious when you want to
* submit a second transfer based on the results of an earlier transfer.
*
- * Internally, libusbx's synchronous interface is expressed in terms of function
+ * Internally, libusb's synchronous interface is expressed in terms of function
* calls to the asynchronous interface.
*
* For details on how to use the asynchronous API, see the
@@ -176,25 +174,25 @@ if (r == 0 && actual_length == sizeof(data)) {
* constraints on packet size defined by endpoint descriptors. The host must
* not send data payloads larger than the endpoint's maximum packet size.
*
- * libusbx and the underlying OS abstract out the packet concept, allowing you
+ * libusb and the underlying OS abstract out the packet concept, allowing you
* to request transfers of any size. Internally, the request will be divided
* up into correctly-sized packets. You do not have to be concerned with
* packet sizes, but there is one exception when considering overflows.
*
* \section overflow Bulk/interrupt transfer overflows
*
- * When requesting data on a bulk endpoint, libusbx requires you to supply a
- * buffer and the maximum number of bytes of data that libusbx can put in that
+ * When requesting data on a bulk endpoint, libusb requires you to supply a
+ * buffer and the maximum number of bytes of data that libusb can put in that
* buffer. However, the size of the buffer is not communicated to the device -
* the device is just asked to send any amount of data.
*
* There is no problem if the device sends an amount of data that is less than
- * or equal to the buffer size. libusbx reports this condition to you through
+ * or equal to the buffer size. libusb reports this condition to you through
* the \ref libusb_transfer::actual_length "libusb_transfer.actual_length"
* field.
*
* Problems may occur if the device attempts to send more data than can fit in
- * the buffer. libusbx reports LIBUSB_TRANSFER_OVERFLOW for this condition but
+ * the buffer. libusb reports LIBUSB_TRANSFER_OVERFLOW for this condition but
* other behaviour is largely undefined: actual_length may or may not be
* accurate, the chunk of data that can fit in the buffer (before overflow)
* may or may not have been transferred.
@@ -212,7 +210,7 @@ if (r == 0 && actual_length == sizeof(data)) {
/**
* @defgroup asyncio Asynchronous device I/O
*
- * This page details libusbx's asynchronous (non-blocking) API for USB device
+ * This page details libusb's asynchronous (non-blocking) API for USB device
* I/O. This interface is very powerful but is also quite complex - you will
* need to read this page carefully to understand the necessary considerations
* and issues surrounding use of this interface. Simplistic applications
@@ -227,7 +225,7 @@ if (r == 0 && actual_length == sizeof(data)) {
*
* \section asyncabstraction Transfer abstraction
*
- * For the asynchronous I/O, libusbx implements the concept of a generic
+ * For the asynchronous I/O, libusb implements the concept of a generic
* transfer entity for all types of I/O (control, bulk, interrupt,
* isochronous). The generic transfer object must be treated slightly
* differently depending on which type of I/O you are performing with it.
@@ -240,7 +238,7 @@ if (r == 0 && actual_length == sizeof(data)) {
* -# <b>Allocation</b>: allocate a libusb_transfer
* -# <b>Filling</b>: populate the libusb_transfer instance with information
* about the transfer you wish to perform
- * -# <b>Submission</b>: ask libusbx to submit the transfer
+ * -# <b>Submission</b>: ask libusb to submit the transfer
* -# <b>Completion handling</b>: examine transfer results in the
* libusb_transfer structure
* -# <b>Deallocation</b>: clean up resources
@@ -287,7 +285,7 @@ if (r == 0 && actual_length == sizeof(data)) {
*
* The user-specified callback is passed a pointer to the libusb_transfer
* structure which was used to setup and submit the transfer. At completion
- * time, libusbx has populated this structure with results of the transfer:
+ * time, libusb has populated this structure with results of the transfer:
* success or failure reason, number of bytes of data transferred, etc. See
* the libusb_transfer structure documentation for more information.
*
@@ -326,7 +324,7 @@ if (r == 0 && actual_length == sizeof(data)) {
* has completed will result in undefined behaviour.
*
* When a transfer is cancelled, some of the data may have been transferred.
- * libusbx will communicate this to you in the transfer callback. Do not assume
+ * libusb will communicate this to you in the transfer callback. Do not assume
* that no data was transferred.
*
* \section bulk_overflows Overflows on device-to-host bulk/interrupt endpoints
@@ -468,7 +466,7 @@ if (r == 0 && actual_length == sizeof(data)) {
*
* In most circumstances, it is not safe to use stack memory for transfer
* buffers. This is because the function that fired off the asynchronous
- * transfer may return before libusbx has finished using the buffer, and when
+ * transfer may return before libusb has finished using the buffer, and when
* the function returns it's stack gets destroyed. This is true for both
* host-to-device and device-to-host transfers.
*
@@ -488,101 +486,64 @@ if (r == 0 && actual_length == sizeof(data)) {
* \ref libusb_transfer_status::LIBUSB_TRANSFER_ERROR "LIBUSB_TRANSFER_ERROR"
* (they would normally be regarded as COMPLETED)
* - \ref libusb_transfer_flags::LIBUSB_TRANSFER_FREE_BUFFER
- * "LIBUSB_TRANSFER_FREE_BUFFER" allows you to ask libusbx to free the transfer
+ * "LIBUSB_TRANSFER_FREE_BUFFER" allows you to ask libusb to free the transfer
* buffer when freeing the transfer.
* - \ref libusb_transfer_flags::LIBUSB_TRANSFER_FREE_TRANSFER
- * "LIBUSB_TRANSFER_FREE_TRANSFER" causes libusbx to automatically free the
+ * "LIBUSB_TRANSFER_FREE_TRANSFER" causes libusb to automatically free the
* transfer after the transfer callback returns.
*
* \section asyncevent Event handling
*
- * An asynchronous model requires that libusbx perform work at various
+ * In accordance of the aim of being a lightweight library, libusb does not
+ * create threads internally. This means that libusb code does not execute
+ * at any time other than when your application is calling a libusb function.
+ * However, an asynchronous model requires that libusb perform work at various
* points in time - namely processing the results of previously-submitted
* transfers and invoking the user-supplied callback function.
*
* This gives rise to the libusb_handle_events() function which your
- * application must call into when libusbx has work do to. This gives libusbx
+ * application must call into when libusb has work do to. This gives libusb
* the opportunity to reap pending transfers, invoke callbacks, etc.
*
- * There are 2 different approaches to dealing with libusb_handle_events:
- *
+ * The first issue to discuss here is how your application can figure out
+ * when libusb has work to do. In fact, there are two naive options which
+ * do not actually require your application to know this:
+ * -# Periodically call libusb_handle_events() in non-blocking mode at fixed
+ * short intervals from your main loop
* -# Repeatedly call libusb_handle_events() in blocking mode from a dedicated
* thread.
- * -# Integrate libusbx with your application's main event loop. libusbx
- * exposes a set of file descriptors which allow you to do this.
- *
- * The first approach has the big advantage that it will also work on Windows
- * were libusbx' poll API for select / poll integration is not available. So
- * if you want to support Windows and use the async API, you must use this
- * approach, see the \ref eventthread "Using an event handling thread" section
- * below for details.
*
- * If you prefer a single threaded approach with a single central event loop,
- * see the \ref poll "polling and timing" section for how to integrate libusbx
- * into your application's main event loop.
+ * The first option is plainly not very nice, and will cause unnecessary
+ * CPU wakeups leading to increased power usage and decreased battery life.
+ * The second option is not very nice either, but may be the nicest option
+ * available to you if the "proper" approach can not be applied to your
+ * application (read on...).
*
- * \section eventthread Using an event handling thread
- *
- * Lets begin with stating the obvious: If you're going to use a separate
- * thread for libusbx event handling, your callback functions MUST be
- * threadsafe.
- *
- * Other then that doing event handling from a separate thread, is mostly
- * simple. You can use an event thread function as follows:
-\code
-void *event_thread_func(void *ctx)
-{
- while (event_thread_run)
- libusb_handle_events(ctx);
-
- return NULL;
-}
-\endcode
- *
- * There is one caveat though, stopping this thread requires setting the
- * event_thread_run variable to 0, and after that libusb_handle_events() needs
- * to return control to event_thread_func. But unless some event happens,
- * libusb_handle_events() will not return.
- *
- * There are 2 different ways of dealing with this, depending on if your
- * application uses libusbx' \ref hotplug "hotplug" support or not.
+ * The recommended option is to integrate libusb with your application main
+ * event loop. libusb exposes a set of file descriptors which allow you to do
+ * this. Your main loop is probably already calling poll() or select() or a
+ * variant on a set of file descriptors for other event sources (e.g. keyboard
+ * button presses, mouse movements, network sockets, etc). You then add
+ * libusb's file descriptors to your poll()/select() calls, and when activity
+ * is detected on such descriptors you know it is time to call
+ * libusb_handle_events().
*
- * Applications which do not use hotplug support, should not start the event
- * thread until after their first call to libusb_open(), and should stop the
- * thread when closing the last open device as follows:
-\code
-void my_close_handle(libusb_device_handle *handle)
-{
- if (open_devs == 1)
- event_thread_run = 0;
-
- libusb_close(handle); // This wakes up libusb_handle_events()
-
- if (open_devs == 1)
- pthread_join(event_thread);
-
- open_devs--;
-}
-\endcode
+ * There is one final event handling complication. libusb supports
+ * asynchronous transfers which time out after a specified time period, and
+ * this requires that libusb is called into at or after the timeout so that
+ * the timeout can be handled. So, in addition to considering libusb's file
+ * descriptors in your main event loop, you must also consider that libusb
+ * sometimes needs to be called into at fixed points in time even when there
+ * is no file descriptor activity.
*
- * Applications using hotplug support should start the thread at program init,
- * after having successfully called libusb_hotplug_register_callback(), and
- * should stop the thread at program exit as follows:
-\code
-void my_libusb_exit(void)
-{
- event_thread_run = 0;
- libusb_hotplug_deregister_callback(ctx, hotplug_cb_handle); // This wakes up libusb_handle_events()
- pthread_join(event_thread);
- libusb_exit(ctx);
-}
-\endcode
+ * For the details on retrieving the set of file descriptors and determining
+ * the next timeout, see the \ref poll "polling and timing" API documentation.
*/
/**
* @defgroup poll Polling and timing
*
- * This page documents libusbx's functions for polling events and timing.
+ * This page documents libusb's functions for polling events and timing.
* These functions are only necessary for users of the
* \ref asyncio "asynchronous API". If you are only using the simpler
* \ref syncio "synchronous API" then you do not need to ever call these
@@ -590,28 +551,10 @@ void my_libusb_exit(void)
*
* The justification for the functionality described here has already been
* discussed in the \ref asyncevent "event handling" section of the
- * asynchronous API documentation. In summary, libusbx does not create internal
+ * asynchronous API documentation. In summary, libusb does not create internal
* threads for event processing and hence relies on your application calling
- * into libusbx at certain points in time so that pending events can be handled.
- *
- * Your main loop is probably already calling poll() or select() or a
- * variant on a set of file descriptors for other event sources (e.g. keyboard
- * button presses, mouse movements, network sockets, etc). You then add
- * libusbx's file descriptors to your poll()/select() calls, and when activity
- * is detected on such descriptors you know it is time to call
- * libusb_handle_events().
- *
- * There is one final event handling complication. libusbx supports
- * asynchronous transfers which time out after a specified time period.
- *
- * On some platforms a timerfd is used, so the timeout handling is just another
- * fd, on other platforms this requires that libusbx is called into at or after
- * the timeout to handle it. So, in addition to considering libusbx's file
- * descriptors in your main event loop, you must also consider that libusbx
- * sometimes needs to be called into at fixed points in time even when there
- * is no file descriptor activity, see \ref polltime details.
- *
- * In order to know precisely when libusbx needs to be called into, libusbx
+ * into libusb at certain points in time so that pending events can be handled.
+ * In order to know precisely when libusb needs to be called into, libusb
* offers you a set of pollable file descriptors and information about when
* the next timeout expires.
*
@@ -620,10 +563,10 @@ void my_libusb_exit(void)
*
* \section pollsimple The simple option
*
- * If your application revolves solely around libusbx and does not need to
+ * If your application revolves solely around libusb and does not need to
* handle other event sources, you can have a program structure as follows:
\code
-// initialize libusbx
+// initialize libusb
// find and open device
// maybe fire off some initial async I/O
@@ -640,21 +583,20 @@ while (user_has_not_requested_exit)
* \section pollmain The more advanced option
*
* \note This functionality is currently only available on Unix-like platforms.
- * On Windows, libusb_get_pollfds() simply returns NULL. Applications which
- * want to support Windows are advised to use an \ref eventthread
- * "event handling thread" instead.
+ * On Windows, libusb_get_pollfds() simply returns NULL. Exposing event sources
+ * on Windows will require some further thought and design.
*
* In more advanced applications, you will already have a main loop which
* is monitoring other event sources: network sockets, X11 events, mouse
- * movements, etc. Through exposing a set of file descriptors, libusbx is
+ * movements, etc. Through exposing a set of file descriptors, libusb is
* designed to cleanly integrate into such main loops.
*
* In addition to polling file descriptors for the other event sources, you
- * take a set of file descriptors from libusbx and monitor those too. When you
- * detect activity on libusbx's file descriptors, you call
+ * take a set of file descriptors from libusb and monitor those too. When you
+ * detect activity on libusb's file descriptors, you call
* libusb_handle_events_timeout() in non-blocking mode.
*
- * What's more, libusbx may also need to handle events at specific moments in
+ * What's more, libusb may also need to handle events at specific moments in
* time. No file descriptor activity is generated at these times, so your
* own application needs to be continually aware of when the next one of these
* moments occurs (through calling libusb_get_next_timeout()), and then it
@@ -662,25 +604,25 @@ while (user_has_not_requested_exit)
* these moments occur. This means that you need to adjust your
* poll()/select() timeout accordingly.
*
- * libusbx provides you with a set of file descriptors to poll and expects you
+ * libusb provides you with a set of file descriptors to poll and expects you
* to poll all of them, treating them as a single entity. The meaning of each
* file descriptor in the set is an internal implementation detail,
* platform-dependent and may vary from release to release. Don't try and
- * interpret the meaning of the file descriptors, just do as libusbx indicates,
+ * interpret the meaning of the file descriptors, just do as libusb indicates,
* polling all of them at once.
*
* In pseudo-code, you want something that looks like:
\code
-// initialise libusbx
+// initialise libusb
libusb_get_pollfds(ctx)
while (user has not requested application exit) {
libusb_get_next_timeout(ctx);
- poll(on libusbx file descriptors plus any other event sources of interest,
- using a timeout no larger than the value libusbx just suggested)
- if (poll() indicated activity on libusbx file descriptors)
+ poll(on libusb file descriptors plus any other event sources of interest,
+ using a timeout no larger than the value libusb just suggested)
+ if (poll() indicated activity on libusb file descriptors)
libusb_handle_events_timeout(ctx, &zero_tv);
- if (time has elapsed to or beyond the libusbx timeout)
+ if (time has elapsed to or beyond the libusb timeout)
libusb_handle_events_timeout(ctx, &zero_tv);
// handle events from other sources here
}
@@ -690,7 +632,7 @@ while (user has not requested application exit) {
*
* \subsection polltime Notes on time-based events
*
- * The above complication with having to track time and call into libusbx at
+ * The above complication with having to track time and call into libusb at
* specific moments is a bit of a headache. For maximum compatibility, you do
* need to write your main loop as above, but you may decide that you can
* restrict the supported platforms of your application and get away with
@@ -702,18 +644,18 @@ while (user has not requested application exit) {
* - Linux, provided that the following version requirements are satisfied:
* - Linux v2.6.27 or newer, compiled with timerfd support
* - glibc v2.9 or newer
- * - libusbx v1.0.5 or newer
+ * - libusb v1.0.5 or newer
*
* Under these configurations, libusb_get_next_timeout() will \em always return
* 0, so your main loop can be simplified to:
\code
-// initialise libusbx
+// initialise libusb
libusb_get_pollfds(ctx)
while (user has not requested application exit) {
- poll(on libusbx file descriptors plus any other event sources of interest,
+ poll(on libusb file descriptors plus any other event sources of interest,
using any timeout that you like)
- if (poll() indicated activity on libusbx file descriptors)
+ if (poll() indicated activity on libusb file descriptors)
libusb_handle_events_timeout(ctx, &zero_tv);
// handle events from other sources here
}
@@ -723,20 +665,20 @@ while (user has not requested application exit) {
*
* Do remember that if you simplify your main loop to the above, you will
* lose compatibility with some platforms (including legacy Linux platforms,
- * and <em>any future platforms supported by libusbx which may have time-based
+ * and <em>any future platforms supported by libusb which may have time-based
* event requirements</em>). The resultant problems will likely appear as
* strange bugs in your application.
*
* You can use the libusb_pollfds_handle_timeouts() function to do a runtime
* check to see if it is safe to ignore the time-based event complications.
- * If your application has taken the shortcut of ignoring libusbx's next timeout
+ * If your application has taken the shortcut of ignoring libusb's next timeout
* in your main loop, then you are advised to check the return value of
* libusb_pollfds_handle_timeouts() during application startup, and to abort
* if the platform does suffer from these timing complications.
*
* \subsection fdsetchange Changes in the file descriptor set
*
- * The set of file descriptors that libusbx uses as event sources may change
+ * The set of file descriptors that libusb uses as event sources may change
* during the life of your application. Rather than having to repeatedly
* call libusb_get_pollfds(), you can set up notification functions for when
* the file descriptor set changes using libusb_set_pollfd_notifiers().
@@ -757,10 +699,10 @@ while (user has not requested application exit) {
/** \page mtasync Multi-threaded applications and asynchronous I/O
*
- * libusbx is a thread-safe library, but extra considerations must be applied
- * to applications which interact with libusbx from multiple threads.
+ * libusb is a thread-safe library, but extra considerations must be applied
+ * to applications which interact with libusb from multiple threads.
*
- * The underlying issue that must be addressed is that all libusbx I/O
+ * The underlying issue that must be addressed is that all libusb I/O
* revolves around monitoring file descriptors through the poll()/select()
* system calls. This is directly exposed at the
* \ref asyncio "asynchronous interface" but it is important to note that the
@@ -768,13 +710,13 @@ while (user has not requested application exit) {
* asynchonrous interface, therefore the same considerations apply.
*
* The issue is that if two or more threads are concurrently calling poll()
- * or select() on libusbx's file descriptors then only one of those threads
+ * or select() on libusb's file descriptors then only one of those threads
* will be woken up when an event arrives. The others will be completely
* oblivious that anything has happened.
*
* Consider the following pseudo-code, which submits an asynchronous transfer
* then waits for its completion. This style is one way you could implement a
- * synchronous interface on top of the asynchronous interface (and libusbx
+ * synchronous interface on top of the asynchronous interface (and libusb
* does something similar, albeit more advanced due to the complications
* explained on this page).
*
@@ -797,7 +739,7 @@ void myfunc() {
libusb_submit_transfer(transfer);
while (!completed) {
- poll(libusbx file descriptors, 120*1000);
+ poll(libusb file descriptors, 120*1000);
if (poll indicates activity)
libusb_handle_events_timeout(ctx, &zero_tv);
}
@@ -811,7 +753,7 @@ void myfunc() {
* The poll() loop has a long timeout to minimize CPU usage during situations
* when nothing is happening (it could reasonably be unlimited).
*
- * If this is the only thread that is polling libusbx's file descriptors, there
+ * If this is the only thread that is polling libusb's file descriptors, there
* is no problem: there is no danger that another thread will swallow up the
* event that we are interested in. On the other hand, if there is another
* thread polling the same descriptors, there is a chance that it will receive
@@ -823,13 +765,13 @@ void myfunc() {
*
* The solution here is to ensure that no two threads are ever polling the
* file descriptors at the same time. A naive implementation of this would
- * impact the capabilities of the library, so libusbx offers the scheme
+ * impact the capabilities of the library, so libusb offers the scheme
* documented below to ensure no loss of functionality.
*
* Before we go any further, it is worth mentioning that all libusb-wrapped
* event handling procedures fully adhere to the scheme documented below.
* This includes libusb_handle_events() and its variants, and all the
- * synchronous I/O functions - libusbx hides this headache from you.
+ * synchronous I/O functions - libusb hides this headache from you.
*
* \section Using libusb_handle_events() from multiple threads
*
@@ -875,17 +817,17 @@ void myfunc() {
*
* \section eventlock The events lock
*
- * The problem is when we consider the fact that libusbx exposes file
+ * The problem is when we consider the fact that libusb exposes file
* descriptors to allow for you to integrate asynchronous USB I/O into
* existing main loops, effectively allowing you to do some work behind
- * libusbx's back. If you do take libusbx's file descriptors and pass them to
+ * libusb's back. If you do take libusb's file descriptors and pass them to
* poll()/select() yourself, you need to be aware of the associated issues.
*
* The first concept to be introduced is the events lock. The events lock
* is used to serialize threads that want to handle events, such that only
* one thread is handling events at any one time.
*
- * You must take the events lock before polling libusbx file descriptors,
+ * You must take the events lock before polling libusb file descriptors,
* using libusb_lock_events(). You must release the lock as soon as you have
* aborted your poll()/select() loop, using libusb_unlock_events().
*
@@ -896,7 +838,7 @@ void myfunc() {
\code
libusb_lock_events(ctx);
while (!completed) {
- poll(libusbx file descriptors, 120*1000);
+ poll(libusb file descriptors, 120*1000);
if (poll indicates activity)
libusb_handle_events_timeout(ctx, &zero_tv);
}
@@ -912,7 +854,7 @@ void myfunc() {
* status of its transfer until the code above has finished (30 seconds later)
* due to contention on the lock.
*
- * To solve this, libusbx offers you a mechanism to determine when another
+ * To solve this, libusb offers you a mechanism to determine when another
* thread is handling events. It also offers a mechanism to block your thread
* until the event handling thread has completed an event (and this mechanism
* does not involve polling of file descriptors).
@@ -938,7 +880,7 @@ if (libusb_try_lock_events(ctx) == 0) {
libusb_unlock_events(ctx);
goto retry;
}
- poll(libusbx file descriptors, 120*1000);
+ poll(libusb file descriptors, 120*1000);
if (poll indicates activity)
libusb_handle_events_locked(ctx, 0);
}
@@ -984,8 +926,8 @@ printf("completed!\n");
* should be apparent from the code shown above.
* -# libusb_try_lock_events() is a non-blocking function which attempts
* to acquire the events lock but returns a failure code if it is contended.
- * -# libusb_event_handling_ok() checks that libusbx is still happy for your
- * thread to be performing event handling. Sometimes, libusbx needs to
+ * -# libusb_event_handling_ok() checks that libusb is still happy for your
+ * thread to be performing event handling. Sometimes, libusb needs to
* interrupt the event handler, and this is how you can check if you have
* been interrupted. If this function returns 0, the correct behaviour is
* for you to give up the event handling lock, and then to repeat the cycle.
@@ -995,12 +937,12 @@ printf("completed!\n");
* libusb_handle_events_timeout() that you can call while holding the
* events lock. libusb_handle_events_timeout() itself implements similar
* logic to the above, so be sure not to call it when you are
- * "working behind libusbx's back", as is the case here.
+ * "working behind libusb's back", as is the case here.
* -# libusb_event_handler_active() determines if someone is currently
* holding the events lock
*
* You might be wondering why there is no function to wake up all threads
- * blocked on libusb_wait_for_event(). This is because libusbx can do this
+ * blocked on libusb_wait_for_event(). This is because libusb can do this
* internally: it will wake up all such threads when someone calls
* libusb_unlock_events() or when a transfer completes (at the point after its
* callback has returned).
@@ -1009,7 +951,7 @@ printf("completed!\n");
*
* The above explanation should be enough to get you going, but if you're
* really thinking through the issues then you may be left with some more
- * questions regarding libusbx's internals. If you're curious, read on, and if
+ * questions regarding libusb's internals. If you're curious, read on, and if
* not, skip to the next section to avoid confusing yourself!
*
* The immediate question that may spring to mind is: what if one thread
@@ -1024,14 +966,14 @@ printf("completed!\n");
* are all kinds of race conditions that could arise here, so it is
* important that nobody is doing event handling at this time.
*
- * libusbx handles these issues internally, so application developers do not
+ * libusb handles these issues internally, so application developers do not
* have to stop their event handlers while opening/closing devices. Here's how
* it works, focusing on the libusb_close() situation first:
*
- * -# During initialization, libusbx opens an internal pipe, and it adds the read
+ * -# During initialization, libusb opens an internal pipe, and it adds the read
* end of this pipe to the set of file descriptors to be polled.
- * -# During libusb_close(), libusbx writes some dummy data on this control pipe.
- * This immediately interrupts the event handler. libusbx also records
+ * -# During libusb_close(), libusb writes some dummy data on this control pipe.
+ * This immediately interrupts the event handler. libusb also records
* internally that it is trying to interrupt event handlers for this
* high-priority event.
* -# At this point, some of the functions described above start behaving
@@ -1046,7 +988,7 @@ printf("completed!\n");
* giving up the events lock very quickly, giving the high-priority
* libusb_close() operation a "free ride" to acquire the events lock. All
* threads that are competing to do event handling become event waiters.
- * -# With the events lock held inside libusb_close(), libusbx can safely remove
+ * -# With the events lock held inside libusb_close(), libusb can safely remove
* a file descriptor from the poll set, in the safety of knowledge that
* nobody is polling those descriptors or trying to access the poll set.
* -# After obtaining the events lock, the close operation completes very
@@ -1063,7 +1005,7 @@ printf("completed!\n");
* call to libusb_open():
*
* -# The device is opened and a file descriptor is added to the poll set.
- * -# libusbx sends some dummy data on the control pipe, and records that it
+ * -# libusb sends some dummy data on the control pipe, and records that it
* is trying to modify the poll descriptor set.
* -# The event handler is interrupted, and the same behaviour change as for
* libusb_close() takes effect, causing all event handling threads to become
@@ -1079,7 +1021,7 @@ printf("completed!\n");
*
* The above may seem a little complicated, but hopefully I have made it clear
* why such complications are necessary. Also, do not forget that this only
- * applies to applications that take libusbx's file descriptors and integrate
+ * applies to applications that take libusb's file descriptors and integrate
* them into their own polling loops.
*
* You may decide that it is OK for your multi-threaded application to ignore
@@ -1128,17 +1070,6 @@ int usbi_io_init(struct libusb_context *ctx)
if (r < 0)
goto err_close_pipe;
- /* create hotplug pipe */
- r = usbi_pipe(ctx->hotplug_pipe);
- if (r < 0) {
- r = LIBUSB_ERROR_OTHER;
- goto err;
- }
-
- r = usbi_add_pollfd(ctx, ctx->hotplug_pipe[0], POLLIN);
- if (r < 0)
- goto err_close_hp_pipe;
-
#ifdef USBI_TIMERFD_AVAILABLE
ctx->timerfd = timerfd_create(usbi_backend->get_timerfd_clockid(),
TFD_NONBLOCK);
@@ -1148,7 +1079,7 @@ int usbi_io_init(struct libusb_context *ctx)
if (r < 0) {
usbi_remove_pollfd(ctx, ctx->ctrl_pipe[0]);
close(ctx->timerfd);
- goto err_close_hp_pipe;
+ goto err_close_pipe;
}
} else {
usbi_dbg("timerfd not available (code %d error %d)", ctx->timerfd, errno);
@@ -1158,9 +1089,6 @@ int usbi_io_init(struct libusb_context *ctx)
return 0;
-err_close_hp_pipe:
- usbi_close(ctx->hotplug_pipe[0]);
- usbi_close(ctx->hotplug_pipe[1]);
err_close_pipe:
usbi_close(ctx->ctrl_pipe[0]);
usbi_close(ctx->ctrl_pipe[1]);
@@ -1179,9 +1107,6 @@ void usbi_io_exit(struct libusb_context *ctx)
usbi_remove_pollfd(ctx, ctx->ctrl_pipe[0]);
usbi_close(ctx->ctrl_pipe[0]);
usbi_close(ctx->ctrl_pipe[1]);
- usbi_remove_pollfd(ctx, ctx->hotplug_pipe[0]);
- usbi_close(ctx->hotplug_pipe[0]);
- usbi_close(ctx->hotplug_pipe[1]);
#ifdef USBI_TIMERFD_AVAILABLE
if (usbi_using_timerfd(ctx)) {
usbi_remove_pollfd(ctx, ctx->timerfd);
@@ -1216,7 +1141,7 @@ static int calculate_timeout(struct usbi_transfer *transfer)
current_time.tv_sec += timeout / 1000;
current_time.tv_nsec += (timeout % 1000) * 1000000;
- while (current_time.tv_nsec >= 1000000000) {
+ if (current_time.tv_nsec > 1000000000) {
current_time.tv_nsec -= 1000000000;
current_time.tv_sec++;
}
@@ -1226,10 +1151,8 @@ static int calculate_timeout(struct usbi_transfer *transfer)
}
/* add a transfer to the (timeout-sorted) active transfers list.
- * Callers of this function must hold the flying_transfers_lock.
- * This function *always* adds the transfer to the flying_transfers list,
- * it will return non 0 if it fails to update the timer, but even then the
- * transfer is added to the flying_transfers list. */
+ * returns 1 if the transfer has a timeout and it is the timeout next to
+ * expire */
static int add_to_flying_list(struct usbi_transfer *transfer)
{
struct usbi_transfer *cur;
@@ -1238,16 +1161,19 @@ static int add_to_flying_list(struct usbi_transfer *transfer)
int r = 0;
int first = 1;
+ usbi_mutex_lock(&ctx->flying_transfers_lock);
+
/* if we have no other flying transfers, start the list with this one */
if (list_empty(&ctx->flying_transfers)) {
list_add(&transfer->list, &ctx->flying_transfers);
+ if (timerisset(timeout))
+ r = 1;
goto out;
}
/* if we have infinite timeout, append to end of list */
if (!timerisset(timeout)) {
list_add_tail(&transfer->list, &ctx->flying_transfers);
- /* first is irrelevant in this case */
goto out;
}
@@ -1260,38 +1186,21 @@ static int add_to_flying_list(struct usbi_transfer *transfer)
(cur_tv->tv_sec == timeout->tv_sec &&
cur_tv->tv_usec > timeout->tv_usec)) {
list_add_tail(&transfer->list, &cur->list);
+ r = first;
goto out;
}
first = 0;
}
- /* first is 0 at this stage (list not empty) */
/* otherwise we need to be inserted at the end */
list_add_tail(&transfer->list, &ctx->flying_transfers);
out:
-#ifdef USBI_TIMERFD_AVAILABLE
- if (first && usbi_using_timerfd(ctx) && timerisset(timeout)) {
- /* if this transfer has the lowest timeout of all active transfers,
- * rearm the timerfd with this transfer's timeout */
- const struct itimerspec it = { {0, 0},
- { timeout->tv_sec, timeout->tv_usec * 1000 } };
- usbi_dbg("arm timerfd for timeout in %dms (first in line)",
- USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
- r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
- if (r < 0) {
- usbi_warn(ctx, "failed to arm first timerfd (errno %d)", errno);
- r = LIBUSB_ERROR_OTHER;
- }
- }
-#else
- UNUSED(first);
-#endif
-
+ usbi_mutex_unlock(&ctx->flying_transfers_lock);
return r;
}
/** \ingroup asyncio
- * Allocate a libusbx transfer with a specified number of isochronous packet
+ * Allocate a libusb transfer with a specified number of isochronous packet
* descriptors. The returned transfer is pre-initialized for you. When the new
* transfer is no longer needed, it should be freed with
* libusb_free_transfer().
@@ -1323,10 +1232,11 @@ struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(
+ sizeof(struct libusb_transfer)
+ (sizeof(struct libusb_iso_packet_descriptor) * iso_packets)
+ os_alloc_size;
- struct usbi_transfer *itransfer = calloc(1, alloc_size);
+ struct usbi_transfer *itransfer = malloc(alloc_size);
if (!itransfer)
return NULL;
+ memset(itransfer, 0, alloc_size);
itransfer->num_iso_packets = iso_packets;
usbi_mutex_init(&itransfer->lock, NULL);
return USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
@@ -1363,62 +1273,6 @@ void API_EXPORTED libusb_free_transfer(struct libusb_transfer *transfer)
free(itransfer);
}
-#ifdef USBI_TIMERFD_AVAILABLE
-static int disarm_timerfd(struct libusb_context *ctx)
-{
- const struct itimerspec disarm_timer = { { 0, 0 }, { 0, 0 } };
- int r;
-
- usbi_dbg("");
- r = timerfd_settime(ctx->timerfd, 0, &disarm_timer, NULL);
- if (r < 0)
- return LIBUSB_ERROR_OTHER;
- else
- return 0;
-}
-
-/* iterates through the flying transfers, and rearms the timerfd based on the
- * next upcoming timeout.
- * must be called with flying_list locked.
- * returns 0 if there was no timeout to arm, 1 if the next timeout was armed,
- * or a LIBUSB_ERROR code on failure.
- */
-static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
-{
- struct usbi_transfer *transfer;
-
- list_for_each_entry(transfer, &ctx->flying_transfers, list, struct usbi_transfer) {
- struct timeval *cur_tv = &transfer->timeout;
-
- /* if we've reached transfers of infinite timeout, then we have no
- * arming to do */
- if (!timerisset(cur_tv))
- goto disarm;
-
- /* act on first transfer that is not already cancelled */
- if (!(transfer->flags & USBI_TRANSFER_TIMED_OUT)) {
- int r;
- const struct itimerspec it = { {0, 0},
- { cur_tv->tv_sec, cur_tv->tv_usec * 1000 } };
- usbi_dbg("next timeout originally %dms", USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
- r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
- if (r < 0)
- return LIBUSB_ERROR_OTHER;
- return 1;
- }
- }
-
-disarm:
- return disarm_timerfd(ctx);
-}
-#else
-static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
-{
- (void)ctx;
- return 0;
-}
-#endif
-
/** \ingroup asyncio
* Submit a transfer. This function will fire off the USB transfer and then
* return immediately.
@@ -1437,7 +1291,7 @@ int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
struct usbi_transfer *itransfer =
LIBUSB_TRANSFER_TO_USBI_TRANSFER(transfer);
int r;
- int updated_fds;
+ int first;
usbi_mutex_lock(&itransfer->lock);
itransfer->transferred = 0;
@@ -1448,22 +1302,30 @@ int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
goto out;
}
- usbi_mutex_lock(&ctx->flying_transfers_lock);
- r = add_to_flying_list(itransfer);
- if (r == LIBUSB_SUCCESS) {
- r = usbi_backend->submit_transfer(itransfer);
- }
- if (r != LIBUSB_SUCCESS) {
+ first = add_to_flying_list(itransfer);
+ r = usbi_backend->submit_transfer(itransfer);
+ if (r) {
+ usbi_mutex_lock(&ctx->flying_transfers_lock);
list_del(&itransfer->list);
- arm_timerfd_for_next_timeout(ctx);
+ usbi_mutex_unlock(&ctx->flying_transfers_lock);
}
- usbi_mutex_unlock(&ctx->flying_transfers_lock);
+#ifdef USBI_TIMERFD_AVAILABLE
+ else if (first && usbi_using_timerfd(ctx)) {
+ /* if this transfer has the lowest timeout of all active transfers,
+ * rearm the timerfd with this transfer's timeout */
+ const struct itimerspec it = { {0, 0},
+ { itransfer->timeout.tv_sec, itransfer->timeout.tv_usec * 1000 } };
+ usbi_dbg("arm timerfd for timeout in %dms (first in line)", transfer->timeout);
+ r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
+ if (r < 0)
+ r = LIBUSB_ERROR_OTHER;
+ }
+#else
+ (void)first;
+#endif
out:
- updated_fds = (itransfer->flags & USBI_TRANSFER_UPDATED_FDS);
usbi_mutex_unlock(&itransfer->lock);
- if (updated_fds)
- usbi_fd_notification(ctx);
return r;
}
@@ -1491,8 +1353,7 @@ int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)
usbi_mutex_lock(&itransfer->lock);
r = usbi_backend->cancel_transfer(itransfer);
if (r < 0) {
- if (r != LIBUSB_ERROR_NOT_FOUND &&
- r != LIBUSB_ERROR_NO_DEVICE)
+ if (r != LIBUSB_ERROR_NOT_FOUND)
usbi_err(TRANSFER_CTX(transfer),
"cancel transfer failed error %d", r);
else
@@ -1508,6 +1369,66 @@ int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)
return r;
}
+#ifdef USBI_TIMERFD_AVAILABLE
+static int disarm_timerfd(struct libusb_context *ctx)
+{
+ const struct itimerspec disarm_timer = { { 0, 0 }, { 0, 0 } };
+ int r;
+
+ usbi_dbg("");
+ r = timerfd_settime(ctx->timerfd, 0, &disarm_timer, NULL);
+ if (r < 0)
+ return LIBUSB_ERROR_OTHER;
+ else
+ return 0;
+}
+
+/* iterates through the flying transfers, and rearms the timerfd based on the
+ * next upcoming timeout.
+ * must be called with flying_list locked.
+ * returns 0 if there was no timeout to arm, 1 if the next timeout was armed,
+ * or a LIBUSB_ERROR code on failure.
+ */
+static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
+{
+ struct usbi_transfer *transfer;
+
+ list_for_each_entry(transfer, &ctx->flying_transfers, list, struct usbi_transfer) {
+ struct timeval *cur_tv = &transfer->timeout;
+
+ /* if we've reached transfers of infinite timeout, then we have no
+ * arming to do */
+ if (!timerisset(cur_tv))
+ return 0;
+
+ /* act on first transfer that is not already cancelled */
+ if (!(transfer->flags & USBI_TRANSFER_TIMED_OUT)) {
+ int r;
+ const struct itimerspec it = { {0, 0},
+ { cur_tv->tv_sec, cur_tv->tv_usec * 1000 } };
+ usbi_dbg("next timeout originally %dms", USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
+ r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
+ if (r < 0)
+ return LIBUSB_ERROR_OTHER;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+#else
+static int disarm_timerfd(struct libusb_context *ctx)
+{
+ (void)ctx;
+ return 0;
+}
+static int arm_timerfd_for_next_timeout(struct libusb_context *ctx)
+{
+ (void)ctx;
+ return 0;
+}
+#endif
+
/* Handle completion of a transfer (completion might be an error condition).
* This will invoke the user-supplied callback function, which may end up
* freeing the transfer. Therefore you cannot use the transfer structure
@@ -1535,8 +1456,14 @@ int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
if (usbi_using_timerfd(ctx))
r = arm_timerfd_for_next_timeout(ctx);
usbi_mutex_unlock(&ctx->flying_transfers_lock);
- if (usbi_using_timerfd(ctx) && (r < 0))
- return r;
+
+ if (usbi_using_timerfd(ctx)) {
+ if (r < 0)
+ return r;
+ r = disarm_timerfd(ctx);
+ if (r < 0)
+ return r;
+ }
if (status == LIBUSB_TRANSFER_COMPLETED
&& transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) {
@@ -1585,11 +1512,11 @@ int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer)
/** \ingroup poll
* Attempt to acquire the event handling lock. This lock is used to ensure that
- * only one thread is monitoring libusbx event sources at any one time.
+ * only one thread is monitoring libusb event sources at any one time.
*
* You only need to use this lock if you are developing an application
- * which calls poll() or select() on libusbx's file descriptors directly.
- * If you stick to libusbx's event handling loop functions (e.g.
+ * which calls poll() or select() on libusb's file descriptors directly.
+ * If you stick to libusb's event handling loop functions (e.g.
* libusb_handle_events()) then you do not need to be concerned with this
* locking.
*
@@ -1605,15 +1532,14 @@ int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer)
int API_EXPORTED libusb_try_lock_events(libusb_context *ctx)
{
int r;
- unsigned int ru;
USBI_GET_CONTEXT(ctx);
/* is someone else waiting to modify poll fds? if so, don't let this thread
* start event handling */
usbi_mutex_lock(&ctx->pollfd_modify_lock);
- ru = ctx->pollfd_modify;
+ r = ctx->pollfd_modify;
usbi_mutex_unlock(&ctx->pollfd_modify_lock);
- if (ru) {
+ if (r) {
usbi_dbg("someone else is modifying poll fds");
return 1;
}
@@ -1629,11 +1555,11 @@ int API_EXPORTED libusb_try_lock_events(libusb_context *ctx)
/** \ingroup poll
* Acquire the event handling lock, blocking until successful acquisition if
* it is contended. This lock is used to ensure that only one thread is
- * monitoring libusbx event sources at any one time.
+ * monitoring libusb event sources at any one time.
*
* You only need to use this lock if you are developing an application
- * which calls poll() or select() on libusbx's file descriptors directly.
- * If you stick to libusbx's event handling loop functions (e.g.
+ * which calls poll() or select() on libusb's file descriptors directly.
+ * If you stick to libusb's event handling loop functions (e.g.
* libusb_handle_events()) then you do not need to be concerned with this
* locking.
*
@@ -1676,7 +1602,7 @@ void API_EXPORTED libusb_unlock_events(libusb_context *ctx)
/** \ingroup poll
* Determine if it is still OK for this thread to be doing event handling.
*
- * Sometimes, libusbx needs to temporarily pause all event handlers, and this
+ * Sometimes, libusb needs to temporarily pause all event handlers, and this
* is the function you should use before polling file descriptors to see if
* this is the case.
*
@@ -1696,7 +1622,7 @@ void API_EXPORTED libusb_unlock_events(libusb_context *ctx)
*/
int API_EXPORTED libusb_event_handling_ok(libusb_context *ctx)
{
- unsigned int r;
+ int r;
USBI_GET_CONTEXT(ctx);
/* is someone else waiting to modify poll fds? if so, don't let this thread
@@ -1724,7 +1650,7 @@ int API_EXPORTED libusb_event_handling_ok(libusb_context *ctx)
*/
int API_EXPORTED libusb_event_handler_active(libusb_context *ctx)
{
- unsigned int r;
+ int r;
USBI_GET_CONTEXT(ctx);
/* is someone else waiting to modify poll fds? if so, don't let this thread
@@ -1750,9 +1676,9 @@ int API_EXPORTED libusb_event_handler_active(libusb_context *ctx)
* events, then call libusb_wait_for_event().
*
* You only need to use this lock if you are developing an application
- * which calls poll() or select() on libusbx's file descriptors directly,
+ * which calls poll() or select() on libusb's file descriptors directly,
* <b>and</b> may potentially be handling events from 2 threads simultaenously.
- * If you stick to libusbx's event handling loop functions (e.g.
+ * If you stick to libusb's event handling loop functions (e.g.
* libusb_handle_events()) then you do not need to be concerned with this
* locking.
*
@@ -1820,7 +1746,7 @@ int API_EXPORTED libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
timeout.tv_sec += tv->tv_sec;
timeout.tv_nsec += tv->tv_usec * 1000;
- while (timeout.tv_nsec >= 1000000000) {
+ if (timeout.tv_nsec > 1000000000) {
timeout.tv_nsec -= 1000000000;
timeout.tv_sec++;
}
@@ -1900,6 +1826,10 @@ static int handle_timerfd_trigger(struct libusb_context *ctx)
{
int r;
+ r = disarm_timerfd(ctx);
+ if (r < 0)
+ return r;
+
usbi_mutex_lock(&ctx->flying_transfers_lock);
/* process the timeout that just happened */
@@ -1923,7 +1853,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
int r;
struct usbi_pollfd *ipollfd;
POLL_NFDS_TYPE nfds = 0;
- struct pollfd *fds = NULL;
+ struct pollfd *fds;
int i = -1;
int timeout_ms;
@@ -1932,8 +1862,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
nfds++;
/* TODO: malloc when number of fd's changes, not on every poll */
- if (nfds != 0)
- fds = malloc(sizeof(*fds) * nfds);
+ fds = malloc(sizeof(*fds) * nfds);
if (!fds) {
usbi_mutex_unlock(&ctx->pollfds_lock);
return LIBUSB_ERROR_NO_MEM;
@@ -1949,7 +1878,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
}
usbi_mutex_unlock(&ctx->pollfds_lock);
- timeout_ms = (int)(tv->tv_sec * 1000) + (tv->tv_usec / 1000);
+ timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
/* round up to next millisecond */
if (tv->tv_usec % 1000)
@@ -1987,36 +1916,9 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
}
}
- /* fd[1] is always the hotplug pipe */
- if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) && fds[1].revents) {
- libusb_hotplug_message message;
- ssize_t ret;
-
- usbi_dbg("caught a fish on the hotplug pipe");
-
- /* read the message from the hotplug thread */
- ret = usbi_read(ctx->hotplug_pipe[0], &message, sizeof (message));
- if (ret < sizeof(message)) {
- usbi_err(ctx, "hotplug pipe read error %d < %d",
- ret, sizeof(message));
- r = LIBUSB_ERROR_OTHER;
- goto handled;
- }
-
- usbi_hotplug_match(ctx, message.device, message.event);
-
- /* the device left. dereference the device */
- if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == message.event)
- libusb_unref_device(message.device);
-
- fds[1].revents = 0;
- if (1 == r--)
- goto handled;
- } /* else there shouldn't be anything on this pipe */
-
#ifdef USBI_TIMERFD_AVAILABLE
- /* on timerfd configurations, fds[2] is the timerfd */
- if (usbi_using_timerfd(ctx) && fds[2].revents) {
+ /* on timerfd configurations, fds[1] is the timerfd */
+ if (usbi_using_timerfd(ctx) && fds[1].revents) {
/* timerfd indicates that a timeout has expired */
int ret;
usbi_dbg("timerfd triggered");
@@ -2033,7 +1935,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
} else {
/* more events pending...
* prevent OS backend from trying to handle events on timerfd */
- fds[2].revents = 0;
+ fds[1].revents = 0;
r--;
}
}
@@ -2078,7 +1980,7 @@ static int get_next_timeout(libusb_context *ctx, struct timeval *tv,
/** \ingroup poll
* Handle any pending events.
*
- * libusbx determines "pending events" by checking if any timeouts have expired
+ * libusb determines "pending events" by checking if any timeouts have expired
* and by checking the set of file descriptors for activity.
*
* If a zero timeval is passed, this function will handle any already-pending
@@ -2227,9 +2129,9 @@ int API_EXPORTED libusb_handle_events_completed(libusb_context *ctx,
* held, see libusb_lock_events().
*
* This function is designed to be called under the situation where you have
- * taken the event lock and are calling poll()/select() directly on libusbx's
+ * taken the event lock and are calling poll()/select() directly on libusb's
* file descriptors (as opposed to using libusb_handle_events() or similar).
- * You detect events on libusbx's descriptors, so you then call this function
+ * You detect events on libusb's descriptors, so you then call this function
* with a zero timeout value (while still holding the event lock).
*
* \param ctx the context to operate on, or NULL for the default context
@@ -2256,19 +2158,19 @@ int API_EXPORTED libusb_handle_events_locked(libusb_context *ctx,
/** \ingroup poll
* Determines whether your application must apply special timing considerations
- * when monitoring libusbx's file descriptors.
+ * when monitoring libusb's file descriptors.
*
* This function is only useful for applications which retrieve and poll
- * libusbx's file descriptors in their own main loop (\ref pollmain).
+ * libusb's file descriptors in their own main loop (\ref pollmain).
*
- * Ordinarily, libusbx's event handler needs to be called into at specific
+ * Ordinarily, libusb's event handler needs to be called into at specific
* moments in time (in addition to times when there is activity on the file
* descriptor set). The usual approach is to use libusb_get_next_timeout()
* to learn about when the next timeout occurs, and to adjust your
* poll()/select() timeout accordingly so that you can make a call into the
* library at that time.
*
- * Some platforms supported by libusbx do not come with this baggage - any
+ * Some platforms supported by libusb do not come with this baggage - any
* events relevant to timing will be represented by activity on the file
* descriptor set, and libusb_get_next_timeout() will always return 0.
* This function allows you to detect whether you are running on such a
@@ -2277,10 +2179,10 @@ int API_EXPORTED libusb_handle_events_locked(libusb_context *ctx,
* Since v1.0.5.
*
* \param ctx the context to operate on, or NULL for the default context
- * \returns 0 if you must call into libusbx at times determined by
+ * \returns 0 if you must call into libusb at times determined by
* libusb_get_next_timeout(), or 1 if all timeout events are handled internally
* or through regular activity on the file descriptors.
- * \see \ref pollmain "Polling libusbx file descriptors for event handling"
+ * \see \ref pollmain "Polling libusb file descriptors for event handling"
*/
int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
{
@@ -2294,21 +2196,21 @@ int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
}
/** \ingroup poll
- * Determine the next internal timeout that libusbx needs to handle. You only
+ * Determine the next internal timeout that libusb needs to handle. You only
* need to use this function if you are calling poll() or select() or similar
- * on libusbx's file descriptors yourself - you do not need to use it if you
+ * on libusb's file descriptors yourself - you do not need to use it if you
* are calling libusb_handle_events() or a variant directly.
*
* You should call this function in your main loop in order to determine how
- * long to wait for select() or poll() to return results. libusbx needs to be
+ * long to wait for select() or poll() to return results. libusb needs to be
* called into at this timeout, so you should use it as an upper bound on
* your select() or poll() call.
*
* When the timeout has expired, call into libusb_handle_events_timeout()
- * (perhaps in non-blocking mode) so that libusbx can handle the timeout.
+ * (perhaps in non-blocking mode) so that libusb can handle the timeout.
*
* This function may return 1 (success) and an all-zero timeval. If this is
- * the case, it indicates that libusbx has a timeout that has already expired
+ * the case, it indicates that libusb has a timeout that has already expired
* so you should call libusb_handle_events_timeout() or similar immediately.
* A return code of 0 indicates that there are no pending timeouts.
*
@@ -2317,7 +2219,7 @@ int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
*
* \param ctx the context to operate on, or NULL for the default context
* \param tv output location for a relative time against the current
- * clock in which libusbx must be called into in order to process timeout events
+ * clock in which libusb must be called into in order to process timeout events
* \returns 0 if there are no pending timeouts, 1 if a timeout was returned,
* or LIBUSB_ERROR_OTHER on failure
*/
@@ -2366,7 +2268,7 @@ int API_EXPORTED libusb_get_next_timeout(libusb_context *ctx,
r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &cur_ts);
if (r < 0) {
usbi_err(ctx, "failed to read monotonic clock, errno=%d", errno);
- return 0;
+ return LIBUSB_ERROR_OTHER;
}
TIMESPEC_TO_TIMEVAL(&cur_tv, &cur_ts);
@@ -2384,7 +2286,7 @@ int API_EXPORTED libusb_get_next_timeout(libusb_context *ctx,
/** \ingroup poll
* Register notification functions for file descriptor additions/removals.
* These functions will be invoked for every new or removed file descriptor
- * that libusbx uses as an event source.
+ * that libusb uses as an event source.
*
* To remove notifiers, pass NULL values for the function pointers.
*
@@ -2462,7 +2364,7 @@ void usbi_remove_pollfd(struct libusb_context *ctx, int fd)
/** \ingroup poll
* Retrieve a list of file descriptors that should be polled by your main loop
- * as libusbx event sources.
+ * as libusb event sources.
*
* The returned list is NULL-terminated and should be freed with free() when
* done. The actual list contents must not be touched.
@@ -2502,15 +2404,14 @@ out:
usbi_mutex_unlock(&ctx->pollfds_lock);
return (const struct libusb_pollfd **) ret;
#else
- usbi_err(ctx, "external polling of libusbx's internal descriptors "\
+ usbi_err(ctx, "external polling of libusb's internal descriptors "\
"is not yet supported on Windows platforms");
return NULL;
#endif
}
-/* Backends may call this from handle_events to report disconnection of a
- * device. This function ensures transfers get cancelled appropriately.
- * Callers of this function must hold the events_lock.
+/* Backends call this from handle_events to report disconnection of a device.
+ * The transfers get cancelled appropriately.
*/
void usbi_handle_disconnect(struct libusb_device_handle *handle)
{
@@ -2525,22 +2426,12 @@ void usbi_handle_disconnect(struct libusb_device_handle *handle)
*
* this is a bit tricky because:
* 1. we can't do transfer completion while holding flying_transfers_lock
- * because the completion handler may try to re-submit the transfer
* 2. the transfers list can change underneath us - if we were to build a
- * list of transfers to complete (while holding lock), the situation
+ * list of transfers to complete (while holding look), the situation
* might be different by the time we come to free them
*
* so we resort to a loop-based approach as below
- *
- * This is safe because transfers are only removed from the
- * flying_transfer list by usbi_handle_transfer_completion and
- * libusb_close, both of which hold the events_lock while doing so,
- * so usbi_handle_disconnect cannot be running at the same time.
- *
- * Note that libusb_submit_transfer also removes the transfer from
- * the flying_transfer list on submission failure, but it keeps the
- * flying_transfer list locked between addition and removal, so
- * usbi_handle_disconnect never sees such transfers.
+ * FIXME: is this still potentially racy?
*/
while (1) {
@@ -2556,9 +2447,6 @@ void usbi_handle_disconnect(struct libusb_device_handle *handle)
if (!to_cancel)
break;
- usbi_dbg("cancelling transfer %p from disconnect",
- USBI_TRANSFER_TO_LIBUSB_TRANSFER(to_cancel));
-
usbi_backend->clear_transfer_priv(to_cancel);
usbi_handle_transfer_completion(to_cancel, LIBUSB_TRANSFER_NO_DEVICE);
}
diff --git a/third_party/libusb/src/libusb/libusb-1.0.def b/third_party/libusb/src/libusb/libusb-1.0.def
index cb0e32a..1d6a5d2 100644
--- a/third_party/libusb/src/libusb/libusb-1.0.def
+++ b/third_party/libusb/src/libusb/libusb-1.0.def
@@ -1,4 +1,4 @@
-LIBRARY "libusb-1.0.dll"
+LIBRARY
EXPORTS
libusb_alloc_transfer
libusb_alloc_transfer@4 = libusb_alloc_transfer
@@ -26,26 +26,14 @@ EXPORTS
libusb_event_handling_ok@4 = libusb_event_handling_ok
libusb_exit
libusb_exit@4 = libusb_exit
- libusb_free_bos_descriptor
- libusb_free_bos_descriptor@4 = libusb_free_bos_descriptor
libusb_free_config_descriptor
libusb_free_config_descriptor@4 = libusb_free_config_descriptor
- libusb_free_container_id_descriptor
- libusb_free_container_id_descriptor@4 = libusb_free_container_id_descriptor
libusb_free_device_list
libusb_free_device_list@8 = libusb_free_device_list
- libusb_free_ss_endpoint_companion_descriptor
- libusb_free_ss_endpoint_companion_descriptor@4 = libusb_free_ss_endpoint_companion_descriptor
- libusb_free_ss_usb_device_capability_descriptor
- libusb_free_ss_usb_device_capability_descriptor@4 = libusb_free_ss_usb_device_capability_descriptor
libusb_free_transfer
libusb_free_transfer@4 = libusb_free_transfer
- libusb_free_usb_2_0_extension_descriptor
- libusb_free_usb_2_0_extension_descriptor@4 = libusb_free_usb_2_0_extension_descriptor
libusb_get_active_config_descriptor
libusb_get_active_config_descriptor@8 = libusb_get_active_config_descriptor
- libusb_get_bos_descriptor
- libusb_get_bos_descriptor@8 = libusb_get_bos_descriptor
libusb_get_bus_number
libusb_get_bus_number@4 = libusb_get_bus_number
libusb_get_config_descriptor
@@ -54,8 +42,6 @@ EXPORTS
libusb_get_config_descriptor_by_value@12 = libusb_get_config_descriptor_by_value
libusb_get_configuration
libusb_get_configuration@8 = libusb_get_configuration
- libusb_get_container_id_descriptor
- libusb_get_container_id_descriptor@12 = libusb_get_container_id_descriptor
libusb_get_device
libusb_get_device@4 = libusb_get_device
libusb_get_device_address
@@ -72,24 +58,10 @@ EXPORTS
libusb_get_max_packet_size@8 = libusb_get_max_packet_size
libusb_get_next_timeout
libusb_get_next_timeout@8 = libusb_get_next_timeout
- libusb_get_parent
- libusb_get_parent@4 = libusb_get_parent
libusb_get_pollfds
libusb_get_pollfds@4 = libusb_get_pollfds
- libusb_get_port_number
- libusb_get_port_number@4 = libusb_get_port_number
- libusb_get_port_numbers
- libusb_get_port_numbers@12 = libusb_get_port_numbers
- libusb_get_port_path
- libusb_get_port_path@16 = libusb_get_port_path
- libusb_get_ss_endpoint_companion_descriptor
- libusb_get_ss_endpoint_companion_descriptor@12 = libusb_get_ss_endpoint_companion_descriptor
- libusb_get_ss_usb_device_capability_descriptor
- libusb_get_ss_usb_device_capability_descriptor@12 = libusb_get_ss_usb_device_capability_descriptor
libusb_get_string_descriptor_ascii
libusb_get_string_descriptor_ascii@16 = libusb_get_string_descriptor_ascii
- libusb_get_usb_2_0_extension_descriptor
- libusb_get_usb_2_0_extension_descriptor@12 = libusb_get_usb_2_0_extension_descriptor
libusb_get_version
libusb_get_version@0 = libusb_get_version
libusb_handle_events
@@ -104,10 +76,6 @@ EXPORTS
libusb_handle_events_timeout_completed@12 = libusb_handle_events_timeout_completed
libusb_has_capability
libusb_has_capability@4 = libusb_has_capability
- libusb_hotplug_deregister_callback
- libusb_hotplug_deregister_callback@8 = libusb_hotplug_deregister_callback
- libusb_hotplug_register_callback
- libusb_hotplug_register_callback@36 = libusb_hotplug_register_callback
libusb_init
libusb_init@4 = libusb_init
libusb_interrupt_transfer
@@ -130,8 +98,6 @@ EXPORTS
libusb_release_interface@8 = libusb_release_interface
libusb_reset_device
libusb_reset_device@4 = libusb_reset_device
- libusb_set_auto_detach_kernel_driver
- libusb_set_auto_detach_kernel_driver@8 = libusb_set_auto_detach_kernel_driver
libusb_set_configuration
libusb_set_configuration@8 = libusb_set_configuration
libusb_set_debug
@@ -140,10 +106,6 @@ EXPORTS
libusb_set_interface_alt_setting@12 = libusb_set_interface_alt_setting
libusb_set_pollfd_notifiers
libusb_set_pollfd_notifiers@16 = libusb_set_pollfd_notifiers
- libusb_setlocale
- libusb_setlocale@4 = libusb_setlocale
- libusb_strerror
- libusb_strerror@4 = libusb_strerror
libusb_submit_transfer
libusb_submit_transfer@4 = libusb_submit_transfer
libusb_try_lock_events
diff --git a/third_party/libusb/src/libusb/libusb-1.0.rc b/third_party/libusb/src/libusb/libusb-1.0.rc
index ae49757..a59a430 100644
--- a/third_party/libusb/src/libusb/libusb-1.0.rc
+++ b/third_party/libusb/src/libusb/libusb-1.0.rc
@@ -5,22 +5,16 @@
* The information can then be queried using standard APIs and can also be
* viewed with utilities such as Windows Explorer.
*/
-#ifndef _WIN32_WCE
#include "winresrc.h"
-#endif
#include "version.h"
#ifndef LIBUSB_VERSIONSTRING
#define LU_STR(s) #s
#define LU_XSTR(s) LU_STR(s)
#if LIBUSB_NANO > 0
-#define LIBUSB_VERSIONSTRING \
- LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
- LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
+#define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0"
#else
-#define LIBUSB_VERSIONSTRING \
- LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \
- LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
+#define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0"
#endif
#endif
@@ -41,7 +35,8 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "CompanyName", "libusbx.org\0"
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "libusb.org\0"
VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0"
VALUE "FileVersion", LIBUSB_VERSIONSTRING
VALUE "InternalName", "libusb\0"
diff --git a/third_party/libusb/src/libusb/libusb.h b/third_party/libusb/src/libusb/libusb.h
index 15bd0d5..1d0dd7d 100644
--- a/third_party/libusb/src/libusb/libusb.h
+++ b/third_party/libusb/src/libusb/libusb.h
@@ -1,10 +1,7 @@
/*
- * Public libusbx header file
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
- * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2012 Pete Batard <pete@akeo.ie>
- * Copyright © 2012 Nathan Hjelm <hjelmn@cs.unm.edu>
- * For more information, please visit: http://libusbx.org
+ * Public libusb header file
+ * Copyright (C) 2007-2008 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
@@ -25,16 +22,8 @@
#define LIBUSB_H
#ifdef _MSC_VER
-// Disable warning 4200 for [0].
-#pragma warning(push)
-#pragma warning(disable: 4200)
-#endif
-
-#ifdef _MSC_VER
/* on MS environments, the inline keyword is available in C++ only */
-#if !defined(__cplusplus)
#define inline __inline
-#endif
/* ssize_t is also not available (copy/paste from MinGW) */
#ifndef _SSIZE_T_DEFINED
#define _SSIZE_T_DEFINED
@@ -47,7 +36,7 @@
#endif /* _SSIZE_T_DEFINED */
#endif /* _MSC_VER */
-/* stdint.h is not available on older MSVC */
+/* stdint.h is also not usually available on MS */
#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
@@ -56,49 +45,36 @@ typedef unsigned __int32 uint32_t;
#include <stdint.h>
#endif
-#if !defined(_WIN32_WCE)
#include <sys/types.h>
-#endif
+#include <time.h>
+#include <limits.h>
#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
#include <sys/time.h>
#endif
-#include <time.h>
-#include <limits.h>
-
/* 'interface' might be defined as a macro on Windows, so we need to
- * undefine it so as not to break the current libusbx API, because
+ * undefine it so as not to break the current libusb API, because
* libusb_config_descriptor has an 'interface' member
* As this can be problematic if you include windows.h after libusb.h
* in your sources, we force windows.h to be included first. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h>
#if defined(interface)
#undef interface
#endif
-#if !defined(__CYGWIN__)
-#include <winsock.h>
-#endif
#endif
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define LIBUSB_DEPRECATED_FOR(f) \
- __attribute__((deprecated("Use " #f " instead")))
-#else
-#define LIBUSB_DEPRECATED_FOR(f)
-#endif /* __GNUC__ */
-
/** \def LIBUSB_CALL
* \ingroup misc
- * libusbx's Windows calling convention.
+ * libusb's Windows calling convention.
*
* Under Windows, the selection of available compilers and configurations
* means that, unlike other platforms, there is not <em>one true calling
* convention</em> (calling convention: the manner in which parameters are
* passed to funcions in the generated assembly code).
*
- * Matching the Windows API itself, libusbx uses the WINAPI convention (which
+ * Matching the Windows API itself, libusb uses the WINAPI convention (which
* translates to the <tt>stdcall</tt> convention) and guarantees that the
* library is compiled in this way. The public header file also includes
* appropriate annotations so that your own software will use the right
@@ -106,7 +82,7 @@ typedef unsigned __int32 uint32_t;
* your codebase.
*
* The one consideration that you must apply in your software is to mark
- * all functions which you use as libusbx callbacks with this LIBUSB_CALL
+ * all functions which you use as libusb callbacks with this LIBUSB_CALL
* annotation, so that they too get compiled for the correct calling
* convention.
*
@@ -114,44 +90,19 @@ typedef unsigned __int32 uint32_t;
* means that you can apply it to your code without worrying about
* cross-platform compatibility.
*/
-/* LIBUSB_CALL must be defined on both definition and declaration of libusbx
+/* LIBUSB_CALL must be defined on both definition and declaration of libusb
* functions. You'd think that declaration would be enough, but cygwin will
* complain about conflicting types unless both are marked this way.
* The placement of this macro is important too; it must appear after the
* return type, before the function name. See internal documentation for
* API_EXPORTED.
*/
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+#if defined(_WIN32) || defined(__CYGWIN__)
#define LIBUSB_CALL WINAPI
#else
#define LIBUSB_CALL
#endif
-/** \def LIBUSBX_API_VERSION
- * \ingroup misc
- * libusbx's API version.
- *
- * Since version 1.0.13, to help with feature detection, libusbx defines
- * a LIBUSBX_API_VERSION macro that gets increased every time there is a
- * significant change to the API, such as the introduction of a new call,
- * the definition of a new macro/enum member, or any other element that
- * libusbx applications may want to detect at compilation time.
- *
- * The macro is typically used in an application as follows:
- * \code
- * #if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x01001234)
- * // Use one of the newer features from the libusbx API
- * #endif
- * \endcode
- *
- * Another feature of LIBUSBX_API_VERSION is that it can be used to detect
- * whether you are compiling against the libusb or the libusbx library.
- *
- * Internally, LIBUSBX_API_VERSION is defined as follows:
- * (libusbx major << 24) | (libusbx minor << 16) | (16 bit incremental)
- */
-#define LIBUSBX_API_VERSION 0x01000102
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -170,8 +121,8 @@ static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
uint8_t b8[2];
uint16_t b16;
} _tmp;
- _tmp.b8[1] = (uint8_t) (x >> 8);
- _tmp.b8[0] = (uint8_t) (x & 0xff);
+ _tmp.b8[1] = x >> 8;
+ _tmp.b8[0] = x & 0xff;
return _tmp.b16;
}
@@ -267,12 +218,6 @@ enum libusb_descriptor_type {
/** Endpoint descriptor. See libusb_endpoint_descriptor. */
LIBUSB_DT_ENDPOINT = 0x05,
- /** BOS descriptor */
- LIBUSB_DT_BOS = 0x0f,
-
- /** Device Capability descriptor */
- LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
-
/** HID descriptor */
LIBUSB_DT_HID = 0x21,
@@ -284,35 +229,15 @@ enum libusb_descriptor_type {
/** Hub descriptor */
LIBUSB_DT_HUB = 0x29,
-
- /** SuperSpeed Hub descriptor */
- LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
-
- /** SuperSpeed Endpoint Companion descriptor */
- LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30
};
/* Descriptor sizes per descriptor type */
#define LIBUSB_DT_DEVICE_SIZE 18
#define LIBUSB_DT_CONFIG_SIZE 9
#define LIBUSB_DT_INTERFACE_SIZE 9
-#define LIBUSB_DT_ENDPOINT_SIZE 7
-#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
+#define LIBUSB_DT_ENDPOINT_SIZE 7
+#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
#define LIBUSB_DT_HUB_NONVAR_SIZE 7
-#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
-#define LIBUSB_DT_BOS_SIZE 5
-#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
-
-/* BOS descriptor sizes */
-#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
-#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
-#define LIBUSB_BT_CONTAINER_ID_SIZE 20
-
-/* We unwrap the BOS => define its max size */
-#define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
- (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
- (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
- (LIBUSB_BT_CONTAINER_ID_SIZE))
#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
#define LIBUSB_ENDPOINT_DIR_MASK 0x80
@@ -350,7 +275,7 @@ enum libusb_transfer_type {
};
/** \ingroup misc
- * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */
+ * Standard requests, as defined in table 9-3 of the USB2 specifications */
enum libusb_standard_request {
/** Request status of the specific recipient */
LIBUSB_REQUEST_GET_STATUS = 0x00,
@@ -388,13 +313,6 @@ enum libusb_standard_request {
/** Set then report an endpoint's synchronization frame */
LIBUSB_REQUEST_SYNCH_FRAME = 0x0C,
-
- /** Sets both the U1 and U2 Exit Latency */
- LIBUSB_REQUEST_SET_SEL = 0x30,
-
- /** Delay from the time a host transmits a packet to the time it is
- * received by the device. */
- LIBUSB_SET_ISOCH_DELAY = 0x31,
};
/** \ingroup misc
@@ -474,7 +392,7 @@ enum libusb_iso_usage_type {
/** \ingroup desc
* A structure representing the standard USB device descriptor. This
- * descriptor is documented in section 9.6.1 of the USB 3.0 specification.
+ * descriptor is documented in section 9.6.1 of the USB 2.0 specification.
* All multiple-byte fields are represented in host-endian format.
*/
struct libusb_device_descriptor {
@@ -528,7 +446,7 @@ struct libusb_device_descriptor {
/** \ingroup desc
* A structure representing the standard USB endpoint descriptor. This
- * descriptor is documented in section 9.6.6 of the USB 3.0 specification.
+ * descriptor is documented in section 9.6.3 of the USB 2.0 specification.
* All multiple-byte fields are represented in host-endian format.
*/
struct libusb_endpoint_descriptor {
@@ -568,7 +486,7 @@ struct libusb_endpoint_descriptor {
/** For audio devices only: the address if the synch endpoint */
uint8_t bSynchAddress;
- /** Extra descriptors. If libusbx encounters unknown endpoint descriptors,
+ /** Extra descriptors. If libusb encounters unknown endpoint descriptors,
* it will store them here, should you wish to parse them. */
const unsigned char *extra;
@@ -578,7 +496,7 @@ struct libusb_endpoint_descriptor {
/** \ingroup desc
* A structure representing the standard USB interface descriptor. This
- * descriptor is documented in section 9.6.5 of the USB 3.0 specification.
+ * descriptor is documented in section 9.6.5 of the USB 2.0 specification.
* All multiple-byte fields are represented in host-endian format.
*/
struct libusb_interface_descriptor {
@@ -618,7 +536,7 @@ struct libusb_interface_descriptor {
* by the bNumEndpoints field. */
const struct libusb_endpoint_descriptor *endpoint;
- /** Extra descriptors. If libusbx encounters unknown interface descriptors,
+ /** Extra descriptors. If libusb encounters unknown interface descriptors,
* it will store them here, should you wish to parse them. */
const unsigned char *extra;
@@ -640,7 +558,7 @@ struct libusb_interface {
/** \ingroup desc
* A structure representing the standard USB configuration descriptor. This
- * descriptor is documented in section 9.6.3 of the USB 3.0 specification.
+ * descriptor is documented in section 9.6.3 of the USB 2.0 specification.
* All multiple-byte fields are represented in host-endian format.
*/
struct libusb_config_descriptor {
@@ -676,7 +594,7 @@ struct libusb_config_descriptor {
* this array is determined by the bNumInterfaces field. */
const struct libusb_interface *interface;
- /** Extra descriptors. If libusbx encounters unknown configuration
+ /** Extra descriptors. If libusb encounters unknown configuration
* descriptors, it will store them here, should you wish to parse them. */
const unsigned char *extra;
@@ -684,187 +602,6 @@ struct libusb_config_descriptor {
int extra_length;
};
-/** \ingroup desc
- * A structure representing the superspeed endpoint companion
- * descriptor. This descriptor is documented in section 9.6.7 of
- * the USB 3.0 specification. All multiple-byte fields are represented in
- * host-endian format.
- */
-struct libusb_ss_endpoint_companion_descriptor {
-
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
-
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in
- * this context. */
- uint8_t bDescriptorType;
-
-
- /** The maximum number of packets the endpoint can send or
- * recieve as part of a burst. */
- uint8_t bMaxBurst;
-
- /** In bulk EP: bits 4:0 represents the maximum number of
- * streams the EP supports. In isochronous EP: bits 1:0
- * represents the Mult - a zero based value that determines
- * the maximum number of packets within a service interval */
- uint8_t bmAttributes;
-
- /** The total number of bytes this EP will transfer every
- * service interval. valid only for periodic EPs. */
- uint16_t wBytesPerInterval;
-};
-
-/** \ingroup desc
- * A generic representation of a BOS Device Capability descriptor. It is
- * advised to check bDevCapabilityType and call the matching
- * libusb_get_*_descriptor function to get a structure fully matching the type.
- */
-struct libusb_bos_dev_capability_descriptor {
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
- * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
- uint8_t bDescriptorType;
- /** Device Capability type */
- uint8_t bDevCapabilityType;
- /** Device Capability data (bLength - 3 bytes) */
- uint8_t dev_capability_data
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
- [] /* valid C99 code */
-#else
- [0] /* non-standard, but usually working code */
-#endif
- ;
-};
-
-/** \ingroup desc
- * A structure representing the Binary Device Object Store (BOS) descriptor.
- * This descriptor is documented in section 9.6.2 of the USB 3.0 specification.
- * All multiple-byte fields are represented in host-endian format.
- */
-struct libusb_bos_descriptor {
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
-
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS
- * in this context. */
- uint8_t bDescriptorType;
-
- /** Length of this descriptor and all of its sub descriptors */
- uint16_t wTotalLength;
-
- /** The number of separate device capability descriptors in
- * the BOS */
- uint8_t bNumDeviceCaps;
-
- /** bNumDeviceCap Device Capability Descriptors */
- struct libusb_bos_dev_capability_descriptor *dev_capability
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
- [] /* valid C99 code */
-#else
- [0] /* non-standard, but usually working code */
-#endif
- ;
-};
-
-/** \ingroup desc
- * A structure representing the USB 2.0 Extension descriptor
- * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification.
- * All multiple-byte fields are represented in host-endian format.
- */
-struct libusb_usb_2_0_extension_descriptor {
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
-
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
- * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
- uint8_t bDescriptorType;
-
- /** Capability type. Will have value
- * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION
- * LIBUSB_BT_USB_2_0_EXTENSION in this context. */
- uint8_t bDevCapabilityType;
-
- /** Bitmap encoding of supported device level features.
- * A value of one in a bit location indicates a feature is
- * supported; a value of zero indicates it is not supported.
- * See \ref libusb_usb_2_0_extension_attributes. */
- uint32_t bmAttributes;
-};
-
-/** \ingroup desc
- * A structure representing the SuperSpeed USB Device Capability descriptor
- * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification.
- * All multiple-byte fields are represented in host-endian format.
- */
-struct libusb_ss_usb_device_capability_descriptor {
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
-
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
- * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
- uint8_t bDescriptorType;
-
- /** Capability type. Will have value
- * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
- * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */
- uint8_t bDevCapabilityType;
-
- /** Bitmap encoding of supported device level features.
- * A value of one in a bit location indicates a feature is
- * supported; a value of zero indicates it is not supported.
- * See \ref libusb_ss_usb_device_capability_attributes. */
- uint8_t bmAttributes;
-
- /** Bitmap encoding of the speed supported by this device when
- * operating in SuperSpeed mode. See \ref libusb_supported_speed. */
- uint16_t wSpeedSupported;
-
- /** The lowest speed at which all the functionality supported
- * by the device is available to the user. For example if the
- * device supports all its functionality when connected at
- * full speed and above then it sets this value to 1. */
- uint8_t bFunctionalitySupport;
-
- /** U1 Device Exit Latency. */
- uint8_t bU1DevExitLat;
-
- /** U2 Device Exit Latency. */
- uint16_t bU2DevExitLat;
-};
-
-/** \ingroup desc
- * A structure representing the Container ID descriptor.
- * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification.
- * All multiple-byte fields, except UUIDs, are represented in host-endian format.
- */
-struct libusb_container_id_descriptor {
- /** Size of this descriptor (in bytes) */
- uint8_t bLength;
-
- /** Descriptor type. Will have value
- * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
- * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
- uint8_t bDescriptorType;
-
- /** Capability type. Will have value
- * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID
- * LIBUSB_BT_CONTAINER_ID in this context. */
- uint8_t bDevCapabilityType;
-
- /** Reserved field */
- uint8_t bReserved;
-
- /** 128 bit UUID */
- uint8_t ContainerID[16];
-};
-
/** \ingroup asyncio
* Setup packet for control transfers. */
struct libusb_control_setup {
@@ -895,15 +632,14 @@ struct libusb_control_setup {
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
-/* libusbx */
+/* libusb */
struct libusb_context;
struct libusb_device;
struct libusb_device_handle;
-struct libusb_hotplug_callback;
/** \ingroup lib
- * Structure providing the version of the libusbx runtime
+ * Structure representing the libusb version.
*/
struct libusb_version {
/** Library major version. */
@@ -915,27 +651,27 @@ struct libusb_version {
/** Library micro version. */
const uint16_t micro;
- /** Library nano version. */
+ /** Library nano version. This field is only nonzero on Windows. */
const uint16_t nano;
/** Library release candidate suffix string, e.g. "-rc4". */
const char *rc;
- /** For ABI compatibility only. */
- const char* describe;
+ /** Output of `git describe --tags` at library build time. */
+ const char *describe;
};
/** \ingroup lib
- * Structure representing a libusbx session. The concept of individual libusbx
+ * Structure representing a libusb session. The concept of individual libusb
* sessions allows for your program to use two libraries (or dynamically
* load two modules) which both independently use libusb. This will prevent
- * interference between the individual libusbx users - for example
+ * interference between the individual libusb users - for example
* libusb_set_debug() will not affect the other user of the library, and
* libusb_exit() will not destroy resources that the other user is still
* using.
*
* Sessions are created by libusb_init() and destroyed through libusb_exit().
- * If your application is guaranteed to only ever include a single libusbx
+ * If your application is guaranteed to only ever include a single libusb
* user (i.e. you), you do not have to worry about contexts: pass NULL in
* every function call where a context is required. The default context
* will be used.
@@ -952,8 +688,8 @@ typedef struct libusb_context libusb_context;
* Certain operations can be performed on a device, but in order to do any
* I/O you will have to first obtain a device handle using libusb_open().
*
- * Devices are reference counted with libusb_ref_device() and
- * libusb_unref_device(), and are freed when the reference count reaches 0.
+ * Devices are reference counted with libusb_device_ref() and
+ * libusb_device_unref(), and are freed when the reference count reaches 0.
* New devices presented by libusb_get_device_list() have a reference count of
* 1, and libusb_free_device_list() can optionally decrease the reference count
* on all devices in the list. libusb_open() adds another reference which is
@@ -976,83 +712,27 @@ typedef struct libusb_device_handle libusb_device_handle;
* Speed codes. Indicates the speed at which the device is operating.
*/
enum libusb_speed {
- /** The OS doesn't report or know the device speed. */
- LIBUSB_SPEED_UNKNOWN = 0,
-
- /** The device is operating at low speed (1.5MBit/s). */
- LIBUSB_SPEED_LOW = 1,
-
- /** The device is operating at full speed (12MBit/s). */
- LIBUSB_SPEED_FULL = 2,
-
- /** The device is operating at high speed (480MBit/s). */
- LIBUSB_SPEED_HIGH = 3,
-
- /** The device is operating at super speed (5000MBit/s). */
- LIBUSB_SPEED_SUPER = 4,
-};
-
-/** \ingroup dev
- * Supported speeds (wSpeedSupported) bitfield. Indicates what
- * speeds the device supports.
- */
-enum libusb_supported_speed {
- /** Low speed operation supported (1.5MBit/s). */
- LIBUSB_LOW_SPEED_OPERATION = 1,
-
- /** Full speed operation supported (12MBit/s). */
- LIBUSB_FULL_SPEED_OPERATION = 2,
-
- /** High speed operation supported (480MBit/s). */
- LIBUSB_HIGH_SPEED_OPERATION = 4,
-
- /** Superspeed operation supported (5000MBit/s). */
- LIBUSB_SUPER_SPEED_OPERATION = 8,
-};
-
-/** \ingroup dev
- * Masks for the bits of the
- * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
- * of the USB 2.0 Extension descriptor.
- */
-enum libusb_usb_2_0_extension_attributes {
- /** Supports Link Power Management (LPM) */
- LIBUSB_BM_LPM_SUPPORT = 2,
-};
-
-/** \ingroup dev
- * Masks for the bits of the
- * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
- * field of the SuperSpeed USB Device Capability descriptor.
- */
-enum libusb_ss_usb_device_capability_attributes {
- /** Supports Latency Tolerance Messages (LTM) */
- LIBUSB_BM_LTM_SUPPORT = 2,
-};
+ /** The OS doesn't report or know the device speed. */
+ LIBUSB_SPEED_UNKNOWN = 0,
-/** \ingroup dev
- * USB capability types
- */
-enum libusb_bos_type {
- /** Wireless USB device capability */
- LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1,
+ /** The device is operating at low speed (1.5MBit/s). */
+ LIBUSB_SPEED_LOW = 1,
- /** USB 2.0 extensions */
- LIBUSB_BT_USB_2_0_EXTENSION = 2,
+ /** The device is operating at full speed (12MBit/s). */
+ LIBUSB_SPEED_FULL = 2,
- /** SuperSpeed USB device capability */
- LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3,
+ /** The device is operating at high speed (480MBit/s). */
+ LIBUSB_SPEED_HIGH = 3,
- /** Container ID type */
- LIBUSB_BT_CONTAINER_ID = 4,
+ /** The device is operating at super speed (5000MBit/s). */
+ LIBUSB_SPEED_SUPER = 4,
};
/** \ingroup misc
- * Error codes. Most libusbx functions return 0 on success or one of these
+ * Error codes. Most libusb functions return 0 on success or one of these
* codes on failure.
- * You can call libusb_error_name() to retrieve a string representation of an
- * error code or libusb_strerror() to get an end-user suitable description of
- * an error code.
+ * You can call \ref libusb_error_name() to retrieve a string representation
+ * of an error code.
*/
enum libusb_error {
/** Success (no error) */
@@ -1094,16 +774,13 @@ enum libusb_error {
/** Operation not supported or unimplemented on this platform */
LIBUSB_ERROR_NOT_SUPPORTED = -12,
- /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
- message strings in strerror.c when adding new error codes here. */
+ /* NB! Remember to update libusb_error_name()
+ when adding new error codes here. */
/** Other error */
LIBUSB_ERROR_OTHER = -99,
};
-/* Total number of error codes in enum libusb_error */
-#define LIBUSB_ERROR_COUNT 14
-
/** \ingroup asyncio
* Transfer status codes */
enum libusb_transfer_status {
@@ -1129,9 +806,6 @@ enum libusb_transfer_status {
/** Device sent more data than requested */
LIBUSB_TRANSFER_OVERFLOW,
-
- /* NB! Remember to update libusb_error_name()
- when adding new status codes here. */
};
/** \ingroup asyncio
@@ -1194,7 +868,7 @@ struct libusb_transfer;
* Asynchronous transfer callback function type. When submitting asynchronous
* transfers, you pass a pointer to a callback function of this type via the
* \ref libusb_transfer::callback "callback" member of the libusb_transfer
- * structure. libusbx will call this function later, when the transfer has
+ * structure. libusb will call this function later, when the transfer has
* completed or failed. See \ref asyncio for more information.
* \param transfer The libusb_transfer struct the callback function is being
* notified about.
@@ -1207,6 +881,12 @@ typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transf
* completed, the library populates the transfer with the results and passes
* it back to the user.
*/
+
+#if defined(OS_WIN)
+#pragma warning(push)
+#pragma warning(disable:4200)
+#endif // defined(OS_WIN)
+
struct libusb_transfer {
/** Handle of the device that this transfer will be submitted to */
libusb_device_handle *dev_handle;
@@ -1265,42 +945,18 @@ struct libusb_transfer {
;
};
+#if defined(OS_WIN)
+#pragma warning(pop)
+#endif // defined(OS_WIN)
+
/** \ingroup misc
- * Capabilities supported by an instance of libusb on the current running
- * platform. Test if the loaded library supports a given capability by calling
+ * Capabilities supported by this instance of libusb. Test if the loaded
+ * library supports a given capability by calling
* \ref libusb_has_capability().
*/
enum libusb_capability {
/** The libusb_has_capability() API is available. */
- LIBUSB_CAP_HAS_CAPABILITY = 0x0000,
- /** Hotplug support is available on this platform. */
- LIBUSB_CAP_HAS_HOTPLUG = 0x0001,
- /** The library can access HID devices without requiring user intervention.
- * Note that before being able to actually access an HID device, you may
- * still have to call additional libusbx functions such as
- * \ref libusb_detach_kernel_driver(). */
- LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
- /** The library supports detaching of the default USB driver, using
- * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
- LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
-};
-
-/** \ingroup lib
- * Log message levels.
- * - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default)
- * - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr
- * - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr
- * - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stdout, warning
- * and error messages are printed to stderr
- * - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stdout,
- * warnings and errors to stderr
- */
-enum libusb_log_level {
- LIBUSB_LOG_LEVEL_NONE = 0,
- LIBUSB_LOG_LEVEL_ERROR,
- LIBUSB_LOG_LEVEL_WARNING,
- LIBUSB_LOG_LEVEL_INFO,
- LIBUSB_LOG_LEVEL_DEBUG,
+ LIBUSB_CAP_HAS_CAPABILITY = 0,
};
int LIBUSB_CALL libusb_init(libusb_context **ctx);
@@ -1309,8 +965,6 @@ void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
int LIBUSB_CALL libusb_has_capability(uint32_t capability);
const char * LIBUSB_CALL libusb_error_name(int errcode);
-int LIBUSB_CALL libusb_setlocale(const char *locale);
-const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
libusb_device ***list);
@@ -1331,38 +985,7 @@ int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
void LIBUSB_CALL libusb_free_config_descriptor(
struct libusb_config_descriptor *config);
-int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
- struct libusb_context *ctx,
- const struct libusb_endpoint_descriptor *endpoint,
- struct libusb_ss_endpoint_companion_descriptor **ep_comp);
-void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
- struct libusb_ss_endpoint_companion_descriptor *ep_comp);
-int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *handle,
- struct libusb_bos_descriptor **bos);
-void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
-int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
- struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
-void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
- struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
-int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
- struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
-void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
- struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
-int LIBUSB_CALL libusb_get_container_id_descriptor(struct libusb_context *ctx,
- struct libusb_bos_dev_capability_descriptor *dev_cap,
- struct libusb_container_id_descriptor **container_id);
-void LIBUSB_CALL libusb_free_container_id_descriptor(
- struct libusb_container_id_descriptor *container_id);
uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
-uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
-int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
-LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
-int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
-libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev,
@@ -1396,8 +1019,6 @@ int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev,
int interface_number);
int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev,
int interface_number);
-int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
- libusb_device_handle *dev, int enable);
/* async I/O */
@@ -1515,8 +1136,8 @@ static inline void libusb_fill_control_transfer(
transfer->timeout = timeout;
transfer->buffer = buffer;
if (setup)
- transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
- + libusb_le16_to_cpu(setup->wLength));
+ transfer->length = LIBUSB_CONTROL_SETUP_SIZE
+ + libusb_le16_to_cpu(setup->wLength);
transfer->user_data = user_data;
transfer->callback = callback;
}
@@ -1651,7 +1272,7 @@ static inline unsigned char *libusb_get_iso_packet_buffer(
* signed to avoid compiler warnings. FIXME for libusb-2. */
if (packet > INT_MAX)
return NULL;
- _packet = (int) packet;
+ _packet = packet;
if (_packet >= transfer->num_iso_packets)
return NULL;
@@ -1691,12 +1312,12 @@ static inline unsigned char *libusb_get_iso_packet_buffer_simple(
* signed to avoid compiler warnings. FIXME for libusb-2. */
if (packet > INT_MAX)
return NULL;
- _packet = (int) packet;
+ _packet = packet;
if (_packet >= transfer->num_iso_packets)
return NULL;
- return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
+ return transfer->buffer + (transfer->iso_packet_desc[0].length * _packet);
}
/* sync I/O */
@@ -1729,8 +1350,8 @@ static inline int libusb_get_descriptor(libusb_device_handle *dev,
uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
{
return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN,
- LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
- 0, data, (uint16_t) length, 1000);
+ LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data,
+ (uint16_t) length, 1000);
}
/** \ingroup desc
@@ -1825,127 +1446,8 @@ void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
void *user_data);
-/** \ingroup hotplug
- * Callback handle.
- *
- * Callbacks handles are generated by libusb_hotplug_register_callback()
- * and can be used to deregister callbacks. Callback handles are unique
- * per libusb_context and it is safe to call libusb_hotplug_deregister_callback()
- * on an already deregisted callback.
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * For more information, see \ref hotplug.
- */
-typedef int libusb_hotplug_callback_handle;
-
-/** \ingroup hotplug
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * Flags for hotplug events */
-typedef enum {
- /** Arm the callback and fire it for all matching currently attached devices. */
- LIBUSB_HOTPLUG_ENUMERATE = 1,
-} libusb_hotplug_flag;
-
-/** \ingroup hotplug
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * Hotplug events */
-typedef enum {
- /** A device has been plugged in and is ready to use */
- LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01,
-
- /** A device has left and is no longer available.
- * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device.
- * It is safe to call libusb_get_device_descriptor on a device that has left */
- LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02,
-} libusb_hotplug_event;
-
-/** \ingroup hotplug
- * Wildcard matching for hotplug events */
-#define LIBUSB_HOTPLUG_MATCH_ANY -1
-
-/** \ingroup hotplug
- * Hotplug callback function type. When requesting hotplug event notifications,
- * you pass a pointer to a callback function of this type.
- *
- * This callback may be called by an internal event thread and as such it is
- * recommended the callback do minimal processing before returning.
- *
- * libusbx will call this function later, when a matching event had happened on
- * a matching device. See \ref hotplug for more information.
- *
- * It is safe to call either libusb_hotplug_register_callback() or
- * libusb_hotplug_deregister_callback() from within a callback function.
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * \param libusb_context context of this notification
- * \param device libusb_device this event occurred on
- * \param event event that occurred
- * \param user_data user data provided when this callback was registered
- * \returns bool whether this callback is finished processing events.
- * returning 1 will cause this callback to be deregistered
- */
-typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
- libusb_device *device,
- libusb_hotplug_event event,
- void *user_data);
-
-/** \ingroup hotplug
- * Register a hotplug callback function
- *
- * Register a callback with the libusb_context. The callback will fire
- * when a matching event occurs on a matching device. The callback is
- * armed until either it is deregistered with libusb_hotplug_deregister_callback()
- * or the supplied callback returns 1 to indicate it is finished processing events.
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * \param[in] ctx context to register this callback with
- * \param[in] events bitwise or of events that will trigger this callback. See \ref
- * libusb_hotplug_event
- * \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag
- * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
- * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
- * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
- * \param[in] cb_fn the function to be invoked on a matching event/device
- * \param[in] user_data user data to pass to the callback function
- * \param[out] handle pointer to store the handle of the allocated callback (can be NULL)
- * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure
- */
-int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
- libusb_hotplug_event events,
- libusb_hotplug_flag flags,
- int vendor_id, int product_id,
- int dev_class,
- libusb_hotplug_callback_fn cb_fn,
- void *user_data,
- libusb_hotplug_callback_handle *handle);
-
-/** \ingroup hotplug
- * Deregisters a hotplug callback.
- *
- * Deregister a callback from a libusb_context. This function is safe to call from within
- * a hotplug callback.
- *
- * Since version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102
- *
- * \param[in] ctx context this callback is registered with
- * \param[in] handle the handle of the callback to deregister
- */
-void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
- libusb_hotplug_callback_handle handle);
-
#ifdef __cplusplus
}
#endif
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
#endif
diff --git a/third_party/libusb/src/libusb/libusbi.h b/third_party/libusb/src/libusb/libusbi.h
index 02efae30..976be0d 100644
--- a/third_party/libusb/src/libusb/libusbi.h
+++ b/third_party/libusb/src/libusb/libusbi.h
@@ -1,7 +1,7 @@
/*
- * Internal header for libusbx
- * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ * Internal 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
@@ -21,7 +21,7 @@
#ifndef LIBUSBI_H
#define LIBUSBI_H
-#include "config.h"
+#include <config.h>
#include <stddef.h>
#include <stdint.h>
@@ -31,17 +31,14 @@
#include <poll.h>
#endif
-#ifdef HAVE_MISSING_H
-#include "missing.h"
-#endif
-#include "libusb.h"
-#include "version.h"
+#include <libusb.h>
+#include <version.h>
-/* Inside the libusbx code, mark all public functions as follows:
+/* Inside the libusb code, mark all public functions as follows:
* return_type API_EXPORTED function_name(params) { ... }
* But if the function returns a pointer, mark it as follows:
* DEFAULT_VISIBILITY return_type * LIBUSB_CALL function_name(params) { ... }
- * In the libusbx public header, mark all declarations as:
+ * In the libusb public header, mark all declarations as:
* return_type LIBUSB_CALL function_name(params);
*/
#define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY
@@ -52,39 +49,23 @@
#define USB_MAXINTERFACES 32
#define USB_MAXCONFIG 8
-/* Backend specific capabilities */
-#define USBI_CAP_HAS_HID_ACCESS 0x00010000
-#define USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER 0x00020000
-
-/* Maximum number of bytes in a log line */
-#define USBI_MAX_LOG_LEN 1024
-/* Terminator for log lines */
-#define USBI_LOG_LINE_END "\n"
-
-/* The following is used to silence warnings for unused variables */
-#define UNUSED(var) do { (void)(var); } while(0)
-
-#if !defined(ARRAYSIZE)
-#define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))
-#endif
-
struct list_head {
struct list_head *prev, *next;
};
/* Get an entry from the list
- * ptr - the address of this list_head element in "type"
- * type - the data type that contains "member"
- * member - the list_head element in "type"
+ * ptr - the address of this list_head element in "type"
+ * type - the data type that contains "member"
+ * member - the list_head element in "type"
*/
#define list_entry(ptr, type, member) \
- ((type *)((uintptr_t)(ptr) - (uintptr_t)offsetof(type, member)))
+ ((type *)((uintptr_t)(ptr) - (uintptr_t)(&((type *)0L)->member)))
/* Get each entry from a list
- * pos - A structure pointer has a "member" element
- * head - list head
- * member - the list_head element in "pos"
- * type - the type of the first parameter
+ * pos - A structure pointer has a "member" element
+ * head - list head
+ * member - the list_head element in "pos"
+ * type - the type of the first parameter
*/
#define list_for_each_entry(pos, head, member, type) \
for (pos = list_entry((head)->next, type, member); \
@@ -127,15 +108,6 @@ static inline void list_del(struct list_head *entry)
{
entry->next->prev = entry->prev;
entry->prev->next = entry->next;
- entry->next = entry->prev = NULL;
-}
-
-static inline void *usbi_reallocf(void *ptr, size_t size)
-{
- void *ret = realloc(ptr, size);
- if (!ret)
- free(ptr);
- return ret;
}
#define container_of(ptr, type, member) ({ \
@@ -147,52 +119,93 @@ static inline void *usbi_reallocf(void *ptr, size_t size)
#define TIMESPEC_IS_SET(ts) ((ts)->tv_sec != 0 || (ts)->tv_nsec != 0)
-void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
+enum usbi_log_level {
+ LOG_LEVEL_DEBUG,
+ LOG_LEVEL_INFO,
+ LOG_LEVEL_WARNING,
+ LOG_LEVEL_ERROR,
+};
+
+void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, ...);
-void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
+void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
const char *function, const char *format, va_list args);
#if !defined(_MSC_VER) || _MSC_VER >= 1400
#ifdef ENABLE_LOGGING
#define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __FUNCTION__, __VA_ARGS__)
-#define usbi_dbg(...) _usbi_log(NULL, LIBUSB_LOG_LEVEL_DEBUG, __VA_ARGS__)
#else
#define _usbi_log(ctx, level, ...) do { (void)(ctx); } while(0)
+#endif
+
+#ifdef ENABLE_DEBUG_LOGGING
+#define usbi_dbg(...) _usbi_log(NULL, LOG_LEVEL_DEBUG, __VA_ARGS__)
+#else
#define usbi_dbg(...) do {} while(0)
#endif
-#define usbi_info(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_INFO, __VA_ARGS__)
-#define usbi_warn(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define usbi_err(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_ERROR, __VA_ARGS__)
+#define usbi_info(ctx, ...) _usbi_log(ctx, LOG_LEVEL_INFO, __VA_ARGS__)
+#define usbi_warn(ctx, ...) _usbi_log(ctx, LOG_LEVEL_WARNING, __VA_ARGS__)
+#define usbi_err(ctx, ...) _usbi_log(ctx, LOG_LEVEL_ERROR, __VA_ARGS__)
#else /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
+/* Old MS compilers don't support variadic macros. The code is simple, so we
+ * repeat it for each loglevel. Note that the debug case is special.
+ *
+ * Support for variadic macros was introduced in Visual C++ 2005.
+ * http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx
+ */
+
+static inline void usbi_info(struct libusb_context *ctx, const char *fmt, ...)
+{
#ifdef ENABLE_LOGGING
-#define LOG_BODY(ctxt, level) \
-{ \
- va_list args; \
- va_start (args, format); \
- usbi_log_v(ctxt, level, "", format, args); \
- va_end(args); \
+ va_list args;
+ va_start(args, fmt);
+ usbi_log_v(ctx, LOG_LEVEL_INFO, "", fmt, args);
+ va_end(args);
+#else
+ (void)ctx;
+#endif
}
+
+static inline void usbi_warn(struct libusb_context *ctx, const char *fmt, ...)
+{
+#ifdef ENABLE_LOGGING
+ va_list args;
+ va_start(args, fmt);
+ usbi_log_v(ctx, LOG_LEVEL_WARNING, "", fmt, args);
+ va_end(args);
#else
-#define LOG_BODY(ctxt, level) do { (void)(ctxt); } while(0)
+ (void)ctx;
#endif
+}
-static inline void usbi_info(struct libusb_context *ctx, const char *format,
- ...)
- LOG_BODY(ctx,LIBUSB_LOG_LEVEL_INFO)
-static inline void usbi_warn(struct libusb_context *ctx, const char *format,
- ...)
- LOG_BODY(ctx,LIBUSB_LOG_LEVEL_WARNING)
-static inline void usbi_err( struct libusb_context *ctx, const char *format,
- ...)
- LOG_BODY(ctx,LIBUSB_LOG_LEVEL_ERROR)
+static inline void usbi_err(struct libusb_context *ctx, const char *fmt, ...)
+{
+#ifdef ENABLE_LOGGING
+ va_list args;
+ va_start(args, fmt);
+ usbi_log_v(ctx, LOG_LEVEL_ERROR, "", fmt, args);
+ va_end(args);
+#else
+ (void)ctx;
+#endif
+}
-static inline void usbi_dbg(const char *format, ...)
- LOG_BODY(NULL,LIBUSB_LOG_LEVEL_DEBUG)
+static inline void usbi_dbg(const char *fmt, ...)
+{
+#ifdef ENABLE_DEBUG_LOGGING
+ va_list args;
+ va_start(args, fmt);
+ usbi_log_v(NULL, LOG_LEVEL_DEBUG, "", fmt, args);
+ va_end(args);
+#else
+ (void)fmt;
+#endif
+}
#endif /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
@@ -208,13 +221,32 @@ static inline void usbi_dbg(const char *format, ...)
#define IS_XFERIN(xfer) (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
#define IS_XFEROUT(xfer) (!IS_XFERIN(xfer))
-/* Internal abstraction for thread synchronization */
+/* Internal abstractions for thread synchronization and poll */
#if defined(THREADS_POSIX)
-#include "os/threads_posix.h"
-#elif defined(OS_WINDOWS) || defined(OS_WINCE)
+#include <os/threads_posix.h>
+#elif defined(OS_WINDOWS)
#include <os/threads_windows.h>
#endif
+#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD)
+#include <unistd.h>
+#include <os/poll_posix.h>
+#elif defined(OS_WINDOWS)
+#include <os/poll_windows.h>
+#endif
+
+#if defined(OS_WINDOWS) && !defined(__GCC__)
+#undef HAVE_GETTIMEOFDAY
+int usbi_gettimeofday(struct timeval *tp, void *tzp);
+#define LIBUSB_GETTIMEOFDAY_WIN32
+#define HAVE_USBI_GETTIMEOFDAY
+#else
+#ifdef HAVE_GETTIMEOFDAY
+#define usbi_gettimeofday(tv, tz) gettimeofday((tv), (tz))
+#define HAVE_USBI_GETTIMEOFDAY
+#endif
+#endif
+
extern struct libusb_context *usbi_default_context;
struct libusb_context {
@@ -233,11 +265,6 @@ struct libusb_context {
struct list_head open_devs;
usbi_mutex_t open_devs_lock;
- /* A list of registered hotplug callbacks */
- struct list_head hotplug_cbs;
- usbi_mutex_t hotplug_cbs_lock;
- int hotplug_pipe[2];
-
/* this is a list of in-flight transfer handles, sorted by timeout
* expiration. URBs to timeout the soonest are placed at the beginning of
* the list, URBs that will time out later are placed after, and urbs with
@@ -275,8 +302,6 @@ struct libusb_context {
* this timerfd is maintained to trigger on the next pending timeout */
int timerfd;
#endif
-
- struct list_head list;
};
#ifdef USBI_TIMERFD_AVAILABLE
@@ -294,25 +319,13 @@ struct libusb_device {
struct libusb_context *ctx;
uint8_t bus_number;
- uint8_t port_number;
- struct libusb_device* parent_dev;
uint8_t device_address;
uint8_t num_configurations;
enum libusb_speed speed;
struct list_head list;
unsigned long session_data;
-
- struct libusb_device_descriptor device_descriptor;
- int attached;
-
- unsigned char os_priv
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
- [] /* valid C99 code */
-#else
- [0] /* non-standard, but usually working code */
-#endif
- ;
+ unsigned char os_priv[0];
};
struct libusb_device_handle {
@@ -322,14 +335,7 @@ struct libusb_device_handle {
struct list_head list;
struct libusb_device *dev;
- int auto_detach_kernel_driver;
- unsigned char os_priv
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
- [] /* valid C99 code */
-#else
- [0] /* non-standard, but usually working code */
-#endif
- ;
+ unsigned char os_priv[0];
};
enum {
@@ -379,9 +385,6 @@ enum usbi_transfer_flags {
/* Operation on the transfer failed because the device disappeared */
USBI_TRANSFER_DEVICE_DISAPPEARED = 1 << 3,
-
- /* Set by backend submit_transfer() if the fds in use have been updated */
- USBI_TRANSFER_UPDATED_FDS = 1 << 4,
};
#define USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer) \
@@ -423,35 +426,12 @@ int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
enum libusb_transfer_status status);
int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer);
-int usbi_parse_descriptor(const unsigned char *source, const char *descriptor,
+int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
void *dest, int host_endian);
-int usbi_device_cache_descriptor(libusb_device *dev);
int usbi_get_config_index_by_value(struct libusb_device *dev,
uint8_t bConfigurationValue, int *idx);
-void usbi_connect_device (struct libusb_device *dev);
-void usbi_disconnect_device (struct libusb_device *dev);
-
-/* Internal abstraction for poll (needs struct usbi_transfer on Windows) */
-#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD)
-#include <unistd.h>
-#include "os/poll_posix.h"
-#elif defined(OS_WINDOWS) || defined(OS_WINCE)
-#include "os/poll_windows.h"
-#endif
-
-#if (defined(OS_WINDOWS) || defined(OS_WINCE)) && !defined(__GNUC__)
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-int usbi_gettimeofday(struct timeval *tp, void *tzp);
-#define LIBUSB_GETTIMEOFDAY_WIN32
-#define HAVE_USBI_GETTIMEOFDAY
-#else
-#ifdef HAVE_GETTIMEOFDAY
-#define usbi_gettimeofday(tv, tz) gettimeofday((tv), (tz))
-#define HAVE_USBI_GETTIMEOFDAY
-#endif
-#endif
+/* polling */
struct usbi_pollfd {
/* must come first */
@@ -474,13 +454,7 @@ void usbi_fd_notification(struct libusb_context *ctx);
struct discovered_devs {
size_t len;
size_t capacity;
- struct libusb_device *devices
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
- [] /* valid C99 code */
-#else
- [0] /* non-standard, but usually working code */
-#endif
- ;
+ struct libusb_device *devices[0];
};
struct discovered_devs *discovered_devs_append(
@@ -494,14 +468,11 @@ struct usbi_os_backend {
/* A human-readable name for your backend, e.g. "Linux usbfs" */
const char *name;
- /* Binary mask for backend specific capabilities */
- uint32_t caps;
-
/* Perform initialization of your backend. You might use this function
* to determine specific capabilities of the system, allocate required
* data structures for later, etc.
*
- * This function is called when a libusbx user initializes the library
+ * This function is called when a libusb user initializes the library
* prior to use.
*
* Return 0 on success, or a LIBUSB_ERROR code on failure.
@@ -531,7 +502,7 @@ struct usbi_os_backend {
* but that is an unlikely case.
*
* After computing a session ID for a device, call
- * usbi_get_device_by_session_id(). This function checks if libusbx already
+ * usbi_get_device_by_session_id(). This function checks if libusb already
* knows about the device, and if so, it provides you with a libusb_device
* structure for it.
*
@@ -562,37 +533,18 @@ struct usbi_os_backend {
* This function is executed when the user wishes to retrieve a list
* of USB devices connected to the system.
*
- * If the backend has hotplug support, this function is not used!
- *
* Return 0 on success, or a LIBUSB_ERROR code on failure.
*/
int (*get_device_list)(struct libusb_context *ctx,
struct discovered_devs **discdevs);
- /* Apps which were written before hotplug support, may listen for
- * hotplug events on their own and call libusb_get_device_list on
- * device addition. In this case libusb_get_device_list will likely
- * return a list without the new device in there, as the hotplug
- * event thread will still be busy enumerating the device, which may
- * take a while, or may not even have seen the event yet.
- *
- * To avoid this libusb_get_device_list will call this optional
- * function for backends with hotplug support before copying
- * ctx->usb_devs to the user. In this function the backend should
- * ensure any pending hotplug events are fully processed before
- * returning.
- *
- * Optional, should be implemented by backends with hotplug support.
- */
- void (*hotplug_poll)(void);
-
/* Open a device for I/O and other USB operations. The device handle
* is preallocated for you, you can retrieve the device in question
* through handle->dev.
*
* Your backend should allocate any internal resources required for I/O
* and other operations so that those operations can happen (hopefully)
- * without hiccup. This is also a good place to inform libusbx that it
+ * without hiccup. This is also a good place to inform libusb that it
* should monitor certain file descriptors related to this device -
* see the usbi_add_pollfd() function.
*
@@ -616,7 +568,7 @@ struct usbi_os_backend {
/* Close a device such that the handle cannot be used again. Your backend
* should destroy any resources that were allocated in the open path.
* This may also be a good place to call usbi_remove_pollfd() to inform
- * libusbx of any file descriptors associated with this device that should
+ * libusb of any file descriptors associated with this device that should
* no longer be monitored.
*
* This function is called when the user closes a device handle.
@@ -695,29 +647,13 @@ struct usbi_os_backend {
uint8_t config_index, unsigned char *buffer, size_t len,
int *host_endian);
- /* Like get_config_descriptor but then by bConfigurationValue instead
- * of by index.
- *
- * Optional, if not present the core will call get_config_descriptor
- * for all configs until it finds the desired bConfigurationValue.
- *
- * Returns a pointer to the raw-descriptor in *buffer, this memory
- * is valid as long as device is valid.
- *
- * Returns the length of the returned raw-descriptor on success,
- * or a LIBUSB_ERROR code on failure.
- */
- int (*get_config_descriptor_by_value)(struct libusb_device *device,
- uint8_t bConfigurationValue, unsigned char **buffer,
- int *host_endian);
-
/* Get the bConfigurationValue for the active configuration for a device.
* Optional. This should only be implemented if you can retrieve it from
* cache (don't generate I/O).
*
* If you cannot retrieve this from cache, either do not implement this
* function, or return LIBUSB_ERROR_NOT_SUPPORTED. This will cause
- * libusbx to retrieve the information through a standard control transfer.
+ * libusb to retrieve the information through a standard control transfer.
*
* This function must be non-blocking.
* Return:
@@ -894,8 +830,6 @@ struct usbi_os_backend {
*
* This function must not block.
*
- * This function gets called with the flying_transfers_lock locked!
- *
* Return:
* - 0 on success
* - LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
@@ -916,7 +850,7 @@ struct usbi_os_backend {
* all private data from the transfer as if you were just about to report
* completion or cancellation.
*
- * This function might seem a bit out of place. It is used when libusbx
+ * This function might seem a bit out of place. It is used when libusb
* detects a disconnected device - it calls this function for all pending
* transfers before reporting completion (with the disconnect code) to
* the user. Maybe we can improve upon this internal interface in future.
@@ -996,9 +930,6 @@ extern const struct usbi_os_backend linux_usbfs_backend;
extern const struct usbi_os_backend darwin_backend;
extern const struct usbi_os_backend openbsd_backend;
extern const struct usbi_os_backend windows_backend;
-extern const struct usbi_os_backend wince_backend;
-
-extern struct list_head active_contexts_list;
-extern usbi_mutex_static_t active_contexts_lock;
#endif
+
diff --git a/third_party/libusb/src/libusb/os/darwin_usb.c b/third_party/libusb/src/libusb/os/darwin_usb.c
index a24558c..8834d0f 100644
--- a/third_party/libusb/src/libusb/os/darwin_usb.c
+++ b/third_party/libusb/src/libusb/os/darwin_usb.c
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode:nil -*- */
/*
- * darwin backend for libusbx 1.0
- * Copyright © 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
+ * darwin backend for libusb 1.0
+ * Copyright (C) 2008-2011 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
@@ -18,16 +17,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "config.h"
+#include <config.h>
#include <ctype.h>
+#include <dirent.h>
#include <errno.h>
+#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <fcntl.h>
#include <libkern/OSAtomic.h>
#include <mach/clock.h>
@@ -40,23 +42,22 @@
#include <objc/objc-auto.h>
#endif
+#include <IOKit/IOCFBundle.h>
+#include <IOKit/usb/IOUSBLib.h>
+#include <IOKit/IOCFPlugIn.h>
+
#include "darwin_usb.h"
/* async event thread */
-static pthread_mutex_t libusb_darwin_at_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t libusb_darwin_at_cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t libusb_darwin_at_mutex;
+static pthread_cond_t libusb_darwin_at_cond;
static clock_serv_t clock_realtime;
static clock_serv_t clock_monotonic;
-static CFRunLoopRef libusb_darwin_acfl = NULL; /* event cf loop */
+static CFRunLoopRef libusb_darwin_acfl = NULL; /* async cf loop */
static volatile int32_t initCount = 0;
-static usbi_mutex_t darwin_cached_devices_lock = PTHREAD_MUTEX_INITIALIZER;
-static struct list_head darwin_cached_devices = {&darwin_cached_devices, &darwin_cached_devices};
-
-#define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
-
/* async event thread */
static pthread_t libusb_darwin_at;
@@ -66,10 +67,6 @@ static int darwin_release_interface(struct libusb_device_handle *dev_handle, int
static int darwin_reset_device(struct libusb_device_handle *dev_handle);
static void darwin_async_io_callback (void *refcon, IOReturn result, void *arg0);
-static int darwin_scan_devices(struct libusb_context *ctx);
-static int process_new_device (struct libusb_context *ctx, io_service_t service);
-
-#if defined(ENABLE_LOGGING)
static const char *darwin_error_str (int result) {
switch (result) {
case kIOReturnSuccess:
@@ -98,15 +95,10 @@ static const char *darwin_error_str (int result) {
return "data overrun";
case kIOReturnCannotWire:
return "physical memory can not be wired down";
- case kIOReturnNoResources:
- return "out of resources";
- case kIOUSBHighSpeedSplitError:
- return "high speed split error";
default:
return "unknown error";
}
}
-#endif
static int darwin_to_libusb (int result) {
switch (result) {
@@ -133,21 +125,6 @@ static int darwin_to_libusb (int result) {
}
}
-/* this function must be called with the darwin_cached_devices_lock held */
-static void darwin_deref_cached_device(struct darwin_cached_device *cached_dev) {
- cached_dev->refcount--;
- /* free the device and remove it from the cache */
- if (0 == cached_dev->refcount) {
- list_del(&cached_dev->list);
-
- (*(cached_dev->device))->Release(cached_dev->device);
- free (cached_dev);
- }
-}
-
-static void darwin_ref_cached_device(struct darwin_cached_device *cached_dev) {
- cached_dev->refcount++;
-}
static int ep_to_pipeRef(struct libusb_device_handle *dev_handle, uint8_t ep, uint8_t *pipep, uint8_t *ifcp) {
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
@@ -157,19 +134,19 @@ static int ep_to_pipeRef(struct libusb_device_handle *dev_handle, uint8_t ep, ui
int8_t i, iface;
- usbi_dbg ("converting ep address 0x%02x to pipeRef and interface", ep);
+ usbi_info (HANDLE_CTX(dev_handle), "converting ep address 0x%02x to pipeRef and interface", ep);
for (iface = 0 ; iface < USB_MAXINTERFACES ; iface++) {
cInterface = &priv->interfaces[iface];
if (dev_handle->claimed_interfaces & (1 << iface)) {
for (i = 0 ; i < cInterface->num_endpoints ; i++) {
- if (cInterface->endpoint_addrs[i] == ep) {
- *pipep = i + 1;
- *ifcp = iface;
- usbi_dbg ("pipe %d on interface %d matches", *pipep, *ifcp);
- return 0;
- }
+ if (cInterface->endpoint_addrs[i] == ep) {
+ *pipep = i + 1;
+ *ifcp = iface;
+ usbi_info (HANDLE_CTX(dev_handle), "pipe %d on interface %d matches", *pipep, *ifcp);
+ return 0;
+ }
}
}
}
@@ -180,7 +157,7 @@ static int ep_to_pipeRef(struct libusb_device_handle *dev_handle, uint8_t ep, ui
return -1;
}
-static int usb_setup_device_iterator (io_iterator_t *deviceIterator, UInt32 location) {
+static int usb_setup_device_iterator (io_iterator_t *deviceIterator, long location) {
CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOUSBDeviceClassName);
if (!matchingDict)
@@ -192,9 +169,7 @@ static int usb_setup_device_iterator (io_iterator_t *deviceIterator, UInt32 loca
&kCFTypeDictionaryValueCallBacks);
if (propertyMatchDict) {
- /* there are no unsigned CFNumber types so treat the value as signed. the os seems to do this
- internally (CFNumberType of locationID is 3) */
- CFTypeRef locationCF = CFNumberCreate (NULL, kCFNumberSInt32Type, &location);
+ CFTypeRef locationCF = CFNumberCreate (NULL, kCFNumberLongType, &location);
CFDictionarySetValue (propertyMatchDict, CFSTR(kUSBDevicePropertyLocationID), locationCF);
/* release our reference to the CFNumber (CFDictionarySetValue retains it) */
@@ -210,92 +185,118 @@ static int usb_setup_device_iterator (io_iterator_t *deviceIterator, UInt32 loca
return IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, deviceIterator);
}
-static int get_ioregistry_value_number (io_service_t service, CFStringRef property, CFNumberType type, void *p) {
- CFTypeRef cfNumber = IORegistryEntryCreateCFProperty (service, property, kCFAllocatorDefault, 0);
- int ret = 0;
+static usb_device_t **usb_get_next_device (io_iterator_t deviceIterator, UInt32 *locationp) {
+ io_cf_plugin_ref_t *plugInInterface = NULL;
+ usb_device_t **device;
+ io_service_t usbDevice;
+ long result;
+ SInt32 score;
- if (cfNumber) {
- if (CFGetTypeID(cfNumber) == CFNumberGetTypeID()) {
- ret = CFNumberGetValue(cfNumber, type, p);
- }
+ if (!IOIteratorIsValid (deviceIterator))
+ return NULL;
- CFRelease (cfNumber);
- }
- return ret;
-}
+ while ((usbDevice = IOIteratorNext(deviceIterator))) {
+ result = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID,
+ kIOCFPlugInInterfaceID, &plugInInterface,
+ &score);
-static usb_device_t **darwin_device_from_service (io_service_t service)
-{
- io_cf_plugin_ref_t *plugInInterface = NULL;
- usb_device_t **device;
- kern_return_t result;
- SInt32 score;
+ /* we are done with the usb_device_t */
+ (void)IOObjectRelease(usbDevice);
+ if (kIOReturnSuccess == result && plugInInterface)
+ break;
- result = IOCreatePlugInInterfaceForService(service, kIOUSBDeviceUserClientTypeID,
- kIOCFPlugInInterfaceID, &plugInInterface,
- &score);
+ usbi_dbg ("libusb/darwin.c usb_get_next_device: could not set up plugin for service: %s\n", darwin_error_str (result));
+ }
- if (kIOReturnSuccess != result || !plugInInterface) {
- usbi_dbg ("could not set up plugin for service: %s\n", darwin_error_str (result));
+ if (!usbDevice)
return NULL;
- }
(void)(*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(DeviceInterfaceID),
- (LPVOID)&device);
- /* Use release instead of IODestroyPlugInInterface to avoid stopping IOServices associated with this device */
- (*plugInInterface)->Release (plugInInterface);
+ (LPVOID)&device);
+
+ (*plugInInterface)->Stop(plugInInterface);
+ IODestroyPlugInInterface (plugInInterface);
+
+ /* get the location from the device */
+ if (locationp)
+ (*(device))->GetLocationID(device, locationp);
return device;
}
-static void darwin_devices_attached (void *ptr, io_iterator_t add_devices) {
- struct libusb_context *ctx;
- io_service_t service;
+static kern_return_t darwin_get_device (uint32_t dev_location, usb_device_t ***darwin_device) {
+ kern_return_t kresult;
+ UInt32 location;
+ io_iterator_t deviceIterator;
- usbi_mutex_lock(&active_contexts_lock);
+ kresult = usb_setup_device_iterator (&deviceIterator, dev_location);
+ if (kresult)
+ return kresult;
- while ((service = IOIteratorNext(add_devices))) {
- /* add this device to each active context's device list */
- list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
- process_new_device (ctx, service);;
- }
+ /* This port of libusb uses locations to keep track of devices. */
+ while ((*darwin_device = usb_get_next_device (deviceIterator, &location)) != NULL) {
+ if (location == dev_location)
+ break;
- IOObjectRelease(service);
+ (**darwin_device)->Release(*darwin_device);
}
- usbi_mutex_unlock(&active_contexts_lock);
+ IOObjectRelease (deviceIterator);
+
+ if (!(*darwin_device))
+ return kIOReturnNoDevice;
+
+ return kIOReturnSuccess;
}
+
+
static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
- struct libusb_device *dev = NULL;
- struct libusb_context *ctx;
+ struct libusb_context *ctx = (struct libusb_context *)ptr;
+ struct libusb_device_handle *handle;
+ struct darwin_device_priv *dpriv;
+ struct darwin_device_handle_priv *priv;
io_service_t device;
- UInt64 session;
- int ret;
+ long location;
+ bool locationValid;
+ CFTypeRef locationCF;
+ UInt32 message;
+
+ usbi_info (ctx, "a device has been detached");
while ((device = IOIteratorNext (rem_devices)) != 0) {
/* get the location from the i/o registry */
- ret = get_ioregistry_value_number (device, CFSTR("sessionID"), kCFNumberSInt64Type, &session);
+ locationCF = IORegistryEntryCreateCFProperty (device, CFSTR(kUSBDevicePropertyLocationID), kCFAllocatorDefault, 0);
+
IOObjectRelease (device);
- if (!ret)
+
+ if (!locationCF)
continue;
- usbi_mutex_lock(&active_contexts_lock);
+ locationValid = CFGetTypeID(locationCF) == CFNumberGetTypeID() &&
+ CFNumberGetValue(locationCF, kCFNumberLongType, &location);
+
+ CFRelease (locationCF);
+
+ if (!locationValid)
+ continue;
- list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
- usbi_dbg ("notifying context %p of device disconnect", ctx);
+ usbi_mutex_lock(&ctx->open_devs_lock);
+ list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
+ dpriv = (struct darwin_device_priv *)handle->dev->os_priv;
- dev = usbi_get_device_by_session_id(ctx, session);
- if (dev) {
- /* signal the core that this device has been disconnected. the core will tear down this device
- when the reference count reaches 0 */
- usbi_disconnect_device(dev);
+ /* the device may have been opened several times. write to each handle's event descriptor */
+ if (dpriv->location == location && handle->os_priv) {
+ priv = (struct darwin_device_handle_priv *)handle->os_priv;
+
+ message = MESSAGE_DEVICE_GONE;
+ write (priv->fds[1], &message, sizeof (message));
}
}
- usbi_mutex_unlock(&active_contexts_lock);
+ usbi_mutex_unlock(&ctx->open_devs_lock);
}
}
@@ -306,7 +307,7 @@ static void darwin_clear_iterator (io_iterator_t iter) {
IOObjectRelease (device);
}
-static void *darwin_event_thread_main (void *arg0) {
+static void *event_thread_main (void *arg0) {
IOReturn kresult;
struct libusb_context *ctx = (struct libusb_context *)arg0;
CFRunLoopRef runloop;
@@ -314,22 +315,23 @@ static void *darwin_event_thread_main (void *arg0) {
/* Set this thread's name, so it can be seen in the debugger
and crash reports. */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- pthread_setname_np ("org.libusb.device-hotplug");
+ pthread_setname_np ("org.libusb.device-detach");
+#endif
/* Tell the Objective-C garbage collector about this thread.
This is required because, unlike NSThreads, pthreads are
not automatically registered. Although we don't use
Objective-C, we use CoreFoundation, which does. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
objc_registerThreadWithCollector();
#endif
- /* hotplug (device arrival/removal) sources */
+ /* hotplug (device removal) source */
CFRunLoopSourceRef libusb_notification_cfsource;
io_notification_port_t libusb_notification_port;
io_iterator_t libusb_rem_device_iterator;
- io_iterator_t libusb_add_device_iterator;
- usbi_dbg ("creating hotplug event source");
+ usbi_info (ctx, "creating hotplug event source");
runloop = CFRunLoopGetCurrent ();
CFRetain (runloop);
@@ -341,21 +343,9 @@ static void *darwin_event_thread_main (void *arg0) {
/* create notifications for removed devices */
kresult = IOServiceAddMatchingNotification (libusb_notification_port, kIOTerminatedNotification,
- IOServiceMatching(kIOUSBDeviceClassName),
- (IOServiceMatchingCallback)darwin_devices_detached,
- (void *)ctx, &libusb_rem_device_iterator);
-
- if (kresult != kIOReturnSuccess) {
- usbi_err (ctx, "could not add hotplug event source: %s", darwin_error_str (kresult));
-
- pthread_exit (NULL);
- }
-
- /* create notifications for attached devices */
- kresult = IOServiceAddMatchingNotification(libusb_notification_port, kIOFirstMatchNotification,
- IOServiceMatching(kIOUSBDeviceClassName),
- (IOServiceMatchingCallback)darwin_devices_attached,
- (void *)ctx, &libusb_add_device_iterator);
+ IOServiceMatching(kIOUSBDeviceClassName),
+ (IOServiceMatchingCallback)darwin_devices_detached,
+ (void *)ctx, &libusb_rem_device_iterator);
if (kresult != kIOReturnSuccess) {
usbi_err (ctx, "could not add hotplug event source: %s", darwin_error_str (kresult));
@@ -365,11 +355,10 @@ static void *darwin_event_thread_main (void *arg0) {
/* arm notifiers */
darwin_clear_iterator (libusb_rem_device_iterator);
- darwin_clear_iterator (libusb_add_device_iterator);
- usbi_dbg ("darwin event thread ready to receive events");
+ usbi_info (ctx, "thread ready to receive events");
- /* signal the main thread that the hotplug runloop has been created. */
+ /* signal the main thread that the async runloop has been created. */
pthread_mutex_lock (&libusb_darwin_at_mutex);
libusb_darwin_acfl = runloop;
pthread_cond_signal (&libusb_darwin_at_cond);
@@ -378,17 +367,11 @@ static void *darwin_event_thread_main (void *arg0) {
/* run the runloop */
CFRunLoopRun();
- usbi_dbg ("darwin event thread exiting");
-
- /* remove the notification cfsource */
- CFRunLoopRemoveSource(runloop, libusb_notification_cfsource, kCFRunLoopDefaultMode);
+ usbi_info (ctx, "thread exiting");
/* delete notification port */
IONotificationPortDestroy (libusb_notification_port);
-
- /* delete iterators */
IOObjectRelease (libusb_rem_device_iterator);
- IOObjectRelease (libusb_add_device_iterator);
CFRelease (runloop);
@@ -397,40 +380,21 @@ static void *darwin_event_thread_main (void *arg0) {
pthread_exit (NULL);
}
-static void _darwin_finalize(void) {
- struct darwin_cached_device *dev, *next;
-
- usbi_mutex_lock(&darwin_cached_devices_lock);
- list_for_each_entry_safe(dev, next, &darwin_cached_devices, list, struct darwin_cached_device) {
- darwin_deref_cached_device(dev);
- }
- usbi_mutex_unlock(&darwin_cached_devices_lock);
-}
-
static int darwin_init(struct libusb_context *ctx) {
host_name_port_t host_self;
- static int initted = 0;
- int rc;
-
- rc = darwin_scan_devices (ctx);
- if (LIBUSB_SUCCESS != rc) {
- return rc;
- }
if (OSAtomicIncrement32Barrier(&initCount) == 1) {
/* create the clocks that will be used */
- if (!initted) {
- initted = 1;
- atexit(_darwin_finalize);
- }
-
host_self = mach_host_self();
host_get_clock_service(host_self, CALENDAR_CLOCK, &clock_realtime);
host_get_clock_service(host_self, SYSTEM_CLOCK, &clock_monotonic);
mach_port_deallocate(mach_task_self(), host_self);
- pthread_create (&libusb_darwin_at, NULL, darwin_event_thread_main, (void *)ctx);
+ pthread_mutex_init (&libusb_darwin_at_mutex, NULL);
+ pthread_cond_init (&libusb_darwin_at_cond, NULL);
+
+ pthread_create (&libusb_darwin_at, NULL, event_thread_main, (void *)ctx);
pthread_mutex_lock (&libusb_darwin_at_mutex);
while (!libusb_darwin_acfl)
@@ -438,7 +402,7 @@ static int darwin_init(struct libusb_context *ctx) {
pthread_mutex_unlock (&libusb_darwin_at_mutex);
}
- return rc;
+ return 0;
}
static void darwin_exit (void) {
@@ -446,14 +410,14 @@ static void darwin_exit (void) {
mach_port_deallocate(mach_task_self(), clock_realtime);
mach_port_deallocate(mach_task_self(), clock_monotonic);
- /* stop the event runloop and wait for the thread to terminate. */
+ /* stop the async runloop and wait for the thread to terminate. */
CFRunLoopStop (libusb_darwin_acfl);
pthread_join (libusb_darwin_at, NULL);
}
}
static int darwin_get_device_descriptor(struct libusb_device *dev, unsigned char *buffer, int *host_endian) {
- struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
+ struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
/* return cached copy */
memmove (buffer, &(priv->dev_descriptor), DEVICE_DESC_LENGTH);
@@ -464,7 +428,7 @@ static int darwin_get_device_descriptor(struct libusb_device *dev, unsigned char
}
static int get_configuration_index (struct libusb_device *dev, int config_value) {
- struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
+ struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
UInt8 i, numConfig;
IOUSBConfigurationDescriptorPtr desc;
IOReturn kresult;
@@ -482,15 +446,15 @@ static int get_configuration_index (struct libusb_device *dev, int config_value)
}
/* configuration not found */
- return LIBUSB_ERROR_NOT_FOUND;
+ return LIBUSB_ERROR_OTHER;
}
static int darwin_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len, int *host_endian) {
- struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
+ struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
int config_index;
if (0 == priv->active_config)
- return LIBUSB_ERROR_NOT_FOUND;
+ return LIBUSB_ERROR_INVALID_PARAM;
config_index = get_configuration_index (dev, priv->active_config);
if (config_index < 0)
@@ -500,15 +464,27 @@ static int darwin_get_active_config_descriptor(struct libusb_device *dev, unsign
}
static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian) {
- struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
+ struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
IOUSBConfigurationDescriptorPtr desc;
IOReturn kresult;
- int ret;
+ usb_device_t **device = NULL;
- if (!priv || !priv->device)
+ if (!priv)
return LIBUSB_ERROR_OTHER;
- kresult = (*priv->device)->GetConfigurationDescriptorPtr (priv->device, config_index, &desc);
+ if (!priv->device) {
+ kresult = darwin_get_device (priv->location, &device);
+ if (kresult || !device) {
+ usbi_err (DEVICE_CTX (dev), "could not find device: %s", darwin_error_str (kresult));
+
+ return darwin_to_libusb (kresult);
+ }
+
+ /* don't have to open the device to get a config descriptor */
+ } else
+ device = priv->device;
+
+ kresult = (*device)->GetConfigurationDescriptorPtr (device, config_index, &desc);
if (kresult == kIOReturnSuccess) {
/* copy descriptor */
if (libusb_le16_to_cpu(desc->wTotalLength) < len)
@@ -520,16 +496,15 @@ static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t confi
*host_endian = 0;
}
- ret = darwin_to_libusb (kresult);
- if (ret != LIBUSB_SUCCESS)
- return ret;
+ if (!priv->device)
+ (*device)->Release (device);
- return len;
+ return darwin_to_libusb (kresult);
}
/* check whether the os has configured the device */
-static int darwin_check_configuration (struct libusb_context *ctx, struct darwin_cached_device *dev) {
- usb_device_t **darwin_device = dev->device;
+static int darwin_check_configuration (struct libusb_context *ctx, struct libusb_device *dev, usb_device_t **darwin_device) {
+ struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
IOUSBConfigurationDescriptorPtr configDesc;
IOUSBFindInterfaceRequest request;
@@ -537,14 +512,14 @@ static int darwin_check_configuration (struct libusb_context *ctx, struct darwin
io_iterator_t interface_iterator;
io_service_t firstInterface;
- if (dev->dev_descriptor.bNumConfigurations < 1) {
+ if (priv->dev_descriptor.bNumConfigurations < 1) {
usbi_err (ctx, "device has no configurations");
return LIBUSB_ERROR_OTHER; /* no configurations at this speed so we can't use it */
}
/* find the first configuration */
kresult = (*darwin_device)->GetConfigurationDescriptorPtr (darwin_device, 0, &configDesc);
- dev->first_config = (kIOReturnSuccess == kresult) ? configDesc->bConfigurationValue : 1;
+ priv->first_config = (kIOReturnSuccess == kresult) ? configDesc->bConfigurationValue : 1;
/* check if the device is already configured. there is probably a better way than iterating over the
to accomplish this (the trick is we need to avoid a call to GetConfigurations since buggy devices
@@ -570,83 +545,72 @@ static int darwin_check_configuration (struct libusb_context *ctx, struct darwin
IOObjectRelease (firstInterface);
/* device is configured */
- if (dev->dev_descriptor.bNumConfigurations == 1)
+ if (priv->dev_descriptor.bNumConfigurations == 1)
/* to avoid problems with some devices get the configurations value from the configuration descriptor */
- dev->active_config = dev->first_config;
+ priv->active_config = priv->first_config;
else
/* devices with more than one configuration should work with GetConfiguration */
- (*darwin_device)->GetConfiguration (darwin_device, &dev->active_config);
+ (*darwin_device)->GetConfiguration (darwin_device, &priv->active_config);
} else
/* not configured */
- dev->active_config = 0;
+ priv->active_config = 0;
- usbi_dbg ("active config: %u, first config: %u", dev->active_config, dev->first_config);
+ usbi_info (ctx, "active config: %u, first config: %u", priv->active_config, priv->first_config);
return 0;
}
-static int darwin_request_descriptor (usb_device_t **device, UInt8 desc, UInt8 desc_index, void *buffer, size_t buffer_size) {
- IOUSBDevRequestTO req;
-
- memset (buffer, 0, buffer_size);
-
- /* Set up request for descriptor/ */
- req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
- req.bRequest = kUSBRqGetDescriptor;
- req.wValue = desc << 8;
- req.wIndex = desc_index;
- req.wLength = buffer_size;
- req.pData = buffer;
- req.noDataTimeout = 20;
- req.completionTimeout = 100;
-
- return (*device)->DeviceRequestTO (device, &req);
-}
-
-static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct darwin_cached_device *dev) {
- usb_device_t **device = dev->device;
- int retries = 1, delay = 30000;
+static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct libusb_device *dev, usb_device_t **device) {
+ struct darwin_device_priv *priv;
+ int retries = 5, delay = 30000;
int unsuspended = 0, try_unsuspend = 1, try_reconfigure = 1;
int is_open = 0;
int ret = 0, ret2;
+ IOUSBDevRequest req;
UInt8 bDeviceClass;
UInt16 idProduct, idVendor;
- dev->can_enumerate = 0;
-
(*device)->GetDeviceClass (device, &bDeviceClass);
(*device)->GetDeviceProduct (device, &idProduct);
(*device)->GetDeviceVendor (device, &idVendor);
- /* According to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
- * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request. Still,
- * to follow the spec as closely as possible, try opening the device */
+ priv = (struct darwin_device_priv *)dev->os_priv;
+
+ /* try to open the device (we can usually continue even if this fails) */
is_open = ((*device)->USBDeviceOpenSeize(device) == kIOReturnSuccess);
+ /**** retrieve device descriptor ****/
do {
- /**** retrieve device descriptor ****/
- ret = darwin_request_descriptor (device, kUSBDeviceDesc, 0, &dev->dev_descriptor, sizeof(dev->dev_descriptor));
-
- if (kIOReturnOverrun == ret && kUSBDeviceDesc == dev->dev_descriptor.bDescriptorType)
+ /* Set up request for device descriptor */
+ memset (&(priv->dev_descriptor), 0, sizeof(IOUSBDeviceDescriptor));
+ req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
+ req.bRequest = kUSBRqGetDescriptor;
+ req.wValue = kUSBDeviceDesc << 8;
+ req.wIndex = 0;
+ req.wLength = sizeof(priv->dev_descriptor);
+ req.pData = &(priv->dev_descriptor);
+
+ /* according to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
+ * devices and Apple's USB Prober doesn't bother to open the device before issuing a descriptor request. Still,
+ * to follow the spec as closely as possible, try opening the device */
+
+ ret = (*(device))->DeviceRequest (device, &req);
+
+ if (kIOReturnOverrun == ret && kUSBDeviceDesc == priv->dev_descriptor.bDescriptorType)
/* received an overrun error but we still received a device descriptor */
ret = kIOReturnSuccess;
- if (kIOUSBVendorIDAppleComputer == idVendor) {
- /* NTH: don't bother retrying or unsuspending Apple devices */
- break;
- }
-
- if (kIOReturnSuccess == ret && (0 == dev->dev_descriptor.bNumConfigurations ||
- 0 == dev->dev_descriptor.bcdUSB)) {
+ if (kIOReturnSuccess == ret && (0 == priv->dev_descriptor.bNumConfigurations ||
+ 0 == priv->dev_descriptor.bcdUSB)) {
/* work around for incorrectly configured devices */
if (try_reconfigure && is_open) {
- usbi_dbg("descriptor appears to be invalid. resetting configuration before trying again...");
+ usbi_dbg("descriptor appears to be invalid. resetting configuration before trying again...");
- /* set the first configuration */
- (*device)->SetConfiguration(device, 1);
+ /* set the first configuration */
+ (*device)->SetConfiguration(device, 1);
- /* don't try to reconfigure again */
- try_reconfigure = 0;
+ /* don't try to reconfigure again */
+ try_reconfigure = 0;
}
ret = kIOUSBPipeStalled;
@@ -655,27 +619,25 @@ static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct da
if (kIOReturnSuccess != ret && is_open && try_unsuspend) {
/* device may be suspended. unsuspend it and try again */
#if DeviceVersion >= 320
- UInt32 info = 0;
+ UInt32 info;
/* IOUSBFamily 320+ provides a way to detect device suspension but earlier versions do not */
(void)(*device)->GetUSBDeviceInformation (device, &info);
- /* note that the device was suspended */
- if (info & (1 << kUSBInformationDeviceIsSuspendedBit) || 0 == info)
- try_unsuspend = 1;
+ try_unsuspend = info & (1 << kUSBInformationDeviceIsSuspendedBit);
#endif
if (try_unsuspend) {
- /* try to unsuspend the device */
- ret2 = (*device)->USBDeviceSuspend (device, 0);
- if (kIOReturnSuccess != ret2) {
- /* prevent log spew from poorly behaving devices. this indicates the
- os actually had trouble communicating with the device */
- usbi_dbg("could not retrieve device descriptor. failed to unsuspend: %s",darwin_error_str(ret2));
- } else
- unsuspended = 1;
-
- try_unsuspend = 0;
+ /* resume the device */
+ ret2 = (*device)->USBDeviceSuspend (device, 0);
+ if (kIOReturnSuccess != ret2) {
+ /* prevent log spew from poorly behaving devices. this indicates the
+ os actually had trouble communicating with the device */
+ usbi_dbg("could not retrieve device descriptor. failed to unsuspend: %s",darwin_error_str(ret2));
+ } else
+ unsuspended = 1;
+
+ try_unsuspend = 0;
}
}
@@ -696,223 +658,128 @@ static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct da
if (ret != kIOReturnSuccess) {
/* a debug message was already printed out for this error */
if (LIBUSB_CLASS_HUB == bDeviceClass)
- usbi_dbg ("could not retrieve device descriptor %.4x:%.4x: %s (%x). skipping device",
- idVendor, idProduct, darwin_error_str (ret), ret);
+ usbi_dbg ("could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
else
- usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s (%x). skipping device",
- idVendor, idProduct, darwin_error_str (ret), ret);
+ usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s. skipping device", idVendor, idProduct, darwin_error_str (ret));
+
return -1;
}
+ usbi_dbg ("device descriptor:");
+ usbi_dbg (" bDescriptorType: 0x%02x", priv->dev_descriptor.bDescriptorType);
+ usbi_dbg (" bcdUSB: 0x%04x", priv->dev_descriptor.bcdUSB);
+ usbi_dbg (" bDeviceClass: 0x%02x", priv->dev_descriptor.bDeviceClass);
+ usbi_dbg (" bDeviceSubClass: 0x%02x", priv->dev_descriptor.bDeviceSubClass);
+ usbi_dbg (" bDeviceProtocol: 0x%02x", priv->dev_descriptor.bDeviceProtocol);
+ usbi_dbg (" bMaxPacketSize0: 0x%02x", priv->dev_descriptor.bMaxPacketSize0);
+ usbi_dbg (" idVendor: 0x%04x", priv->dev_descriptor.idVendor);
+ usbi_dbg (" idProduct: 0x%04x", priv->dev_descriptor.idProduct);
+ usbi_dbg (" bcdDevice: 0x%04x", priv->dev_descriptor.bcdDevice);
+ usbi_dbg (" iManufacturer: 0x%02x", priv->dev_descriptor.iManufacturer);
+ usbi_dbg (" iProduct: 0x%02x", priv->dev_descriptor.iProduct);
+ usbi_dbg (" iSerialNumber: 0x%02x", priv->dev_descriptor.iSerialNumber);
+ usbi_dbg (" bNumConfigurations: 0x%02x", priv->dev_descriptor.bNumConfigurations);
+
/* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
- if (libusb_le16_to_cpu (dev->dev_descriptor.idProduct) != idProduct) {
+ if (libusb_le16_to_cpu (priv->dev_descriptor.idProduct) != idProduct) {
/* not a valid device */
usbi_warn (ctx, "idProduct from iokit (%04x) does not match idProduct in descriptor (%04x). skipping device",
- idProduct, libusb_le16_to_cpu (dev->dev_descriptor.idProduct));
+ idProduct, libusb_le16_to_cpu (priv->dev_descriptor.idProduct));
return -1;
}
- usbi_dbg ("cached device descriptor:");
- usbi_dbg (" bDescriptorType: 0x%02x", dev->dev_descriptor.bDescriptorType);
- usbi_dbg (" bcdUSB: 0x%04x", dev->dev_descriptor.bcdUSB);
- usbi_dbg (" bDeviceClass: 0x%02x", dev->dev_descriptor.bDeviceClass);
- usbi_dbg (" bDeviceSubClass: 0x%02x", dev->dev_descriptor.bDeviceSubClass);
- usbi_dbg (" bDeviceProtocol: 0x%02x", dev->dev_descriptor.bDeviceProtocol);
- usbi_dbg (" bMaxPacketSize0: 0x%02x", dev->dev_descriptor.bMaxPacketSize0);
- usbi_dbg (" idVendor: 0x%04x", dev->dev_descriptor.idVendor);
- usbi_dbg (" idProduct: 0x%04x", dev->dev_descriptor.idProduct);
- usbi_dbg (" bcdDevice: 0x%04x", dev->dev_descriptor.bcdDevice);
- usbi_dbg (" iManufacturer: 0x%02x", dev->dev_descriptor.iManufacturer);
- usbi_dbg (" iProduct: 0x%02x", dev->dev_descriptor.iProduct);
- usbi_dbg (" iSerialNumber: 0x%02x", dev->dev_descriptor.iSerialNumber);
- usbi_dbg (" bNumConfigurations: 0x%02x", dev->dev_descriptor.bNumConfigurations);
-
- dev->can_enumerate = 1;
-
return 0;
}
-static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t service,
- struct darwin_cached_device **cached_out) {
- struct darwin_cached_device *new_device;
- UInt64 sessionID, parent_sessionID;
- int ret = LIBUSB_SUCCESS;
- usb_device_t **device;
- io_service_t parent;
- kern_return_t result;
- UInt8 port = 0;
-
- *cached_out = NULL;
-
- /* get some info from the io registry */
- (void) get_ioregistry_value_number (service, CFSTR("sessionID"), kCFNumberSInt64Type, &sessionID);
- (void) get_ioregistry_value_number (service, CFSTR("PortNum"), kCFNumberSInt8Type, &port);
-
- usbi_dbg("finding cached device for sessionID 0x\n" PRIx64, sessionID);
-
- result = IORegistryEntryGetParentEntry (service, kIOUSBPlane, &parent);
-
- if (kIOReturnSuccess == result) {
- (void) get_ioregistry_value_number (parent, CFSTR("sessionID"), kCFNumberSInt64Type, &parent_sessionID);
- IOObjectRelease(parent);
- }
+static int process_new_device (struct libusb_context *ctx, usb_device_t **device, UInt32 locationID, struct discovered_devs **_discdevs) {
+ struct darwin_device_priv *priv;
+ struct libusb_device *dev;
+ struct discovered_devs *discdevs;
+ UInt16 address;
+ UInt8 devSpeed;
+ int ret = 0, need_unref = 0;
- usbi_mutex_lock(&darwin_cached_devices_lock);
do {
- list_for_each_entry(new_device, &darwin_cached_devices, list, struct darwin_cached_device) {
- usbi_dbg("matching sessionID 0x%x against cached device with sessionID 0x%x", sessionID, new_device->session);
- if (new_device->session == sessionID) {
- usbi_dbg("using cached device for device");
- *cached_out = new_device;
- break;
- }
- }
-
- if (*cached_out)
- break;
-
- usbi_dbg("caching new device with sessionID 0x%x\n", sessionID);
+ dev = usbi_get_device_by_session_id(ctx, locationID);
+ if (!dev) {
+ usbi_info (ctx, "allocating new device for location 0x%08x", locationID);
+ dev = usbi_alloc_device(ctx, locationID);
+ need_unref = 1;
+ } else
+ usbi_info (ctx, "using existing device for location 0x%08x", locationID);
- new_device = calloc (1, sizeof (*new_device));
- if (!new_device) {
+ if (!dev) {
ret = LIBUSB_ERROR_NO_MEM;
break;
}
- device = darwin_device_from_service (service);
- if (!device) {
- ret = LIBUSB_ERROR_NO_DEVICE;
- free (new_device);
- new_device = NULL;
- break;
- }
-
- /* add this device to the cached device list */
- list_add(&new_device->list, &darwin_cached_devices);
-
- (*device)->GetDeviceAddress (device, (USBDeviceAddress *)&new_device->address);
-
- /* keep a reference to this device */
- darwin_ref_cached_device(new_device);
+ priv = (struct darwin_device_priv *)dev->os_priv;
- new_device->device = device;
- new_device->session = sessionID;
- (*device)->GetLocationID (device, &new_device->location);
- new_device->port = port;
- new_device->parent_session = parent_sessionID;
+ (*device)->GetDeviceAddress (device, (USBDeviceAddress *)&address);
- /* cache the device descriptor */
- ret = darwin_cache_device_descriptor(ctx, new_device);
- if (ret)
+ ret = darwin_cache_device_descriptor (ctx, dev, device);
+ if (ret < 0)
break;
- if (new_device->can_enumerate) {
- snprintf(new_device->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", new_device->address,
- new_device->dev_descriptor.idVendor, new_device->dev_descriptor.idProduct,
- new_device->dev_descriptor.bDeviceClass, new_device->dev_descriptor.bDeviceSubClass);
- }
- } while (0);
-
- usbi_mutex_unlock(&darwin_cached_devices_lock);
-
- /* keep track of devices regardless of if we successfully enumerate them to
- prevent them from being enumerated multiple times */
-
- *cached_out = new_device;
-
- return ret;
-}
-
-static int process_new_device (struct libusb_context *ctx, io_service_t service) {
- struct darwin_device_priv *priv;
- struct libusb_device *dev = NULL;
- struct darwin_cached_device *cached_device;
- UInt8 devSpeed;
- int ret = 0;
-
- do {
- ret = darwin_get_cached_device (ctx, service, &cached_device);
-
- if (ret < 0 || (cached_device && !cached_device->can_enumerate)) {
- return ret;
- }
-
- /* check current active configuration (and cache the first configuration value--
- which may be used by claim_interface) */
- ret = darwin_check_configuration (ctx, cached_device);
- if (ret)
+ /* check current active configuration (and cache the first configuration value-- which may be used by claim_interface) */
+ ret = darwin_check_configuration (ctx, dev, device);
+ if (ret < 0)
break;
- usbi_dbg ("allocating new device in context %p for with session 0x%08x",
- ctx, cached_device->session);
+ dev->bus_number = locationID >> 24;
+ dev->device_address = address;
- dev = usbi_alloc_device(ctx, cached_device->session);
- if (!dev) {
- return LIBUSB_ERROR_NO_MEM;
- }
-
- priv = (struct darwin_device_priv *)dev->os_priv;
-
- priv->dev = cached_device;
- darwin_ref_cached_device (priv->dev);
-
- if (cached_device->parent_session > 0) {
- dev->parent_dev = usbi_get_device_by_session_id (ctx, cached_device->parent_session);
- } else {
- dev->parent_dev = NULL;
- }
- dev->port_number = cached_device->port;
- dev->bus_number = cached_device->location >> 24;
- dev->device_address = cached_device->address;
-
- /* need to add a reference to the parent device */
- if (dev->parent_dev) {
- libusb_ref_device(dev->parent_dev);
- }
-
- (*(priv->dev->device))->GetDeviceSpeed (priv->dev->device, &devSpeed);
+ (*device)->GetDeviceSpeed (device, &devSpeed);
switch (devSpeed) {
case kUSBDeviceSpeedLow: dev->speed = LIBUSB_SPEED_LOW; break;
case kUSBDeviceSpeedFull: dev->speed = LIBUSB_SPEED_FULL; break;
case kUSBDeviceSpeedHigh: dev->speed = LIBUSB_SPEED_HIGH; break;
-#if DeviceVersion >= 500
- case kUSBDeviceSpeedSuper: dev->speed = LIBUSB_SPEED_SUPER; break;
-#endif
default:
usbi_warn (ctx, "Got unknown device speed %d", devSpeed);
}
+ /* save our location, we'll need this later */
+ priv->location = locationID;
+ snprintf(priv->sys_path, 20, "%03i-%04x-%04x-%02x-%02x", address, priv->dev_descriptor.idVendor, priv->dev_descriptor.idProduct,
+ priv->dev_descriptor.bDeviceClass, priv->dev_descriptor.bDeviceSubClass);
+
ret = usbi_sanitize_device (dev);
if (ret < 0)
break;
- usbi_dbg ("found device with address %d port = %d parent = %p at %p", dev->device_address,
- dev->port_number, (void *) dev->parent_dev, priv->dev->sys_path);
+ /* append the device to the list of discovered devices */
+ discdevs = discovered_devs_append(*_discdevs, dev);
+ if (!discdevs) {
+ ret = LIBUSB_ERROR_NO_MEM;
+ break;
+ }
+
+ *_discdevs = discdevs;
+
+ usbi_info (ctx, "found device with address %d at %s", dev->device_address, priv->sys_path);
} while (0);
- if (0 == ret) {
- usbi_connect_device (dev);
- } else {
- libusb_unref_device (dev);
- }
+ if (need_unref)
+ libusb_unref_device(dev);
return ret;
}
-static int darwin_scan_devices(struct libusb_context *ctx) {
- io_iterator_t deviceIterator;
- io_service_t service;
- kern_return_t kresult;
+static int darwin_get_device_list(struct libusb_context *ctx, struct discovered_devs **_discdevs) {
+ io_iterator_t deviceIterator;
+ usb_device_t **device;
+ kern_return_t kresult;
+ UInt32 location;
kresult = usb_setup_device_iterator (&deviceIterator, 0);
if (kresult != kIOReturnSuccess)
return darwin_to_libusb (kresult);
- while ((service = IOIteratorNext (deviceIterator))) {
- (void) process_new_device (ctx, service);
+ while ((device = usb_get_next_device (deviceIterator, &location)) != NULL) {
+ (void) process_new_device (ctx, device, location, _discdevs);
- IOObjectRelease(service);
+ (*(device))->Release(device);
}
IOObjectRelease(deviceIterator);
@@ -922,43 +789,56 @@ static int darwin_scan_devices(struct libusb_context *ctx) {
static int darwin_open (struct libusb_device_handle *dev_handle) {
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
+ usb_device_t **darwin_device;
IOReturn kresult;
if (0 == dpriv->open_count) {
+ kresult = darwin_get_device (dpriv->location, &darwin_device);
+ if (kresult) {
+ usbi_err (HANDLE_CTX (dev_handle), "could not find device: %s", darwin_error_str (kresult));
+ return darwin_to_libusb (kresult);
+ }
+
+ dpriv->device = darwin_device;
+
/* try to open the device */
kresult = (*(dpriv->device))->USBDeviceOpenSeize (dpriv->device);
- if (kresult != kIOReturnSuccess) {
- usbi_warn (HANDLE_CTX (dev_handle), "USBDeviceOpen: %s", darwin_error_str(kresult));
- if (kIOReturnExclusiveAccess != kresult) {
- return darwin_to_libusb (kresult);
+ if (kresult != kIOReturnSuccess) {
+ usbi_err (HANDLE_CTX (dev_handle), "USBDeviceOpen: %s", darwin_error_str(kresult));
+
+ switch (kresult) {
+ case kIOReturnExclusiveAccess:
+ /* it is possible to perform some actions on a device that is not open so do not return an error */
+ priv->is_open = 0;
+
+ break;
+ default:
+ (*(dpriv->device))->Release (dpriv->device);
+ dpriv->device = NULL;
+ return darwin_to_libusb (kresult);
}
-
- /* it is possible to perform some actions on a device that is not open so do not return an error */
- priv->is_open = 0;
} else {
- priv->is_open = 1;
- }
+ /* create async event source */
+ kresult = (*(dpriv->device))->CreateDeviceAsyncEventSource (dpriv->device, &priv->cfSource);
+ if (kresult != kIOReturnSuccess) {
+ usbi_err (HANDLE_CTX (dev_handle), "CreateDeviceAsyncEventSource: %s", darwin_error_str(kresult));
- /* create async event source */
- kresult = (*(dpriv->device))->CreateDeviceAsyncEventSource (dpriv->device, &priv->cfSource);
- if (kresult != kIOReturnSuccess) {
- usbi_err (HANDLE_CTX (dev_handle), "CreateDeviceAsyncEventSource: %s", darwin_error_str(kresult));
+ (*(dpriv->device))->USBDeviceClose (dpriv->device);
+ (*(dpriv->device))->Release (dpriv->device);
- if (priv->is_open) {
- (*(dpriv->device))->USBDeviceClose (dpriv->device);
+ dpriv->device = NULL;
+ return darwin_to_libusb (kresult);
}
- priv->is_open = 0;
-
- return darwin_to_libusb (kresult);
- }
+ priv->is_open = 1;
- CFRetain (libusb_darwin_acfl);
+ CFRetain (libusb_darwin_acfl);
- /* add the cfSource to the aync run loop */
- CFRunLoopAddSource(libusb_darwin_acfl, priv->cfSource, kCFRunLoopCommonModes);
+ /* add the cfSource to the aync run loop */
+ CFRunLoopAddSource(libusb_darwin_acfl, priv->cfSource, kCFRunLoopCommonModes);
+ }
}
/* device opened successfully */
@@ -972,14 +852,14 @@ static int darwin_open (struct libusb_device_handle *dev_handle) {
usbi_add_pollfd(HANDLE_CTX(dev_handle), priv->fds[0], POLLIN);
- usbi_dbg ("device open for access");
+ usbi_info (HANDLE_CTX (dev_handle), "device open for access");
return 0;
}
static void darwin_close (struct libusb_device_handle *dev_handle) {
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
IOReturn kresult;
int i;
@@ -997,23 +877,30 @@ static void darwin_close (struct libusb_device_handle *dev_handle) {
libusb_release_interface (dev_handle, i);
if (0 == dpriv->open_count) {
- /* delete the device's async event source */
- if (priv->cfSource) {
- CFRunLoopRemoveSource (libusb_darwin_acfl, priv->cfSource, kCFRunLoopDefaultMode);
- CFRelease (priv->cfSource);
- priv->cfSource = NULL;
- CFRelease (libusb_darwin_acfl);
- }
-
if (priv->is_open) {
+ /* delete the device's async event source */
+ if (priv->cfSource) {
+ CFRunLoopRemoveSource (libusb_darwin_acfl, priv->cfSource, kCFRunLoopDefaultMode);
+ CFRelease (priv->cfSource);
+ }
+
/* close the device */
kresult = (*(dpriv->device))->USBDeviceClose(dpriv->device);
if (kresult) {
- /* Log the fact that we had a problem closing the file, however failing a
- * close isn't really an error, so return success anyway */
- usbi_warn (HANDLE_CTX (dev_handle), "USBDeviceClose: %s", darwin_error_str(kresult));
+ /* Log the fact that we had a problem closing the file, however failing a
+ * close isn't really an error, so return success anyway */
+ usbi_err (HANDLE_CTX (dev_handle), "USBDeviceClose: %s", darwin_error_str(kresult));
}
}
+
+ kresult = (*(dpriv->device))->Release(dpriv->device);
+ if (kresult) {
+ /* Log the fact that we had a problem closing the file, however failing a
+ * close isn't really an error, so return success anyway */
+ usbi_err (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));
+ }
+
+ dpriv->device = NULL;
}
/* file descriptors are maintained per-instance */
@@ -1025,7 +912,7 @@ static void darwin_close (struct libusb_device_handle *dev_handle) {
}
static int darwin_get_configuration(struct libusb_device_handle *dev_handle, int *config) {
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
*config = (int) dpriv->active_config;
@@ -1033,7 +920,7 @@ static int darwin_get_configuration(struct libusb_device_handle *dev_handle, int
}
static int darwin_set_configuration(struct libusb_device_handle *dev_handle, int config) {
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
IOReturn kresult;
int i;
@@ -1059,10 +946,9 @@ static int darwin_set_configuration(struct libusb_device_handle *dev_handle, int
static int darwin_get_interface (usb_device_t **darwin_device, uint8_t ifc, io_service_t *usbInterfacep) {
IOUSBFindInterfaceRequest request;
+ uint8_t current_interface;
kern_return_t kresult;
io_iterator_t interface_iterator;
- UInt8 bInterfaceNumber;
- int ret;
*usbInterfacep = IO_OBJECT_NULL;
@@ -1076,16 +962,10 @@ static int darwin_get_interface (usb_device_t **darwin_device, uint8_t ifc, io_s
if (kresult)
return kresult;
- while ((*usbInterfacep = IOIteratorNext(interface_iterator))) {
- /* find the interface number */
- ret = get_ioregistry_value_number (*usbInterfacep, CFSTR("bInterfaceNumber"), kCFNumberSInt8Type,
- &bInterfaceNumber);
-
- if (ret && bInterfaceNumber == ifc) {
- break;
- }
-
- (void) IOObjectRelease (*usbInterfacep);
+ for ( current_interface = 0 ; current_interface <= ifc ; current_interface++ ) {
+ *usbInterfacep = IOIteratorNext(interface_iterator);
+ if (current_interface != ifc)
+ (void) IOObjectRelease (*usbInterfacep);
}
/* done with the interface iterator */
@@ -1107,7 +987,7 @@ static int get_endpoints (struct libusb_device_handle *dev_handle, int iface) {
u_int16_t dont_care2;
int i;
- usbi_dbg ("building table of endpoints.");
+ usbi_info (HANDLE_CTX (dev_handle), "building table of endpoints.");
/* retrieve the total number of endpoints on this interface */
kresult = (*(cInterface->interface))->GetNumEndpoints(cInterface->interface, &numep);
@@ -1119,7 +999,7 @@ static int get_endpoints (struct libusb_device_handle *dev_handle, int iface) {
/* iterate through pipe references */
for (i = 1 ; i <= numep ; i++) {
kresult = (*(cInterface->interface))->GetPipeProperties(cInterface->interface, i, &direction, &number, &dont_care1,
- &dont_care2, &dont_care3);
+ &dont_care2, &dont_care3);
if (kresult != kIOReturnSuccess) {
usbi_err (HANDLE_CTX (dev_handle), "error getting pipe information for pipe %d: %s", i, darwin_error_str(kresult));
@@ -1127,7 +1007,7 @@ static int get_endpoints (struct libusb_device_handle *dev_handle, int iface) {
return darwin_to_libusb (kresult);
}
- usbi_dbg ("interface: %i pipe %i: dir: %i number: %i", iface, i, direction, number);
+ usbi_info (HANDLE_CTX (dev_handle), "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));
}
@@ -1138,7 +1018,7 @@ static int get_endpoints (struct libusb_device_handle *dev_handle, int iface) {
}
static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int iface) {
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)dev_handle->os_priv;
io_service_t usbInterface = IO_OBJECT_NULL;
IOReturn kresult;
@@ -1177,7 +1057,7 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i
/* get an interface to the device's interface */
kresult = IOCreatePlugInInterfaceForService (usbInterface, kIOUSBInterfaceUserClientTypeID,
- kIOCFPlugInInterfaceID, &plugInInterface, &score);
+ kIOCFPlugInInterfaceID, &plugInInterface, &score);
/* ignore release error */
(void)IOObjectRelease (usbInterface);
@@ -1194,11 +1074,10 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i
/* Do the actual claim */
kresult = (*plugInInterface)->QueryInterface(plugInInterface,
- CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
- (LPVOID)&cInterface->interface);
+ CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
+ (LPVOID)&cInterface->interface);
/* We no longer need the intermediate plug-in */
- /* Use release instead of IODestroyPlugInInterface to avoid stopping IOServices associated with this device */
- (*plugInInterface)->Release (plugInInterface);
+ IODestroyPlugInInterface (plugInInterface);
if (kresult || !cInterface->interface) {
usbi_err (HANDLE_CTX (dev_handle), "QueryInterface: %s", darwin_error_str(kresult));
return darwin_to_libusb (kresult);
@@ -1236,7 +1115,7 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i
/* add the cfSource to the async thread's run loop */
CFRunLoopAddSource(libusb_darwin_acfl, cInterface->cfSource, kCFRunLoopDefaultMode);
- usbi_dbg ("interface opened");
+ usbi_info (HANDLE_CTX (dev_handle), "interface opened");
return 0;
}
@@ -1263,11 +1142,11 @@ static int darwin_release_interface(struct libusb_device_handle *dev_handle, int
kresult = (*(cInterface->interface))->USBInterfaceClose(cInterface->interface);
if (kresult)
- usbi_warn (HANDLE_CTX (dev_handle), "USBInterfaceClose: %s", darwin_error_str(kresult));
+ usbi_err (HANDLE_CTX (dev_handle), "USBInterfaceClose: %s", darwin_error_str(kresult));
kresult = (*(cInterface->interface))->Release(cInterface->interface);
if (kresult != kIOReturnSuccess)
- usbi_warn (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));
+ usbi_err (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));
cInterface->interface = IO_OBJECT_NULL;
@@ -1317,68 +1196,31 @@ static int darwin_clear_halt(struct libusb_device_handle *dev_handle, unsigned c
cInterface = &priv->interfaces[iface];
+#if (InterfaceVersion < 190)
+ kresult = (*(cInterface->interface))->ClearPipeStall(cInterface->interface, pipeRef);
+#else
/* newer versions of darwin support clearing additional bits on the device's endpoint */
kresult = (*(cInterface->interface))->ClearPipeStallBothEnds(cInterface->interface, pipeRef);
+#endif
if (kresult)
- usbi_warn (HANDLE_CTX (dev_handle), "ClearPipeStall: %s", darwin_error_str (kresult));
+ usbi_err (HANDLE_CTX (dev_handle), "ClearPipeStall: %s", darwin_error_str (kresult));
return darwin_to_libusb (kresult);
}
static int darwin_reset_device(struct libusb_device_handle *dev_handle) {
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
- IOUSBDeviceDescriptor descriptor;
- IOUSBConfigurationDescriptorPtr cached_configuration;
- IOUSBConfigurationDescriptor configuration;
- bool reenumerate = false;
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
IOReturn kresult;
- int i;
kresult = (*(dpriv->device))->ResetDevice (dpriv->device);
- if (kresult) {
+ if (kresult)
usbi_err (HANDLE_CTX (dev_handle), "ResetDevice: %s", darwin_error_str (kresult));
- return darwin_to_libusb (kresult);
- }
- do {
- usbi_dbg ("darwin/reset_device: checking if device descriptor changed");
-
- /* ignore return code. if we can't get a descriptor it might be worthwhile re-enumerating anway */
- (void) darwin_request_descriptor (dpriv->device, kUSBDeviceDesc, 0, &descriptor, sizeof (descriptor));
-
- /* check if the device descriptor has changed */
- if (0 != memcmp (&dpriv->dev_descriptor, &descriptor, sizeof (descriptor))) {
- reenumerate = true;
- break;
- }
-
- /* check if any configuration descriptor has changed */
- for (i = 0 ; i < descriptor.bNumConfigurations ; ++i) {
- usbi_dbg ("darwin/reset_device: checking if configuration descriptor %d changed", i);
-
- (void) darwin_request_descriptor (dpriv->device, kUSBConfDesc, i, &configuration, sizeof (configuration));
- (*(dpriv->device))->GetConfigurationDescriptorPtr (dpriv->device, i, &cached_configuration);
-
- if (!cached_configuration || 0 != memcmp (cached_configuration, &configuration, sizeof (configuration))) {
- reenumerate = true;
- break;
- }
- }
- } while (0);
-
- if (reenumerate) {
- usbi_dbg ("darwin/reset_device: device requires reenumeration");
- (void) (*(dpriv->device))->USBDeviceReEnumerate (dpriv->device, 0);
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- usbi_dbg ("darwin/reset_device: device reset complete");
-
- return LIBUSB_SUCCESS;
+ return darwin_to_libusb (kresult);
}
static int darwin_kernel_driver_active(struct libusb_device_handle *dev_handle, int interface) {
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)dev_handle->dev->os_priv;
io_service_t usbInterface;
CFTypeRef driver;
IOReturn kresult;
@@ -1417,15 +1259,7 @@ static int darwin_detach_kernel_driver (struct libusb_device_handle *dev_handle,
}
static void darwin_destroy_device(struct libusb_device *dev) {
- struct darwin_device_priv *dpriv = (struct darwin_device_priv *) dev->os_priv;
-
- if (dpriv->dev) {
- /* need to hold the lock in case this is the last reference to the device */
- usbi_mutex_lock(&darwin_cached_devices_lock);
- darwin_deref_cached_device (dpriv->dev);
- dpriv->dev = NULL;
- usbi_mutex_unlock(&darwin_cached_devices_lock);
- }
+ (void)dev;
}
static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
@@ -1434,12 +1268,15 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
IOReturn ret;
uint8_t transferType;
- /* None of the values below are used in libusbx for bulk transfers */
+ /* None of the values below are used in libusb for bulk transfers */
uint8_t direction, number, interval, pipeRef, iface;
uint16_t maxPacketSize;
struct darwin_interface *cInterface;
+ if (IS_XFEROUT(transfer) && transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET)
+ return LIBUSB_ERROR_NOT_SUPPORTED;
+
if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface) != 0) {
usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
@@ -1449,38 +1286,33 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
cInterface = &priv->interfaces[iface];
(*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
- &transferType, &maxPacketSize, &interval);
-
- if (0 != (transfer->length % maxPacketSize)) {
- /* do not need a zero packet */
- transfer->flags &= ~LIBUSB_TRANSFER_ADD_ZERO_PACKET;
- }
+ &transferType, &maxPacketSize, &interval);
/* submit the request */
/* timeouts are unavailable on interrupt endpoints */
if (transferType == kUSBInterrupt) {
if (IS_XFERIN(transfer))
ret = (*(cInterface->interface))->ReadPipeAsync(cInterface->interface, pipeRef, transfer->buffer,
- transfer->length, darwin_async_io_callback, itransfer);
+ transfer->length, darwin_async_io_callback, itransfer);
else
ret = (*(cInterface->interface))->WritePipeAsync(cInterface->interface, pipeRef, transfer->buffer,
- transfer->length, darwin_async_io_callback, itransfer);
+ transfer->length, darwin_async_io_callback, itransfer);
} else {
itransfer->flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
if (IS_XFERIN(transfer))
ret = (*(cInterface->interface))->ReadPipeAsyncTO(cInterface->interface, pipeRef, transfer->buffer,
- transfer->length, transfer->timeout, transfer->timeout,
- darwin_async_io_callback, (void *)itransfer);
+ transfer->length, transfer->timeout, transfer->timeout,
+ darwin_async_io_callback, (void *)itransfer);
else
ret = (*(cInterface->interface))->WritePipeAsyncTO(cInterface->interface, pipeRef, transfer->buffer,
- transfer->length, transfer->timeout, transfer->timeout,
- darwin_async_io_callback, (void *)itransfer);
+ transfer->length, transfer->timeout, transfer->timeout,
+ darwin_async_io_callback, (void *)itransfer);
}
if (ret)
usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
- darwin_error_str(ret), ret);
+ darwin_error_str(ret), ret);
return darwin_to_libusb (ret);
}
@@ -1490,12 +1322,11 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
- IOReturn kresult;
- uint8_t direction, number, interval, pipeRef, iface, transferType;
- uint16_t maxPacketSize;
- UInt64 frame;
- AbsoluteTime atTime;
- int i;
+ IOReturn kresult;
+ uint8_t pipeRef, iface;
+ UInt64 frame;
+ AbsoluteTime atTime;
+ int i;
struct darwin_interface *cInterface;
@@ -1512,7 +1343,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
return LIBUSB_ERROR_NO_MEM;
}
- /* copy the frame list from the libusbx descriptor (the structures differ only is member order) */
+ /* copy the frame list from the libusb descriptor (the structures differ only is member order) */
for (i = 0 ; i < transfer->num_iso_packets ; i++)
tpriv->isoc_framelist[i].frReqCount = transfer->iso_packet_desc[i].length;
@@ -1525,10 +1356,6 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
cInterface = &priv->interfaces[iface];
- /* determine the properties of this endpoint and the speed of the device */
- (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
- &transferType, &maxPacketSize, &interval);
-
/* Last but not least we need the bus frame number */
kresult = (*(cInterface->interface))->GetBusFrameNumber(cInterface->interface, &frame, &atTime);
if (kresult) {
@@ -1539,9 +1366,6 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
return darwin_to_libusb (kresult);
}
- (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
- &transferType, &maxPacketSize, &interval);
-
/* schedule for a frame a little in the future */
frame += 4;
@@ -1551,23 +1375,18 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
/* submit the request */
if (IS_XFERIN(transfer))
kresult = (*(cInterface->interface))->ReadIsochPipeAsync(cInterface->interface, pipeRef, transfer->buffer, frame,
- transfer->num_iso_packets, tpriv->isoc_framelist, darwin_async_io_callback,
- itransfer);
+ transfer->num_iso_packets, tpriv->isoc_framelist, darwin_async_io_callback,
+ itransfer);
else
kresult = (*(cInterface->interface))->WriteIsochPipeAsync(cInterface->interface, pipeRef, transfer->buffer, frame,
- transfer->num_iso_packets, tpriv->isoc_framelist, darwin_async_io_callback,
- itransfer);
+ transfer->num_iso_packets, tpriv->isoc_framelist, darwin_async_io_callback,
+ itransfer);
- if (LIBUSB_SPEED_FULL == transfer->dev_handle->dev->speed)
- /* Full speed */
- cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1));
- else
- /* High/super speed */
- cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)) / 8;
+ cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets / 8;
if (kresult != kIOReturnSuccess) {
usbi_err (TRANSFER_CTX (transfer), "isochronous transfer failed (dir: %s): %s", IS_XFERIN(transfer) ? "In" : "Out",
- darwin_error_str(kresult));
+ darwin_error_str(kresult));
free (tpriv->isoc_framelist);
tpriv->isoc_framelist = NULL;
}
@@ -1578,7 +1397,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
static int submit_control_transfer(struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_control_setup *setup = (struct libusb_control_setup *) transfer->buffer;
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
@@ -1593,7 +1412,7 @@ static int submit_control_transfer(struct usbi_transfer *itransfer) {
tpriv->req.wValue = OSSwapLittleToHostInt16 (setup->wValue);
tpriv->req.wIndex = OSSwapLittleToHostInt16 (setup->wIndex);
tpriv->req.wLength = OSSwapLittleToHostInt16 (setup->wLength);
- /* data is stored after the libusbx control block */
+ /* data is stored after the libusb control block */
tpriv->req.pData = transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
tpriv->req.completionTimeout = transfer->timeout;
tpriv->req.noDataTimeout = transfer->timeout;
@@ -1644,10 +1463,10 @@ static int darwin_submit_transfer(struct usbi_transfer *itransfer) {
static int cancel_control_transfer(struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
IOReturn kresult;
- usbi_warn (ITRANSFER_CTX (itransfer), "aborting all transactions control pipe");
+ usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions control pipe");
if (!dpriv->device)
return LIBUSB_ERROR_NO_DEVICE;
@@ -1659,7 +1478,7 @@ static int cancel_control_transfer(struct usbi_transfer *itransfer) {
static int darwin_abort_transfers (struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
+ struct darwin_device_priv *dpriv = (struct darwin_device_priv *)transfer->dev_handle->dev->os_priv;
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
struct darwin_interface *cInterface;
uint8_t pipeRef, iface;
@@ -1676,15 +1495,20 @@ static int darwin_abort_transfers (struct usbi_transfer *itransfer) {
if (!dpriv->device)
return LIBUSB_ERROR_NO_DEVICE;
- usbi_warn (ITRANSFER_CTX (itransfer), "aborting all transactions on interface %d pipe %d", iface, pipeRef);
+ usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions on interface %d pipe %d", iface, pipeRef);
/* abort transactions */
(*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
- usbi_dbg ("calling clear pipe stall to clear the data toggle bit");
+ usbi_info (ITRANSFER_CTX (itransfer), "calling clear pipe stall to clear the data toggle bit");
+ /* clear the data toggle bit */
+#if (InterfaceVersion < 190)
+ kresult = (*(cInterface->interface))->ClearPipeStall(cInterface->interface, pipeRef);
+#else
/* newer versions of darwin support clearing additional bits on the device's endpoint */
kresult = (*(cInterface->interface))->ClearPipeStallBothEnds(cInterface->interface, pipeRef);
+#endif
return darwin_to_libusb (kresult);
}
@@ -1719,24 +1543,18 @@ static void darwin_async_io_callback (void *refcon, IOReturn result, void *arg0)
struct usbi_transfer *itransfer = (struct usbi_transfer *)refcon;
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
- struct darwin_msg_async_io_complete message = {.itransfer = itransfer, .result = result,
- .size = (UInt32) (uintptr_t) arg0};
-
- usbi_dbg ("an async io operation has completed");
-
- /* if requested write a zero packet */
- if (kIOReturnSuccess == result && IS_XFEROUT(transfer) && transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) {
- struct darwin_interface *cInterface;
- uint8_t iface, pipeRef;
+ UInt32 message, size;
- (void) ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, &iface);
- cInterface = &priv->interfaces[iface];
+ usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has completed");
- (*(cInterface->interface))->WritePipe (cInterface->interface, pipeRef, transfer->buffer, 0);
- }
+ size = (UInt32) (uintptr_t) arg0;
/* send a completion message to the device's file descriptor */
+ message = MESSAGE_ASYNC_IO_COMPLETE;
write (priv->fds[1], &message, sizeof (message));
+ write (priv->fds[1], &itransfer, sizeof (itransfer));
+ write (priv->fds[1], &result, sizeof (IOReturn));
+ write (priv->fds[1], &size, sizeof (size));
}
static int darwin_transfer_status (struct usbi_transfer *itransfer, kern_return_t result) {
@@ -1750,17 +1568,17 @@ static int darwin_transfer_status (struct usbi_transfer *itransfer, kern_return_
case kIOReturnAborted:
return LIBUSB_TRANSFER_CANCELLED;
case kIOUSBPipeStalled:
- usbi_dbg ("transfer error: pipe is stalled");
+ usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: pipe is stalled");
return LIBUSB_TRANSFER_STALL;
case kIOReturnOverrun:
- usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: data overrun");
+ usbi_err (ITRANSFER_CTX (itransfer), "transfer error: data overrun");
return LIBUSB_TRANSFER_OVERFLOW;
case kIOUSBTransactionTimeout:
- usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: timed out");
+ usbi_err (ITRANSFER_CTX (itransfer), "transfer error: timed out");
itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
return LIBUSB_TRANSFER_TIMED_OUT;
default:
- usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: %s (value = 0x%08x)", darwin_error_str (result), result);
+ usbi_err (ITRANSFER_CTX (itransfer), "transfer error: %s (value = 0x%08x)", darwin_error_str (result), result);
return LIBUSB_TRANSFER_ERROR;
}
}
@@ -1779,17 +1597,17 @@ static void darwin_handle_callback (struct usbi_transfer *itransfer, kern_return
return;
}
- usbi_dbg ("handling %s completion with kernel status %d",
- isControl ? "control" : isBulk ? "bulk" : isIsoc ? "isoc" : "interrupt", result);
+ usbi_info (ITRANSFER_CTX (itransfer), "handling %s completion with kernel status %d",
+ isControl ? "control" : isBulk ? "bulk" : isIsoc ? "isoc" : "interrupt", result);
if (kIOReturnSuccess == result || kIOReturnUnderrun == result) {
if (isIsoc && tpriv->isoc_framelist) {
/* copy isochronous results back */
for (i = 0; i < transfer->num_iso_packets ; i++) {
- struct libusb_iso_packet_descriptor *lib_desc = &transfer->iso_packet_desc[i];
- lib_desc->status = darwin_to_libusb (tpriv->isoc_framelist[i].frStatus);
- lib_desc->actual_length = tpriv->isoc_framelist[i].frActCount;
+ struct libusb_iso_packet_descriptor *lib_desc = &transfer->iso_packet_desc[i];
+ lib_desc->status = darwin_to_libusb (tpriv->isoc_framelist[i].frStatus);
+ lib_desc->actual_length = tpriv->isoc_framelist[i].frActCount;
}
} else if (!isIsoc)
itransfer->transferred += io_size;
@@ -1800,35 +1618,64 @@ static void darwin_handle_callback (struct usbi_transfer *itransfer, kern_return
}
static int op_handle_events(struct libusb_context *ctx, struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready) {
- struct darwin_msg_async_io_complete message;
+ struct usbi_transfer *itransfer;
+ UInt32 io_size;
+ IOReturn kresult;
POLL_NFDS_TYPE i = 0;
ssize_t ret;
+ UInt32 message;
usbi_mutex_lock(&ctx->open_devs_lock);
-
for (i = 0; i < nfds && num_ready > 0; i++) {
struct pollfd *pollfd = &fds[i];
+ struct libusb_device_handle *handle;
+ struct darwin_device_handle_priv *hpriv = NULL;
- usbi_dbg ("checking fd %i with revents = %x", pollfd->fd, pollfd->revents);
+ usbi_info (ctx, "checking fd %i with revents = %x", fds[i], pollfd->revents);
if (!pollfd->revents)
continue;
num_ready--;
-
- if (pollfd->revents & POLLERR) {
- /* this probably will never happen so ignore the error an move on. */
- continue;
+ list_for_each_entry(handle, &ctx->open_devs, list, struct libusb_device_handle) {
+ hpriv = (struct darwin_device_handle_priv *)handle->os_priv;
+ if (hpriv->fds[0] == pollfd->fd)
+ break;
}
- /* there is only one type of message */
- ret = read (pollfd->fd, &message, sizeof (message));
- if (ret < (ssize_t) sizeof (message)) {
- usbi_dbg ("WARNING: short read on async io completion pipe\n");
+ if (!(pollfd->revents & POLLERR)) {
+ ret = read (hpriv->fds[0], &message, sizeof (message));
+ if (ret < (ssize_t)sizeof (message))
+ continue;
+ } else
+ /* could not poll the device-- response is to delete the device (this seems a little heavy-handed) */
+ message = MESSAGE_DEVICE_GONE;
+
+ switch (message) {
+ case MESSAGE_DEVICE_GONE:
+ /* remove the device's async port from the runloop */
+ if (hpriv->cfSource) {
+ if (libusb_darwin_acfl)
+ CFRunLoopRemoveSource (libusb_darwin_acfl, hpriv->cfSource, kCFRunLoopDefaultMode);
+ CFRelease (hpriv->cfSource);
+ hpriv->cfSource = NULL;
+ }
+
+ usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fds[0]);
+ usbi_handle_disconnect(handle);
+
+ /* done with this device */
continue;
- }
+ case MESSAGE_ASYNC_IO_COMPLETE:
+ read (hpriv->fds[0], &itransfer, sizeof (itransfer));
+ read (hpriv->fds[0], &kresult, sizeof (IOReturn));
+ read (hpriv->fds[0], &io_size, sizeof (UInt32));
- darwin_handle_callback (message.itransfer, message.result, message.size);
+ darwin_handle_callback (itransfer, kresult, io_size);
+ break;
+ default:
+ usbi_err (ctx, "unknown message received from device pipe");
+ }
}
usbi_mutex_unlock(&ctx->open_devs_lock);
@@ -1862,42 +1709,42 @@ static int darwin_clock_gettime(int clk_id, struct timespec *tp) {
}
const struct usbi_os_backend darwin_backend = {
- .name = "Darwin",
- .caps = 0,
- .init = darwin_init,
- .exit = darwin_exit,
- .get_device_list = NULL, /* not needed */
- .get_device_descriptor = darwin_get_device_descriptor,
- .get_active_config_descriptor = darwin_get_active_config_descriptor,
- .get_config_descriptor = darwin_get_config_descriptor,
-
- .open = darwin_open,
- .close = darwin_close,
- .get_configuration = darwin_get_configuration,
- .set_configuration = darwin_set_configuration,
- .claim_interface = darwin_claim_interface,
- .release_interface = darwin_release_interface,
-
- .set_interface_altsetting = darwin_set_interface_altsetting,
- .clear_halt = darwin_clear_halt,
- .reset_device = darwin_reset_device,
-
- .kernel_driver_active = darwin_kernel_driver_active,
- .detach_kernel_driver = darwin_detach_kernel_driver,
- .attach_kernel_driver = darwin_attach_kernel_driver,
-
- .destroy_device = darwin_destroy_device,
-
- .submit_transfer = darwin_submit_transfer,
- .cancel_transfer = darwin_cancel_transfer,
- .clear_transfer_priv = darwin_clear_transfer_priv,
-
- .handle_events = op_handle_events,
-
- .clock_gettime = darwin_clock_gettime,
-
- .device_priv_size = sizeof(struct darwin_device_priv),
- .device_handle_priv_size = sizeof(struct darwin_device_handle_priv),
- .transfer_priv_size = sizeof(struct darwin_transfer_priv),
- .add_iso_packet_size = 0,
+ .name = "Darwin",
+ .init = darwin_init,
+ .exit = darwin_exit,
+ .get_device_list = darwin_get_device_list,
+ .get_device_descriptor = darwin_get_device_descriptor,
+ .get_active_config_descriptor = darwin_get_active_config_descriptor,
+ .get_config_descriptor = darwin_get_config_descriptor,
+
+ .open = darwin_open,
+ .close = darwin_close,
+ .get_configuration = darwin_get_configuration,
+ .set_configuration = darwin_set_configuration,
+ .claim_interface = darwin_claim_interface,
+ .release_interface = darwin_release_interface,
+
+ .set_interface_altsetting = darwin_set_interface_altsetting,
+ .clear_halt = darwin_clear_halt,
+ .reset_device = darwin_reset_device,
+
+ .kernel_driver_active = darwin_kernel_driver_active,
+ .detach_kernel_driver = darwin_detach_kernel_driver,
+ .attach_kernel_driver = darwin_attach_kernel_driver,
+
+ .destroy_device = darwin_destroy_device,
+
+ .submit_transfer = darwin_submit_transfer,
+ .cancel_transfer = darwin_cancel_transfer,
+ .clear_transfer_priv = darwin_clear_transfer_priv,
+
+ .handle_events = op_handle_events,
+
+ .clock_gettime = darwin_clock_gettime,
+
+ .device_priv_size = sizeof(struct darwin_device_priv),
+ .device_handle_priv_size = sizeof(struct darwin_device_handle_priv),
+ .transfer_priv_size = sizeof(struct darwin_transfer_priv),
+ .add_iso_packet_size = 0,
};
+
diff --git a/third_party/libusb/src/libusb/os/darwin_usb.h b/third_party/libusb/src/libusb/os/darwin_usb.h
index 53b8542..59d0a69 100644
--- a/third_party/libusb/src/libusb/os/darwin_usb.h
+++ b/third_party/libusb/src/libusb/os/darwin_usb.h
@@ -1,6 +1,6 @@
/*
- * darwin backend for libusbx 1.0
- * Copyright © 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
+ * darwin backend for libusb 1.0
+ * Copyright (C) 2008-2009 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
@@ -28,19 +28,7 @@
#include <IOKit/IOCFPlugIn.h>
/* IOUSBInterfaceInferface */
-#if defined (kIOUSBInterfaceInterfaceID550)
-
-#define usb_interface_t IOUSBInterfaceInterface550
-#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID550
-#define InterfaceVersion 550
-
-#elif defined (kIOUSBInterfaceInterfaceID500)
-
-#define usb_interface_t IOUSBInterfaceInterface500
-#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID500
-#define InterfaceVersion 500
-
-#elif defined (kIOUSBInterfaceInterfaceID300)
+#if defined (kIOUSBInterfaceInterfaceID300)
#define usb_interface_t IOUSBInterfaceInterface300
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID300
@@ -58,6 +46,24 @@
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220
#define InterfaceVersion 220
+#elif defined (kIOUSBInterfaceInterfaceID197)
+
+#define usb_interface_t IOUSBInterfaceInterface197
+#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID197
+#define InterfaceVersion 197
+
+#elif defined (kIOUSBInterfaceInterfaceID190)
+
+#define usb_interface_t IOUSBInterfaceInterface190
+#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID190
+#define InterfaceVersion 190
+
+#elif defined (kIOUSBInterfaceInterfaceID182)
+
+#define usb_interface_t IOUSBInterfaceInterface182
+#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID182
+#define InterfaceVersion 182
+
#else
#error "IOUSBFamily is too old. Please upgrade your OS"
@@ -65,13 +71,7 @@
#endif
/* IOUSBDeviceInterface */
-#if defined (kIOUSBDeviceInterfaceID500)
-
-#define usb_device_t IOUSBDeviceInterface500
-#define DeviceInterfaceID kIOUSBDeviceInterfaceID500
-#define DeviceVersion 500
-
-#elif defined (kIOUSBDeviceInterfaceID320)
+#if defined (kIOUSBDeviceInterfaceID320)
#define usb_device_t IOUSBDeviceInterface320
#define DeviceInterfaceID kIOUSBDeviceInterfaceID320
@@ -89,11 +89,24 @@
#define DeviceInterfaceID kIOUSBDeviceInterfaceID245
#define DeviceVersion 245
-#elif defined (kIOUSBDeviceInterfaceID220)
+#elif defined (kIOUSBDeviceInterfaceID197)
+
#define usb_device_t IOUSBDeviceInterface197
#define DeviceInterfaceID kIOUSBDeviceInterfaceID197
#define DeviceVersion 197
+#elif defined (kIOUSBDeviceInterfaceID187)
+
+#define usb_device_t IOUSBDeviceInterface187
+#define DeviceInterfaceID kIOUSBDeviceInterfaceID187
+#define DeviceVersion 187
+
+#elif defined (kIOUSBDeviceInterfaceID182)
+
+#define usb_device_t IOUSBDeviceInterface182
+#define DeviceInterfaceID kIOUSBDeviceInterfaceID182
+#define DeviceVersion 182
+
#else
#error "IOUSBFamily is too old. Please upgrade your OS"
@@ -108,23 +121,13 @@ typedef IOCFPlugInInterface *io_cf_plugin_ref_t;
typedef IONotificationPortRef io_notification_port_t;
/* private structures */
-struct darwin_cached_device {
- struct list_head list;
+struct darwin_device_priv {
IOUSBDeviceDescriptor dev_descriptor;
UInt32 location;
- UInt64 parent_session;
- UInt64 session;
- UInt16 address;
char sys_path[21];
usb_device_t **device;
int open_count;
- UInt8 first_config, active_config, port;
- int can_enumerate;
- int refcount;
-};
-
-struct darwin_device_priv {
- struct darwin_cached_device *dev;
+ UInt8 first_config, active_config;
};
struct darwin_device_handle_priv {
@@ -144,19 +147,23 @@ struct darwin_device_handle_priv {
struct darwin_transfer_priv {
/* Isoc */
IOUSBIsocFrame *isoc_framelist;
- int num_iso_packets;
+ size_t num_iso_packets;
/* Control */
+#if !defined (LIBUSB_NO_TIMEOUT_DEVICE)
IOUSBDevRequestTO req;
+#else
+ IOUSBDevRequest req;
+#endif
/* Bulk */
};
-/* structure for signaling io completion */
-struct darwin_msg_async_io_complete {
- struct usbi_transfer *itransfer;
- IOReturn result;
- UInt32 size;
+enum {
+ MESSAGE_DEVICE_GONE,
+ MESSAGE_ASYNC_IO_COMPLETE
};
+
+
#endif
diff --git a/third_party/libusb/src/libusb/os/linux_netlink.c b/third_party/libusb/src/libusb/os/linux_netlink.c
deleted file mode 100644
index 3a68f69..0000000
--- a/third_party/libusb/src/libusb/os/linux_netlink.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C; c-basic-offset:8 ; indent-tabs-mode:t -*- */
-/*
- * Linux usbfs backend for libusb
- * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
- * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
- * Copyright (c) 2013 Nathan Hjelm <hjelmn@mac.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
- */
-
-#include "config.h"
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-
-#include "libusb.h"
-#include "libusbi.h"
-#include "linux_usbfs.h"
-
-#include <linux/netlink.h>
-#include <linux/filter.h>
-
-#define KERNEL 1
-
-static int linux_netlink_socket = -1;
-static pthread_t libusb_linux_event_thread;
-
-static void *linux_netlink_event_thread_main(void *arg);
-
-struct sockaddr_nl snl = { .nl_family=AF_NETLINK, .nl_groups=KERNEL };
-
-int linux_netlink_start_event_monitor(void)
-{
- int ret;
-
- snl.nl_groups = KERNEL;
-
- linux_netlink_socket = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
- if (-1 == linux_netlink_socket) {
- return LIBUSB_ERROR_OTHER;
- }
-
- ret = bind(linux_netlink_socket, (struct sockaddr *) &snl, sizeof(snl));
- if (0 != ret) {
- return LIBUSB_ERROR_OTHER;
- }
-
- /* TODO -- add authentication */
- /* setsockopt(linux_netlink_socket, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); */
-
- ret = pthread_create(&libusb_linux_event_thread, NULL, linux_netlink_event_thread_main, NULL);
- if (0 != ret) {
- return LIBUSB_ERROR_OTHER;
- }
-
- return LIBUSB_SUCCESS;
-}
-
-int linux_netlink_stop_event_monitor(void)
-{
- int r;
-
- if (-1 == linux_netlink_socket) {
- /* already closed. nothing to do */
- return LIBUSB_SUCCESS;
- }
-
- r = close(linux_netlink_socket);
- if (0 > r) {
- usbi_err(NULL, "error closing netlink socket. %s", strerror(errno));
- return LIBUSB_ERROR_OTHER;
- }
-
- pthread_cancel(libusb_linux_event_thread);
-
- linux_netlink_socket = -1;
-
- return LIBUSB_SUCCESS;
-}
-
-static const char *netlink_message_parse (const char *buffer, size_t len, const char *key)
-{
- size_t keylen = strlen(key);
- size_t offset;
-
- for (offset = 0 ; offset < len && '\0' != buffer[offset] ; offset += strlen(buffer + offset) + 1) {
- if (0 == strncmp(buffer + offset, key, keylen) &&
- '=' == buffer[offset + keylen]) {
- return buffer + offset + keylen + 1;
- }
- }
-
- return NULL;
-}
-
-/* parse parts of netlink message common to both libudev and the kernel */
-static int linux_netlink_parse(char *buffer, size_t len, int *detached, const char **sys_name,
- uint8_t *busnum, uint8_t *devaddr) {
- const char *tmp;
- int i;
-
- errno = 0;
-
- *sys_name = NULL;
- *detached = 0;
- *busnum = 0;
- *devaddr = 0;
-
- tmp = netlink_message_parse((const char *) buffer, len, "ACTION");
- if (tmp == NULL)
- return -1;
- if (0 == strcmp(tmp, "remove")) {
- *detached = 1;
- } else if (0 != strcmp(tmp, "add")) {
- usbi_dbg("unknown device action %s", tmp);
- return -1;
- }
-
- /* check that this is a usb message */
- tmp = netlink_message_parse(buffer, len, "SUBSYSTEM");
- if (NULL == tmp || 0 != strcmp(tmp, "usb")) {
- /* not usb. ignore */
- return -1;
- }
-
- tmp = netlink_message_parse(buffer, len, "BUSNUM");
- if (NULL == tmp) {
- /* no bus number (likely a usb interface). ignore*/
- return -1;
- }
-
- *busnum = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
- if (errno) {
- errno = 0;
- return -1;
- }
-
- tmp = netlink_message_parse(buffer, len, "DEVNUM");
- if (NULL == tmp) {
- return -1;
- }
-
- *devaddr = (uint8_t)(strtoul(tmp, NULL, 10) & 0xff);
- if (errno) {
- errno = 0;
- return -1;
- }
-
- tmp = netlink_message_parse(buffer, len, "DEVPATH");
- if (NULL == tmp) {
- return -1;
- }
-
- for (i = strlen(tmp) - 1 ; i ; --i) {
- if ('/' ==tmp[i]) {
- *sys_name = tmp + i + 1;
- break;
- }
- }
-
- /* found a usb device */
- return 0;
-}
-
-static int linux_netlink_read_message(void)
-{
- unsigned char buffer[1024];
- struct iovec iov = {.iov_base = buffer, .iov_len = sizeof(buffer)};
- struct msghdr meh = { .msg_iov=&iov, .msg_iovlen=1,
- .msg_name=&snl, .msg_namelen=sizeof(snl) };
- const char *sys_name = NULL;
- uint8_t busnum, devaddr;
- int detached, r;
- size_t len;
-
- /* read netlink message */
- memset(buffer, 0, sizeof(buffer));
- len = recvmsg(linux_netlink_socket, &meh, 0);
- if (len < 32) {
- if (errno != EAGAIN)
- usbi_dbg("error recieving message from netlink");
- return -1;
- }
-
- /* TODO -- authenticate this message is from the kernel or udevd */
-
- r = linux_netlink_parse(buffer, len, &detached, &sys_name,
- &busnum, &devaddr);
- if (r)
- return r;
-
- usbi_dbg("netlink hotplug found device busnum: %hhu, devaddr: %hhu, sys_name: %s, removed: %s",
- busnum, devaddr, sys_name, detached ? "yes" : "no");
-
- /* signal device is available (or not) to all contexts */
- if (detached)
- linux_hotplug_disconnected(busnum, devaddr, sys_name);
- else
- linux_hotplug_enumerate(busnum, devaddr, sys_name);
-
- return 0;
-}
-
-static void *linux_netlink_event_thread_main(void *arg)
-{
- struct pollfd fds = {.fd = linux_netlink_socket,
- .events = POLLIN};
-
- /* silence compiler warning */
- (void) arg;
-
- while (1 == poll(&fds, 1, -1)) {
- if (POLLIN != fds.revents) {
- break;
- }
-
- usbi_mutex_static_lock(&linux_hotplug_lock);
- linux_netlink_read_message();
- usbi_mutex_static_unlock(&linux_hotplug_lock);
- }
-
- return NULL;
-}
-
-void linux_netlink_hotplug_poll(void)
-{
- int r;
-
- usbi_mutex_static_lock(&linux_hotplug_lock);
- do {
- r = linux_netlink_read_message();
- } while (r == 0);
- usbi_mutex_static_unlock(&linux_hotplug_lock);
-}
diff --git a/third_party/libusb/src/libusb/os/linux_udev.c b/third_party/libusb/src/libusb/os/linux_udev.c
deleted file mode 100644
index 5a2aadf..0000000
--- a/third_party/libusb/src/libusb/os/linux_udev.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* -*- Mode: C; c-basic-offset:8 ; indent-tabs-mode:t -*- */
-/*
- * Linux usbfs backend for libusb
- * Copyright (C) 2007-2009 Daniel Drake <dsd@gentoo.org>
- * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com>
- * Copyright (c) 2012-2013 Nathan Hjelm <hjelmn@mac.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
- */
-
-#include "config.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <libudev.h>
-
-#include "libusb.h"
-#include "libusbi.h"
-#include "linux_usbfs.h"
-
-/* udev context */
-static struct udev *udev_ctx = NULL;
-static int udev_monitor_fd = -1;
-static struct udev_monitor *udev_monitor = NULL;
-static pthread_t linux_event_thread;
-
-static void udev_hotplug_event(struct udev_device* udev_dev);
-static void *linux_udev_event_thread_main(void *arg);
-
-int linux_udev_start_event_monitor(void)
-{
- int r;
-
- assert(udev_ctx == NULL);
- udev_ctx = udev_new();
- if (!udev_ctx) {
- usbi_err(NULL, "could not create udev context");
- return LIBUSB_ERROR_OTHER;
- }
-
- udev_monitor = udev_monitor_new_from_netlink(udev_ctx, "udev");
- if (!udev_monitor) {
- usbi_err(NULL, "could not initialize udev monitor");
- goto err_free_ctx;
- }
-
- r = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", 0);
- if (r) {
- usbi_err(NULL, "could not initialize udev monitor filter for \"usb\" subsystem");
- goto err_free_monitor;
- }
-
- if (udev_monitor_enable_receiving(udev_monitor)) {
- usbi_err(NULL, "failed to enable the udev monitor");
- goto err_free_monitor;
- }
-
- udev_monitor_fd = udev_monitor_get_fd(udev_monitor);
-
- /* Some older versions of udev are not non-blocking by default,
- * so make sure this is set */
- r = fcntl(udev_monitor_fd, F_GETFL);
- if (r == -1) {
- usbi_err(NULL, "getting udev monitor fd flags (%d)", errno);
- goto err_free_monitor;
- }
- r = fcntl(udev_monitor_fd, F_SETFL, r | O_NONBLOCK);
- if (r) {
- usbi_err(NULL, "setting udev monitor fd flags (%d)", errno);
- goto err_free_monitor;
- }
-
- r = pthread_create(&linux_event_thread, NULL, linux_udev_event_thread_main, NULL);
- if (r) {
- usbi_err(NULL, "creating hotplug event thread (%d)", r);
- goto err_free_monitor;
- }
-
- return LIBUSB_SUCCESS;
-
-err_free_monitor:
- udev_monitor_unref(udev_monitor);
- udev_monitor = NULL;
- udev_monitor_fd = -1;
-err_free_ctx:
- udev_unref(udev_ctx);
- udev_ctx = NULL;
- return LIBUSB_ERROR_OTHER;
-}
-
-int linux_udev_stop_event_monitor(void)
-{
- assert(udev_ctx != NULL);
- assert(udev_monitor != NULL);
- assert(udev_monitor_fd != -1);
-
- /* Cancel the event thread. This is the only way to guarantee the
- thread exits since closing the monitor fd won't necessarily cause
- poll to return. */
- pthread_cancel(linux_event_thread);
- pthread_join(linux_event_thread, NULL);
-
- /* Release the udev monitor */
- udev_monitor_unref(udev_monitor);
- udev_monitor = NULL;
- udev_monitor_fd = -1;
-
- /* Clean up the udev context */
- udev_unref(udev_ctx);
- udev_ctx = NULL;
-
- return LIBUSB_SUCCESS;
-}
-
-static void *linux_udev_event_thread_main(void *arg)
-{
- struct udev_device* udev_dev;
- struct pollfd fds = {.fd = udev_monitor_fd,
- .events = POLLIN};
-
- usbi_dbg("udev event thread entering.");
-
- while (1 == poll(&fds, 1, -1)) {
- if (NULL == udev_monitor || POLLIN != fds.revents) {
- break;
- }
-
- usbi_mutex_static_lock(&linux_hotplug_lock);
- udev_dev = udev_monitor_receive_device(udev_monitor);
- if (udev_dev)
- udev_hotplug_event(udev_dev);
- usbi_mutex_static_unlock(&linux_hotplug_lock);
- }
-
- usbi_dbg("udev event thread exiting");
-
- return NULL;
-}
-
-static int udev_device_info(struct libusb_context *ctx, int detached,
- struct udev_device *udev_dev, uint8_t *busnum,
- uint8_t *devaddr, const char **sys_name) {
- const char *dev_node;
-
- dev_node = udev_device_get_devnode(udev_dev);
- if (!dev_node) {
- return LIBUSB_ERROR_OTHER;
- }
-
- *sys_name = udev_device_get_sysname(udev_dev);
- if (!*sys_name) {
- return LIBUSB_ERROR_OTHER;
- }
-
- return linux_get_device_address(ctx, detached, busnum, devaddr,
- dev_node, *sys_name);
-}
-
-static void udev_hotplug_event(struct udev_device* udev_dev)
-{
- const char* udev_action;
- const char* sys_name = NULL;
- uint8_t busnum = 0, devaddr = 0;
- int detached;
- int r;
-
- do {
- udev_action = udev_device_get_action(udev_dev);
- if (!udev_action) {
- break;
- }
-
- detached = !strncmp(udev_action, "remove", 6);
-
- r = udev_device_info(NULL, detached, udev_dev, &busnum, &devaddr, &sys_name);
- if (LIBUSB_SUCCESS != r) {
- break;
- }
-
- usbi_dbg("udev hotplug event. action: %s.", udev_action);
-
- if (strncmp(udev_action, "add", 3) == 0) {
- linux_hotplug_enumerate(busnum, devaddr, sys_name);
- } else if (detached) {
- linux_hotplug_disconnected(busnum, devaddr, sys_name);
- } else {
- usbi_err(NULL, "ignoring udev action %s", udev_action);
- }
- } while (0);
-
- udev_device_unref(udev_dev);
-}
-
-int linux_udev_scan_devices(struct libusb_context *ctx)
-{
- struct udev_enumerate *enumerator;
- struct udev_list_entry *devices, *entry;
- struct udev_device *udev_dev;
- const char *sys_name;
- int r;
-
- assert(udev_ctx != NULL);
-
- enumerator = udev_enumerate_new(udev_ctx);
- if (NULL == enumerator) {
- usbi_err(ctx, "error creating udev enumerator");
- return LIBUSB_ERROR_OTHER;
- }
-
- udev_enumerate_add_match_subsystem(enumerator, "usb");
- udev_enumerate_scan_devices(enumerator);
- devices = udev_enumerate_get_list_entry(enumerator);
-
- udev_list_entry_foreach(entry, devices) {
- const char *path = udev_list_entry_get_name(entry);
- uint8_t busnum = 0, devaddr = 0;
-
- udev_dev = udev_device_new_from_syspath(udev_ctx, path);
-
- r = udev_device_info(ctx, 0, udev_dev, &busnum, &devaddr, &sys_name);
- if (r) {
- udev_device_unref(udev_dev);
- continue;
- }
-
- linux_enumerate_device(ctx, busnum, devaddr, sys_name);
- udev_device_unref(udev_dev);
- }
-
- udev_enumerate_unref(enumerator);
-
- return LIBUSB_SUCCESS;
-}
-
-void linux_udev_hotplug_poll(void)
-{
- struct udev_device* udev_dev;
-
- usbi_mutex_static_lock(&linux_hotplug_lock);
- do {
- udev_dev = udev_monitor_receive_device(udev_monitor);
- if (udev_dev) {
- usbi_dbg("Handling hotplug event from hotplug_poll");
- udev_hotplug_event(udev_dev);
- }
- } while (udev_dev);
- usbi_mutex_static_unlock(&linux_hotplug_lock);
-}
diff --git a/third_party/libusb/src/libusb/os/linux_usbfs.c b/third_party/libusb/src/libusb/os/linux_usbfs.c
index 09288af..02d182d 100644
--- a/third_party/libusb/src/libusb/os/linux_usbfs.c
+++ b/third_party/libusb/src/libusb/os/linux_usbfs.c
@@ -1,9 +1,7 @@
/*
- * Linux usbfs backend for libusbx
- * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
- * Copyright © 2013 Nathan Hjelm <hjelmn@mac.com>
- * Copyright © 2012-2013 Hans de Goede <hdegoede@redhat.com>
+ * Linux usbfs backend 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
@@ -20,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "config.h"
-
-#include <assert.h>
+#include <config.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -47,23 +43,23 @@
*
* sysfs allows us to read the kernel's in-memory copies of device descriptors
* and so forth, avoiding the need to open the device:
- * - The binary "descriptors" file contains all config descriptors since
- * 2.6.26, commit 217a9081d8e69026186067711131b77f0ce219ed
- * - The binary "descriptors" file was added in 2.6.23, commit
- * 69d42a78f935d19384d1f6e4f94b65bb162b36df, but it only contains the
- * active config descriptors
- * - The "busnum" file was added in 2.6.22, commit
- * 83f7d958eab2fbc6b159ee92bf1493924e1d0f72
+ * - The binary "descriptors" file was added in 2.6.23.
+ * - The "busnum" file was added in 2.6.22
* - The "devnum" file has been present since pre-2.6.18
* - the "bConfigurationValue" file has been present since pre-2.6.18
*
* If we have bConfigurationValue, busnum, and devnum, then we can determine
* the active configuration without having to open the usbfs node in RDWR mode.
+ * We assume this is the case if we see the busnum file (indicates 2.6.22+).
* The busnum file is important as that is the only way we can relate sysfs
* devices to usbfs nodes.
*
- * If we also have all descriptors, we can obtain the device descriptor and
+ * If we also have descriptors, we can obtain the device descriptor and active
* configuration without touching usbfs at all.
+ *
+ * The descriptors file originally only contained the active configuration
+ * descriptor alongside the device descriptor, but all configurations are
+ * included as of Linux 2.6.26.
*/
/* endianness for multi-byte fields:
@@ -71,8 +67,6 @@
* Descriptors exposed by usbfs have the multi-byte fields in the device
* descriptor as host endian. Multi-byte fields in the other descriptors are
* bus-endian. The kernel documentation says otherwise, but it is wrong.
- *
- * In sysfs all descriptors are bus-endian.
*/
static const char *usbfs_path = NULL;
@@ -107,42 +101,21 @@ static int supports_flag_zero_packet = -1;
* systems. appropriate choice made at initialization time. */
static clockid_t monotonic_clkid = -1;
-/* Linux 2.6.22 (commit 83f7d958eab2fbc6b159ee92bf1493924e1d0f72) adds a busnum
- * to sysfs, so we can relate devices. This also implies that we can read
+/* do we have a busnum to relate devices? this also implies that we can read
* the active configuration through bConfigurationValue */
-static int sysfs_can_relate_devices = -1;
-
-/* Linux 2.6.26 (commit 217a9081d8e69026186067711131b77f0ce219ed) adds all
- * config descriptors (rather then just the active config) to the sysfs
- * descriptors file, so from then on we can use them. */
-static int sysfs_has_descriptors = -1;
-
-/* how many times have we initted (and not exited) ? */
-static volatile int init_count = 0;
-
-/* Serialize hotplug start/stop, scan-devices, event-thread, and poll */
-usbi_mutex_static_t linux_hotplug_lock = USBI_MUTEX_INITIALIZER;
+static int sysfs_can_relate_devices = 0;
-static int linux_start_event_monitor(void);
-static int linux_stop_event_monitor(void);
-static int linux_scan_devices(struct libusb_context *ctx);
-static int sysfs_scan_device(struct libusb_context *ctx, const char *devname);
-static int detach_kernel_driver_and_claim(struct libusb_device_handle *, int);
-
-#if !defined(USE_UDEV)
-static int linux_default_scan_devices (struct libusb_context *ctx);
-#endif
+/* do we have a descriptors file? */
+static int sysfs_has_descriptors = 0;
struct linux_device_priv {
char *sysfs_dir;
- unsigned char *descriptors;
- int descriptors_len;
- int active_config; /* cache val for !sysfs_can_relate_devices */
+ unsigned char *dev_descriptor;
+ unsigned char *config_descriptor;
};
struct linux_device_handle_priv {
int fd;
- uint32_t caps;
};
enum reap_action {
@@ -169,43 +142,21 @@ struct linux_transfer_priv {
enum reap_action reap_action;
int num_urbs;
- int num_retired;
+ unsigned int num_retired;
enum libusb_transfer_status reap_status;
/* next iso packet in user-supplied transfer to be populated */
int iso_packet_offset;
};
-static int _get_usbfs_fd(struct libusb_device *dev, mode_t mode, int silent)
+static void _get_usbfs_path(struct libusb_device *dev, char *path)
{
- struct libusb_context *ctx = DEVICE_CTX(dev);
- char path[PATH_MAX];
- int fd;
-
if (usbdev_names)
snprintf(path, PATH_MAX, "%s/usbdev%d.%d",
usbfs_path, dev->bus_number, dev->device_address);
else
snprintf(path, PATH_MAX, "%s/%03d/%03d",
usbfs_path, dev->bus_number, dev->device_address);
-
- fd = open(path, mode);
- if (fd != -1)
- return fd; /* Success */
-
- if (!silent) {
- usbi_err(ctx, "libusbx couldn't open USB device %s: %s",
- path, strerror(errno));
- if (errno == EACCES && mode == O_RDWR)
- usbi_err(ctx, "libusbx requires write access to USB "
- "device nodes.");
- }
-
- if (errno == EACCES)
- return LIBUSB_ERROR_ACCESS;
- if (errno == ENOENT)
- return LIBUSB_ERROR_NO_DEVICE;
- return LIBUSB_ERROR_IO;
}
static struct linux_device_priv *_device_priv(struct libusb_device *dev)
@@ -348,6 +299,22 @@ static int kernel_version_ge(int major, int minor, int sublevel)
return ksublevel >= sublevel;
}
+/* Return 1 if filename exists inside dirname in sysfs.
+ SYSFS_DEVICE_PATH is assumed to be the beginning of the path. */
+static int sysfs_has_file(const char *dirname, const char *filename)
+{
+ struct stat statbuf;
+ char path[PATH_MAX];
+ int r;
+
+ snprintf(path, PATH_MAX, "%s/%s/%s", SYSFS_DEVICE_PATH, dirname, filename);
+ r = stat(path, &statbuf);
+ if (r == 0 && S_ISREG(statbuf.st_mode))
+ return 1;
+
+ return 0;
+}
+
static int op_init(struct libusb_context *ctx)
{
struct stat statbuf;
@@ -386,103 +353,79 @@ static int op_init(struct libusb_context *ctx)
if (supports_flag_zero_packet)
usbi_dbg("zero length packet flag supported");
- if (-1 == sysfs_has_descriptors) {
- /* sysfs descriptors has all descriptors since Linux 2.6.26 */
- sysfs_has_descriptors = kernel_version_ge(2,6,26);
- if (-1 == sysfs_has_descriptors) {
- usbi_err(ctx, "error checking for sysfs descriptors");
- return LIBUSB_ERROR_OTHER;
- }
- }
+ r = stat(SYSFS_DEVICE_PATH, &statbuf);
+ if (r == 0 && S_ISDIR(statbuf.st_mode)) {
+ DIR *devices = opendir(SYSFS_DEVICE_PATH);
+ struct dirent *entry;
- if (-1 == sysfs_can_relate_devices) {
- /* sysfs has busnum since Linux 2.6.22 */
- sysfs_can_relate_devices = kernel_version_ge(2,6,22);
- if (-1 == sysfs_can_relate_devices) {
- usbi_err(ctx, "error checking for sysfs busnum");
- return LIBUSB_ERROR_OTHER;
- }
- }
+ usbi_dbg("found usb devices in sysfs");
- if (sysfs_can_relate_devices || sysfs_has_descriptors) {
- r = stat(SYSFS_DEVICE_PATH, &statbuf);
- if (r != 0 || !S_ISDIR(statbuf.st_mode)) {
- usbi_warn(ctx, "sysfs not mounted");
- sysfs_can_relate_devices = 0;
- sysfs_has_descriptors = 0;
+ if (!devices) {
+ usbi_err(ctx, "opendir devices failed errno=%d", errno);
+ return LIBUSB_ERROR_IO;
}
- }
- if (sysfs_can_relate_devices)
- usbi_dbg("sysfs can relate devices");
+ /* Make sure sysfs supports all the required files. If it
+ * does not, then usbfs will be used instead. Determine
+ * this by looping through the directories in
+ * SYSFS_DEVICE_PATH. With the assumption that there will
+ * always be subdirectories of the name usbN (usb1, usb2,
+ * etc) representing the root hubs, check the usbN
+ * subdirectories to see if they have all the needed files.
+ * This algorithm uses the usbN subdirectories (root hubs)
+ * because a device disconnection will cause a race
+ * condition regarding which files are available, sometimes
+ * causing an incorrect result. The root hubs are used
+ * because it is assumed that they will always be present.
+ * See the "sysfs vs usbfs" comment at the top of this file
+ * for more details. */
+ while ((entry = readdir(devices))) {
+ int has_busnum=0, has_devnum=0, has_descriptors=0;
+ int has_configuration_value=0;
+
+ /* Only check the usbN directories. */
+ if (strncmp(entry->d_name, "usb", 3) != 0)
+ continue;
- if (sysfs_has_descriptors)
- usbi_dbg("sysfs has complete descriptors");
-
- usbi_mutex_static_lock(&linux_hotplug_lock);
- r = LIBUSB_SUCCESS;
- if (init_count == 0) {
- /* start up hotplug event handler */
- r = linux_start_event_monitor();
- }
- if (r == LIBUSB_SUCCESS) {
- r = linux_scan_devices(ctx);
- if (r == LIBUSB_SUCCESS)
- init_count++;
- else if (init_count == 0)
- linux_stop_event_monitor();
- } else
- usbi_err(ctx, "error starting hotplug event monitor");
- usbi_mutex_static_unlock(&linux_hotplug_lock);
+ /* Check for the files libusb needs from sysfs. */
+ has_busnum = sysfs_has_file(entry->d_name, "busnum");
+ has_devnum = sysfs_has_file(entry->d_name, "devnum");
+ has_descriptors = sysfs_has_file(entry->d_name, "descriptors");
+ has_configuration_value = sysfs_has_file(entry->d_name, "bConfigurationValue");
- return r;
-}
+ if (has_busnum && has_devnum && has_configuration_value)
+ sysfs_can_relate_devices = 1;
+ if (has_descriptors)
+ sysfs_has_descriptors = 1;
-static void op_exit(void)
-{
- usbi_mutex_static_lock(&linux_hotplug_lock);
- assert(init_count != 0);
- if (!--init_count) {
- /* tear down event handler */
- (void)linux_stop_event_monitor();
- }
- usbi_mutex_static_unlock(&linux_hotplug_lock);
-}
+ /* Only need to check until we've found ONE device which
+ has all the attributes. */
+ if (sysfs_has_descriptors && sysfs_can_relate_devices)
+ break;
+ }
+ closedir(devices);
-static int linux_start_event_monitor(void)
-{
-#if defined(USE_UDEV)
- return linux_udev_start_event_monitor();
-#else
- return linux_netlink_start_event_monitor();
-#endif
-}
+ /* Only use sysfs descriptors if the rest of
+ sysfs will work for libusb. */
+ if (!sysfs_can_relate_devices)
+ sysfs_has_descriptors = 0;
+ } else {
+ usbi_dbg("sysfs usb info not available");
+ sysfs_has_descriptors = 0;
+ sysfs_can_relate_devices = 0;
+ }
-static int linux_stop_event_monitor(void)
-{
-#if defined(USE_UDEV)
- return linux_udev_stop_event_monitor();
-#else
- return linux_netlink_stop_event_monitor();
-#endif
+ return 0;
}
-static int linux_scan_devices(struct libusb_context *ctx)
+static int usbfs_get_device_descriptor(struct libusb_device *dev,
+ unsigned char *buffer)
{
-#if defined(USE_UDEV)
- return linux_udev_scan_devices(ctx);
-#else
- return linux_default_scan_devices(ctx);
-#endif
-}
+ struct linux_device_priv *priv = _device_priv(dev);
-static void op_hotplug_poll(void)
-{
-#if defined(USE_UDEV)
- linux_udev_hotplug_poll();
-#else
- linux_netlink_hotplug_poll();
-#endif
+ /* return cached copy */
+ memcpy(buffer, priv->dev_descriptor, DEVICE_DESC_LENGTH);
+ return 0;
}
static int _open_sysfs_attr(struct libusb_device *dev, const char *attr)
@@ -538,14 +481,52 @@ static int __read_sysfs_attr(struct libusb_context *ctx,
return value;
}
+static int sysfs_get_device_descriptor(struct libusb_device *dev,
+ unsigned char *buffer)
+{
+ int fd;
+ ssize_t r;
+
+ /* sysfs provides access to an in-memory copy of the device descriptor,
+ * so we use that rather than keeping our own copy */
+
+ fd = _open_sysfs_attr(dev, "descriptors");
+ if (fd < 0)
+ return fd;
+
+ r = read(fd, buffer, DEVICE_DESC_LENGTH);;
+ close(fd);
+ if (r < 0) {
+ usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d", fd, errno);
+ return LIBUSB_ERROR_IO;
+ } else if (r < DEVICE_DESC_LENGTH) {
+ usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, DEVICE_DESC_LENGTH);
+ return LIBUSB_ERROR_IO;
+ }
+
+ return 0;
+}
+
static int op_get_device_descriptor(struct libusb_device *dev,
unsigned char *buffer, int *host_endian)
{
- struct linux_device_priv *priv = _device_priv(dev);
+ if (sysfs_has_descriptors) {
+ return sysfs_get_device_descriptor(dev, buffer);
+ } else {
+ *host_endian = 1;
+ return usbfs_get_device_descriptor(dev, buffer);
+ }
+}
- *host_endian = sysfs_has_descriptors ? 0 : 1;
- memcpy(buffer, priv->descriptors, DEVICE_DESC_LENGTH);
+static int usbfs_get_active_config_descriptor(struct libusb_device *dev,
+ unsigned char *buffer, size_t len)
+{
+ struct linux_device_priv *priv = _device_priv(dev);
+ if (!priv->config_descriptor)
+ return LIBUSB_ERROR_NOT_FOUND; /* device is unconfigured */
+ /* retrieve cached copy */
+ memcpy(buffer, priv->config_descriptor, len);
return 0;
}
@@ -592,213 +573,250 @@ static int sysfs_get_active_config(struct libusb_device *dev, int *config)
return 0;
}
-int linux_get_device_address (struct libusb_context *ctx, int detached,
- uint8_t *busnum, uint8_t *devaddr,const char *dev_node,
- const char *sys_name)
+/* takes a usbfs/descriptors fd seeked to the start of a configuration, and
+ * seeks to the next one. */
+static int seek_to_next_config(struct libusb_context *ctx, int fd,
+ int host_endian)
{
- usbi_dbg("getting address for device: %s detached: %d", sys_name, detached);
- /* can't use sysfs to read the bus and device number if the
- * device has been detached */
- if (!sysfs_can_relate_devices || detached || NULL == sys_name) {
- if (NULL == dev_node) {
- return LIBUSB_ERROR_OTHER;
- }
-
- /* will this work with all supported kernel versions? */
- if (!strncmp(dev_node, "/dev/bus/usb", 12)) {
- sscanf (dev_node, "/dev/bus/usb/%hhd/%hhd", busnum, devaddr);
- } else if (!strncmp(dev_node, "/proc/bus/usb", 13)) {
- sscanf (dev_node, "/proc/bus/usb/%hhd/%hhd", busnum, devaddr);
- }
+ struct libusb_config_descriptor config;
+ unsigned char tmp[6];
+ off_t off;
+ ssize_t r;
- return LIBUSB_SUCCESS;
+ /* read first 6 bytes of descriptor */
+ r = read(fd, tmp, sizeof(tmp));
+ if (r < 0) {
+ usbi_err(ctx, "read failed ret=%d errno=%d", r, errno);
+ return LIBUSB_ERROR_IO;
+ } else if (r < sizeof(tmp)) {
+ usbi_err(ctx, "short descriptor read %d/%d", r, sizeof(tmp));
+ return LIBUSB_ERROR_IO;
}
- usbi_dbg("scan %s", sys_name);
-
- *busnum = __read_sysfs_attr(ctx, sys_name, "busnum");
- if (0 > *busnum)
- return *busnum;
-
- *devaddr = __read_sysfs_attr(ctx, sys_name, "devnum");
- if (0 > *devaddr)
- return *devaddr;
-
- usbi_dbg("bus=%d dev=%d", *busnum, *devaddr);
- if (*busnum > 255 || *devaddr > 255)
- return LIBUSB_ERROR_INVALID_PARAM;
+ /* seek forward to end of config */
+ usbi_parse_descriptor(tmp, "bbwbb", &config, host_endian);
+ off = lseek(fd, config.wTotalLength - sizeof(tmp), SEEK_CUR);
+ if (off < 0) {
+ usbi_err(ctx, "seek failed ret=%d errno=%d", off, errno);
+ return LIBUSB_ERROR_IO;
+ }
- return LIBUSB_SUCCESS;
+ return 0;
}
-/* Return offset of the next descriptor with the given type */
-static int seek_to_next_descriptor(struct libusb_context *ctx,
- uint8_t descriptor_type, unsigned char *buffer, int size)
+static int sysfs_get_active_config_descriptor(struct libusb_device *dev,
+ unsigned char *buffer, size_t len)
{
- struct usb_descriptor_header header;
- int i;
+ int fd;
+ ssize_t r;
+ off_t off;
+ int to_copy;
+ int config;
+ unsigned char tmp[6];
- for (i = 0; size >= 0; i += header.bLength, size -= header.bLength) {
- if (size == 0)
- return LIBUSB_ERROR_NOT_FOUND;
+ r = sysfs_get_active_config(dev, &config);
+ if (r < 0)
+ return r;
+ if (config == -1)
+ return LIBUSB_ERROR_NOT_FOUND;
- if (size < 2) {
- usbi_err(ctx, "short descriptor read %d/2", size);
- return LIBUSB_ERROR_IO;
- }
- usbi_parse_descriptor(buffer + i, "bb", &header, 0);
+ usbi_dbg("active configuration %d", config);
- if (i && header.bDescriptorType == descriptor_type)
- return i;
- }
- usbi_err(ctx, "bLength overflow by %d bytes", -size);
- return LIBUSB_ERROR_IO;
-}
+ /* sysfs provides access to an in-memory copy of the device descriptor,
+ * so we use that rather than keeping our own copy */
-/* Return offset to next config */
-static int seek_to_next_config(struct libusb_context *ctx,
- unsigned char *buffer, int size)
-{
- struct libusb_config_descriptor config;
-
- if (size == 0)
- return LIBUSB_ERROR_NOT_FOUND;
+ fd = _open_sysfs_attr(dev, "descriptors");
+ if (fd < 0)
+ return fd;
- if (size < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(ctx, "short descriptor read %d/%d",
- size, LIBUSB_DT_CONFIG_SIZE);
+ /* device might have been unconfigured since we read bConfigurationValue,
+ * so first check that there is any config descriptor data at all... */
+ off = lseek(fd, 0, SEEK_END);
+ if (off < 1) {
+ usbi_err(DEVICE_CTX(dev), "end seek failed, ret=%d errno=%d",
+ off, errno);
+ close(fd);
return LIBUSB_ERROR_IO;
+ } else if (off == DEVICE_DESC_LENGTH) {
+ close(fd);
+ return LIBUSB_ERROR_NOT_FOUND;
}
- usbi_parse_descriptor(buffer, "bbwbbbbb", &config, 0);
- if (config.bDescriptorType != LIBUSB_DT_CONFIG) {
- usbi_err(ctx, "descriptor is not a config desc (type 0x%02x)",
- config.bDescriptorType);
+ off = lseek(fd, DEVICE_DESC_LENGTH, SEEK_SET);
+ if (off < 0) {
+ usbi_err(DEVICE_CTX(dev), "seek failed, ret=%d errno=%d", off, errno);
+ close(fd);
return LIBUSB_ERROR_IO;
}
- /*
- * In usbfs the config descriptors are config.wTotalLength bytes apart,
- * with any short reads from the device appearing as holes in the file.
- *
- * In sysfs wTotalLength is ignored, instead the kernel returns a
- * config descriptor with verified bLength fields, with descriptors
- * with an invalid bLength removed.
- */
- if (sysfs_has_descriptors) {
- int next = seek_to_next_descriptor(ctx, LIBUSB_DT_CONFIG,
- buffer, size);
- if (next == LIBUSB_ERROR_NOT_FOUND)
- next = size;
- if (next < 0)
- return next;
-
- if (next != config.wTotalLength)
- usbi_warn(ctx, "config length mismatch wTotalLength "
- "%d real %d", config.wTotalLength, next);
- return next;
- } else {
- if (config.wTotalLength < LIBUSB_DT_CONFIG_SIZE) {
- usbi_err(ctx, "invalid wTotalLength %d",
- config.wTotalLength);
+ /* unbounded loop: we expect the descriptor to be present under all
+ * circumstances */
+ while (1) {
+ r = read(fd, tmp, sizeof(tmp));
+ if (r < 0) {
+ usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d",
+ fd, errno);
return LIBUSB_ERROR_IO;
- } else if (config.wTotalLength > size) {
- usbi_warn(ctx, "short descriptor read %d/%d",
- size, config.wTotalLength);
- return size;
- } else
- return config.wTotalLength;
- }
-}
+ } else if (r < sizeof(tmp)) {
+ usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, sizeof(tmp));
+ return LIBUSB_ERROR_IO;
+ }
-static int op_get_config_descriptor_by_value(struct libusb_device *dev,
- uint8_t value, unsigned char **buffer, int *host_endian)
-{
- struct libusb_context *ctx = DEVICE_CTX(dev);
- struct linux_device_priv *priv = _device_priv(dev);
- unsigned char *descriptors = priv->descriptors;
- int size = priv->descriptors_len;
- struct libusb_config_descriptor *config;
+ /* check bConfigurationValue */
+ if (tmp[5] == config)
+ break;
- *buffer = NULL;
- /* Unlike the device desc. config descs. are always in raw format */
- *host_endian = 0;
+ /* try the next descriptor */
+ off = lseek(fd, 0 - sizeof(tmp), SEEK_CUR);
+ if (off < 0)
+ return LIBUSB_ERROR_IO;
- /* Skip device header */
- descriptors += DEVICE_DESC_LENGTH;
- size -= DEVICE_DESC_LENGTH;
+ r = seek_to_next_config(DEVICE_CTX(dev), fd, 0);
+ if (r < 0)
+ return r;
+ }
- /* Seek till the config is found, or till "EOF" */
- while (1) {
- int next = seek_to_next_config(ctx, descriptors, size);
- if (next < 0)
- return next;
- config = (struct libusb_config_descriptor *)descriptors;
- if (config->bConfigurationValue == value) {
- *buffer = descriptors;
- return next;
+ to_copy = (len < sizeof(tmp)) ? len : sizeof(tmp);
+ memcpy(buffer, tmp, to_copy);
+ if (len > sizeof(tmp)) {
+ r = read(fd, buffer + sizeof(tmp), len - sizeof(tmp));
+ if (r < 0) {
+ usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d",
+ fd, errno);
+ r = LIBUSB_ERROR_IO;
+ } else if (r == 0) {
+ usbi_dbg("device is unconfigured");
+ r = LIBUSB_ERROR_NOT_FOUND;
+ } else if (r < len - sizeof(tmp)) {
+ usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, len);
+ r = LIBUSB_ERROR_IO;
}
- size -= next;
- descriptors += next;
+ } else {
+ r = 0;
}
+
+ close(fd);
+ return r;
}
static int op_get_active_config_descriptor(struct libusb_device *dev,
unsigned char *buffer, size_t len, int *host_endian)
{
- int r, config;
- unsigned char *config_desc;
+ if (sysfs_has_descriptors) {
+ return sysfs_get_active_config_descriptor(dev, buffer, len);
+ } else {
+ return usbfs_get_active_config_descriptor(dev, buffer, len);
+ }
+}
+
+/* takes a usbfs fd, attempts to find the requested config and copy a certain
+ * amount of it into an output buffer. */
+static int get_config_descriptor(struct libusb_context *ctx, int fd,
+ uint8_t config_index, unsigned char *buffer, size_t len)
+{
+ off_t off;
+ ssize_t r;
- if (sysfs_can_relate_devices) {
- r = sysfs_get_active_config(dev, &config);
+ off = lseek(fd, DEVICE_DESC_LENGTH, SEEK_SET);
+ if (off < 0) {
+ usbi_err(ctx, "seek failed ret=%d errno=%d", off, errno);
+ return LIBUSB_ERROR_IO;
+ }
+
+ /* might need to skip some configuration descriptors to reach the
+ * requested configuration */
+ while (config_index > 0) {
+ r = seek_to_next_config(ctx, fd, 1);
if (r < 0)
return r;
- } else {
- /* Use cached bConfigurationValue */
- struct linux_device_priv *priv = _device_priv(dev);
- config = priv->active_config;
+ config_index--;
}
- if (config == -1)
- return LIBUSB_ERROR_NOT_FOUND;
- r = op_get_config_descriptor_by_value(dev, config, &config_desc,
- host_endian);
- if (r < 0)
- return r;
+ /* read the rest of the descriptor */
+ r = read(fd, buffer, len);
+ if (r < 0) {
+ usbi_err(ctx, "read failed ret=%d errno=%d", r, errno);
+ return LIBUSB_ERROR_IO;
+ } else if (r < len) {
+ usbi_err(ctx, "short output read %d/%d", r, len);
+ return LIBUSB_ERROR_IO;
+ }
- len = MIN(len, r);
- memcpy(buffer, config_desc, len);
- return len;
+ return 0;
}
static int op_get_config_descriptor(struct libusb_device *dev,
uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
{
- struct linux_device_priv *priv = _device_priv(dev);
- unsigned char *descriptors = priv->descriptors;
- int i, r, size = priv->descriptors_len;
+ char filename[PATH_MAX];
+ int fd;
+ int r;
+
+ /* always read from usbfs: sysfs only has the active descriptor
+ * this will involve waking the device up, but oh well! */
+
+ /* FIXME: the above is no longer true, new kernels have all descriptors
+ * in the descriptors file. but its kinda hard to detect if the kernel
+ * is sufficiently new. */
- /* Unlike the device desc. config descs. are always in raw format */
- *host_endian = 0;
+ _get_usbfs_path(dev, filename);
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ usbi_err(DEVICE_CTX(dev),
+ "open '%s' failed, ret=%d errno=%d", filename, fd, errno);
+ return LIBUSB_ERROR_IO;
+ }
+
+ r = get_config_descriptor(DEVICE_CTX(dev), fd, config_index, buffer, len);
+ close(fd);
+ return r;
+}
- /* Skip device header */
- descriptors += DEVICE_DESC_LENGTH;
- size -= DEVICE_DESC_LENGTH;
+/* cache the active config descriptor in memory. a value of -1 means that
+ * we aren't sure which one is active, so just assume the first one.
+ * only for usbfs. */
+static int cache_active_config(struct libusb_device *dev, int fd,
+ int active_config)
+{
+ struct linux_device_priv *priv = _device_priv(dev);
+ struct libusb_config_descriptor config;
+ unsigned char tmp[8];
+ unsigned char *buf;
+ int idx;
+ int r;
- /* Seek till the config is found, or till "EOF" */
- for (i = 0; ; i++) {
- r = seek_to_next_config(DEVICE_CTX(dev), descriptors, size);
+ if (active_config == -1) {
+ idx = 0;
+ } else {
+ r = usbi_get_config_index_by_value(dev, active_config, &idx);
if (r < 0)
return r;
- if (i == config_index)
- break;
- size -= r;
- descriptors += r;
+ if (idx == -1)
+ return LIBUSB_ERROR_NOT_FOUND;
+ }
+
+ r = get_config_descriptor(DEVICE_CTX(dev), fd, idx, tmp, sizeof(tmp));
+ if (r < 0) {
+ usbi_err(DEVICE_CTX(dev), "first read error %d", r);
+ return r;
}
- len = MIN(len, r);
- memcpy(buffer, descriptors, len);
- return len;
+ usbi_parse_descriptor(tmp, "bbw", &config, 0);
+ buf = malloc(config.wTotalLength);
+ if (!buf)
+ return LIBUSB_ERROR_NO_MEM;
+
+ r = get_config_descriptor(DEVICE_CTX(dev), fd, idx, buf,
+ config.wTotalLength);
+ if (r < 0) {
+ free(buf);
+ return r;
+ }
+
+ if (priv->config_descriptor)
+ free(priv->config_descriptor);
+ priv->config_descriptor = buf;
+ return 0;
}
/* send a control message to retrieve active configuration */
@@ -835,9 +853,11 @@ static int initialize_device(struct libusb_device *dev, uint8_t busnum,
uint8_t devaddr, const char *sysfs_dir)
{
struct linux_device_priv *priv = _device_priv(dev);
- struct libusb_context *ctx = DEVICE_CTX(dev);
- int descriptors_size = 512; /* Begin with a 1024 byte alloc */
+ unsigned char *dev_buf;
+ char path[PATH_MAX];
int fd, speed;
+ int active_config = 0;
+ int device_configured = 1;
ssize_t r;
dev->bus_number = busnum;
@@ -864,162 +884,113 @@ static int initialize_device(struct libusb_device *dev, uint8_t busnum,
}
}
- /* cache descriptors in memory */
if (sysfs_has_descriptors)
- fd = _open_sysfs_attr(dev, "descriptors");
- else
- fd = _get_usbfs_fd(dev, O_RDONLY, 0);
- if (fd < 0)
- return fd;
+ return 0;
- do {
- descriptors_size *= 2;
- priv->descriptors = usbi_reallocf(priv->descriptors,
- descriptors_size);
- if (!priv->descriptors) {
- close(fd);
- return LIBUSB_ERROR_NO_MEM;
- }
- /* usbfs has holes in the file */
- if (!sysfs_has_descriptors) {
- memset(priv->descriptors + priv->descriptors_len,
- 0, descriptors_size - priv->descriptors_len);
- }
- r = read(fd, priv->descriptors + priv->descriptors_len,
- descriptors_size - priv->descriptors_len);
- if (r < 0) {
- usbi_err(ctx, "read descriptor failed ret=%d errno=%d",
- fd, errno);
- close(fd);
- return LIBUSB_ERROR_IO;
- }
- priv->descriptors_len += r;
- } while (priv->descriptors_len == descriptors_size);
-
- close(fd);
+ /* cache device descriptor in memory so that we can retrieve it later
+ * without waking the device up (op_get_device_descriptor) */
- if (priv->descriptors_len < DEVICE_DESC_LENGTH) {
- usbi_err(ctx, "short descriptor read (%d)",
- priv->descriptors_len);
- return LIBUSB_ERROR_IO;
+ priv->dev_descriptor = NULL;
+ priv->config_descriptor = NULL;
+
+ if (sysfs_can_relate_devices) {
+ int tmp = sysfs_get_active_config(dev, &active_config);
+ if (tmp < 0)
+ return tmp;
+ if (active_config == -1)
+ device_configured = 0;
}
- if (sysfs_can_relate_devices)
- return LIBUSB_SUCCESS;
+ _get_usbfs_path(dev, path);
+ fd = open(path, O_RDWR);
+ if (fd < 0 && errno == EACCES) {
+ fd = open(path, O_RDONLY);
+ /* if we only have read-only access to the device, we cannot
+ * send a control message to determine the active config. just
+ * assume the first one is active. */
+ active_config = -1;
+ }
- /* cache active config */
- fd = _get_usbfs_fd(dev, O_RDWR, 1);
if (fd < 0) {
- /* cannot send a control message to determine the active
- * config. just assume the first one is active. */
- usbi_warn(ctx, "Missing rw usbfs access; cannot determine "
- "active configuration descriptor");
- if (priv->descriptors_len >=
- (DEVICE_DESC_LENGTH + LIBUSB_DT_CONFIG_SIZE)) {
- struct libusb_config_descriptor config;
- usbi_parse_descriptor(
- priv->descriptors + DEVICE_DESC_LENGTH,
- "bbwbbbbb", &config, 0);
- priv->active_config = config.bConfigurationValue;
- } else
- priv->active_config = -1; /* No config dt */
-
- return LIBUSB_SUCCESS;
- }
-
- r = usbfs_get_active_config(dev, fd);
- if (r > 0) {
- priv->active_config = r;
- r = LIBUSB_SUCCESS;
- } else if (r == 0) {
- /* some buggy devices have a configuration 0, but we're
- * reaching into the corner of a corner case here, so let's
- * not support buggy devices in these circumstances.
- * stick to the specs: a configuration value of 0 means
- * unconfigured. */
- usbi_dbg("active cfg 0? assuming unconfigured device");
- priv->active_config = -1;
- r = LIBUSB_SUCCESS;
- } else if (r == LIBUSB_ERROR_IO) {
- /* buggy devices sometimes fail to report their active config.
- * assume unconfigured and continue the probing */
- usbi_warn(ctx, "couldn't query active configuration, assuming"
- " unconfigured");
- priv->active_config = -1;
- r = LIBUSB_SUCCESS;
- } /* else r < 0, just return the error code */
-
- close(fd);
- return r;
-}
+ usbi_err(DEVICE_CTX(dev), "open failed, ret=%d errno=%d", fd, errno);
+ return LIBUSB_ERROR_IO;
+ }
-static int linux_get_parent_info(struct libusb_device *dev, const char *sysfs_dir)
-{
- struct libusb_context *ctx = DEVICE_CTX(dev);
- struct libusb_device *it;
- char *parent_sysfs_dir, *tmp;
- int ret, add_parent = 1;
-
- /* XXX -- can we figure out the topology when using usbfs? */
- if (NULL == sysfs_dir || 0 == strncmp(sysfs_dir, "usb", 3)) {
- /* either using usbfs or finding the parent of a root hub */
- return LIBUSB_SUCCESS;
- }
-
- parent_sysfs_dir = strdup(sysfs_dir);
- if (NULL != (tmp = strrchr(parent_sysfs_dir, '.')) ||
- NULL != (tmp = strrchr(parent_sysfs_dir, '-'))) {
- dev->port_number = atoi(tmp + 1);
- *tmp = '\0';
- } else {
- usbi_warn(ctx, "Can not parse sysfs_dir: %s, no parent info",
- parent_sysfs_dir);
- free (parent_sysfs_dir);
- return LIBUSB_SUCCESS;
- }
-
- /* is the parent a root hub? */
- if (NULL == strchr(parent_sysfs_dir, '-')) {
- tmp = parent_sysfs_dir;
- ret = asprintf (&parent_sysfs_dir, "usb%s", tmp);
- free (tmp);
- if (0 > ret) {
- return LIBUSB_ERROR_NO_MEM;
+ if (!sysfs_can_relate_devices) {
+ if (active_config == -1) {
+ /* if we only have read-only access to the device, we cannot
+ * send a control message to determine the active config. just
+ * assume the first one is active. */
+ usbi_warn(DEVICE_CTX(dev), "access to %s is read-only; cannot "
+ "determine active configuration descriptor", path);
+ } else {
+ active_config = usbfs_get_active_config(dev, fd);
+ if (active_config == LIBUSB_ERROR_IO) {
+ /* buggy devices sometimes fail to report their active config.
+ * assume unconfigured and continue the probing */
+ usbi_warn(DEVICE_CTX(dev), "couldn't query active "
+ "configuration, assumung unconfigured");
+ device_configured = 0;
+ } else if (active_config < 0) {
+ close(fd);
+ return active_config;
+ } else if (active_config == 0) {
+ /* some buggy devices have a configuration 0, but we're
+ * reaching into the corner of a corner case here, so let's
+ * not support buggy devices in these circumstances.
+ * stick to the specs: a configuration value of 0 means
+ * unconfigured. */
+ usbi_dbg("active cfg 0? assuming unconfigured device");
+ device_configured = 0;
+ }
}
}
-retry:
- /* find the parent in the context */
- usbi_mutex_lock(&ctx->usb_devs_lock);
- list_for_each_entry(it, &ctx->usb_devs, list, struct libusb_device) {
- struct linux_device_priv *priv = _device_priv(it);
- if (0 == strcmp (priv->sysfs_dir, parent_sysfs_dir)) {
- dev->parent_dev = libusb_ref_device(it);
- break;
- }
+ dev_buf = malloc(DEVICE_DESC_LENGTH);
+ if (!dev_buf) {
+ close(fd);
+ return LIBUSB_ERROR_NO_MEM;
}
- usbi_mutex_unlock(&ctx->usb_devs_lock);
- if (!dev->parent_dev && add_parent) {
- usbi_dbg("parent_dev %s not enumerated yet, enumerating now",
- parent_sysfs_dir);
- sysfs_scan_device(ctx, parent_sysfs_dir);
- add_parent = 0;
- goto retry;
+ r = read(fd, dev_buf, DEVICE_DESC_LENGTH);
+ if (r < 0) {
+ usbi_err(DEVICE_CTX(dev),
+ "read descriptor failed ret=%d errno=%d", fd, errno);
+ free(dev_buf);
+ close(fd);
+ return LIBUSB_ERROR_IO;
+ } else if (r < DEVICE_DESC_LENGTH) {
+ usbi_err(DEVICE_CTX(dev), "short descriptor read (%d)", r);
+ free(dev_buf);
+ close(fd);
+ return LIBUSB_ERROR_IO;
}
- usbi_dbg("Dev %p (%s) has parent %p (%s) port %d", dev, sysfs_dir,
- dev->parent_dev, parent_sysfs_dir, dev->port_number);
+ /* bit of a hack: set num_configurations now because cache_active_config()
+ * calls usbi_get_config_index_by_value() which uses it */
+ dev->num_configurations = dev_buf[DEVICE_DESC_LENGTH - 1];
- free (parent_sysfs_dir);
+ if (device_configured) {
+ r = cache_active_config(dev, fd, active_config);
+ if (r < 0) {
+ close(fd);
+ free(dev_buf);
+ return r;
+ }
+ }
- return LIBUSB_SUCCESS;
+ close(fd);
+ priv->dev_descriptor = dev_buf;
+ return 0;
}
-int linux_enumerate_device(struct libusb_context *ctx,
- uint8_t busnum, uint8_t devaddr, const char *sysfs_dir)
+static int enumerate_device(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs, uint8_t busnum, uint8_t devaddr,
+ const char *sysfs_dir)
{
+ struct discovered_devs *discdevs;
unsigned long session_id;
+ int need_unref = 0;
struct libusb_device *dev;
int r = 0;
@@ -1030,73 +1001,48 @@ int linux_enumerate_device(struct libusb_context *ctx,
usbi_dbg("busnum %d devaddr %d session_id %ld", busnum, devaddr,
session_id);
- if (usbi_get_device_by_session_id(ctx, session_id)) {
- /* device already exists in the context */
- usbi_dbg("session_id %ld already exists", session_id);
- return LIBUSB_SUCCESS;
+ dev = usbi_get_device_by_session_id(ctx, session_id);
+ if (dev) {
+ usbi_dbg("using existing device for %d/%d (session %ld)",
+ busnum, devaddr, session_id);
+ } else {
+ usbi_dbg("allocating new device for %d/%d (session %ld)",
+ busnum, devaddr, session_id);
+ dev = usbi_alloc_device(ctx, session_id);
+ if (!dev)
+ return LIBUSB_ERROR_NO_MEM;
+ need_unref = 1;
+ r = initialize_device(dev, busnum, devaddr, sysfs_dir);
+ if (r < 0)
+ goto out;
+ r = usbi_sanitize_device(dev);
+ if (r < 0)
+ goto out;
}
- usbi_dbg("allocating new device for %d/%d (session %ld)",
- busnum, devaddr, session_id);
- dev = usbi_alloc_device(ctx, session_id);
- if (!dev)
- return LIBUSB_ERROR_NO_MEM;
-
- r = initialize_device(dev, busnum, devaddr, sysfs_dir);
- if (r < 0)
- goto out;
- r = usbi_sanitize_device(dev);
- if (r < 0)
- goto out;
+ discdevs = discovered_devs_append(*_discdevs, dev);
+ if (!discdevs)
+ r = LIBUSB_ERROR_NO_MEM;
+ else
+ *_discdevs = discdevs;
- r = linux_get_parent_info(dev, sysfs_dir);
- if (r < 0)
- goto out;
out:
- if (r < 0)
+ if (need_unref)
libusb_unref_device(dev);
- else
- usbi_connect_device(dev);
-
return r;
}
-void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_name)
-{
- struct libusb_context *ctx;
-
- usbi_mutex_static_lock(&active_contexts_lock);
- list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
- linux_enumerate_device(ctx, busnum, devaddr, sys_name);
- }
- usbi_mutex_static_unlock(&active_contexts_lock);
-}
-
-void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name)
-{
- struct libusb_context *ctx;
- struct libusb_device *dev;
- unsigned long session_id = busnum << 8 | devaddr;
-
- usbi_mutex_static_lock(&active_contexts_lock);
- list_for_each_entry(ctx, &active_contexts_list, list, struct libusb_context) {
- dev = usbi_get_device_by_session_id (ctx, session_id);
- if (NULL != dev) {
- usbi_disconnect_device (dev);
- } else {
- usbi_dbg("device not found for session %x", session_id);
- }
- }
- usbi_mutex_static_unlock(&active_contexts_lock);
-}
-
-#if !defined(USE_UDEV)
-/* open a bus directory and adds all discovered devices to the context */
-static int usbfs_scan_busdir(struct libusb_context *ctx, uint8_t busnum)
+/* open a bus directory and adds all discovered devices to discdevs. on
+ * failure (non-zero return) the pre-existing discdevs should be destroyed
+ * (and devices freed). on success, the new discdevs pointer should be used
+ * as it may have been moved. */
+static int usbfs_scan_busdir(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs, uint8_t busnum)
{
DIR *dir;
char dirpath[PATH_MAX];
struct dirent *entry;
+ struct discovered_devs *discdevs = *_discdevs;
int r = LIBUSB_ERROR_IO;
snprintf(dirpath, PATH_MAX, "%s/%03d", usbfs_path, busnum);
@@ -1121,7 +1067,7 @@ static int usbfs_scan_busdir(struct libusb_context *ctx, uint8_t busnum)
continue;
}
- if (linux_enumerate_device(ctx, busnum, (uint8_t) devaddr, NULL)) {
+ if (enumerate_device(ctx, &discdevs, busnum, (uint8_t) devaddr, NULL)) {
usbi_dbg("failed to enumerate dir entry %s", entry->d_name);
continue;
}
@@ -1129,14 +1075,18 @@ static int usbfs_scan_busdir(struct libusb_context *ctx, uint8_t busnum)
r = 0;
}
+ if (!r)
+ *_discdevs = discdevs;
closedir(dir);
return r;
}
-static int usbfs_get_device_list(struct libusb_context *ctx)
+static int usbfs_get_device_list(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs)
{
struct dirent *entry;
DIR *buses = opendir(usbfs_path);
+ struct discovered_devs *discdevs = *_discdevs;
int r = 0;
if (!buses) {
@@ -1145,6 +1095,7 @@ static int usbfs_get_device_list(struct libusb_context *ctx)
}
while ((entry = readdir(buses))) {
+ struct discovered_devs *discdevs_new = discdevs;
int busnum;
if (entry->d_name[0] == '.')
@@ -1155,7 +1106,8 @@ static int usbfs_get_device_list(struct libusb_context *ctx)
if (!_is_usbdev_entry(entry, &busnum, &devaddr))
continue;
- r = linux_enumerate_device(ctx, busnum, (uint8_t) devaddr, NULL);
+ r = enumerate_device(ctx, &discdevs_new, busnum,
+ (uint8_t) devaddr, NULL);
if (r < 0) {
usbi_dbg("failed to enumerate dir entry %s", entry->d_name);
continue;
@@ -1167,35 +1119,48 @@ static int usbfs_get_device_list(struct libusb_context *ctx)
continue;
}
- r = usbfs_scan_busdir(ctx, busnum);
+ r = usbfs_scan_busdir(ctx, &discdevs_new, busnum);
if (r < 0)
- break;
+ goto out;
}
+ discdevs = discdevs_new;
}
+out:
closedir(buses);
+ *_discdevs = discdevs;
return r;
}
-#endif
-static int sysfs_scan_device(struct libusb_context *ctx, const char *devname)
+static int sysfs_scan_device(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs, const char *devname)
{
- uint8_t busnum, devaddr;
- int ret;
+ int busnum;
+ int devaddr;
- ret = linux_get_device_address (ctx, 0, &busnum, &devaddr, NULL, devname);
- if (LIBUSB_SUCCESS != ret) {
- return ret;
- }
+ usbi_dbg("scan %s", devname);
- return linux_enumerate_device(ctx, busnum & 0xff, devaddr & 0xff,
+ busnum = __read_sysfs_attr(ctx, devname, "busnum");
+ if (busnum < 0)
+ return busnum;
+
+ devaddr = __read_sysfs_attr(ctx, devname, "devnum");
+ if (devaddr < 0)
+ return devaddr;
+
+ usbi_dbg("bus=%d dev=%d", busnum, devaddr);
+ if (busnum > 255 || devaddr > 255)
+ return LIBUSB_ERROR_INVALID_PARAM;
+
+ return enumerate_device(ctx, _discdevs, busnum & 0xff, devaddr & 0xff,
devname);
}
-#if !defined(USE_UDEV)
-static int sysfs_get_device_list(struct libusb_context *ctx)
+static int sysfs_get_device_list(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs)
{
+ struct discovered_devs *discdevs = *_discdevs;
DIR *devices = opendir(SYSFS_DEVICE_PATH);
struct dirent *entry;
int r = LIBUSB_ERROR_IO;
@@ -1206,23 +1171,29 @@ static int sysfs_get_device_list(struct libusb_context *ctx)
}
while ((entry = readdir(devices))) {
+ struct discovered_devs *discdevs_new = discdevs;
+
if ((!isdigit(entry->d_name[0]) && strncmp(entry->d_name, "usb", 3))
|| strchr(entry->d_name, ':'))
continue;
- if (sysfs_scan_device(ctx, entry->d_name)) {
+ if (sysfs_scan_device(ctx, &discdevs_new, entry->d_name)) {
usbi_dbg("failed to enumerate dir entry %s", entry->d_name);
continue;
}
r = 0;
+ discdevs = discdevs_new;
}
+ if (!r)
+ *_discdevs = discdevs;
closedir(devices);
return r;
}
-static int linux_default_scan_devices (struct libusb_context *ctx)
+static int op_get_device_list(struct libusb_context *ctx,
+ struct discovered_devs **_discdevs)
{
/* we can retrieve device list and descriptors from sysfs or usbfs.
* sysfs is preferable, because if we use usbfs we end up resuming
@@ -1235,32 +1206,35 @@ static int linux_default_scan_devices (struct libusb_context *ctx)
* adequacy of sysfs and sets sysfs_can_relate_devices.
*/
if (sysfs_can_relate_devices != 0)
- return sysfs_get_device_list(ctx);
+ return sysfs_get_device_list(ctx, _discdevs);
else
- return usbfs_get_device_list(ctx);
+ return usbfs_get_device_list(ctx, _discdevs);
}
-#endif
static int op_open(struct libusb_device_handle *handle)
{
struct linux_device_handle_priv *hpriv = _device_handle_priv(handle);
- int r;
-
- hpriv->fd = _get_usbfs_fd(handle->dev, O_RDWR, 0);
- if (hpriv->fd < 0)
- return hpriv->fd;
+ char filename[PATH_MAX];
- r = ioctl(hpriv->fd, IOCTL_USBFS_GET_CAPABILITIES, &hpriv->caps);
- if (r < 0) {
- if (errno == ENOTTY)
- usbi_dbg("getcap not available");
- else
- usbi_err(HANDLE_CTX(handle), "getcap failed (%d)", errno);
- hpriv->caps = 0;
- if (supports_flag_zero_packet)
- hpriv->caps |= USBFS_CAP_ZERO_PACKET;
- if (supports_flag_bulk_continuation)
- hpriv->caps |= USBFS_CAP_BULK_CONTINUATION;
+ _get_usbfs_path(handle->dev, filename);
+ usbi_dbg("opening %s", filename);
+ hpriv->fd = open(filename, O_RDWR);
+ if (hpriv->fd < 0) {
+ if (errno == EACCES) {
+ usbi_err(HANDLE_CTX(handle), "libusb couldn't open USB device %s: "
+ "Permission denied.", filename);
+ usbi_err(HANDLE_CTX(handle),
+ "libusb requires write access to USB device nodes.");
+ return LIBUSB_ERROR_ACCESS;
+ } else if (errno == ENOENT) {
+ usbi_err(HANDLE_CTX(handle), "libusb couldn't open USB device %s: "
+ "No such file or directory.", filename);
+ return LIBUSB_ERROR_NO_DEVICE;
+ } else {
+ usbi_err(HANDLE_CTX(handle),
+ "open failed, code %d errno %d", hpriv->fd, errno);
+ return LIBUSB_ERROR_IO;
+ }
}
return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->fd, POLLOUT);
@@ -1277,13 +1251,10 @@ static int op_get_configuration(struct libusb_device_handle *handle,
int *config)
{
int r;
+ if (sysfs_can_relate_devices != 1)
+ return LIBUSB_ERROR_NOT_SUPPORTED;
- if (sysfs_can_relate_devices) {
- r = sysfs_get_active_config(handle->dev, config);
- } else {
- r = usbfs_get_active_config(handle->dev,
- _device_handle_priv(handle)->fd);
- }
+ r = sysfs_get_active_config(handle->dev, config);
if (r < 0)
return r;
@@ -1312,13 +1283,25 @@ static int op_set_configuration(struct libusb_device_handle *handle, int config)
return LIBUSB_ERROR_OTHER;
}
- /* update our cached active config descriptor */
- priv->active_config = config;
+ if (!sysfs_has_descriptors) {
+ /* update our cached active config descriptor */
+ if (config == -1) {
+ if (priv->config_descriptor) {
+ free(priv->config_descriptor);
+ priv->config_descriptor = NULL;
+ }
+ } else {
+ r = cache_active_config(handle->dev, fd, config);
+ if (r < 0)
+ usbi_warn(HANDLE_CTX(handle),
+ "failed to update cached config descriptor, error %d", r);
+ }
+ }
- return LIBUSB_SUCCESS;
+ return 0;
}
-static int claim_interface(struct libusb_device_handle *handle, int iface)
+static int op_claim_interface(struct libusb_device_handle *handle, int iface)
{
int fd = _device_handle_priv(handle)->fd;
int r = ioctl(fd, IOCTL_USBFS_CLAIMINTF, &iface);
@@ -1337,7 +1320,7 @@ static int claim_interface(struct libusb_device_handle *handle, int iface)
return 0;
}
-static int release_interface(struct libusb_device_handle *handle, int iface)
+static int op_release_interface(struct libusb_device_handle *handle, int iface)
{
int fd = _device_handle_priv(handle)->fd;
int r = ioctl(fd, IOCTL_USBFS_RELEASEINTF, &iface);
@@ -1408,7 +1391,7 @@ static int op_reset_device(struct libusb_device_handle *handle)
getting bound to the in kernel driver if any). */
for (i = 0; i < USB_MAXINTERFACES; i++) {
if (handle->claimed_interfaces & (1L << i)) {
- release_interface(handle, i);
+ op_release_interface(handle, i);
}
}
@@ -1429,18 +1412,11 @@ static int op_reset_device(struct libusb_device_handle *handle)
/* And re-claim any interfaces which were claimed before the reset */
for (i = 0; i < USB_MAXINTERFACES; i++) {
if (handle->claimed_interfaces & (1L << i)) {
- /*
- * A driver may have completed modprobing during
- * IOCTL_USBFS_RESET, and bound itself as soon as
- * IOCTL_USBFS_RESET released the device lock
- */
- r = detach_kernel_driver_and_claim(handle, i);
+ r = op_claim_interface(handle, i);
if (r) {
usbi_warn(HANDLE_CTX(handle),
- "failed to re-claim interface %d after reset: %s",
- i, libusb_error_name(r));
+ "failed to re-claim interface %d after reset", i);
handle->claimed_interfaces &= ~(1L << i);
- ret = LIBUSB_ERROR_NOT_FOUND;
}
}
}
@@ -1469,7 +1445,7 @@ static int op_kernel_driver_active(struct libusb_device_handle *handle,
return LIBUSB_ERROR_OTHER;
}
- return (strcmp(getdrv.driver, "usbfs") == 0) ? 0 : 1;
+ return 1;
}
static int op_detach_kernel_driver(struct libusb_device_handle *handle,
@@ -1477,18 +1453,12 @@ static int op_detach_kernel_driver(struct libusb_device_handle *handle,
{
int fd = _device_handle_priv(handle)->fd;
struct usbfs_ioctl command;
- struct usbfs_getdriver getdrv;
int r;
command.ifno = interface;
command.ioctl_code = IOCTL_USBFS_DISCONNECT;
command.data = NULL;
- getdrv.interface = interface;
- r = ioctl(fd, IOCTL_USBFS_GETDRIVER, &getdrv);
- if (r == 0 && strcmp(getdrv.driver, "usbfs") == 0)
- return LIBUSB_ERROR_NOT_FOUND;
-
r = ioctl(fd, IOCTL_USBFS_IOCTL, &command);
if (r) {
if (errno == ENODATA)
@@ -1538,69 +1508,15 @@ static int op_attach_kernel_driver(struct libusb_device_handle *handle,
return 0;
}
-static int detach_kernel_driver_and_claim(struct libusb_device_handle *handle,
- int interface)
-{
- struct usbfs_disconnect_claim dc;
- int r, fd = _device_handle_priv(handle)->fd;
-
- dc.interface = interface;
- strcpy(dc.driver, "usbfs");
- dc.flags = USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER;
- r = ioctl(fd, IOCTL_USBFS_DISCONNECT_CLAIM, &dc);
- if (r == 0 || (r != 0 && errno != ENOTTY)) {
- if (r == 0)
- return 0;
-
- switch (errno) {
- case EBUSY:
- return LIBUSB_ERROR_BUSY;
- case EINVAL:
- return LIBUSB_ERROR_INVALID_PARAM;
- case ENODEV:
- return LIBUSB_ERROR_NO_DEVICE;
- }
- usbi_err(HANDLE_CTX(handle),
- "disconnect-and-claim failed errno %d", errno);
- return LIBUSB_ERROR_OTHER;
- }
-
- /* Fallback code for kernels which don't support the
- disconnect-and-claim ioctl */
- r = op_detach_kernel_driver(handle, interface);
- if (r != 0 && r != LIBUSB_ERROR_NOT_FOUND)
- return r;
-
- return claim_interface(handle, interface);
-}
-
-static int op_claim_interface(struct libusb_device_handle *handle, int iface)
-{
- if (handle->auto_detach_kernel_driver)
- return detach_kernel_driver_and_claim(handle, iface);
- else
- return claim_interface(handle, iface);
-}
-
-static int op_release_interface(struct libusb_device_handle *handle, int iface)
-{
- int r;
-
- r = release_interface(handle, iface);
- if (r)
- return r;
-
- if (handle->auto_detach_kernel_driver)
- op_attach_kernel_driver(handle, iface);
-
- return 0;
-}
-
static void op_destroy_device(struct libusb_device *dev)
{
struct linux_device_priv *priv = _device_priv(dev);
- if (priv->descriptors)
- free(priv->descriptors);
+ if (!sysfs_has_descriptors) {
+ if (priv->dev_descriptor)
+ free(priv->dev_descriptor);
+ if (priv->config_descriptor)
+ free(priv->config_descriptor);
+ }
if (priv->sysfs_dir)
free(priv->sysfs_dir);
}
@@ -1667,7 +1583,6 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
struct usbfs_urb *urbs;
int is_out = (transfer->endpoint & LIBUSB_ENDPOINT_DIR_MASK)
== LIBUSB_ENDPOINT_OUT;
- int bulk_buffer_len, use_bulk_continuation;
int r;
int i;
size_t alloc_size;
@@ -1675,67 +1590,30 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
if (tpriv->urbs)
return LIBUSB_ERROR_BUSY;
- if (is_out && (transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) &&
- !(dpriv->caps & USBFS_CAP_ZERO_PACKET))
+ if (is_out && transfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET &&
+ !supports_flag_zero_packet)
return LIBUSB_ERROR_NOT_SUPPORTED;
- /*
- * Older versions of usbfs place a 16kb limit on bulk URBs. We work
- * around this by splitting large transfers into 16k blocks, and then
- * submit all urbs at once. it would be simpler to submit one urb at
- * a time, but there is a big performance gain doing it this way.
- *
- * Newer versions lift the 16k limit (USBFS_CAP_NO_PACKET_SIZE_LIM),
- * using arbritary large transfers can still be a bad idea though, as
- * the kernel needs to allocate physical contiguous memory for this,
- * which may fail for large buffers.
- *
- * The kernel solves this problem by splitting the transfer into
- * blocks itself when the host-controller is scatter-gather capable
- * (USBFS_CAP_BULK_SCATTER_GATHER), which most controllers are.
- *
- * Last, there is the issue of short-transfers when splitting, for
- * short split-transfers to work reliable USBFS_CAP_BULK_CONTINUATION
- * is needed, but this is not always available.
- */
- if (dpriv->caps & USBFS_CAP_BULK_SCATTER_GATHER) {
- /* Good! Just submit everything in one go */
- bulk_buffer_len = transfer->length ? transfer->length : 1;
- use_bulk_continuation = 0;
- } else if (dpriv->caps & USBFS_CAP_BULK_CONTINUATION) {
- /* Split the transfers and use bulk-continuation to
- avoid issues with short-transfers */
- bulk_buffer_len = MAX_BULK_BUFFER_LENGTH;
- use_bulk_continuation = 1;
- } else if (dpriv->caps & USBFS_CAP_NO_PACKET_SIZE_LIM) {
- /* Don't split, assume the kernel can alloc the buffer
- (otherwise the submit will fail with -ENOMEM) */
- bulk_buffer_len = transfer->length ? transfer->length : 1;
- use_bulk_continuation = 0;
- } else {
- /* Bad, splitting without bulk-continuation, short transfers
- which end before the last urb will not work reliable! */
- /* Note we don't warn here as this is "normal" on kernels <
- 2.6.32 and not a problem for most applications */
- bulk_buffer_len = MAX_BULK_BUFFER_LENGTH;
- use_bulk_continuation = 0;
- }
-
- int num_urbs = transfer->length / bulk_buffer_len;
+ /* usbfs places a 16kb limit on bulk URBs. we divide up larger requests
+ * into smaller units to meet such restriction, then fire off all the
+ * units at once. it would be simpler if we just fired one unit at a time,
+ * but there is a big performance gain through doing it this way. */
+ int num_urbs = transfer->length / MAX_BULK_BUFFER_LENGTH;
int last_urb_partial = 0;
if (transfer->length == 0) {
num_urbs = 1;
- } else if ((transfer->length % bulk_buffer_len) > 0) {
+ } else if ((transfer->length % MAX_BULK_BUFFER_LENGTH) > 0) {
last_urb_partial = 1;
num_urbs++;
}
usbi_dbg("need %d urbs for new transfer with length %d", num_urbs,
transfer->length);
alloc_size = num_urbs * sizeof(struct usbfs_urb);
- urbs = calloc(1, alloc_size);
+ urbs = malloc(alloc_size);
if (!urbs)
return LIBUSB_ERROR_NO_MEM;
+ memset(urbs, 0, alloc_size);
tpriv->urbs = urbs;
tpriv->num_urbs = num_urbs;
tpriv->num_retired = 0;
@@ -1747,18 +1625,17 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
urb->usercontext = itransfer;
urb->type = urb_type;
urb->endpoint = transfer->endpoint;
- urb->buffer = transfer->buffer + (i * bulk_buffer_len);
- /* don't set the short not ok flag for the last URB */
- if (use_bulk_continuation && !is_out && (i < num_urbs - 1))
+ urb->buffer = transfer->buffer + (i * MAX_BULK_BUFFER_LENGTH);
+ if (supports_flag_bulk_continuation && !is_out)
urb->flags = USBFS_URB_SHORT_NOT_OK;
if (i == num_urbs - 1 && last_urb_partial)
- urb->buffer_length = transfer->length % bulk_buffer_len;
+ urb->buffer_length = transfer->length % MAX_BULK_BUFFER_LENGTH;
else if (transfer->length == 0)
urb->buffer_length = 0;
else
- urb->buffer_length = bulk_buffer_len;
+ urb->buffer_length = MAX_BULK_BUFFER_LENGTH;
- if (i > 0 && use_bulk_continuation)
+ if (i > 0 && supports_flag_bulk_continuation)
urb->flags |= USBFS_URB_BULK_CONTINUATION;
/* we have already checked that the flag is supported */
@@ -1790,7 +1667,7 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer,
* complications:
* - discarding is asynchronous - discarded urbs will be reaped
* later. the user must not have freed the transfer when the
- * discarded URBs are reaped, otherwise libusbx will be using
+ * discarded URBs are reaped, otherwise libusb will be using
* freed memory.
* - the earlier URBs may have completed successfully and we do
* not want to throw away any data.
@@ -1845,17 +1722,11 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
/* usbfs places a 32kb limit on iso URBs. we divide up larger requests
* into smaller units to meet such restriction, then fire off all the
* units at once. it would be simpler if we just fired one unit at a time,
- * but there is a big performance gain through doing it this way.
- *
- * Newer kernels lift the 32k limit (USBFS_CAP_NO_PACKET_SIZE_LIM),
- * using arbritary large transfers is still be a bad idea though, as
- * the kernel needs to allocate physical contiguous memory for this,
- * which may fail for large buffers.
- */
+ * but there is a big performance gain through doing it this way. */
/* calculate how many URBs we need */
for (i = 0; i < num_packets; i++) {
- unsigned int space_remaining = MAX_ISO_BUFFER_LENGTH - this_urb_len;
+ int space_remaining = MAX_ISO_BUFFER_LENGTH - this_urb_len;
packet_len = transfer->iso_packet_desc[i].length;
if (packet_len > space_remaining) {
@@ -1868,9 +1739,10 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
usbi_dbg("need %d 32k URBs for transfer", num_urbs);
alloc_size = num_urbs * sizeof(*urbs);
- urbs = calloc(1, alloc_size);
+ urbs = malloc(alloc_size);
if (!urbs)
return LIBUSB_ERROR_NO_MEM;
+ memset(urbs, 0, alloc_size);
tpriv->iso_urbs = urbs;
tpriv->num_urbs = num_urbs;
@@ -1881,7 +1753,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
/* allocate + initialize each URB with the correct number of packets */
for (i = 0; i < num_urbs; i++) {
struct usbfs_urb *urb;
- unsigned int space_remaining_in_urb = MAX_ISO_BUFFER_LENGTH;
+ int space_remaining_in_urb = MAX_ISO_BUFFER_LENGTH;
int urb_packet_offset = 0;
unsigned char *urb_buffer_orig = urb_buffer;
int j;
@@ -1904,11 +1776,12 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
alloc_size = sizeof(*urb)
+ (urb_packet_offset * sizeof(struct usbfs_iso_packet_desc));
- urb = calloc(1, alloc_size);
+ urb = malloc(alloc_size);
if (!urb) {
free_iso_urbs(tpriv);
return LIBUSB_ERROR_NO_MEM;
}
+ memset(urb, 0, alloc_size);
urbs[i] = urb;
/* populate packet lengths */
@@ -1952,7 +1825,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
* complications:
* - discarding is asynchronous - discarded urbs will be reaped
* later. the user must not have freed the transfer when the
- * discarded URBs are reaped, otherwise libusbx will be using
+ * discarded URBs are reaped, otherwise libusb will be using
* freed memory.
* - the earlier URBs may have completed successfully and we do
* not want to throw away any data.
@@ -1992,9 +1865,10 @@ static int submit_control_transfer(struct usbi_transfer *itransfer)
if (transfer->length - LIBUSB_CONTROL_SETUP_SIZE > MAX_CTRL_BUFFER_LENGTH)
return LIBUSB_ERROR_INVALID_PARAM;
- urb = calloc(1, sizeof(struct usbfs_urb));
+ urb = malloc(sizeof(struct usbfs_urb));
if (!urb)
return LIBUSB_ERROR_NO_MEM;
+ memset(urb, 0, sizeof(struct usbfs_urb));
tpriv->urbs = urb;
tpriv->num_urbs = 1;
tpriv->reap_action = NORMAL;
@@ -2127,7 +2001,7 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer,
*
* When this happens, our objectives are not to lose any "surplus" data,
* and also to stick it at the end of the previously-received data
- * (closing any holes), so that libusbx reports the total amount of
+ * (closing any holes), so that libusb reports the total amount of
* transferred data and presents it in a contiguous chunk.
*/
if (urb->actual_length > 0) {
@@ -2461,7 +2335,7 @@ static int op_handle_events(struct libusb_context *ctx,
struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready)
{
int r;
- unsigned int i = 0;
+ int i = 0;
usbi_mutex_lock(&ctx->open_devs_lock);
for (i = 0; i < nfds && num_ready > 0; i++) {
@@ -2485,9 +2359,7 @@ static int op_handle_events(struct libusb_context *ctx,
continue;
}
- do {
- r = reap_for_handle(handle);
- } while (r == 0);
+ r = reap_for_handle(handle);
if (r == 1 || r == LIBUSB_ERROR_NO_DEVICE)
continue;
else if (r < 0)
@@ -2522,15 +2394,12 @@ static clockid_t op_get_timerfd_clockid(void)
const struct usbi_os_backend linux_usbfs_backend = {
.name = "Linux usbfs",
- .caps = USBI_CAP_HAS_HID_ACCESS|USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER,
.init = op_init,
- .exit = op_exit,
- .get_device_list = NULL,
- .hotplug_poll = op_hotplug_poll,
+ .exit = NULL,
+ .get_device_list = op_get_device_list,
.get_device_descriptor = op_get_device_descriptor,
.get_active_config_descriptor = op_get_active_config_descriptor,
.get_config_descriptor = op_get_config_descriptor,
- .get_config_descriptor_by_value = op_get_config_descriptor_by_value,
.open = op_open,
.close = op_close,
@@ -2566,3 +2435,4 @@ const struct usbi_os_backend linux_usbfs_backend = {
.transfer_priv_size = sizeof(struct linux_transfer_priv),
.add_iso_packet_size = 0,
};
+
diff --git a/third_party/libusb/src/libusb/os/linux_usbfs.h b/third_party/libusb/src/libusb/os/linux_usbfs.h
index 499bab7..487acb5 100644
--- a/third_party/libusb/src/libusb/os/linux_usbfs.h
+++ b/third_party/libusb/src/libusb/os/linux_usbfs.h
@@ -1,7 +1,7 @@
/*
* usbfs header structures
- * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
- * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
+ * Copyright (C) 2007 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
@@ -21,8 +21,6 @@
#ifndef LIBUSB_USBFS_H
#define LIBUSB_USBFS_H
-#include <linux/types.h>
-
#define SYSFS_DEVICE_PATH "/sys/bus/usb/devices"
struct usbfs_ctrltransfer {
@@ -118,20 +116,6 @@ struct usbfs_hub_portinfo {
unsigned char port[127]; /* port to device num mapping */
};
-#define USBFS_CAP_ZERO_PACKET 0x01
-#define USBFS_CAP_BULK_CONTINUATION 0x02
-#define USBFS_CAP_NO_PACKET_SIZE_LIM 0x04
-#define USBFS_CAP_BULK_SCATTER_GATHER 0x08
-
-#define USBFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
-#define USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
-
-struct usbfs_disconnect_claim {
- unsigned int interface;
- unsigned int flags;
- char driver[USBFS_MAXDRIVERNAME + 1];
-};
-
#define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer)
#define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer)
#define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int)
@@ -151,31 +135,5 @@ struct usbfs_disconnect_claim {
#define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int)
#define IOCTL_USBFS_DISCONNECT _IO('U', 22)
#define IOCTL_USBFS_CONNECT _IO('U', 23)
-#define IOCTL_USBFS_CLAIM_PORT _IOR('U', 24, unsigned int)
-#define IOCTL_USBFS_RELEASE_PORT _IOR('U', 25, unsigned int)
-#define IOCTL_USBFS_GET_CAPABILITIES _IOR('U', 26, __u32)
-#define IOCTL_USBFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbfs_disconnect_claim)
-
-extern usbi_mutex_static_t linux_hotplug_lock;
-
-#if defined(HAVE_LIBUDEV)
-int linux_udev_start_event_monitor(void);
-int linux_udev_stop_event_monitor(void);
-int linux_udev_scan_devices(struct libusb_context *ctx);
-void linux_udev_hotplug_poll(void);
-#else
-int linux_netlink_start_event_monitor(void);
-int linux_netlink_stop_event_monitor(void);
-void linux_netlink_hotplug_poll(void);
-#endif
-
-void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_name);
-void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name);
-
-int linux_get_device_address (struct libusb_context *ctx, int detached,
- uint8_t *busnum, uint8_t *devaddr, const char *dev_node,
- const char *sys_name);
-int linux_enumerate_device(struct libusb_context *ctx,
- uint8_t busnum, uint8_t devaddr, const char *sysfs_dir);
#endif
diff --git a/third_party/libusb/src/libusb/os/openbsd_usb.c b/third_party/libusb/src/libusb/os/openbsd_usb.c
index f4fd454..e31941b 100644
--- a/third_party/libusb/src/libusb/os/openbsd_usb.c
+++ b/third_party/libusb/src/libusb/os/openbsd_usb.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2011 Martin Pieuchot <mpi@openbsd.org>
+ * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -89,18 +89,15 @@ static int _access_endpoint(struct libusb_transfer *);
const struct usbi_os_backend openbsd_backend = {
"Synchronous OpenBSD backend",
- 0,
NULL, /* init() */
NULL, /* exit() */
obsd_get_device_list,
- NULL, /* hotplug_poll */
obsd_open,
obsd_close,
obsd_get_device_descriptor,
obsd_get_active_config_descriptor,
obsd_get_config_descriptor,
- NULL, /* get_config_descriptor_by_value() */
obsd_get_configuration,
obsd_set_configuration,
@@ -161,9 +158,7 @@ obsd_get_device_list(struct libusb_context * ctx,
session_id = (di.udi_bus << 8 | di.udi_addr);
dev = usbi_get_device_by_session_id(ctx, session_id);
- if (dev) {
- dev = libusb_ref_device(dev);
- } else {
+ if (dev == NULL) {
dev = usbi_alloc_device(ctx, session_id);
if (dev == NULL)
return (LIBUSB_ERROR_NO_MEM);
@@ -194,8 +189,6 @@ obsd_get_device_list(struct libusb_context * ctx,
if (discovered_devs_append(*discdevs, dev) == NULL)
return (LIBUSB_ERROR_NO_MEM);
-
- libusb_unref_device(dev);
}
return (LIBUSB_SUCCESS);
@@ -275,7 +268,7 @@ obsd_get_active_config_descriptor(struct libusb_device *dev,
*host_endian = 0;
- return len;
+ return (LIBUSB_SUCCESS);
}
int
@@ -313,7 +306,7 @@ obsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
*host_endian = 0;
- return len;
+ return (LIBUSB_SUCCESS);
}
int
@@ -641,7 +634,7 @@ _sync_control_transfer(struct usbi_transfer *itransfer)
req.ucr_request.bmRequestType = setup->bmRequestType;
req.ucr_request.bRequest = setup->bRequest;
- /* Don't use USETW, libusbx already deals with the endianness */
+ /* Don't use USETW, libusb already deals with the endianness */
(*(uint16_t *)req.ucr_request.wValue) = setup->wValue;
(*(uint16_t *)req.ucr_request.wIndex) = setup->wIndex;
(*(uint16_t *)req.ucr_request.wLength) = setup->wLength;
diff --git a/third_party/libusb/src/libusb/os/poll_posix.c b/third_party/libusb/src/libusb/os/poll_posix.c
deleted file mode 100644
index eeaf5dc..0000000
--- a/third_party/libusb/src/libusb/os/poll_posix.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * poll_posix: poll compatibility wrapper for POSIX systems
- * Copyright © 2013 RealVNC Ltd.
- *
- * 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
- *
- */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "libusbi.h"
-
-int usbi_pipe(int pipefd[2])
-{
- int ret = pipe(pipefd);
- if (ret != 0) {
- return ret;
- }
- ret = fcntl(pipefd[1], F_GETFL);
- if (ret == -1) {
- usbi_dbg("Failed to get pipe fd flags: %d", errno);
- goto err_close_pipe;
- }
- ret = fcntl(pipefd[1], F_SETFL, ret | O_NONBLOCK);
- if (ret != 0) {
- usbi_dbg("Failed to set non-blocking on new pipe: %d", errno);
- goto err_close_pipe;
- }
-
- return 0;
-
-err_close_pipe:
- usbi_close(pipefd[0]);
- usbi_close(pipefd[1]);
- return ret;
-}
diff --git a/third_party/libusb/src/libusb/os/poll_posix.h b/third_party/libusb/src/libusb/os/poll_posix.h
index 5b4b2c9..0e5e7f5b 100644
--- a/third_party/libusb/src/libusb/os/poll_posix.h
+++ b/third_party/libusb/src/libusb/os/poll_posix.h
@@ -4,8 +4,7 @@
#define usbi_write write
#define usbi_read read
#define usbi_close close
+#define usbi_pipe pipe
#define usbi_poll poll
-int usbi_pipe(int pipefd[2]);
-
#endif /* LIBUSB_POLL_POSIX_H */
diff --git a/third_party/libusb/src/libusb/os/poll_windows.c b/third_party/libusb/src/libusb/os/poll_windows.c
index 7ed19ba..7f4d9c4 100644
--- a/third_party/libusb/src/libusb/os/poll_windows.c
+++ b/third_party/libusb/src/libusb/os/poll_windows.c
@@ -1,7 +1,6 @@
/*
* poll_windows: poll compatibility wrapper for Windows
- * Copyright © 2012-2013 RealVNC Ltd.
- * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
+ * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
@@ -22,7 +21,7 @@
*/
/*
- * poll() and pipe() Windows compatibility layer for libusbx 1.0
+ * poll() and pipe() Windows compatibility layer for libusb 1.0
*
* The way this layer works is by using OVERLAPPED with async I/O transfers, as
* OVERLAPPED have an associated event which is flagged for I/O completion.
@@ -32,7 +31,7 @@
* OVERLAPPED mode
* - call usbi_create_fd with this handle to obtain a custom fd.
* Note that if you need simultaneous R/W access, you need to call create_fd
- * twice, once in RW_READ and once in RW_WRITE mode to obtain 2 separate
+ * twice, once in _O_RDONLY and once in _O_WRONLY mode to obtain 2 separate
* pollable fds
* - leave the core functions call the poll routine and flag POLLIN/POLLOUT
*
@@ -41,10 +40,12 @@
* context.
*/
#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <io.h>
-#include "libusbi.h"
+#include <libusbi.h>
// Uncomment to debug the polling layer
//#define DEBUG_POLL_WINDOWS
@@ -52,8 +53,8 @@
#define poll_dbg usbi_dbg
#else
// MSVC++ < 2005 cannot use a variadic argument and non MSVC
-// compilers produce warnings if parenthesis are ommitted.
-#if defined(_MSC_VER) && (_MSC_VER < 1400)
+// compilers produce warnings if parenthesis are omitted.
+#if defined(_MSC_VER) && _MSC_VER < 1400
#define poll_dbg
#else
#define poll_dbg(...)
@@ -64,10 +65,20 @@
#pragma warning(disable:28719)
#endif
+#if defined(__CYGWIN__)
+// cygwin produces a warning unless these prototypes are defined
+extern int _open(char* name, int flags);
+extern int _close(int fd);
+extern int _snprintf(char *buffer, size_t count, const char *format, ...);
+#define NUL_DEVICE "/dev/null"
+#else
+#define NUL_DEVICE "NUL"
+#endif
+
#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
// public fd data
-const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, NULL, NULL, RW_NONE};
+const struct winfd INVALID_WINFD = {-1, INVALID_HANDLE_VALUE, NULL, RW_NONE};
struct winfd poll_fd[MAX_FDS];
// internal fd data
struct {
@@ -82,25 +93,12 @@ BOOLEAN is_polling_set = FALSE;
LONG pipe_number = 0;
static volatile LONG compat_spinlock = 0;
-#if !defined(_WIN32_WCE)
// CancelIoEx, available on Vista and later only, provides the ability to cancel
// a single transfer (OVERLAPPED) when used. As it may not be part of any of the
// platform headers, we hook into the Kernel32 system DLL directly to seek it.
static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL;
-#define Use_Duplicate_Handles (pCancelIoEx == NULL)
-
-static inline void setup_cancel_io(void)
-{
- HMODULE hKernel32 = GetModuleHandleA("KERNEL32");
- if (hKernel32 != NULL) {
- pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
- GetProcAddress(hKernel32, "CancelIoEx");
- }
- usbi_dbg("Will use CancelIo%s for I/O cancellation",
- Use_Duplicate_Handles?"":"Ex");
-}
-
-static inline BOOL cancel_io(int _index)
+#define CancelIoEx_Available (pCancelIoEx != NULL)
+static __inline BOOL cancel_io(int _index)
{
if ((_index < 0) || (_index >= MAX_FDS)) {
return FALSE;
@@ -110,12 +108,7 @@ static inline BOOL cancel_io(int _index)
|| (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
return TRUE;
}
- if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
- // Cancel outstanding transfer via the specific callback
- (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
- return TRUE;
- }
- if (pCancelIoEx != NULL) {
+ if (CancelIoEx_Available) {
return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped);
}
if (_poll_fd[_index].thread_id == GetCurrentThreadId()) {
@@ -124,30 +117,6 @@ static inline BOOL cancel_io(int _index)
usbi_warn(NULL, "Unable to cancel I/O that was started from another thread");
return FALSE;
}
-#else
-#define Use_Duplicate_Handles FALSE
-
-static __inline void setup_cancel_io()
-{
- // No setup needed on WinCE
-}
-
-static __inline BOOL cancel_io(int _index)
-{
- if ((_index < 0) || (_index >= MAX_FDS)) {
- return FALSE;
- }
- if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
- || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
- return TRUE;
- }
- if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
- // Cancel outstanding transfer via the specific callback
- (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
- }
- return TRUE;
-}
-#endif
// Init
void init_polling(void)
@@ -158,7 +127,10 @@ void init_polling(void)
SleepEx(0, TRUE);
}
if (!is_polling_set) {
- setup_cancel_io();
+ pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED))
+ GetProcAddress(GetModuleHandleA("KERNEL32"), "CancelIoEx");
+ usbi_dbg("Will use CancelIo%s for I/O cancellation",
+ CancelIoEx_Available?"Ex":"");
for (i=0; i<MAX_FDS; i++) {
poll_fd[i] = INVALID_WINFD;
_poll_fd[i].original_handle = INVALID_HANDLE_VALUE;
@@ -167,15 +139,15 @@ void init_polling(void)
}
is_polling_set = TRUE;
}
- InterlockedExchange((LONG *)&compat_spinlock, 0);
+ compat_spinlock = 0;
}
// Internal function to retrieve the table index (and lock the fd mutex)
-static int _fd_to_index_and_lock(int fd)
+int _fd_to_index_and_lock(int fd)
{
int i;
- if (fd < 0)
+ if (fd <= 0)
return -1;
for (i=0; i<MAX_FDS; i++) {
@@ -192,7 +164,7 @@ static int _fd_to_index_and_lock(int fd)
return -1;
}
-static OVERLAPPED *create_overlapped(void)
+OVERLAPPED *create_overlapped(void)
{
OVERLAPPED *overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
@@ -206,7 +178,7 @@ static OVERLAPPED *create_overlapped(void)
return overlapped;
}
-static void free_overlapped(OVERLAPPED *overlapped)
+void free_overlapped(OVERLAPPED *overlapped)
{
if (overlapped == NULL)
return;
@@ -218,6 +190,20 @@ static void free_overlapped(OVERLAPPED *overlapped)
free(overlapped);
}
+void reset_overlapped(OVERLAPPED *overlapped)
+{
+ HANDLE event_handle;
+ if (overlapped == NULL)
+ return;
+
+ event_handle = overlapped->hEvent;
+ if (event_handle != NULL) {
+ ResetEvent(event_handle);
+ }
+ memset(overlapped, 0, sizeof(OVERLAPPED));
+ overlapped->hEvent = event_handle;
+}
+
void exit_polling(void)
{
int i;
@@ -235,8 +221,12 @@ void exit_polling(void)
// terminating, and we should be able to access the fd
// mutex lock before too long
EnterCriticalSection(&_poll_fd[i].mutex);
+ if ( (poll_fd[i].fd > 0) && (poll_fd[i].handle != INVALID_HANDLE_VALUE) && (poll_fd[i].handle != 0)
+ && (GetFileType(poll_fd[i].handle) == FILE_TYPE_UNKNOWN) ) {
+ _close(poll_fd[i].fd);
+ }
free_overlapped(poll_fd[i].overlapped);
- if (Use_Duplicate_Handles) {
+ if (!CancelIoEx_Available) {
// Close duplicate handle
if (_poll_fd[i].original_handle != INVALID_HANDLE_VALUE) {
CloseHandle(poll_fd[i].handle);
@@ -247,12 +237,12 @@ void exit_polling(void)
DeleteCriticalSection(&_poll_fd[i].mutex);
}
}
- InterlockedExchange((LONG *)&compat_spinlock, 0);
+ compat_spinlock = 0;
}
/*
* Create a fake pipe.
- * As libusbx only uses pipes for signaling, all we need from a pipe is an
+ * As libusb only uses pipes for signaling, all we need from a pipe is an
* event. To that extent, we create a single wfd and overlapped as a means
* to access that event.
*/
@@ -263,8 +253,7 @@ int usbi_pipe(int filedes[2])
CHECK_INIT_POLLING;
- overlapped = create_overlapped();
-
+ overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
return -1;
}
@@ -272,6 +261,22 @@ int usbi_pipe(int filedes[2])
overlapped->Internal = STATUS_PENDING;
overlapped->InternalHigh = 0;
+ // Read end of the "pipe"
+ filedes[0] = _open(NUL_DEVICE, _O_WRONLY);
+ if (filedes[0] < 0) {
+ usbi_err(NULL, "could not create pipe: errno %d", errno);
+ goto out1;
+ }
+ // We can use the same handle for both ends
+ filedes[1] = filedes[0];
+ poll_dbg("pipe filedes = %d", filedes[0]);
+
+ // Note: manual reset must be true (second param) as the reset occurs in read
+ overlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if(!overlapped->hEvent) {
+ goto out2;
+ }
+
for (i=0; i<MAX_FDS; i++) {
if (poll_fd[i].fd < 0) {
EnterCriticalSection(&_poll_fd[i].mutex);
@@ -281,13 +286,7 @@ int usbi_pipe(int filedes[2])
continue;
}
- // Use index as the unique fd number
- poll_fd[i].fd = i;
- // Read end of the "pipe"
- filedes[0] = poll_fd[i].fd;
- // We can use the same handle for both ends
- filedes[1] = filedes[0];
-
+ poll_fd[i].fd = filedes[0];
poll_fd[i].handle = DUMMY_HANDLE;
poll_fd[i].overlapped = overlapped;
// There's no polling on the write end, so we just use READ for our needs
@@ -297,7 +296,12 @@ int usbi_pipe(int filedes[2])
return 0;
}
}
- free_overlapped(overlapped);
+
+ CloseHandle(overlapped->hEvent);
+out2:
+ _close(filedes[0]);
+out1:
+ free(overlapped);
return -1;
}
@@ -315,9 +319,9 @@ int usbi_pipe(int filedes[2])
* read and one for write. Using a single R/W fd is unsupported and will
* produce unexpected results
*/
-struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer *itransfer, cancel_transfer *cancel_fn)
+struct winfd usbi_create_fd(HANDLE handle, int access_mode)
{
- int i;
+ int i, fd;
struct winfd wfd = INVALID_WINFD;
OVERLAPPED* overlapped = NULL;
@@ -327,22 +331,27 @@ struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer
return INVALID_WINFD;
}
- wfd.itransfer = itransfer;
- wfd.cancel_fn = cancel_fn;
-
- if ((access_mode != RW_READ) && (access_mode != RW_WRITE)) {
- usbi_warn(NULL, "only one of RW_READ or RW_WRITE are supported.\n"
+ if ((access_mode != _O_RDONLY) && (access_mode != _O_WRONLY)) {
+ usbi_warn(NULL, "only one of _O_RDONLY or _O_WRONLY are supported.\n"
"If you want to poll for R/W simultaneously, create multiple fds from the same handle.");
return INVALID_WINFD;
}
- if (access_mode == RW_READ) {
+ if (access_mode == _O_RDONLY) {
wfd.rw = RW_READ;
} else {
wfd.rw = RW_WRITE;
}
+ // Ensure that we get a non system conflicting unique fd, using
+ // the same fd attribution system as the pipe ends
+ fd = _open(NUL_DEVICE, _O_WRONLY);
+ if (fd < 0) {
+ return INVALID_WINFD;
+ }
+
overlapped = create_overlapped();
if(overlapped == NULL) {
+ _close(fd);
return INVALID_WINFD;
}
@@ -354,11 +363,10 @@ struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer
LeaveCriticalSection(&_poll_fd[i].mutex);
continue;
}
- // Use index as the unique fd number
- wfd.fd = i;
+ wfd.fd = fd;
// Attempt to emulate some of the CancelIoEx behaviour on platforms
// that don't have it
- if (Use_Duplicate_Handles) {
+ if (!CancelIoEx_Available) {
_poll_fd[i].thread_id = GetCurrentThreadId();
if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(),
&wfd.handle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
@@ -379,15 +387,21 @@ struct winfd usbi_create_fd(HANDLE handle, int access_mode, struct usbi_transfer
}
}
free_overlapped(overlapped);
+ _close(fd);
return INVALID_WINFD;
}
-static void _free_index(int _index)
+void _free_index(int _index)
{
// Cancel any async IO (Don't care about the validity of our handles for this)
cancel_io(_index);
+ // close fake handle for devices
+ if ( (poll_fd[_index].handle != INVALID_HANDLE_VALUE) && (poll_fd[_index].handle != 0)
+ && (GetFileType(poll_fd[_index].handle) == FILE_TYPE_UNKNOWN) ) {
+ _close(poll_fd[_index].fd);
+ }
// close the duplicate handle (if we have an actual duplicate)
- if (Use_Duplicate_Handles) {
+ if (!CancelIoEx_Available) {
if (_poll_fd[_index].original_handle != INVALID_HANDLE_VALUE) {
CloseHandle(poll_fd[_index].handle);
}
@@ -403,18 +417,17 @@ static void _free_index(int _index)
*
* Note that the associated Windows handle is not closed by this call
*/
-void usbi_free_fd(struct winfd *wfd)
+void usbi_free_fd(int fd)
{
int _index;
CHECK_INIT_POLLING;
- _index = _fd_to_index_and_lock(wfd->fd);
+ _index = _fd_to_index_and_lock(fd);
if (_index < 0) {
return;
}
_free_index(_index);
- *wfd = INVALID_WINFD;
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
@@ -638,7 +651,15 @@ int usbi_close(int fd)
if (_index < 0) {
errno = EBADF;
} else {
- free_overlapped(poll_fd[_index].overlapped);
+ if (poll_fd[_index].overlapped != NULL) {
+ // Must be a different event for each end of the pipe
+ CloseHandle(poll_fd[_index].overlapped->hEvent);
+ free(poll_fd[_index].overlapped);
+ }
+ r = _close(poll_fd[_index].fd);
+ if (r != 0) {
+ errno = EIO;
+ }
poll_fd[_index] = INVALID_WINFD;
LeaveCriticalSection(&_poll_fd[_index].mutex);
}
@@ -651,7 +672,6 @@ int usbi_close(int fd)
ssize_t usbi_write(int fd, const void *buf, size_t count)
{
int _index;
- UNUSED(buf);
CHECK_INIT_POLLING;
@@ -688,7 +708,6 @@ ssize_t usbi_read(int fd, void *buf, size_t count)
{
int _index;
ssize_t r = -1;
- UNUSED(buf);
CHECK_INIT_POLLING;
diff --git a/third_party/libusb/src/libusb/os/poll_windows.h b/third_party/libusb/src/libusb/os/poll_windows.h
index deed206..6e5bf2b 100644
--- a/third_party/libusb/src/libusb/os/poll_windows.h
+++ b/third_party/libusb/src/libusb/os/poll_windows.h
@@ -1,7 +1,6 @@
/*
* Windows compat: POSIX compatibility wrapper
- * Copyright © 2012-2013 RealVNC Ltd.
- * Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
+ * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
*
@@ -32,17 +31,12 @@
#define STATUS_REPARSE ((LONG)0x00000104L)
#endif
#define STATUS_COMPLETED_SYNCHRONOUSLY STATUS_REPARSE
-#if defined(_WIN32_WCE)
-// WinCE doesn't have a HasOverlappedIoCompleted() macro, so attempt to emulate it
-#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) != STATUS_PENDING)
-#endif
#define HasOverlappedIoCompletedSync(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) == STATUS_COMPLETED_SYNCHRONOUSLY)
#define DUMMY_HANDLE ((HANDLE)(LONG_PTR)-2)
enum windows_version {
WINDOWS_UNSUPPORTED,
- WINDOWS_CE,
WINDOWS_XP,
WINDOWS_2003, // also includes XP 64
WINDOWS_VISTA_AND_LATER,
@@ -72,14 +66,10 @@ enum rw_type {
};
// fd struct that can be used for polling on Windows
-typedef int cancel_transfer(struct usbi_transfer *itransfer);
-
struct winfd {
int fd; // what's exposed to libusb core
HANDLE handle; // what we need to attach overlapped to the I/O op, so we can poll it
OVERLAPPED* overlapped; // what will report our I/O status
- struct usbi_transfer *itransfer; // Associated transfer, or NULL if completed
- cancel_transfer *cancel_fn; // Function pointer to cancel transfer API
enum rw_type rw; // I/O transfer direction: read *XOR* write (NOT BOTH)
};
extern const struct winfd INVALID_WINFD;
@@ -92,9 +82,8 @@ int usbi_close(int fd);
void init_polling(void);
void exit_polling(void);
-struct winfd usbi_create_fd(HANDLE handle, int access_mode,
- struct usbi_transfer *transfer, cancel_transfer *cancel_fn);
-void usbi_free_fd(struct winfd* winfd);
+struct winfd usbi_create_fd(HANDLE handle, int access_mode);
+void usbi_free_fd(int fd);
struct winfd fd_to_winfd(int fd);
struct winfd handle_to_winfd(HANDLE handle);
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped);
@@ -123,3 +112,4 @@ do { \
} \
} while (0)
#endif
+
diff --git a/third_party/libusb/src/libusb/os/threads_posix.c b/third_party/libusb/src/libusb/os/threads_posix.c
index 46f6db7..60c57cf 100644
--- a/third_party/libusb/src/libusb/os/threads_posix.c
+++ b/third_party/libusb/src/libusb/os/threads_posix.c
@@ -1,8 +1,8 @@
/*
- * libusbx synchronization using POSIX Threads
+ * libusb synchronization using POSIX Threads
*
- * Copyright © 2011 Vitali Lovich <vlovich@aliph.com>
- * Copyright © 2011 Peter Stuge <peter@stuge.se>
+ * Copyright (C) 2011 Vitali Lovich <vlovich@aliph.com>
+ * Copyright (C) 2011 Peter Stuge <peter@stuge.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,14 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__linux__) || defined(__OpenBSD__)
-# include <unistd.h>
-# include <sys/syscall.h>
-#elif defined(__APPLE__)
-# include <mach/mach.h>
-#elif defined(__CYGWIN__)
-# include <windows.h>
-#endif
+#ifdef _XOPEN_SOURCE
+# if _XOPEN_SOURCE < 500
+# undef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500
+# endif
+#else
+#define _XOPEN_SOURCE 500
+#endif /* _XOPEN_SOURCE */
#include "threads_posix.h"
@@ -41,7 +41,6 @@ int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
return err;
}
- /* mutexattr_settype requires _GNU_SOURCE or _XOPEN_SOURCE >= 500 on Linux */
err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
if (err != 0)
goto finish;
@@ -54,22 +53,3 @@ finish:
return err;
}
-
-int usbi_get_tid(void)
-{
- int ret = -1;
-#if defined(__linux__)
- ret = syscall(SYS_gettid);
-#elif defined(__OpenBSD__)
- /* The following only works with OpenBSD > 5.1 as it requires
- real thread support. For 5.1 and earlier, -1 is returned. */
- ret = syscall(SYS_getthrid);
-#elif defined(__APPLE__)
- ret = mach_thread_self();
- mach_port_deallocate(mach_task_self(), ret);
-#elif defined(__CYGWIN__)
- ret = GetCurrentThreadId();
-#endif
-/* TODO: NetBSD thread ID support */
- return ret;
-}
diff --git a/third_party/libusb/src/libusb/os/threads_posix.h b/third_party/libusb/src/libusb/os/threads_posix.h
index 0b6a71a..9752208 100644
--- a/third_party/libusb/src/libusb/os/threads_posix.h
+++ b/third_party/libusb/src/libusb/os/threads_posix.h
@@ -1,7 +1,7 @@
/*
- * libusbx synchronization using POSIX Threads
+ * libusb synchronization using POSIX Threads
*
- * Copyright © 2010 Peter Stuge <peter@stuge.se>
+ * Copyright (C) 2010 Peter Stuge <peter@stuge.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -45,6 +45,4 @@
extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
-int usbi_get_tid(void);
-
#endif /* LIBUSB_THREADS_POSIX_H */
diff --git a/third_party/libusb/src/libusb/os/threads_windows.c b/third_party/libusb/src/libusb/os/threads_windows.c
index cad27e9..1394bb0 100644
--- a/third_party/libusb/src/libusb/os/threads_windows.c
+++ b/third_party/libusb/src/libusb/os/threads_windows.c
@@ -1,7 +1,7 @@
/*
- * libusbx synchronization on Microsoft Windows
+ * libusb synchronization on Microsoft Windows
*
- * Copyright © 2010 Michael Plante <michael.plante@gmail.com>
+ * Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,11 +25,9 @@
#include "libusbi.h"
-extern const uint64_t epoch_time;
int usbi_mutex_init(usbi_mutex_t *mutex,
const usbi_mutexattr_t *attr) {
- UNUSED(attr);
if(! mutex) return ((errno=EINVAL));
*mutex = CreateMutex(NULL, FALSE, NULL);
if(!*mutex) return ((errno=ENOMEM));
@@ -81,9 +79,10 @@ int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
return 0;
}
+
+
int usbi_cond_init(usbi_cond_t *cond,
const usbi_condattr_t *attr) {
- UNUSED(attr);
if(!cond) return ((errno=EINVAL));
list_init(&cond->waiters );
list_init(&cond->not_waiting);
@@ -91,14 +90,15 @@ int usbi_cond_init(usbi_cond_t *cond,
}
int usbi_cond_destroy(usbi_cond_t *cond) {
// This assumes no one is using this anymore. The check MAY NOT BE safe.
- struct usbi_cond_perthread *pos, *next_pos = NULL;
+ struct usbi_cond_perthread *pos, *prev_pos = NULL;
if(!cond) return ((errno=EINVAL));
if(!list_empty(&cond->waiters)) return ((errno=EBUSY )); // (!see above!)
- list_for_each_entry_safe(pos, next_pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
- CloseHandle(pos->event);
+ list_for_each_entry(pos, &cond->not_waiting, list, struct usbi_cond_perthread) {
+ free(prev_pos);
list_del(&pos->list);
- free(pos);
+ prev_pos = pos;
}
+ free(prev_pos);
return 0;
}
@@ -128,7 +128,7 @@ int usbi_cond_signal(usbi_cond_t *cond) {
// The wait function will remove its respective item from the list.
return SetEvent(pos->event) ? 0 : ((errno=EINVAL));
}
-__inline static int usbi_cond_intwait(usbi_cond_t *cond,
+static int __inline usbi_cond_intwait(usbi_cond_t *cond,
usbi_mutex_t *mutex,
DWORD timeout_ms) {
struct usbi_cond_perthread *pos;
@@ -181,11 +181,9 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
struct timeval targ_time, cur_time, delta_time;
struct timespec cur_time_ns;
DWORD millis;
+ extern const uint64_t epoch_time;
- // GetSystemTimeAsFileTime() is not available on CE
- SYSTEMTIME st;
- GetSystemTime(&st);
- SystemTimeToFileTime(&st, &filetime);
+ GetSystemTimeAsFileTime(&filetime);
rtime.LowPart = filetime.dwLowDateTime;
rtime.HighPart = filetime.dwHighDateTime;
rtime.QuadPart -= epoch_time;
@@ -207,6 +205,3 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
return usbi_cond_intwait(cond, mutex, millis);
}
-int usbi_get_tid(void) {
- return GetCurrentThreadId();
-}
diff --git a/third_party/libusb/src/libusb/os/threads_windows.h b/third_party/libusb/src/libusb/os/threads_windows.h
index df8a0ee..7bb144a 100644
--- a/third_party/libusb/src/libusb/os/threads_windows.h
+++ b/third_party/libusb/src/libusb/os/threads_windows.h
@@ -1,7 +1,7 @@
/*
- * libusbx synchronization on Microsoft Windows
+ * libusb synchronization on Microsoft Windows
*
- * Copyright © 2010 Michael Plante <michael.plante@gmail.com>
+ * Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -82,6 +82,5 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
int usbi_cond_broadcast(usbi_cond_t *cond);
int usbi_cond_signal(usbi_cond_t *cond);
-int usbi_get_tid(void);
-
#endif /* LIBUSB_THREADS_WINDOWS_H */
+
diff --git a/third_party/libusb/src/libusb/os/wince_usb.c b/third_party/libusb/src/libusb/os/wince_usb.c
deleted file mode 100644
index e4a6633..0000000
--- a/third_party/libusb/src/libusb/os/wince_usb.c
+++ /dev/null
@@ -1,1015 +0,0 @@
-/*
- * Windows CE backend for libusbx 1.0
- * Copyright © 2011-2013 RealVNC Ltd.
- * Large portions taken from Windows backend, which is
- * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
- * With contributions from Michael Plante, Orin Eman et al.
- * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
- * Major code testing contribution by Xiaofan Chen
- *
- * 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
- */
-
-#include <libusbi.h>
-
-#include <stdint.h>
-#include <errno.h>
-#include <inttypes.h>
-
-#include "wince_usb.h"
-
-// Forward declares
-static int wince_clock_gettime(int clk_id, struct timespec *tp);
-unsigned __stdcall wince_clock_gettime_threaded(void* param);
-
-// Global variables
-uint64_t hires_frequency, hires_ticks_to_ps;
-int errno;
-const uint64_t epoch_time = UINT64_C(116444736000000000); // 1970.01.01 00:00:000 in MS Filetime
-enum windows_version windows_version = WINDOWS_CE;
-static int concurrent_usage = -1;
-// Timer thread
-// NB: index 0 is for monotonic and 1 is for the thread exit event
-HANDLE timer_thread = NULL;
-HANDLE timer_mutex = NULL;
-struct timespec timer_tp;
-volatile LONG request_count[2] = {0, 1}; // last one must be > 0
-HANDLE timer_request[2] = { NULL, NULL };
-HANDLE timer_response = NULL;
-HANDLE driver_handle = INVALID_HANDLE_VALUE;
-
-/*
- * Converts a windows error to human readable string
- * uses retval as errorcode, or, if 0, use GetLastError()
- */
-#if defined(ENABLE_LOGGING)
-static char* windows_error_str(uint32_t retval)
-{
- static TCHAR wErr_string[ERR_BUFFER_SIZE];
- static char err_string[ERR_BUFFER_SIZE];
-
- DWORD size;
- size_t i;
- uint32_t error_code, format_error;
-
- error_code = retval?retval:GetLastError();
-
- safe_stprintf(wErr_string, ERR_BUFFER_SIZE, _T("[%d] "), error_code);
-
- size = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &wErr_string[safe_tcslen(wErr_string)],
- ERR_BUFFER_SIZE - (DWORD)safe_tcslen(wErr_string), NULL);
- if (size == 0) {
- format_error = GetLastError();
- if (format_error)
- safe_stprintf(wErr_string, ERR_BUFFER_SIZE,
- _T("Windows error code %u (FormatMessage error code %u)"), error_code, format_error);
- else
- safe_stprintf(wErr_string, ERR_BUFFER_SIZE, _T("Unknown error code %u"), error_code);
- } else {
- // Remove CR/LF terminators
- for (i=safe_tcslen(wErr_string)-1; ((wErr_string[i]==0x0A) || (wErr_string[i]==0x0D)); i--) {
- wErr_string[i] = 0;
- }
- }
- if (WideCharToMultiByte(CP_ACP, 0, wErr_string, -1, err_string, ERR_BUFFER_SIZE, NULL, NULL) < 0)
- {
- strcpy(err_string, "Unable to convert error string");
- }
- return err_string;
-}
-#endif
-
-static struct wince_device_priv *_device_priv(struct libusb_device *dev)
-{
- return (struct wince_device_priv *) dev->os_priv;
-}
-
-// ceusbkwrapper to libusb error code mapping
-static int translate_driver_error(int error)
-{
- switch (error) {
- case ERROR_INVALID_PARAMETER:
- return LIBUSB_ERROR_INVALID_PARAM;
- case ERROR_CALL_NOT_IMPLEMENTED:
- case ERROR_NOT_SUPPORTED:
- return LIBUSB_ERROR_NOT_SUPPORTED;
- case ERROR_NOT_ENOUGH_MEMORY:
- return LIBUSB_ERROR_NO_MEM;
- case ERROR_INVALID_HANDLE:
- return LIBUSB_ERROR_NO_DEVICE;
- case ERROR_BUSY:
- return LIBUSB_ERROR_BUSY;
-
- // Error codes that are either unexpected, or have
- // no suitable LIBUSB_ERROR equivilant.
- case ERROR_CANCELLED:
- case ERROR_INTERNAL_ERROR:
- default:
- return LIBUSB_ERROR_OTHER;
- }
-}
-
-static int init_dllimports()
-{
- DLL_LOAD(ceusbkwrapper.dll, UkwOpenDriver, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwGetDeviceList, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwReleaseDeviceList, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwGetDeviceAddress, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwGetDeviceDescriptor, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwGetConfigDescriptor, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwCloseDriver, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwCancelTransfer, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwIssueControlTransfer, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwClaimInterface, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwReleaseInterface, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwSetInterfaceAlternateSetting, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwClearHaltHost, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwClearHaltDevice, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwGetConfig, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwSetConfig, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwResetDevice, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwKernelDriverActive, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwAttachKernelDriver, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwDetachKernelDriver, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwIssueBulkTransfer, TRUE);
- DLL_LOAD(ceusbkwrapper.dll, UkwIsPipeHalted, TRUE);
- return LIBUSB_SUCCESS;
-}
-
-static int init_device(struct libusb_device *dev, UKW_DEVICE drv_dev,
- unsigned char bus_addr, unsigned char dev_addr)
-{
- struct wince_device_priv *priv = _device_priv(dev);
- int r = LIBUSB_SUCCESS;
-
- dev->bus_number = bus_addr;
- dev->device_address = dev_addr;
- priv->dev = drv_dev;
-
- if (!UkwGetDeviceDescriptor(priv->dev, &(priv->desc))) {
- r = translate_driver_error(GetLastError());
- }
- return r;
-}
-
-// Internal API functions
-static int wince_init(struct libusb_context *ctx)
-{
- int i, r = LIBUSB_ERROR_OTHER;
- HANDLE semaphore;
- TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID)
-
- _stprintf(sem_name, _T("libusb_init%08X"), (unsigned int)GetCurrentProcessId()&0xFFFFFFFF);
- semaphore = CreateSemaphore(NULL, 1, 1, sem_name);
- if (semaphore == NULL) {
- usbi_err(ctx, "could not create semaphore: %s", windows_error_str(0));
- return LIBUSB_ERROR_NO_MEM;
- }
-
- // A successful wait brings our semaphore count to 0 (unsignaled)
- // => any concurent wait stalls until the semaphore's release
- if (WaitForSingleObject(semaphore, INFINITE) != WAIT_OBJECT_0) {
- usbi_err(ctx, "failure to access semaphore: %s", windows_error_str(0));
- CloseHandle(semaphore);
- return LIBUSB_ERROR_NO_MEM;
- }
-
- // NB: concurrent usage supposes that init calls are equally balanced with
- // exit calls. If init is called more than exit, we will not exit properly
- if ( ++concurrent_usage == 0 ) { // First init?
- // Initialize pollable file descriptors
- init_polling();
-
- // Load DLL imports
- if (init_dllimports() != LIBUSB_SUCCESS) {
- usbi_err(ctx, "could not resolve DLL functions");
- r = LIBUSB_ERROR_NOT_SUPPORTED;
- goto init_exit;
- }
-
- // try to open a handle to the driver
- driver_handle = UkwOpenDriver();
- if (driver_handle == INVALID_HANDLE_VALUE) {
- usbi_err(ctx, "could not connect to driver");
- r = LIBUSB_ERROR_NOT_SUPPORTED;
- goto init_exit;
- }
-
- // Windows CE doesn't have a way of specifying thread affinity, so this code
- // just has to hope QueryPerformanceCounter doesn't report different values when
- // running on different cores.
- r = LIBUSB_ERROR_NO_MEM;
- for (i = 0; i < 2; i++) {
- timer_request[i] = CreateEvent(NULL, TRUE, FALSE, NULL);
- if (timer_request[i] == NULL) {
- usbi_err(ctx, "could not create timer request event %d - aborting", i);
- goto init_exit;
- }
- }
- timer_response = CreateSemaphore(NULL, 0, MAX_TIMER_SEMAPHORES, NULL);
- if (timer_response == NULL) {
- usbi_err(ctx, "could not create timer response semaphore - aborting");
- goto init_exit;
- }
- timer_mutex = CreateMutex(NULL, FALSE, NULL);
- if (timer_mutex == NULL) {
- usbi_err(ctx, "could not create timer mutex - aborting");
- goto init_exit;
- }
- timer_thread = CreateThread(NULL, 0, wince_clock_gettime_threaded, NULL, 0, NULL);
- if (timer_thread == NULL) {
- usbi_err(ctx, "Unable to create timer thread - aborting");
- goto init_exit;
- }
- }
- // At this stage, either we went through full init successfully, or didn't need to
- r = LIBUSB_SUCCESS;
-
-init_exit: // Holds semaphore here.
- if (!concurrent_usage && r != LIBUSB_SUCCESS) { // First init failed?
- if (driver_handle != INVALID_HANDLE_VALUE) {
- UkwCloseDriver(driver_handle);
- driver_handle = INVALID_HANDLE_VALUE;
- }
- if (timer_thread) {
- SetEvent(timer_request[1]); // actually the signal to quit the thread.
- if (WAIT_OBJECT_0 != WaitForSingleObject(timer_thread, INFINITE)) {
- usbi_warn(ctx, "could not wait for timer thread to quit");
- TerminateThread(timer_thread, 1); // shouldn't happen, but we're destroying
- // all objects it might have held anyway.
- }
- CloseHandle(timer_thread);
- timer_thread = NULL;
- }
- for (i = 0; i < 2; i++) {
- if (timer_request[i]) {
- CloseHandle(timer_request[i]);
- timer_request[i] = NULL;
- }
- }
- if (timer_response) {
- CloseHandle(timer_response);
- timer_response = NULL;
- }
- if (timer_mutex) {
- CloseHandle(timer_mutex);
- timer_mutex = NULL;
- }
- }
-
- if (r != LIBUSB_SUCCESS)
- --concurrent_usage; // Not expected to call libusb_exit if we failed.
-
- ReleaseSemaphore(semaphore, 1, NULL); // increase count back to 1
- CloseHandle(semaphore);
- return r;
-}
-
-static void wince_exit(void)
-{
- int i;
- HANDLE semaphore;
- TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID)
-
- _stprintf(sem_name, _T("libusb_init%08X"), (unsigned int)GetCurrentProcessId()&0xFFFFFFFF);
- semaphore = CreateSemaphore(NULL, 1, 1, sem_name);
- if (semaphore == NULL) {
- return;
- }
-
- // A successful wait brings our semaphore count to 0 (unsignaled)
- // => any concurent wait stalls until the semaphore release
- if (WaitForSingleObject(semaphore, INFINITE) != WAIT_OBJECT_0) {
- CloseHandle(semaphore);
- return;
- }
-
- // Only works if exits and inits are balanced exactly
- if (--concurrent_usage < 0) { // Last exit
- exit_polling();
-
- if (timer_thread) {
- SetEvent(timer_request[1]); // actually the signal to quit the thread.
- if (WAIT_OBJECT_0 != WaitForSingleObject(timer_thread, INFINITE)) {
- usbi_dbg("could not wait for timer thread to quit");
- TerminateThread(timer_thread, 1);
- }
- CloseHandle(timer_thread);
- timer_thread = NULL;
- }
- for (i = 0; i < 2; i++) {
- if (timer_request[i]) {
- CloseHandle(timer_request[i]);
- timer_request[i] = NULL;
- }
- }
- if (timer_response) {
- CloseHandle(timer_response);
- timer_response = NULL;
- }
- if (timer_mutex) {
- CloseHandle(timer_mutex);
- timer_mutex = NULL;
- }
- if (driver_handle != INVALID_HANDLE_VALUE) {
- UkwCloseDriver(driver_handle);
- driver_handle = INVALID_HANDLE_VALUE;
- }
- }
-
- ReleaseSemaphore(semaphore, 1, NULL); // increase count back to 1
- CloseHandle(semaphore);
-}
-
-static int wince_get_device_list(
- struct libusb_context *ctx,
- struct discovered_devs **discdevs)
-{
- UKW_DEVICE devices[MAX_DEVICE_COUNT];
- struct discovered_devs * new_devices = *discdevs;
- DWORD count = 0, i;
- struct libusb_device *dev = NULL;
- unsigned char bus_addr, dev_addr;
- unsigned long session_id;
- BOOL success;
- DWORD release_list_offset = 0;
- int r = LIBUSB_SUCCESS;
-
- success = UkwGetDeviceList(driver_handle, devices, MAX_DEVICE_COUNT, &count);
- if (!success) {
- int libusbErr = translate_driver_error(GetLastError());
- usbi_err(ctx, "could not get devices: %s", windows_error_str(0));
- return libusbErr;
- }
- for(i = 0; i < count; ++i) {
- release_list_offset = i;
- success = UkwGetDeviceAddress(devices[i], &bus_addr, &dev_addr, &session_id);
- if (!success) {
- r = translate_driver_error(GetLastError());
- usbi_err(ctx, "could not get device address for %d: %s", i, windows_error_str(0));
- goto err_out;
- }
- dev = usbi_get_device_by_session_id(ctx, session_id);
- if (dev) {
- usbi_dbg("using existing device for %d/%d (session %ld)",
- bus_addr, dev_addr, session_id);
- libusb_ref_device(dev);
- // Release just this element in the device list (as we already hold a
- // reference to it).
- UkwReleaseDeviceList(driver_handle, &devices[i], 1);
- release_list_offset++;
- } else {
- usbi_dbg("allocating new device for %d/%d (session %ld)",
- bus_addr, dev_addr, session_id);
- dev = usbi_alloc_device(ctx, session_id);
- if (!dev) {
- r = LIBUSB_ERROR_NO_MEM;
- goto err_out;
- }
- r = init_device(dev, devices[i], bus_addr, dev_addr);
- if (r < 0)
- goto err_out;
- r = usbi_sanitize_device(dev);
- if (r < 0)
- goto err_out;
- }
- new_devices = discovered_devs_append(new_devices, dev);
- if (!discdevs) {
- r = LIBUSB_ERROR_NO_MEM;
- goto err_out;
- }
- safe_unref_device(dev);
- }
- *discdevs = new_devices;
- return r;
-err_out:
- *discdevs = new_devices;
- safe_unref_device(dev);
- // Release the remainder of the unprocessed device list.
- // The devices added to new_devices already will still be passed up to libusb,
- // which can dispose of them at its leisure.
- UkwReleaseDeviceList(driver_handle, &devices[release_list_offset], count - release_list_offset);
- return r;
-}
-
-static int wince_open(struct libusb_device_handle *handle)
-{
- // Nothing to do to open devices as a handle to it has
- // been retrieved by wince_get_device_list
- return LIBUSB_SUCCESS;
-}
-
-static void wince_close(struct libusb_device_handle *handle)
-{
- // Nothing to do as wince_open does nothing.
-}
-
-static int wince_get_device_descriptor(
- struct libusb_device *device,
- unsigned char *buffer, int *host_endian)
-{
- struct wince_device_priv *priv = _device_priv(device);
-
- *host_endian = 1;
- memcpy(buffer, &priv->desc, DEVICE_DESC_LENGTH);
- return LIBUSB_SUCCESS;
-}
-
-static int wince_get_active_config_descriptor(
- struct libusb_device *device,
- unsigned char *buffer, size_t len, int *host_endian)
-{
- struct wince_device_priv *priv = _device_priv(device);
- DWORD actualSize = len;
- *host_endian = 0;
- if (!UkwGetConfigDescriptor(priv->dev, UKW_ACTIVE_CONFIGURATION, buffer, len, &actualSize)) {
- return translate_driver_error(GetLastError());
- }
- return actualSize;
-}
-
-static int wince_get_config_descriptor(
- struct libusb_device *device,
- uint8_t config_index,
- unsigned char *buffer, size_t len, int *host_endian)
-{
- struct wince_device_priv *priv = _device_priv(device);
- DWORD actualSize = len;
- *host_endian = 0;
- if (!UkwGetConfigDescriptor(priv->dev, config_index, buffer, len, &actualSize)) {
- return translate_driver_error(GetLastError());
- }
- return actualSize;
-}
-
-static int wince_get_configuration(
- struct libusb_device_handle *handle,
- int *config)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- UCHAR cv = 0;
- if (!UkwGetConfig(priv->dev, &cv)) {
- return translate_driver_error(GetLastError());
- }
- (*config) = cv;
- return LIBUSB_SUCCESS;
-}
-
-static int wince_set_configuration(
- struct libusb_device_handle *handle,
- int config)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- // Setting configuration 0 places the device in Address state.
- // This should correspond to the "unconfigured state" required by
- // libusb when the specified configuration is -1.
- UCHAR cv = (config < 0) ? 0 : config;
- if (!UkwSetConfig(priv->dev, cv)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_claim_interface(
- struct libusb_device_handle *handle,
- int interface_number)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwClaimInterface(priv->dev, interface_number)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_release_interface(
- struct libusb_device_handle *handle,
- int interface_number)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwSetInterfaceAlternateSetting(priv->dev, interface_number, 0)) {
- return translate_driver_error(GetLastError());
- }
- if (!UkwReleaseInterface(priv->dev, interface_number)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_set_interface_altsetting(
- struct libusb_device_handle *handle,
- int interface_number, int altsetting)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwSetInterfaceAlternateSetting(priv->dev, interface_number, altsetting)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_clear_halt(
- struct libusb_device_handle *handle,
- unsigned char endpoint)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwClearHaltHost(priv->dev, endpoint)) {
- return translate_driver_error(GetLastError());
- }
- if (!UkwClearHaltDevice(priv->dev, endpoint)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_reset_device(
- struct libusb_device_handle *handle)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwResetDevice(priv->dev)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_kernel_driver_active(
- struct libusb_device_handle *handle,
- int interface_number)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- BOOL result = FALSE;
- if (!UkwKernelDriverActive(priv->dev, interface_number, &result)) {
- return translate_driver_error(GetLastError());
- }
- return result ? 1 : 0;
-}
-
-static int wince_detach_kernel_driver(
- struct libusb_device_handle *handle,
- int interface_number)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwDetachKernelDriver(priv->dev, interface_number)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_attach_kernel_driver(
- struct libusb_device_handle *handle,
- int interface_number)
-{
- struct wince_device_priv *priv = _device_priv(handle->dev);
- if (!UkwAttachKernelDriver(priv->dev, interface_number)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static void wince_destroy_device(
- struct libusb_device *dev)
-{
- struct wince_device_priv *priv = _device_priv(dev);
- UkwReleaseDeviceList(driver_handle, &priv->dev, 1);
-}
-
-static void wince_clear_transfer_priv(
- struct usbi_transfer *itransfer)
-{
- struct wince_transfer_priv *transfer_priv = (struct wince_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct winfd wfd = fd_to_winfd(transfer_priv->pollable_fd.fd);
- // No need to cancel transfer as it is either complete or abandoned
- wfd.itransfer = NULL;
- CloseHandle(wfd.handle);
- usbi_free_fd(&transfer_priv->pollable_fd);
-}
-
-static int wince_cancel_transfer(
- struct usbi_transfer *itransfer)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct wince_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- struct wince_transfer_priv *transfer_priv = (struct wince_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
-
- if (!UkwCancelTransfer(priv->dev, transfer_priv->pollable_fd.overlapped, UKW_TF_NO_WAIT)) {
- return translate_driver_error(GetLastError());
- }
- return LIBUSB_SUCCESS;
-}
-
-static int wince_submit_control_or_bulk_transfer(struct usbi_transfer *itransfer)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
- struct wince_transfer_priv *transfer_priv = (struct wince_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct wince_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- BOOL direction_in, ret;
- struct winfd wfd;
- DWORD flags;
- HANDLE eventHandle;
- PUKW_CONTROL_HEADER setup = NULL;
- const BOOL control_transfer = transfer->type == LIBUSB_TRANSFER_TYPE_CONTROL;
-
- transfer_priv->pollable_fd = INVALID_WINFD;
- if (control_transfer) {
- setup = (PUKW_CONTROL_HEADER) transfer->buffer;
- direction_in = setup->bmRequestType & LIBUSB_ENDPOINT_IN;
- } else {
- direction_in = transfer->endpoint & LIBUSB_ENDPOINT_IN;
- }
- flags = direction_in ? UKW_TF_IN_TRANSFER : UKW_TF_OUT_TRANSFER;
- flags |= UKW_TF_SHORT_TRANSFER_OK;
-
- eventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (eventHandle == NULL) {
- usbi_err(ctx, "Failed to create event for async transfer");
- return LIBUSB_ERROR_NO_MEM;
- }
-
- wfd = usbi_create_fd(eventHandle, direction_in ? RW_READ : RW_WRITE, itransfer, &wince_cancel_transfer);
- if (wfd.fd < 0) {
- CloseHandle(eventHandle);
- return LIBUSB_ERROR_NO_MEM;
- }
-
- transfer_priv->pollable_fd = wfd;
- if (control_transfer) {
- // Split out control setup header and data buffer
- DWORD bufLen = transfer->length - sizeof(UKW_CONTROL_HEADER);
- PVOID buf = (PVOID) &transfer->buffer[sizeof(UKW_CONTROL_HEADER)];
-
- ret = UkwIssueControlTransfer(priv->dev, flags, setup, buf, bufLen, &transfer->actual_length, wfd.overlapped);
- } else {
- ret = UkwIssueBulkTransfer(priv->dev, flags, transfer->endpoint, transfer->buffer,
- transfer->length, &transfer->actual_length, wfd.overlapped);
- }
- if (!ret) {
- int libusbErr = translate_driver_error(GetLastError());
- usbi_err(ctx, "UkwIssue%sTransfer failed: error %d",
- control_transfer ? "Control" : "Bulk", GetLastError());
- wince_clear_transfer_priv(itransfer);
- return libusbErr;
- }
- usbi_add_pollfd(ctx, transfer_priv->pollable_fd.fd, direction_in ? POLLIN : POLLOUT);
- itransfer->flags |= USBI_TRANSFER_UPDATED_FDS;
-
- return LIBUSB_SUCCESS;
-}
-
-static int wince_submit_iso_transfer(struct usbi_transfer *itransfer)
-{
- return LIBUSB_ERROR_NOT_SUPPORTED;
-}
-
-static int wince_submit_transfer(
- struct usbi_transfer *itransfer)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
-
- switch (transfer->type) {
- case LIBUSB_TRANSFER_TYPE_CONTROL:
- case LIBUSB_TRANSFER_TYPE_BULK:
- case LIBUSB_TRANSFER_TYPE_INTERRUPT:
- return wince_submit_control_or_bulk_transfer(itransfer);
- case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
- return wince_submit_iso_transfer(itransfer);
- default:
- usbi_err(TRANSFER_CTX(transfer), "unknown endpoint type %d", transfer->type);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-}
-
-static void wince_transfer_callback(struct usbi_transfer *itransfer, uint32_t io_result, uint32_t io_size)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct wince_transfer_priv *transfer_priv = (struct wince_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct wince_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- int status;
-
- usbi_dbg("handling I/O completion with errcode %d", io_result);
-
- if (io_result == ERROR_NOT_SUPPORTED &&
- transfer->type != LIBUSB_TRANSFER_TYPE_CONTROL) {
- /* For functional stalls, the WinCE USB layer (and therefore the USB Kernel Wrapper
- * Driver) will report USB_ERROR_STALL/ERROR_NOT_SUPPORTED in situations where the
- * endpoint isn't actually stalled.
- *
- * One example of this is that some devices will occasionally fail to reply to an IN
- * token. The WinCE USB layer carries on with the transaction until it is completed
- * (or cancelled) but then completes it with USB_ERROR_STALL.
- *
- * This code therefore needs to confirm that there really is a stall error, by both
- * checking the pipe status and requesting the endpoint status from the device.
- */
- BOOL halted = FALSE;
- usbi_dbg("checking I/O completion with errcode ERROR_NOT_SUPPORTED is really a stall");
- if (UkwIsPipeHalted(priv->dev, transfer->endpoint, &halted)) {
- /* Pipe status retrieved, so now request endpoint status by sending a GET_STATUS
- * control request to the device. This is done synchronously, which is a bit
- * naughty, but this is a special corner case.
- */
- WORD wStatus = 0;
- DWORD written = 0;
- UKW_CONTROL_HEADER ctrlHeader;
- ctrlHeader.bmRequestType = LIBUSB_REQUEST_TYPE_STANDARD |
- LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_ENDPOINT;
- ctrlHeader.bRequest = LIBUSB_REQUEST_GET_STATUS;
- ctrlHeader.wValue = 0;
- ctrlHeader.wIndex = transfer->endpoint;
- ctrlHeader.wLength = sizeof(wStatus);
- if (UkwIssueControlTransfer(priv->dev,
- UKW_TF_IN_TRANSFER | UKW_TF_SEND_TO_ENDPOINT,
- &ctrlHeader, &wStatus, sizeof(wStatus), &written, NULL)) {
- if (written == sizeof(wStatus) &&
- (wStatus & STATUS_HALT_FLAG) == 0) {
- if (!halted || UkwClearHaltHost(priv->dev, transfer->endpoint)) {
- usbi_dbg("Endpoint doesn't appear to be stalled, overriding error with success");
- io_result = ERROR_SUCCESS;
- } else {
- usbi_dbg("Endpoint doesn't appear to be stalled, but the host is halted, changing error");
- io_result = ERROR_IO_DEVICE;
- }
- }
- }
- }
- }
-
- switch(io_result) {
- case ERROR_SUCCESS:
- itransfer->transferred += io_size;
- status = LIBUSB_TRANSFER_COMPLETED;
- break;
- case ERROR_CANCELLED:
- usbi_dbg("detected transfer cancel");
- status = LIBUSB_TRANSFER_CANCELLED;
- break;
- case ERROR_NOT_SUPPORTED:
- case ERROR_GEN_FAILURE:
- usbi_dbg("detected endpoint stall");
- status = LIBUSB_TRANSFER_STALL;
- break;
- case ERROR_SEM_TIMEOUT:
- usbi_dbg("detected semaphore timeout");
- status = LIBUSB_TRANSFER_TIMED_OUT;
- break;
- case ERROR_OPERATION_ABORTED:
- if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) {
- usbi_dbg("detected timeout");
- status = LIBUSB_TRANSFER_TIMED_OUT;
- } else {
- usbi_dbg("detected operation aborted");
- status = LIBUSB_TRANSFER_CANCELLED;
- }
- break;
- default:
- usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error: %s", windows_error_str(io_result));
- status = LIBUSB_TRANSFER_ERROR;
- break;
- }
- wince_clear_transfer_priv(itransfer);
- if (status == LIBUSB_TRANSFER_CANCELLED) {
- usbi_handle_transfer_cancellation(itransfer);
- } else {
- usbi_handle_transfer_completion(itransfer, (enum libusb_transfer_status)status);
- }
-}
-
-static void wince_handle_callback (struct usbi_transfer *itransfer, uint32_t io_result, uint32_t io_size)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
-
- switch (transfer->type) {
- case LIBUSB_TRANSFER_TYPE_CONTROL:
- case LIBUSB_TRANSFER_TYPE_BULK:
- case LIBUSB_TRANSFER_TYPE_INTERRUPT:
- case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS:
- wince_transfer_callback (itransfer, io_result, io_size);
- break;
- default:
- usbi_err(ITRANSFER_CTX(itransfer), "unknown endpoint type %d", transfer->type);
- }
-}
-
-static int wince_handle_events(
- struct libusb_context *ctx,
- struct pollfd *fds, POLL_NFDS_TYPE nfds, int num_ready)
-{
- struct wince_transfer_priv* transfer_priv = NULL;
- POLL_NFDS_TYPE i = 0;
- BOOL found = FALSE;
- struct usbi_transfer *transfer;
- DWORD io_size, io_result;
-
- usbi_mutex_lock(&ctx->open_devs_lock);
- for (i = 0; i < nfds && num_ready > 0; i++) {
-
- usbi_dbg("checking fd %d with revents = %04x", fds[i].fd, fds[i].revents);
-
- if (!fds[i].revents) {
- continue;
- }
-
- num_ready--;
-
- // Because a Windows OVERLAPPED is used for poll emulation,
- // a pollable fd is created and stored with each transfer
- usbi_mutex_lock(&ctx->flying_transfers_lock);
- list_for_each_entry(transfer, &ctx->flying_transfers, list, struct usbi_transfer) {
- transfer_priv = usbi_transfer_get_os_priv(transfer);
- if (transfer_priv->pollable_fd.fd == fds[i].fd) {
- found = TRUE;
- break;
- }
- }
- usbi_mutex_unlock(&ctx->flying_transfers_lock);
-
- if (found && HasOverlappedIoCompleted(transfer_priv->pollable_fd.overlapped)) {
- io_result = (DWORD)transfer_priv->pollable_fd.overlapped->Internal;
- io_size = (DWORD)transfer_priv->pollable_fd.overlapped->InternalHigh;
- usbi_remove_pollfd(ctx, transfer_priv->pollable_fd.fd);
- // let handle_callback free the event using the transfer wfd
- // If you don't use the transfer wfd, you run a risk of trying to free a
- // newly allocated wfd that took the place of the one from the transfer.
- wince_handle_callback(transfer, io_result, io_size);
- } else if (found) {
- usbi_err(ctx, "matching transfer for fd %x has not completed", fds[i]);
- return LIBUSB_ERROR_OTHER;
- } else {
- usbi_err(ctx, "could not find a matching transfer for fd %x", fds[i]);
- return LIBUSB_ERROR_NOT_FOUND;
- }
- }
-
- usbi_mutex_unlock(&ctx->open_devs_lock);
- return LIBUSB_SUCCESS;
-}
-
-/*
- * Monotonic and real time functions
- */
-unsigned __stdcall wince_clock_gettime_threaded(void* param)
-{
- LARGE_INTEGER hires_counter, li_frequency;
- LONG nb_responses;
- int timer_index;
-
- // Init - find out if we have access to a monotonic (hires) timer
- if (!QueryPerformanceFrequency(&li_frequency)) {
- usbi_dbg("no hires timer available on this platform");
- hires_frequency = 0;
- hires_ticks_to_ps = UINT64_C(0);
- } else {
- hires_frequency = li_frequency.QuadPart;
- // The hires frequency can go as high as 4 GHz, so we'll use a conversion
- // to picoseconds to compute the tv_nsecs part in clock_gettime
- hires_ticks_to_ps = UINT64_C(1000000000000) / hires_frequency;
- usbi_dbg("hires timer available (Frequency: %"PRIu64" Hz)", hires_frequency);
- }
-
- // Main loop - wait for requests
- while (1) {
- timer_index = WaitForMultipleObjects(2, timer_request, FALSE, INFINITE) - WAIT_OBJECT_0;
- if ( (timer_index != 0) && (timer_index != 1) ) {
- usbi_dbg("failure to wait on requests: %s", windows_error_str(0));
- continue;
- }
- if (request_count[timer_index] == 0) {
- // Request already handled
- ResetEvent(timer_request[timer_index]);
- // There's still a possiblity that a thread sends a request between the
- // time we test request_count[] == 0 and we reset the event, in which case
- // the request would be ignored. The simple solution to that is to test
- // request_count again and process requests if non zero.
- if (request_count[timer_index] == 0)
- continue;
- }
- switch (timer_index) {
- case 0:
- WaitForSingleObject(timer_mutex, INFINITE);
- // Requests to this thread are for hires always
- if (QueryPerformanceCounter(&hires_counter) != 0) {
- timer_tp.tv_sec = (long)(hires_counter.QuadPart / hires_frequency);
- timer_tp.tv_nsec = (long)(((hires_counter.QuadPart % hires_frequency)/1000) * hires_ticks_to_ps);
- } else {
- // Fallback to real-time if we can't get monotonic value
- // Note that real-time clock does not wait on the mutex or this thread.
- wince_clock_gettime(USBI_CLOCK_REALTIME, &timer_tp);
- }
- ReleaseMutex(timer_mutex);
-
- nb_responses = InterlockedExchange((LONG*)&request_count[0], 0);
- if ( (nb_responses)
- && (ReleaseSemaphore(timer_response, nb_responses, NULL) == 0) ) {
- usbi_dbg("unable to release timer semaphore %d: %s", windows_error_str(0));
- }
- continue;
- case 1: // time to quit
- usbi_dbg("timer thread quitting");
- return 0;
- }
- }
- usbi_dbg("ERROR: broken timer thread");
- return 1;
-}
-
-static int wince_clock_gettime(int clk_id, struct timespec *tp)
-{
- FILETIME filetime;
- ULARGE_INTEGER rtime;
- DWORD r;
- SYSTEMTIME st;
- switch(clk_id) {
- case USBI_CLOCK_MONOTONIC:
- if (hires_frequency != 0) {
- while (1) {
- InterlockedIncrement((LONG*)&request_count[0]);
- SetEvent(timer_request[0]);
- r = WaitForSingleObject(timer_response, TIMER_REQUEST_RETRY_MS);
- switch(r) {
- case WAIT_OBJECT_0:
- WaitForSingleObject(timer_mutex, INFINITE);
- *tp = timer_tp;
- ReleaseMutex(timer_mutex);
- return LIBUSB_SUCCESS;
- case WAIT_TIMEOUT:
- usbi_dbg("could not obtain a timer value within reasonable timeframe - too much load?");
- break; // Retry until successful
- default:
- usbi_dbg("WaitForSingleObject failed: %s", windows_error_str(0));
- return LIBUSB_ERROR_OTHER;
- }
- }
- }
- // Fall through and return real-time if monotonic was not detected @ timer init
- case USBI_CLOCK_REALTIME:
- // We follow http://msdn.microsoft.com/en-us/library/ms724928%28VS.85%29.aspx
- // with a predef epoch_time to have an epoch that starts at 1970.01.01 00:00
- // Note however that our resolution is bounded by the Windows system time
- // functions and is at best of the order of 1 ms (or, usually, worse)
- GetSystemTime(&st);
- SystemTimeToFileTime(&st, &filetime);
- rtime.LowPart = filetime.dwLowDateTime;
- rtime.HighPart = filetime.dwHighDateTime;
- rtime.QuadPart -= epoch_time;
- tp->tv_sec = (long)(rtime.QuadPart / 10000000);
- tp->tv_nsec = (long)((rtime.QuadPart % 10000000)*100);
- return LIBUSB_SUCCESS;
- default:
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-}
-
-const struct usbi_os_backend wince_backend = {
- "Windows CE",
- 0,
- wince_init,
- wince_exit,
-
- wince_get_device_list,
- NULL, /* hotplug_poll */
- wince_open,
- wince_close,
-
- wince_get_device_descriptor,
- wince_get_active_config_descriptor,
- wince_get_config_descriptor,
- NULL, /* get_config_descriptor_by_value() */
-
- wince_get_configuration,
- wince_set_configuration,
- wince_claim_interface,
- wince_release_interface,
-
- wince_set_interface_altsetting,
- wince_clear_halt,
- wince_reset_device,
-
- wince_kernel_driver_active,
- wince_detach_kernel_driver,
- wince_attach_kernel_driver,
-
- wince_destroy_device,
-
- wince_submit_transfer,
- wince_cancel_transfer,
- wince_clear_transfer_priv,
-
- wince_handle_events,
-
- wince_clock_gettime,
- sizeof(struct wince_device_priv),
- sizeof(struct wince_device_handle_priv),
- sizeof(struct wince_transfer_priv),
- 0,
-};
diff --git a/third_party/libusb/src/libusb/os/wince_usb.h b/third_party/libusb/src/libusb/os/wince_usb.h
deleted file mode 100644
index 3db9693..0000000
--- a/third_party/libusb/src/libusb/os/wince_usb.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Windows CE backend for libusbx 1.0
- * Copyright © 2011-2013 RealVNC Ltd.
- * Portions taken from Windows backend, which is
- * Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
- * With contributions from Michael Plante, Orin Eman et al.
- * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
- * Major code testing contribution by Xiaofan Chen
- *
- * 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
- */
-#pragma once
-
-#include "windows_common.h"
-
-#include <windows.h>
-#include "poll_windows.h"
-
-#define MAX_DEVICE_COUNT 256
-
-// This is a modified dump of the types in the ceusbkwrapper.h library header
-// with functions transformed into extern pointers.
-//
-// This backend dynamically loads ceusbkwrapper.dll and doesn't include
-// ceusbkwrapper.h directly to simplify the build process. The kernel
-// side wrapper driver is built using the platform image build tools,
-// which makes it difficult to reference directly from the libusbx build
-// system.
-struct UKW_DEVICE_PRIV;
-typedef struct UKW_DEVICE_PRIV *UKW_DEVICE;
-typedef UKW_DEVICE *PUKW_DEVICE, *LPUKW_DEVICE;
-
-typedef struct {
- UINT8 bLength;
- UINT8 bDescriptorType;
- UINT16 bcdUSB;
- UINT8 bDeviceClass;
- UINT8 bDeviceSubClass;
- UINT8 bDeviceProtocol;
- UINT8 bMaxPacketSize0;
- UINT16 idVendor;
- UINT16 idProduct;
- UINT16 bcdDevice;
- UINT8 iManufacturer;
- UINT8 iProduct;
- UINT8 iSerialNumber;
- UINT8 bNumConfigurations;
-} UKW_DEVICE_DESCRIPTOR, *PUKW_DEVICE_DESCRIPTOR, *LPUKW_DEVICE_DESCRIPTOR;
-
-typedef struct {
- UINT8 bmRequestType;
- UINT8 bRequest;
- UINT16 wValue;
- UINT16 wIndex;
- UINT16 wLength;
-} UKW_CONTROL_HEADER, *PUKW_CONTROL_HEADER, *LPUKW_CONTROL_HEADER;
-
-// Collection of flags which can be used when issuing transfer requests
-/* Indicates that the transfer direction is 'in' */
-#define UKW_TF_IN_TRANSFER 0x00000001
-/* Indicates that the transfer direction is 'out' */
-#define UKW_TF_OUT_TRANSFER 0x00000000
-/* Specifies that the transfer should complete as soon as possible,
- * even if no OVERLAPPED structure has been provided. */
-#define UKW_TF_NO_WAIT 0x00000100
-/* Indicates that transfers shorter than the buffer are ok */
-#define UKW_TF_SHORT_TRANSFER_OK 0x00000200
-#define UKW_TF_SEND_TO_DEVICE 0x00010000
-#define UKW_TF_SEND_TO_INTERFACE 0x00020000
-#define UKW_TF_SEND_TO_ENDPOINT 0x00040000
-/* Don't block when waiting for memory allocations */
-#define UKW_TF_DONT_BLOCK_FOR_MEM 0x00080000
-
-/* Value to use when dealing with configuration values, such as UkwGetConfigDescriptor,
- * to specify the currently active configuration for the device. */
-#define UKW_ACTIVE_CONFIGURATION -1
-
-DLL_DECLARE(WINAPI, HANDLE, UkwOpenDriver, ());
-DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceList, (HANDLE, LPUKW_DEVICE, DWORD, LPDWORD));
-DLL_DECLARE(WINAPI, void, UkwReleaseDeviceList, (HANDLE, LPUKW_DEVICE, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceAddress, (UKW_DEVICE, unsigned char*, unsigned char*, unsigned long*));
-DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceDescriptor, (UKW_DEVICE, LPUKW_DEVICE_DESCRIPTOR));
-DLL_DECLARE(WINAPI, BOOL, UkwGetConfigDescriptor, (UKW_DEVICE, DWORD, LPVOID, DWORD, LPDWORD));
-DLL_DECLARE(WINAPI, void, UkwCloseDriver, (HANDLE));
-DLL_DECLARE(WINAPI, BOOL, UkwCancelTransfer, (UKW_DEVICE, LPOVERLAPPED, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwIssueControlTransfer, (UKW_DEVICE, DWORD, LPUKW_CONTROL_HEADER, LPVOID, DWORD, LPDWORD, LPOVERLAPPED));
-DLL_DECLARE(WINAPI, BOOL, UkwClaimInterface, (UKW_DEVICE, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwReleaseInterface, (UKW_DEVICE, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwSetInterfaceAlternateSetting, (UKW_DEVICE, DWORD, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwClearHaltHost, (UKW_DEVICE, UCHAR));
-DLL_DECLARE(WINAPI, BOOL, UkwClearHaltDevice, (UKW_DEVICE, UCHAR));
-DLL_DECLARE(WINAPI, BOOL, UkwGetConfig, (UKW_DEVICE, PUCHAR));
-DLL_DECLARE(WINAPI, BOOL, UkwSetConfig, (UKW_DEVICE, UCHAR));
-DLL_DECLARE(WINAPI, BOOL, UkwResetDevice, (UKW_DEVICE));
-DLL_DECLARE(WINAPI, BOOL, UkwKernelDriverActive, (UKW_DEVICE, DWORD, PBOOL));
-DLL_DECLARE(WINAPI, BOOL, UkwAttachKernelDriver, (UKW_DEVICE, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwDetachKernelDriver, (UKW_DEVICE, DWORD));
-DLL_DECLARE(WINAPI, BOOL, UkwIssueBulkTransfer, (UKW_DEVICE, DWORD, UCHAR, LPVOID, DWORD, LPDWORD, LPOVERLAPPED));
-DLL_DECLARE(WINAPI, BOOL, UkwIsPipeHalted, (UKW_DEVICE, UCHAR, LPBOOL));
-
-// Used to determine if an endpoint status really is halted on a failed transfer.
-#define STATUS_HALT_FLAG 0x1
-
-struct wince_device_priv {
- UKW_DEVICE dev;
- UKW_DEVICE_DESCRIPTOR desc;
-};
-
-struct wince_device_handle_priv {
- // This member isn't used, but only exists to avoid an empty structure
- // for private data for the device handle.
- int reserved;
-};
-
-struct wince_transfer_priv {
- struct winfd pollable_fd;
- uint8_t interface_number;
-};
-
diff --git a/third_party/libusb/src/libusb/os/windows_common.h b/third_party/libusb/src/libusb/os/windows_common.h
deleted file mode 100644
index 1da72bd..0000000
--- a/third_party/libusb/src/libusb/os/windows_common.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Windows backend common header for libusbx 1.0
- *
- * This file brings together header code common between
- * the desktop Windows and Windows CE backends.
- * Copyright © 2012-2013 RealVNC Ltd.
- * Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
- * With contributions from Michael Plante, Orin Eman et al.
- * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
- * Major code testing contribution by Xiaofan Chen
- *
- * 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
- */
-
-#pragma once
-
-// Windows API default is uppercase - ugh!
-#if !defined(bool)
-#define bool BOOL
-#endif
-#if !defined(true)
-#define true TRUE
-#endif
-#if !defined(false)
-#define false FALSE
-#endif
-
-#define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0)
-#define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
-#define safe_min(a, b) min((size_t)(a), (size_t)(b))
-#define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \
- ((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0)
-#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1)
-#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1))
-#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1)
-#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
-#define safe_stricmp(str1, str2) _stricmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
-#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
-#define safe_strlen(str) ((str==NULL)?0:strlen(str))
-#define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0)
-#define safe_stprintf _sntprintf
-#define safe_tcslen(str) ((str==NULL)?0:_tcslen(str))
-#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0)
-#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
-#ifndef ARRAYSIZE
-#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
-#endif
-
-#define ERR_BUFFER_SIZE 256
-#define TIMER_REQUEST_RETRY_MS 100
-#define MAX_TIMER_SEMAPHORES 128
-
-
-/*
- * API macros - from libusb-win32 1.x
- */
-#define DLL_DECLARE_PREFIXNAME(api, ret, prefixname, name, args) \
- typedef ret (api * __dll_##name##_t)args; \
- static __dll_##name##_t prefixname = NULL
-
-#ifndef _WIN32_WCE
-#define DLL_STRINGIFY(dll) #dll
-#define DLL_GET_MODULE_HANDLE(dll) GetModuleHandleA(DLL_STRINGIFY(dll))
-#define DLL_LOAD_LIBRARY(dll) LoadLibraryA(DLL_STRINGIFY(dll))
-#else
-#define DLL_STRINGIFY(dll) L#dll
-#define DLL_GET_MODULE_HANDLE(dll) GetModuleHandle(DLL_STRINGIFY(dll))
-#define DLL_LOAD_LIBRARY(dll) LoadLibrary(DLL_STRINGIFY(dll))
-#endif
-
-#define DLL_LOAD_PREFIXNAME(dll, prefixname, name, ret_on_failure) \
- do { \
- HMODULE h = DLL_GET_MODULE_HANDLE(dll); \
- if (!h) \
- h = DLL_LOAD_LIBRARY(dll); \
- if (!h) { \
- if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; } \
- else { break; } \
- } \
- prefixname = (__dll_##name##_t)GetProcAddress(h, \
- DLL_STRINGIFY(name)); \
- if (prefixname) break; \
- prefixname = (__dll_##name##_t)GetProcAddress(h, \
- DLL_STRINGIFY(name) DLL_STRINGIFY(A)); \
- if (prefixname) break; \
- prefixname = (__dll_##name##_t)GetProcAddress(h, \
- DLL_STRINGIFY(name) DLL_STRINGIFY(W)); \
- if (prefixname) break; \
- if(ret_on_failure) \
- return LIBUSB_ERROR_NOT_FOUND; \
- } while(0)
-
-#define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXNAME(api, ret, name, name, args)
-#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure)
-#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args)
-#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure)
diff --git a/third_party/libusb/src/libusb/os/windows_usb.c b/third_party/libusb/src/libusb/os/windows_usb.c
index 51ce55d..0739c19 100644
--- a/third_party/libusb/src/libusb/os/windows_usb.c
+++ b/third_party/libusb/src/libusb/os/windows_usb.c
@@ -1,9 +1,8 @@
/*
- * windows backend for libusbx 1.0
- * Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
+ * windows backend for libusb 1.0
+ * Copyright (c) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
- * HID Reports IOCTLs inspired from HIDAPI by Alan Ott, Signal 11 Software
* Hash table functions adapted from glibc, by Ulrich Drepper et al.
* Major code testing contribution by Xiaofan Chen
*
@@ -34,67 +33,57 @@
#include <objbase.h>
#include <winioctl.h>
-#include "libusbi.h"
+#include <libusbi.h>
#include "poll_windows.h"
#include "windows_usb.h"
+// The following prevents "banned API" errors when using the MS's WDK OACR/Prefast
+#if defined(_PREFAST_)
+#pragma warning(disable:28719)
+#endif
+
// The 2 macros below are used in conjunction with safe loops.
#define LOOP_CHECK(fcall) { r=fcall; if (r != LIBUSB_SUCCESS) continue; }
#define LOOP_BREAK(err) { r=err; continue; }
+extern void usbi_fd_notification(struct libusb_context *ctx);
+
// Helper prototypes
static int windows_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len, int *host_endian);
static int windows_clock_gettime(int clk_id, struct timespec *tp);
unsigned __stdcall windows_clock_gettime_threaded(void* param);
-// Common calls
-static int common_configure_endpoints(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-
-// WinUSB-like API prototypes
-static int winusbx_init(int sub_api, struct libusb_context *ctx);
-static int winusbx_exit(int sub_api);
-static int winusbx_open(int sub_api, struct libusb_device_handle *dev_handle);
-static void winusbx_close(int sub_api, struct libusb_device_handle *dev_handle);
-static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int winusbx_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int winusbx_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int winusbx_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting);
-static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int winusbx_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint);
-static int winusbx_abort_transfers(int sub_api, struct usbi_transfer *itransfer);
-static int winusbx_abort_control(int sub_api, struct usbi_transfer *itransfer);
-static int winusbx_reset_device(int sub_api, struct libusb_device_handle *dev_handle);
-static int winusbx_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size);
-// HID API prototypes
-static int hid_init(int sub_api, struct libusb_context *ctx);
-static int hid_exit(int sub_api);
-static int hid_open(int sub_api, struct libusb_device_handle *dev_handle);
-static void hid_close(int sub_api, struct libusb_device_handle *dev_handle);
-static int hid_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int hid_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int hid_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting);
-static int hid_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int hid_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int hid_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint);
-static int hid_abort_transfers(int sub_api, struct usbi_transfer *itransfer);
-static int hid_reset_device(int sub_api, struct libusb_device_handle *dev_handle);
-static int hid_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size);
+// WinUSB API prototypes
+static int winusb_init(struct libusb_context *ctx);
+static int winusb_exit(void);
+static int winusb_open(struct libusb_device_handle *dev_handle);
+static void winusb_close(struct libusb_device_handle *dev_handle);
+static int winusb_configure_endpoints(struct libusb_device_handle *dev_handle, int iface);
+static int winusb_claim_interface(struct libusb_device_handle *dev_handle, int iface);
+static int winusb_release_interface(struct libusb_device_handle *dev_handle, int iface);
+static int winusb_submit_control_transfer(struct usbi_transfer *itransfer);
+static int winusb_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting);
+static int winusb_submit_bulk_transfer(struct usbi_transfer *itransfer);
+static int winusb_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint);
+static int winusb_abort_transfers(struct usbi_transfer *itransfer);
+static int winusb_abort_control(struct usbi_transfer *itransfer);
+static int winusb_reset_device(struct libusb_device_handle *dev_handle);
+static int winusb_copy_transfer_data(struct usbi_transfer *itransfer, uint32_t io_size);
// Composite API prototypes
-static int composite_init(int sub_api, struct libusb_context *ctx);
-static int composite_exit(int sub_api);
-static int composite_open(int sub_api, struct libusb_device_handle *dev_handle);
-static void composite_close(int sub_api, struct libusb_device_handle *dev_handle);
-static int composite_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int composite_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting);
-static int composite_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface);
-static int composite_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int composite_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int composite_submit_iso_transfer(int sub_api, struct usbi_transfer *itransfer);
-static int composite_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint);
-static int composite_abort_transfers(int sub_api, struct usbi_transfer *itransfer);
-static int composite_abort_control(int sub_api, struct usbi_transfer *itransfer);
-static int composite_reset_device(int sub_api, struct libusb_device_handle *dev_handle);
-static int composite_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size);
+static int composite_init(struct libusb_context *ctx);
+static int composite_exit(void);
+static int composite_open(struct libusb_device_handle *dev_handle);
+static void composite_close(struct libusb_device_handle *dev_handle);
+static int composite_claim_interface(struct libusb_device_handle *dev_handle, int iface);
+static int composite_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting);
+static int composite_release_interface(struct libusb_device_handle *dev_handle, int iface);
+static int composite_submit_control_transfer(struct usbi_transfer *itransfer);
+static int composite_submit_bulk_transfer(struct usbi_transfer *itransfer);
+static int composite_submit_iso_transfer(struct usbi_transfer *itransfer);
+static int composite_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint);
+static int composite_abort_transfers(struct usbi_transfer *itransfer);
+static int composite_abort_control(struct usbi_transfer *itransfer);
+static int composite_reset_device(struct libusb_device_handle *dev_handle);
+static int composite_copy_transfer_data(struct usbi_transfer *itransfer, uint32_t io_size);
// Global variables
@@ -113,12 +102,8 @@ volatile LONG request_count[2] = {0, 1}; // last one must be > 0
HANDLE timer_request[2] = { NULL, NULL };
HANDLE timer_response = NULL;
// API globals
-#define CHECK_WINUSBX_AVAILABLE(sub_api) do { if (sub_api == SUB_API_NOTSET) sub_api = priv->sub_api; \
- if (!WinUSBX[sub_api].initialized) return LIBUSB_ERROR_ACCESS; } while(0)
-static struct winusb_interface WinUSBX[SUB_API_MAX];
-const char* sub_api_name[SUB_API_MAX] = WINUSBX_DRV_NAMES;
-bool api_hid_available = false;
-#define CHECK_HID_AVAILABLE do { if (!api_hid_available) return LIBUSB_ERROR_ACCESS; } while (0)
+bool api_winusb_available = false;
+#define CHECK_WINUSB_AVAILABLE do { if (!api_winusb_available) return LIBUSB_ERROR_ACCESS; } while (0)
static inline BOOLEAN guid_eq(const GUID *guid1, const GUID *guid2) {
if ((guid1 != NULL) && (guid2 != NULL)) {
@@ -127,7 +112,7 @@ static inline BOOLEAN guid_eq(const GUID *guid1, const GUID *guid2) {
return false;
}
-#if defined(ENABLE_LOGGING)
+#if defined(ENABLE_DEBUG_LOGGING) || (defined(_MSC_VER) && _MSC_VER < 1400)
static char* guid_to_string(const GUID* guid)
{
static char guid_string[MAX_GUID_STRING_LENGTH];
@@ -145,18 +130,17 @@ static char* guid_to_string(const GUID* guid)
* Converts a windows error to human readable string
* uses retval as errorcode, or, if 0, use GetLastError()
*/
-#if defined(ENABLE_LOGGING)
static char *windows_error_str(uint32_t retval)
{
static char err_string[ERR_BUFFER_SIZE];
DWORD size;
- ssize_t i;
+ size_t i;
uint32_t error_code, format_error;
error_code = retval?retval:GetLastError();
- safe_sprintf(err_string, ERR_BUFFER_SIZE, "[%u] ", error_code);
+ safe_sprintf(err_string, ERR_BUFFER_SIZE, "[%d] ", error_code);
size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[safe_strlen(err_string)],
@@ -170,13 +154,12 @@ static char err_string[ERR_BUFFER_SIZE];
safe_sprintf(err_string, ERR_BUFFER_SIZE, "Unknown error code %u", error_code);
} else {
// Remove CR/LF terminators
- for (i=safe_strlen(err_string)-1; (i>=0) && ((err_string[i]==0x0A) || (err_string[i]==0x0D)); i--) {
+ for (i=safe_strlen(err_string)-1; ((err_string[i]==0x0A) || (err_string[i]==0x0D)); i--) {
err_string[i] = 0;
}
}
return err_string;
}
-#endif
/*
* Sanitize Microsoft's paths: convert to uppercase, add prefix and fix backslashes.
@@ -202,7 +185,7 @@ static char* sanitize_path(const char* path)
size += add_root;
}
- if ((ret_path = (char*) calloc(size, 1)) == NULL)
+ if ((ret_path = (char*)calloc(size, 1)) == NULL)
return NULL;
safe_strcpy(&ret_path[add_root], size-add_root, path);
@@ -239,7 +222,6 @@ static int init_dlls(void)
DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiDestroyDeviceInfoList, TRUE);
DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiOpenDevRegKey, TRUE);
DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiGetDeviceRegistryPropertyA, TRUE);
- DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiOpenDeviceInterfaceRegKey, TRUE);
DLL_LOAD_PREFIXED(AdvAPI32.dll, p, RegQueryValueExW, TRUE);
DLL_LOAD_PREFIXED(AdvAPI32.dll, p, RegCloseKey, TRUE);
return LIBUSB_SUCCESS;
@@ -259,7 +241,7 @@ static int init_dlls(void)
* incremented index starting at zero) until all interfaces have been returned.
*/
static bool get_devinfo_data(struct libusb_context *ctx,
- HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, const char* usb_class, unsigned _index)
+ HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, char* usb_class, unsigned _index)
{
if (_index <= 0) {
*dev_info = pSetupDiGetClassDevsA(NULL, usb_class, NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);
@@ -362,88 +344,6 @@ err_exit:
return NULL;
}
-/* For libusb0 filter */
-static SP_DEVICE_INTERFACE_DETAIL_DATA_A *get_interface_details_filter(struct libusb_context *ctx,
- HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, const GUID* guid, unsigned _index, char* filter_path){
- SP_DEVICE_INTERFACE_DATA dev_interface_data;
- SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details = NULL;
- DWORD size;
- if (_index <= 0) {
- *dev_info = pSetupDiGetClassDevsA(guid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
- }
- if (dev_info_data != NULL) {
- dev_info_data->cbSize = sizeof(SP_DEVINFO_DATA);
- if (!pSetupDiEnumDeviceInfo(*dev_info, _index, dev_info_data)) {
- if (GetLastError() != ERROR_NO_MORE_ITEMS) {
- usbi_err(ctx, "Could not obtain device info data for index %u: %s",
- _index, windows_error_str(0));
- }
- pSetupDiDestroyDeviceInfoList(*dev_info);
- *dev_info = INVALID_HANDLE_VALUE;
- return NULL;
- }
- }
- dev_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
- if (!pSetupDiEnumDeviceInterfaces(*dev_info, NULL, guid, _index, &dev_interface_data)) {
- if (GetLastError() != ERROR_NO_MORE_ITEMS) {
- usbi_err(ctx, "Could not obtain interface data for index %u: %s",
- _index, windows_error_str(0));
- }
- pSetupDiDestroyDeviceInfoList(*dev_info);
- *dev_info = INVALID_HANDLE_VALUE;
- return NULL;
- }
- // Read interface data (dummy + actual) to access the device path
- if (!pSetupDiGetDeviceInterfaceDetailA(*dev_info, &dev_interface_data, NULL, 0, &size, NULL)) {
- // The dummy call should fail with ERROR_INSUFFICIENT_BUFFER
- if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- usbi_err(ctx, "could not access interface data (dummy) for index %u: %s",
- _index, windows_error_str(0));
- goto err_exit;
- }
- } else {
- usbi_err(ctx, "program assertion failed - http://msdn.microsoft.com/en-us/library/ms792901.aspx is wrong.");
- goto err_exit;
- }
- if ((dev_interface_details = malloc(size)) == NULL) {
- usbi_err(ctx, "could not allocate interface data for index %u.", _index);
- goto err_exit;
- }
- dev_interface_details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
- if (!pSetupDiGetDeviceInterfaceDetailA(*dev_info, &dev_interface_data,
- dev_interface_details, size, &size, NULL)) {
- usbi_err(ctx, "could not access interface data (actual) for index %u: %s",
- _index, windows_error_str(0));
- }
- // [trobinso] lookup the libusb0 symbolic index.
- if (dev_interface_details) {
- HKEY hkey_device_interface=pSetupDiOpenDeviceInterfaceRegKey(*dev_info,&dev_interface_data,0,KEY_READ);
- if (hkey_device_interface != INVALID_HANDLE_VALUE) {
- DWORD libusb0_symboliclink_index=0;
- DWORD value_length=sizeof(DWORD);
- DWORD value_type=0;
- LONG status;
- status = pRegQueryValueExW(hkey_device_interface, L"LUsb0", NULL, &value_type,
- (LPBYTE) &libusb0_symboliclink_index, &value_length);
- if (status == ERROR_SUCCESS) {
- if (libusb0_symboliclink_index < 256) {
- // libusb0.sys is connected to this device instance.
- // If the the device interface guid is {F9F3FF14-AE21-48A0-8A25-8011A7A931D9} then it's a filter.
- safe_sprintf(filter_path, sizeof("\\\\.\\libusb0-0000"), "\\\\.\\libusb0-%04d", libusb0_symboliclink_index);
- usbi_dbg("assigned libusb0 symbolic link %s", filter_path);
- } else {
- // libusb0.sys was connected to this device instance at one time; but not anymore.
- }
- }
- pRegCloseKey(hkey_device_interface);
- }
- }
- return dev_interface_details;
-err_exit:
- pSetupDiDestroyDeviceInfoList(*dev_info);
- *dev_info = INVALID_HANDLE_VALUE;
- return NULL;}
-
/* Hash table functions - modified From glibc 2.3.2:
[Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
[Knuth] The Art of Computer Programming, part 3 (6.4) */
@@ -493,7 +393,7 @@ static int htab_create(struct libusb_context *ctx, unsigned long nel)
htab_filled = 0;
// allocate memory and zero out.
- htab_table = (htab_entry*) calloc(htab_size + 1, sizeof(htab_entry));
+ htab_table = (htab_entry*)calloc(htab_size + 1, sizeof(htab_entry));
if (htab_table == NULL) {
usbi_err(ctx, "could not allocate space for hash table");
return 0;
@@ -535,11 +435,8 @@ static unsigned long htab_hash(char* str)
int c;
char* sz = str;
- if (str == NULL)
- return 0;
-
// Compute main hash value (algorithm suggested by Nokia)
- while ((c = *sz++) != 0)
+ while ((c = *sz++))
r = ((r << 5) + r) + c;
if (r == 0)
++r;
@@ -601,7 +498,7 @@ static unsigned long htab_hash(char* str)
// string (same hash, different string) at the same time is extremely low
safe_free(htab_table[idx].str);
htab_table[idx].used = hval;
- htab_table[idx].str = (char*) malloc(safe_strlen(str)+1);
+ htab_table[idx].str = (char*) calloc(1, safe_strlen(str)+1);
if (htab_table[idx].str == NULL) {
usbi_err(NULL, "could not duplicate string for hash table");
usbi_mutex_unlock(&htab_write_mutex);
@@ -636,7 +533,7 @@ 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;
}
- // TODO: (post hotplug): try without sanitizing
+ // TODO (post hotplug): try without sanitizing
sanitized_path = sanitize_path(path);
if (sanitized_path == NULL) {
return 0;
@@ -671,7 +568,7 @@ static int windows_assign_endpoints(struct libusb_device_handle *dev_handle, int
return LIBUSB_SUCCESS;
}
- priv->usb_interface[iface].endpoint = (uint8_t*) malloc(if_desc->bNumEndpoints);
+ priv->usb_interface[iface].endpoint = (uint8_t*) calloc(1, if_desc->bNumEndpoints);
if (priv->usb_interface[iface].endpoint == NULL) {
return LIBUSB_ERROR_NO_MEM;
}
@@ -683,34 +580,38 @@ static int windows_assign_endpoints(struct libusb_device_handle *dev_handle, int
}
libusb_free_config_descriptor(conf_desc);
- // Extra init may be required to configure endpoints
- return priv->apib->configure_endpoints(SUB_API_NOTSET, dev_handle, iface);
+ // Extra init is required for WinUSB endpoints
+ if (priv->apib->id == USB_API_WINUSB) {
+ return winusb_configure_endpoints(dev_handle, iface);
+ }
+
+ return LIBUSB_SUCCESS;
}
// Lookup for a match in the list of API driver names
-// return -1 if not found, driver match number otherwise
-static int get_sub_api(char* driver, int api){
- int i;
+static bool is_api_driver(char* driver, uint8_t api)
+{
+ uint8_t i;
const char sep_str[2] = {LIST_SEPARATOR, 0};
char *tok, *tmp_str;
size_t len = safe_strlen(driver);
- if (len == 0) return SUB_API_NOTSET;
- tmp_str = (char*) calloc(len+1, 1);
- if (tmp_str == NULL) return SUB_API_NOTSET;
+ if (len == 0) return false;
+ tmp_str = (char*) calloc(1, len+1);
+ if (tmp_str == NULL) return false;
memcpy(tmp_str, driver, len+1);
tok = strtok(tmp_str, sep_str);
while (tok != NULL) {
for (i=0; i<usb_api_backend[api].nb_driver_names; i++) {
- if (safe_stricmp(tok, usb_api_backend[api].driver_name_list[i]) == 0) {
+ if (safe_strcmp(tok, usb_api_backend[api].driver_name_list[i]) == 0) {
free(tmp_str);
- return i;
+ return true;
}
}
tok = strtok(NULL, sep_str);
}
free (tmp_str);
- return SUB_API_NOTSET;
+ return false;
}
/*
@@ -725,14 +626,6 @@ static int auto_claim(struct libusb_transfer *transfer, int *interface_number, i
int current_interface = *interface_number;
int r = LIBUSB_SUCCESS;
- switch(api_type) {
- case USB_API_WINUSBX:
- case USB_API_HID:
- break;
- default:
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
usbi_mutex_lock(&autoclaim_lock);
if (current_interface < 0) // No serviceable interface was found
{
@@ -791,10 +684,10 @@ static void auto_release(struct usbi_transfer *itransfer)
}
/*
- * init: libusbx backend init function
+ * init: libusb backend init function
*
* This function enumerates the HCDs (Host Controller Drivers) and populates our private HCD list
- * In our implementation, we equate Windows' "HCD" to libusbx's "bus". Note that bus is zero indexed.
+ * In our implementation, we equate Windows' "HCD" to LibUSB's "bus". Note that bus is zero indexed.
* HCDs are not expected to change after init (might not hold true for hot pluggable USB PCI card?)
*/
static int windows_init(struct libusb_context *ctx)
@@ -855,7 +748,7 @@ static int windows_init(struct libusb_context *ctx)
// Initialize the low level APIs (we don't care about errors at this stage)
for (i=0; i<USB_API_MAX; i++) {
- usb_api_backend[i].init(SUB_API_NOTSET, ctx);
+ usb_api_backend[i].init(ctx);
}
// Because QueryPerformanceCounter might report different values when
@@ -981,7 +874,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
if (dev->num_configurations == 0)
return LIBUSB_ERROR_INVALID_PARAM;
- priv->config_descriptor = (unsigned char**) calloc(dev->num_configurations, sizeof(unsigned char*));
+ priv->config_descriptor = (unsigned char**) calloc(dev->num_configurations, sizeof(PUSB_CONFIGURATION_DESCRIPTOR));
if (priv->config_descriptor == NULL)
return LIBUSB_ERROR_NO_MEM;
for (i=0; i<dev->num_configurations; i++)
@@ -1006,16 +899,15 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
cd_buf_short.req.SetupPacket.wIndex = i;
cd_buf_short.req.SetupPacket.wLength = (USHORT)(size - sizeof(USB_DESCRIPTOR_REQUEST));
- // Dummy call to get the required data size. Initial failures are reported as info rather
- // than error as they can occur for non-penalizing situations, such as with some hubs.
+ // Dummy call to get the required data size
if (!DeviceIoControl(hub_handle, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, &cd_buf_short, size,
&cd_buf_short, size, &ret_size, NULL)) {
- usbi_info(ctx, "could not access configuration descriptor (dummy) for '%s': %s", device_id, windows_error_str(0));
+ usbi_err(ctx, "could not access configuration descriptor (dummy) for '%s': %s", device_id, windows_error_str(0));
LOOP_BREAK(LIBUSB_ERROR_IO);
}
if ((ret_size != size) || (cd_buf_short.data.wTotalLength < sizeof(USB_CONFIGURATION_DESCRIPTOR))) {
- usbi_info(ctx, "unexpected configuration descriptor size (dummy) for '%s'.", device_id);
+ usbi_err(ctx, "unexpected configuration descriptor size (dummy) for '%s'.", device_id);
LOOP_BREAK(LIBUSB_ERROR_IO);
}
@@ -1056,7 +948,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
i, cd_data->bConfigurationValue, cd_data->wTotalLength);
// Cache the descriptor
- priv->config_descriptor[i] = (unsigned char*) malloc(cd_data->wTotalLength);
+ priv->config_descriptor[i] = (unsigned char*) calloc(1, cd_data->wTotalLength);
if (priv->config_descriptor[i] == NULL)
return LIBUSB_ERROR_NO_MEM;
memcpy(priv->config_descriptor[i], cd_data, cd_data->wTotalLength);
@@ -1065,7 +957,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
}
/*
- * Populate a libusbx device structure
+ * Populate a libusb device structure
*/
static int init_device(struct libusb_device* dev, struct libusb_device* parent_dev,
uint8_t port_number, char* device_id, DWORD devinst)
@@ -1107,10 +999,8 @@ static int init_device(struct libusb_device* dev, struct libusb_device* parent_d
}
dev->bus_number = parent_dev->bus_number;
priv->port = port_number;
- dev->port_number = port_number;
priv->depth = parent_priv->depth + 1;
priv->parent_dev = parent_dev;
- dev->parent_dev = libusb_ref_device(parent_dev);
// If the device address is already set, we can stop here
if (dev->device_address != 0) {
@@ -1152,10 +1042,7 @@ static int init_device(struct libusb_device* dev, struct libusb_device* parent_d
if (conn_info.DeviceAddress > UINT8_MAX) {
usbi_err(ctx, "program assertion failed: device address overflow");
}
- dev->device_address = (uint8_t)conn_info.DeviceAddress + 1;
- if (dev->device_address == 1) {
- usbi_err(ctx, "program assertion failed: device address collision with root hub");
- }
+ dev->device_address = (uint8_t)conn_info.DeviceAddress;
switch (conn_info.Speed) {
case 0: dev->speed = LIBUSB_SPEED_LOW; break;
case 1: dev->speed = LIBUSB_SPEED_FULL; break;
@@ -1166,12 +1053,10 @@ static int init_device(struct libusb_device* dev, struct libusb_device* parent_d
break;
}
} else {
- dev->device_address = 1; // root hubs are set to use device number 1
+ dev->device_address = UINT8_MAX; // Hubs from HCD have a devaddr of 255
force_hcd_device_descriptor(dev);
}
- usbi_sanitize_device(dev);
-
usbi_dbg("(bus: %d, addr: %d, depth: %d, port: %d): '%s'",
dev->bus_number, dev->device_address, priv->depth, priv->port, device_id);
@@ -1179,8 +1064,8 @@ static int init_device(struct libusb_device* dev, struct libusb_device* parent_d
}
// Returns the api type, or 0 if not found/unsupported
-static void get_api_type(struct libusb_context *ctx, HDEVINFO *dev_info,
- SP_DEVINFO_DATA *dev_info_data, int *api, int *sub_api)
+static uint8_t get_api_type(struct libusb_context *ctx,
+ HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data)
{
// Precedence for filter drivers vs driver is in the order of this array
struct driver_lookup lookup[3] = {
@@ -1190,10 +1075,8 @@ static void get_api_type(struct libusb_context *ctx, HDEVINFO *dev_info,
};
DWORD size, reg_type;
unsigned k, l;
- int i, j;
+ uint8_t api;
- *api = USB_API_UNSUPPORTED;
- *sub_api = SUB_API_NOTSET;
// Check the service & filter names to know the API we should use
for (k=0; k<3; k++) {
if (pSetupDiGetDeviceRegistryPropertyA(*dev_info, dev_info_data, lookup[k].reg_prop,
@@ -1211,6 +1094,7 @@ static void get_api_type(struct libusb_context *ctx, HDEVINFO *dev_info,
lookup[k].list[l] = LIST_SEPARATOR;
}
}
+ upperize(lookup[k].list);
usbi_dbg("%s(s): %s", lookup[k].designation, lookup[k].list);
} else {
if (GetLastError() != ERROR_INVALID_DATA) {
@@ -1220,22 +1104,21 @@ static void get_api_type(struct libusb_context *ctx, HDEVINFO *dev_info,
}
}
- for (i=1; i<USB_API_MAX; i++) {
+ for (api=1; api<USB_API_MAX; api++) {
for (k=0; k<3; k++) {
- j = get_sub_api(lookup[k].list, i);
- if (j >= 0) {
- usbi_dbg("matched %s name against %s API",
- lookup[k].designation, (i!=USB_API_WINUSBX)?usb_api_backend[i].designation:sub_api_name[j]);
- *api = i;
- *sub_api = j;
- return;
+ if (is_api_driver(lookup[k].list, api)) {
+ usbi_dbg("matched %s name against %s", lookup[k].designation, usb_api_backend[api].designation);
+ break;
}
}
+ if (k >= 3) continue;
+ return api;
}
+ return 0;
}
static int set_composite_interface(struct libusb_context* ctx, struct libusb_device* dev,
- char* dev_interface_path, char* device_id, int api, int sub_api)
+ char* dev_interface_path, char* device_id, uint8_t api)
{
unsigned i;
struct windows_device_priv *priv = _device_priv(dev);
@@ -1265,78 +1148,36 @@ static int set_composite_interface(struct libusb_context* ctx, struct libusb_dev
}
if (priv->usb_interface[interface_number].path != NULL) {
- if (api == USB_API_HID) {
- // HID devices can have multiple collections (COL##) for each MI_## interface
- usbi_dbg("interface[%d] already set - ignoring HID collection: %s",
- interface_number, device_id);
- return LIBUSB_ERROR_ACCESS;
- }
- // In other cases, just use the latest data
- safe_free(priv->usb_interface[interface_number].path);
+ usbi_warn(ctx, "interface[%d] already set - ignoring: %s", interface_number, device_id);
+ return LIBUSB_ERROR_ACCESS;
}
usbi_dbg("interface[%d] = %s", interface_number, dev_interface_path);
priv->usb_interface[interface_number].path = dev_interface_path;
priv->usb_interface[interface_number].apib = &usb_api_backend[api];
- priv->usb_interface[interface_number].sub_api = sub_api;
- if ((api == USB_API_HID) && (priv->hid == NULL)) {
- priv->hid = (struct hid_device_priv*) calloc(1, sizeof(struct hid_device_priv));
- if (priv->hid == NULL)
- return LIBUSB_ERROR_NO_MEM;
- }
+ priv->composite_api_flags |= 1<<api;
return LIBUSB_SUCCESS;
}
-static int set_hid_interface(struct libusb_context* ctx, struct libusb_device* dev,
- char* dev_interface_path)
-{
- int i;
- struct windows_device_priv *priv = _device_priv(dev);
-
- if (priv->hid == NULL) {
- usbi_err(ctx, "program assertion failed: parent is not HID");
- return LIBUSB_ERROR_NO_DEVICE;
- }
- if (priv->hid->nb_interfaces == USB_MAXINTERFACES) {
- usbi_err(ctx, "program assertion failed: max USB interfaces reached for HID device");
- return LIBUSB_ERROR_NO_DEVICE;
- }
- for (i=0; i<priv->hid->nb_interfaces; i++) {
- if (safe_strcmp(priv->usb_interface[i].path, dev_interface_path) == 0) {
- usbi_dbg("interface[%d] already set to %s", i, dev_interface_path);
- return LIBUSB_SUCCESS;
- }
- }
-
- priv->usb_interface[priv->hid->nb_interfaces].path = dev_interface_path;
- priv->usb_interface[priv->hid->nb_interfaces].apib = &usb_api_backend[USB_API_HID];
- usbi_dbg("interface[%d] = %s", priv->hid->nb_interfaces, dev_interface_path);
- priv->hid->nb_interfaces++;
- return LIBUSB_SUCCESS;
-}
-
/*
- * get_device_list: libusbx backend device enumeration function
+ * get_device_list: libusb backend device enumeration function
*/
static int windows_get_device_list(struct libusb_context *ctx, struct discovered_devs **_discdevs)
{
struct discovered_devs *discdevs;
HDEVINFO dev_info = { 0 };
- const char* usb_class[] = {"USB", "NUSB3", "IUSB3"};
- SP_DEVINFO_DATA dev_info_data = { 0 };
+ char* usb_class[2] = {"USB", "NUSB3"};
+ SP_DEVINFO_DATA dev_info_data;
SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details = NULL;
- GUID hid_guid;
#define MAX_ENUM_GUIDS 64
const GUID* guid[MAX_ENUM_GUIDS];
#define HCD_PASS 0
#define HUB_PASS 1
#define GEN_PASS 2
#define DEV_PASS 3
-#define HID_PASS 4
int r = LIBUSB_SUCCESS;
- int api, sub_api;
- size_t class_index = 0;
+ int class_index = 0;
unsigned int nb_guids, pass, i, j, ancestor;
char path[MAX_PATH_LENGTH];
char strbuf[MAX_PATH_LENGTH];
@@ -1346,10 +1187,12 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
char* dev_id_path = NULL;
unsigned long session_id;
DWORD size, reg_type, port_nr, install_state;
+ BOOL b = FALSE;
HKEY key;
WCHAR guid_string_w[MAX_GUID_STRING_LENGTH];
GUID* if_guid;
LONG s;
+ uint8_t api;
// Keep a list of newly allocated devs to unref
libusb_device** unref_list;
unsigned int unref_size = 64;
@@ -1360,17 +1203,14 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
// PASS 3 : (re)enumerate generic USB devices (including driverless)
// and list additional USB device interface GUIDs to explore
// PASS 4 : (re)enumerate master USB devices that have a device interface
- // PASS 5+: (re)enumerate device interfaced GUIDs (including HID) and
- // set the device interfaces.
+ // PASS 5+: (re)enumerate device interfaced GUIDs and set the device interfaces.
// Init the GUID table
guid[HCD_PASS] = &GUID_DEVINTERFACE_USB_HOST_CONTROLLER;
guid[HUB_PASS] = &GUID_DEVINTERFACE_USB_HUB;
guid[GEN_PASS] = NULL;
guid[DEV_PASS] = &GUID_DEVINTERFACE_USB_DEVICE;
- HidD_GetHidGuid(&hid_guid);
- guid[HID_PASS] = &hid_guid;
- nb_guids = HID_PASS+1;
+ nb_guids = DEV_PASS+1;
unref_list = (libusb_device**) calloc(unref_size, sizeof(libusb_device*));
if (unref_list == NULL) {
@@ -1380,9 +1220,23 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
for (pass = 0; ((pass < nb_guids) && (r == LIBUSB_SUCCESS)); pass++) {
//#define ENUM_DEBUG
#ifdef ENUM_DEBUG
- const char *passname[] = { "HCD", "HUB", "GEN", "DEV", "HID", "EXT" };
- usbi_dbg("\n#### PROCESSING %ss %s", passname[(pass<=HID_PASS)?pass:HID_PASS+1],
- (pass!=GEN_PASS)?guid_to_string(guid[pass]):"");
+ switch(pass) {
+ case HCD_PASS:
+ usbi_dbg("PROCESSING HCDs %s", guid_to_string(guid[pass]));
+ break;
+ case HUB_PASS:
+ usbi_dbg("PROCESSING HUBs %s", guid_to_string(guid[pass]));
+ break;
+ case DEV_PASS:
+ usbi_dbg("PROCESSING DEVs %s", guid_to_string(guid[pass]));
+ break;
+ case GEN_PASS:
+ usbi_dbg("PROCESSING GENs");
+ break;
+ default:
+ usbi_dbg("PROCESSING EXTs %s", guid_to_string(guid[pass]));
+ break;
+ }
#endif
for (i = 0; ; i++) {
// safe loop: free up any (unprotected) dynamic resource
@@ -1415,15 +1269,13 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
}
} else {
// Workaround for a Nec/Renesas USB 3.0 driver bug where root hubs are
- // being listed under the "NUSB3" PnP Symbolic Name rather than "USB".
- // The Intel USB 3.0 driver behaves similar, but uses "IUSB3"
- for (; class_index < ARRAYSIZE(usb_class); class_index++) {
- if (get_devinfo_data(ctx, &dev_info, &dev_info_data, usb_class[class_index], i))
- break;
- i = 0;
+ // being listed under the "NUSB3" PnP Symbolic Name rather than "USB"
+ while ( (class_index < 2) &&
+ (!(b = get_devinfo_data(ctx, &dev_info, &dev_info_data, usb_class[class_index], i))) ) {
+ class_index++;
+ i = 0;
}
- if (class_index >= ARRAYSIZE(usb_class))
- break;
+ if (!b) break;
}
// Read the Device ID path. This is what we'll use as UID
@@ -1457,7 +1309,6 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
// Set API to use or get additional data from generic pass
api = USB_API_UNSUPPORTED;
- sub_api = SUB_API_NOTSET;
switch (pass) {
case HCD_PASS:
break;
@@ -1467,7 +1318,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
if (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_DRIVER,
&reg_type, (BYTE*)strbuf, size, &size)) {
usbi_info(ctx, "The following device has no driver: '%s'", dev_id_path);
- usbi_info(ctx, "libusbx will not be able to access it.");
+ usbi_info(ctx, "libusb will not be able to access it.");
}
// ...and to add the additional device interface GUIDs
key = pSetupDiOpenDevRegKey(dev_info, &dev_info_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
@@ -1489,9 +1340,6 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
}
}
break;
- case HID_PASS:
- api = USB_API_HID;
- break;
default:
// Get the API type (after checking that the driver installation is OK)
if ( (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_INSTALL_STATE,
@@ -1504,7 +1352,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
dev_id_path, install_state);
continue;
}
- get_api_type(ctx, &dev_info, &dev_info_data, &api, &sub_api);
+ api = get_api_type(ctx, &dev_info, &dev_info_data);
break;
}
@@ -1525,7 +1373,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
parent_dev = usbi_get_device_by_session_id(ctx, session_id);
}
if (parent_dev == NULL) {
- usbi_dbg("unlisted ancestor for '%s' (non USB HID, newly connected, etc.) - ignoring", dev_id_path);
+ usbi_dbg("unlisted ancestor for '%s' (newly connected, etc.) - ignoring", dev_id_path);
continue;
}
parent_priv = _device_priv(parent_dev);
@@ -1557,7 +1405,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
unref_list[unref_cur++] = dev;
if (unref_cur >= unref_size) {
unref_size += 64;
- unref_list = usbi_reallocf(unref_list, unref_size*sizeof(libusb_device*));
+ unref_list = realloc(unref_list, unref_size*sizeof(libusb_device*));
if (unref_list == NULL) {
usbi_err(ctx, "could not realloc list for unref - aborting.");
LOOP_BREAK(LIBUSB_ERROR_NO_MEM);
@@ -1577,7 +1425,6 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
dev->device_address = 0;
dev->num_configurations = 0;
priv->apib = &usb_api_backend[USB_API_HUB];
- priv->sub_api = SUB_API_NOTSET;
priv->depth = UINT8_MAX; // Overflow to 0 for HCD Hubs
priv->path = dev_interface_path; dev_interface_path = NULL;
break;
@@ -1589,18 +1436,10 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
// Take care of API initialization
priv->path = dev_interface_path; dev_interface_path = NULL;
priv->apib = &usb_api_backend[api];
- priv->sub_api = sub_api;
switch(api) {
case USB_API_COMPOSITE:
case USB_API_HUB:
break;
- case USB_API_HID:
- priv->hid = calloc(1, sizeof(struct hid_device_priv));
- if (priv->hid == NULL) {
- LOOP_BREAK(LIBUSB_ERROR_NO_MEM);
- }
- priv->hid->nb_interfaces = 0;
- break;
default:
// For other devices, the first interface is the same as the device
priv->usb_interface[0].path = (char*) calloc(safe_strlen(priv->path)+1, 1);
@@ -1632,15 +1471,10 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
r = LIBUSB_SUCCESS;
}
break;
- default: // HID_PASS and later
- if (parent_priv->apib->id == USB_API_HID) {
- usbi_dbg("setting HID interface for [%lX]:", parent_dev->session_data);
- r = set_hid_interface(ctx, parent_dev, dev_interface_path);
- if (r != LIBUSB_SUCCESS) LOOP_BREAK(r);
- dev_interface_path = NULL;
- } else if (parent_priv->apib->id == USB_API_COMPOSITE) {
+ default: // later passes
+ if (parent_priv->apib->id == USB_API_COMPOSITE) {
usbi_dbg("setting composite interface for [%lX]:", parent_dev->session_data);
- switch (set_composite_interface(ctx, parent_dev, dev_interface_path, dev_id_path, api, sub_api)) {
+ switch (set_composite_interface(ctx, parent_dev, dev_interface_path, dev_id_path, api)) {
case LIBUSB_SUCCESS:
dev_interface_path = NULL;
break;
@@ -1658,7 +1492,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
}
// Free any additional GUIDs
- for (pass = HID_PASS+1; pass < nb_guids; pass++) {
+ for (pass = DEV_PASS+1; pass < nb_guids; pass++) {
safe_free(guid[pass]);
}
@@ -1672,7 +1506,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
}
/*
- * exit: libusbx backend deinitialization function
+ * exit: libusb backend deinitialization function
*/
static void windows_exit(void)
{
@@ -1696,7 +1530,7 @@ static void windows_exit(void)
// Only works if exits and inits are balanced exactly
if (--concurrent_usage < 0) { // Last exit
for (i=0; i<USB_API_MAX; i++) {
- usb_api_backend[i].exit(SUB_API_NOTSET);
+ usb_api_backend[i].exit();
}
exit_polling();
@@ -1757,9 +1591,8 @@ static int windows_get_config_descriptor(struct libusb_device *dev, uint8_t conf
size = min(config_header->wTotalLength, len);
memcpy(buffer, priv->config_descriptor[config_index], size);
- *host_endian = 0;
- return size;
+ return LIBUSB_SUCCESS;
}
/*
@@ -1786,14 +1619,14 @@ static int windows_open(struct libusb_device_handle *dev_handle)
return LIBUSB_ERROR_NO_DEVICE;
}
- return priv->apib->open(SUB_API_NOTSET, dev_handle);
+ return priv->apib->open(dev_handle);
}
static void windows_close(struct libusb_device_handle *dev_handle)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- priv->apib->close(SUB_API_NOTSET, dev_handle);
+ priv->apib->close(dev_handle);
}
static int windows_get_configuration(struct libusb_device_handle *dev_handle, int *config)
@@ -1844,7 +1677,7 @@ static int windows_claim_interface(struct libusb_device_handle *dev_handle, int
safe_free(priv->usb_interface[iface].endpoint);
priv->usb_interface[iface].nb_endpoints= 0;
- r = priv->apib->claim_interface(SUB_API_NOTSET, dev_handle, iface);
+ r = priv->apib->claim_interface(dev_handle, iface);
if (r == LIBUSB_SUCCESS) {
r = windows_assign_endpoints(dev_handle, iface, 0);
@@ -1861,7 +1694,7 @@ static int windows_set_interface_altsetting(struct libusb_device_handle *dev_han
safe_free(priv->usb_interface[iface].endpoint);
priv->usb_interface[iface].nb_endpoints= 0;
- r = priv->apib->set_interface_altsetting(SUB_API_NOTSET, dev_handle, iface, altsetting);
+ r = priv->apib->set_interface_altsetting(dev_handle, iface, altsetting);
if (r == LIBUSB_SUCCESS) {
r = windows_assign_endpoints(dev_handle, iface, altsetting);
@@ -1874,19 +1707,19 @@ static int windows_release_interface(struct libusb_device_handle *dev_handle, in
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->apib->release_interface(SUB_API_NOTSET, dev_handle, iface);
+ return priv->apib->release_interface(dev_handle, iface);
}
static int windows_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->apib->clear_halt(SUB_API_NOTSET, dev_handle, endpoint);
+ return priv->apib->clear_halt(dev_handle, endpoint);
}
static int windows_reset_device(struct libusb_device_handle *dev_handle)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->apib->reset_device(SUB_API_NOTSET, dev_handle);
+ return priv->apib->reset_device(dev_handle);
}
// The 3 functions below are unlikely to ever get supported on Windows
@@ -1914,8 +1747,7 @@ static void windows_clear_transfer_priv(struct usbi_transfer *itransfer)
{
struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- usbi_free_fd(&transfer_priv->pollable_fd);
- safe_free(transfer_priv->hid_buffer);
+ usbi_free_fd(transfer_priv->pollable_fd.fd);
// When auto claim is in use, attempt to release the auto-claimed interface
auto_release(itransfer);
}
@@ -1928,7 +1760,7 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer)
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
int r;
- r = priv->apib->submit_bulk_transfer(SUB_API_NOTSET, itransfer);
+ r = priv->apib->submit_bulk_transfer(itransfer);
if (r != LIBUSB_SUCCESS) {
return r;
}
@@ -1936,7 +1768,6 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer)
usbi_add_pollfd(ctx, transfer_priv->pollable_fd.fd,
(short)(IS_XFERIN(transfer) ? POLLIN : POLLOUT));
- itransfer->flags |= USBI_TRANSFER_UPDATED_FDS;
return LIBUSB_SUCCESS;
}
@@ -1948,7 +1779,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
int r;
- r = priv->apib->submit_iso_transfer(SUB_API_NOTSET, itransfer);
+ r = priv->apib->submit_iso_transfer(itransfer);
if (r != LIBUSB_SUCCESS) {
return r;
}
@@ -1956,7 +1787,6 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer)
usbi_add_pollfd(ctx, transfer_priv->pollable_fd.fd,
(short)(IS_XFERIN(transfer) ? POLLIN : POLLOUT));
- itransfer->flags |= USBI_TRANSFER_UPDATED_FDS;
return LIBUSB_SUCCESS;
}
@@ -1968,14 +1798,13 @@ static int submit_control_transfer(struct usbi_transfer *itransfer)
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
int r;
- r = priv->apib->submit_control_transfer(SUB_API_NOTSET, itransfer);
+ r = priv->apib->submit_control_transfer(itransfer);
if (r != LIBUSB_SUCCESS) {
return r;
}
usbi_add_pollfd(ctx, transfer_priv->pollable_fd.fd, POLLIN);
- itransfer->flags |= USBI_TRANSFER_UPDATED_FDS;
return LIBUSB_SUCCESS;
}
@@ -2006,7 +1835,7 @@ static int windows_abort_control(struct usbi_transfer *itransfer)
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- return priv->apib->abort_control(SUB_API_NOTSET, itransfer);
+ return priv->apib->abort_control(itransfer);
}
static int windows_abort_transfers(struct usbi_transfer *itransfer)
@@ -2014,7 +1843,7 @@ static int windows_abort_transfers(struct usbi_transfer *itransfer)
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- return priv->apib->abort_transfers(SUB_API_NOTSET, itransfer);
+ return priv->apib->abort_transfers(itransfer);
}
static int windows_cancel_transfer(struct usbi_transfer *itransfer)
@@ -2038,13 +1867,13 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- int status, istatus;
+ int status;
- usbi_dbg("handling I/O completion with errcode %d, size %d", io_result, io_size);
+ usbi_dbg("handling I/O completion with errcode %d", io_result);
switch(io_result) {
case NO_ERROR:
- status = priv->apib->copy_transfer_data(SUB_API_NOTSET, itransfer, io_size);
+ status = priv->apib->copy_transfer_data(itransfer, io_size);
break;
case ERROR_GEN_FAILURE:
usbi_dbg("detected endpoint stall");
@@ -2055,10 +1884,6 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t
status = LIBUSB_TRANSFER_TIMED_OUT;
break;
case ERROR_OPERATION_ABORTED:
- istatus = priv->apib->copy_transfer_data(SUB_API_NOTSET, itransfer, io_size);
- if (istatus != LIBUSB_TRANSFER_COMPLETED) {
- usbi_dbg("Failed to copy partial data in aborted operation: %d", istatus);
- }
if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) {
usbi_dbg("detected timeout");
status = LIBUSB_TRANSFER_TIMED_OUT;
@@ -2068,7 +1893,7 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t
}
break;
default:
- usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %d: %s", io_result, windows_error_str(0));
+ usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error: %s", windows_error_str(0));
status = LIBUSB_TRANSFER_ERROR;
break;
}
@@ -2142,7 +1967,6 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
windows_handle_callback(transfer, io_result, io_size);
} else {
usbi_err(ctx, "could not find a matching transfer for fd %x", fds[i]);
- usbi_mutex_unlock(&ctx->open_devs_lock);
return LIBUSB_ERROR_NOT_FOUND;
}
}
@@ -2215,6 +2039,8 @@ unsigned __stdcall windows_clock_gettime_threaded(void* param)
return 0;
}
}
+ usbi_dbg("ERROR: broken timer thread");
+ return 1;
}
static int windows_clock_gettime(int clk_id, struct timespec *tp)
@@ -2266,19 +2092,16 @@ static int windows_clock_gettime(int clk_id, struct timespec *tp)
// NB: MSVC6 does not support named initializers.
const struct usbi_os_backend windows_backend = {
"Windows",
- USBI_CAP_HAS_HID_ACCESS,
windows_init,
windows_exit,
windows_get_device_list,
- NULL, /* hotplug_poll */
windows_open,
windows_close,
windows_get_device_descriptor,
windows_get_active_config_descriptor,
windows_get_config_descriptor,
- NULL, /* get_config_descriptor_by_value() */
windows_get_configuration,
windows_set_configuration,
@@ -2315,73 +2138,67 @@ const struct usbi_os_backend windows_backend = {
/*
* USB API backends
*/
-static int unsupported_init(int sub_api, struct libusb_context *ctx) {
+static int unsupported_init(struct libusb_context *ctx) {
return LIBUSB_SUCCESS;
}
-static int unsupported_exit(int sub_api) {
+static int unsupported_exit(void) {
return LIBUSB_SUCCESS;
}
-static int unsupported_open(int sub_api, struct libusb_device_handle *dev_handle) {
+static int unsupported_open(struct libusb_device_handle *dev_handle) {
PRINT_UNSUPPORTED_API(open);
}
-static void unsupported_close(int sub_api, struct libusb_device_handle *dev_handle) {
+static void unsupported_close(struct libusb_device_handle *dev_handle) {
usbi_dbg("unsupported API call for 'close'");
}
-static int unsupported_configure_endpoints(int sub_api, struct libusb_device_handle *dev_handle, int iface) {
- PRINT_UNSUPPORTED_API(configure_endpoints);
-}
-static int unsupported_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface) {
+static int unsupported_claim_interface(struct libusb_device_handle *dev_handle, int iface) {
PRINT_UNSUPPORTED_API(claim_interface);
}
-static int unsupported_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting) {
+static int unsupported_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting) {
PRINT_UNSUPPORTED_API(set_interface_altsetting);
}
-static int unsupported_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface) {
+static int unsupported_release_interface(struct libusb_device_handle *dev_handle, int iface) {
PRINT_UNSUPPORTED_API(release_interface);
}
-static int unsupported_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint) {
+static int unsupported_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint) {
PRINT_UNSUPPORTED_API(clear_halt);
}
-static int unsupported_reset_device(int sub_api, struct libusb_device_handle *dev_handle) {
+static int unsupported_reset_device(struct libusb_device_handle *dev_handle) {
PRINT_UNSUPPORTED_API(reset_device);
}
-static int unsupported_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer) {
+static int unsupported_submit_bulk_transfer(struct usbi_transfer *itransfer) {
PRINT_UNSUPPORTED_API(submit_bulk_transfer);
}
-static int unsupported_submit_iso_transfer(int sub_api, struct usbi_transfer *itransfer) {
+static int unsupported_submit_iso_transfer(struct usbi_transfer *itransfer) {
PRINT_UNSUPPORTED_API(submit_iso_transfer);
}
-static int unsupported_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer) {
+static int unsupported_submit_control_transfer(struct usbi_transfer *itransfer) {
PRINT_UNSUPPORTED_API(submit_control_transfer);
}
-static int unsupported_abort_control(int sub_api, struct usbi_transfer *itransfer) {
+static int unsupported_abort_control(struct usbi_transfer *itransfer) {
PRINT_UNSUPPORTED_API(abort_control);
}
-static int unsupported_abort_transfers(int sub_api, struct usbi_transfer *itransfer) {
+static int unsupported_abort_transfers(struct usbi_transfer *itransfer) {
PRINT_UNSUPPORTED_API(abort_transfers);
}
-static int unsupported_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size) {
+static int unsupported_copy_transfer_data(struct usbi_transfer *itransfer, uint32_t io_size) {
PRINT_UNSUPPORTED_API(copy_transfer_data);
}
-static int common_configure_endpoints(int sub_api, struct libusb_device_handle *dev_handle, int iface) {
- return LIBUSB_SUCCESS;
-}
+
// These names must be uppercase
-const char* hub_driver_names[] = {"USBHUB", "USBHUB3", "NUSB3HUB", "RUSB3HUB", "FLXHCIH", "TIHUB3", "ETRONHUB3", "VIAHUB3", "ASMTHUB3", "IUSB3HUB"};
+const char* hub_driver_names[] = {"USBHUB", "USBHUB3", "NUSB3HUB", "FLXHCIH", "TIHUB3", "ETRONHUB3", "VIAHUB3", "ASMTHUB3"};
const char* composite_driver_names[] = {"USBCCGP"};
-const char* winusbx_driver_names[] = WINUSBX_DRV_NAMES;
-const char* hid_driver_names[] = {"HIDUSB", "MOUHID", "KBDHID"};
+const char* winusb_driver_names[] = {"WINUSB"};
const struct windows_usb_api_backend usb_api_backend[USB_API_MAX] = {
{
USB_API_UNSUPPORTED,
"Unsupported API",
+ &CLASS_GUID_UNSUPPORTED,
NULL,
0,
unsupported_init,
unsupported_exit,
unsupported_open,
unsupported_close,
- unsupported_configure_endpoints,
unsupported_claim_interface,
unsupported_set_interface_altsetting,
unsupported_release_interface,
@@ -2396,13 +2213,13 @@ const struct windows_usb_api_backend usb_api_backend[USB_API_MAX] = {
}, {
USB_API_HUB,
"HUB API",
+ &CLASS_GUID_UNSUPPORTED,
hub_driver_names,
- ARRAYSIZE(hub_driver_names),
+ sizeof(hub_driver_names)/sizeof(hub_driver_names[0]),
unsupported_init,
unsupported_exit,
unsupported_open,
unsupported_close,
- unsupported_configure_endpoints,
unsupported_claim_interface,
unsupported_set_interface_altsetting,
unsupported_release_interface,
@@ -2417,13 +2234,13 @@ const struct windows_usb_api_backend usb_api_backend[USB_API_MAX] = {
}, {
USB_API_COMPOSITE,
"Composite API",
+ &CLASS_GUID_COMPOSITE,
composite_driver_names,
- ARRAYSIZE(composite_driver_names),
+ sizeof(composite_driver_names)/sizeof(composite_driver_names[0]),
composite_init,
composite_exit,
composite_open,
composite_close,
- common_configure_endpoints,
composite_claim_interface,
composite_set_interface_altsetting,
composite_release_interface,
@@ -2436,131 +2253,58 @@ const struct windows_usb_api_backend usb_api_backend[USB_API_MAX] = {
composite_abort_transfers,
composite_copy_transfer_data,
}, {
- USB_API_WINUSBX,
- "WinUSB-like APIs",
- winusbx_driver_names,
- ARRAYSIZE(winusbx_driver_names),
- winusbx_init,
- winusbx_exit,
- winusbx_open,
- winusbx_close,
- winusbx_configure_endpoints,
- winusbx_claim_interface,
- winusbx_set_interface_altsetting,
- winusbx_release_interface,
- winusbx_clear_halt,
- winusbx_reset_device,
- winusbx_submit_bulk_transfer,
- unsupported_submit_iso_transfer,
- winusbx_submit_control_transfer,
- winusbx_abort_control,
- winusbx_abort_transfers,
- winusbx_copy_transfer_data,
- }, {
- USB_API_HID,
- "HID API",
- hid_driver_names,
- ARRAYSIZE(hid_driver_names),
- hid_init,
- hid_exit,
- hid_open,
- hid_close,
- common_configure_endpoints,
- hid_claim_interface,
- hid_set_interface_altsetting,
- hid_release_interface,
- hid_clear_halt,
- hid_reset_device,
- hid_submit_bulk_transfer,
+ USB_API_WINUSB,
+ "WinUSB API",
+ &CLASS_GUID_LIBUSB_WINUSB,
+ winusb_driver_names,
+ sizeof(winusb_driver_names)/sizeof(winusb_driver_names[0]),
+ winusb_init,
+ winusb_exit,
+ winusb_open,
+ winusb_close,
+ winusb_claim_interface,
+ winusb_set_interface_altsetting,
+ winusb_release_interface,
+ winusb_clear_halt,
+ winusb_reset_device,
+ winusb_submit_bulk_transfer,
unsupported_submit_iso_transfer,
- hid_submit_control_transfer,
- hid_abort_transfers,
- hid_abort_transfers,
- hid_copy_transfer_data,
+ winusb_submit_control_transfer,
+ winusb_abort_control,
+ winusb_abort_transfers,
+ winusb_copy_transfer_data,
},
};
/*
- * WinUSB-like (WinUSB, libusb0/libusbK through libusbk DLL) API functions
+ * WinUSB API functions
*/
-#define WinUSBX_Set(fn) do { if (native_winusb) WinUSBX[i].fn = (WinUsb_##fn##_t) GetProcAddress(h, "WinUsb_" #fn); \
- else pLibK_GetProcAddress((PVOID*)&WinUSBX[i].fn, i, KUSB_FNID_##fn); } while (0)
-
-static int winusbx_init(int sub_api, struct libusb_context *ctx)
-{
- HMODULE h = NULL;
- bool native_winusb = false;
- int i;
- KLIB_VERSION LibK_Version;
- LibK_GetProcAddress_t pLibK_GetProcAddress = NULL;
- LibK_GetVersion_t pLibK_GetVersion = NULL;
-
- h = GetModuleHandleA("libusbK");
- if (h == NULL) {
- h = LoadLibraryA("libusbK");
- }
- if (h == NULL) {
- usbi_info(ctx, "libusbK DLL is not available, will use native WinUSB");
- h = GetModuleHandleA("WinUSB");
- if (h == NULL) {
- h = LoadLibraryA("WinUSB");
- } if (h == NULL) {
- usbi_warn(ctx, "WinUSB DLL is not available either,\n"
- "you will not be able to access devices outside of enumeration");
- return LIBUSB_ERROR_NOT_FOUND;
- }
- } else {
- usbi_dbg("using libusbK DLL for universal access");
- pLibK_GetVersion = (LibK_GetVersion_t) GetProcAddress(h, "LibK_GetVersion");
- if (pLibK_GetVersion != NULL) {
- pLibK_GetVersion(&LibK_Version);
- usbi_dbg("libusbK version: %d.%d.%d.%d", LibK_Version.Major, LibK_Version.Minor,
- LibK_Version.Micro, LibK_Version.Nano);
- }
- pLibK_GetProcAddress = (LibK_GetProcAddress_t) GetProcAddress(h, "LibK_GetProcAddress");
- if (pLibK_GetProcAddress == NULL) {
- usbi_err(ctx, "LibK_GetProcAddress() not found in libusbK DLL");
- return LIBUSB_ERROR_NOT_FOUND;
- }
- }
- native_winusb = (pLibK_GetProcAddress == NULL);
- for (i=SUB_API_LIBUSBK; i<SUB_API_MAX; i++) {
- WinUSBX_Set(AbortPipe);
- WinUSBX_Set(ControlTransfer);
- WinUSBX_Set(FlushPipe);
- WinUSBX_Set(Free);
- WinUSBX_Set(GetAssociatedInterface);
- WinUSBX_Set(GetCurrentAlternateSetting);
- WinUSBX_Set(GetDescriptor);
- WinUSBX_Set(GetOverlappedResult);
- WinUSBX_Set(GetPipePolicy);
- WinUSBX_Set(GetPowerPolicy);
- WinUSBX_Set(Initialize);
- WinUSBX_Set(QueryDeviceInformation);
- WinUSBX_Set(QueryInterfaceSettings);
- WinUSBX_Set(QueryPipe);
- WinUSBX_Set(ReadPipe);
- WinUSBX_Set(ResetPipe);
- WinUSBX_Set(SetCurrentAlternateSetting);
- WinUSBX_Set(SetPipePolicy);
- WinUSBX_Set(SetPowerPolicy);
- WinUSBX_Set(WritePipe);
- if (!native_winusb) {
- WinUSBX_Set(ResetDevice);
- }
- if (WinUSBX[i].Initialize != NULL) {
- WinUSBX[i].initialized = true;
- usbi_dbg("initalized sub API %s", sub_api_name[i]);
- } else {
- usbi_warn(ctx, "Failed to initalize sub API %s", sub_api_name[i]);
- WinUSBX[i].initialized = false;
- }
- }
+static int winusb_init(struct libusb_context *ctx)
+{
+ DLL_LOAD(winusb.dll, WinUsb_Initialize, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_Free, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_GetAssociatedInterface, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_GetDescriptor, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_QueryInterfaceSettings, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_QueryDeviceInformation, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_SetCurrentAlternateSetting, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_GetCurrentAlternateSetting, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_QueryPipe, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_SetPipePolicy, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_GetPipePolicy, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_ReadPipe, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_WritePipe, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_ControlTransfer, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_ResetPipe, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_AbortPipe, TRUE);
+ DLL_LOAD(winusb.dll, WinUsb_FlushPipe, TRUE);
+
+ api_winusb_available = true;
return LIBUSB_SUCCESS;
}
-static int winusbx_exit(int sub_api)
+static int winusb_exit(void)
{
return LIBUSB_SUCCESS;
}
@@ -2568,7 +2312,7 @@ static int winusbx_exit(int sub_api)
// NB: open and close must ensure that they only handle interface of
// the right API type, as these functions can be called wholesale from
// composite_open(), with interfaces belonging to different APIs
-static int winusbx_open(int sub_api, struct libusb_device_handle *dev_handle)
+static int winusb_open(struct libusb_device_handle *dev_handle)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
@@ -2577,12 +2321,12 @@ static int winusbx_open(int sub_api, struct libusb_device_handle *dev_handle)
HANDLE file_handle;
int i;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
// WinUSB requires a seperate handle for each interface
for (i = 0; i < USB_MAXINTERFACES; i++) {
if ( (priv->usb_interface[i].path != NULL)
- && (priv->usb_interface[i].apib->id == USB_API_WINUSBX) ) {
+ && (priv->usb_interface[i].apib->id == USB_API_WINUSB) ) {
file_handle = CreateFileA(priv->usb_interface[i].path, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
if (file_handle == INVALID_HANDLE_VALUE) {
@@ -2603,20 +2347,18 @@ static int winusbx_open(int sub_api, struct libusb_device_handle *dev_handle)
return LIBUSB_SUCCESS;
}
-static void winusbx_close(int sub_api, struct libusb_device_handle *dev_handle)
+static void winusb_close(struct libusb_device_handle *dev_handle)
{
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
HANDLE file_handle;
int i;
- if (sub_api == SUB_API_NOTSET)
- sub_api = priv->sub_api;
- if (!WinUSBX[sub_api].initialized)
+ if (!api_winusb_available)
return;
for (i = 0; i < USB_MAXINTERFACES; i++) {
- if (priv->usb_interface[i].apib->id == USB_API_WINUSBX) {
+ if (priv->usb_interface[i].apib->id == USB_API_WINUSB) {
file_handle = handle_priv->interface_handle[i].dev_handle;
if ( (file_handle != 0) && (file_handle != INVALID_HANDLE_VALUE)) {
CloseHandle(file_handle);
@@ -2625,7 +2367,7 @@ static void winusbx_close(int sub_api, struct libusb_device_handle *dev_handle)
}
}
-static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle *dev_handle, int iface)
+static int winusb_configure_endpoints(struct libusb_device_handle *dev_handle, int iface)
{
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
@@ -2635,36 +2377,32 @@ static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle
uint8_t endpoint_address;
int i;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
// With handle and enpoints set (in parent), we can setup the default pipe properties
// see http://download.microsoft.com/download/D/1/D/D1DD7745-426B-4CC3-A269-ABBBE427C0EF/DVC-T705_DDC08.pptx
for (i=-1; i<priv->usb_interface[iface].nb_endpoints; i++) {
endpoint_address =(i==-1)?0:priv->usb_interface[iface].endpoint[i];
- if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
+ if (!WinUsb_SetPipePolicy(winusb_handle, endpoint_address,
PIPE_TRANSFER_TIMEOUT, sizeof(ULONG), &timeout)) {
usbi_dbg("failed to set PIPE_TRANSFER_TIMEOUT for control endpoint %02X", endpoint_address);
}
- if ((i == -1) || (sub_api == SUB_API_LIBUSB0)) {
- continue; // Other policies don't apply to control endpoint or libusb0
- }
+ if (i == -1) continue; // Other policies don't apply to control endpoint
policy = false;
- if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
+ if (!WinUsb_SetPipePolicy(winusb_handle, endpoint_address,
SHORT_PACKET_TERMINATE, sizeof(UCHAR), &policy)) {
usbi_dbg("failed to disable SHORT_PACKET_TERMINATE for endpoint %02X", endpoint_address);
}
- if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
+ if (!WinUsb_SetPipePolicy(winusb_handle, endpoint_address,
IGNORE_SHORT_PACKETS, sizeof(UCHAR), &policy)) {
usbi_dbg("failed to disable IGNORE_SHORT_PACKETS for endpoint %02X", endpoint_address);
}
- policy = true;
- /* ALLOW_PARTIAL_READS must be enabled due to likely libusbK bug. See:
- https://sourceforge.net/mailarchive/message.php?msg_id=29736015 */
- if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
+ if (!WinUsb_SetPipePolicy(winusb_handle, endpoint_address,
ALLOW_PARTIAL_READS, sizeof(UCHAR), &policy)) {
- usbi_dbg("failed to enable ALLOW_PARTIAL_READS for endpoint %02X", endpoint_address);
+ usbi_dbg("failed to disable ALLOW_PARTIAL_READS for endpoint %02X", endpoint_address);
}
- if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
+ policy = true;
+ if (!WinUsb_SetPipePolicy(winusb_handle, endpoint_address,
AUTO_CLEAR_STALL, sizeof(UCHAR), &policy)) {
usbi_dbg("failed to enable AUTO_CLEAR_STALL for endpoint %02X", endpoint_address);
}
@@ -2673,26 +2411,18 @@ static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle
return LIBUSB_SUCCESS;
}
-static int winusbx_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
+static int winusb_claim_interface(struct libusb_device_handle *dev_handle, int iface)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
bool is_using_usbccgp = (priv->apib->id == USB_API_COMPOSITE);
HANDLE file_handle, winusb_handle;
- DWORD err;
- int i;
- SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details = NULL;
- HDEVINFO dev_info = INVALID_HANDLE_VALUE;
- SP_DEVINFO_DATA dev_info_data;
- char* dev_path_no_guid = NULL;
- char filter_path[] = "\\\\.\\libusb0-0000";
- bool found_filter = false;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
// If the device is composite, but using the default Windows composite parent driver (usbccgp)
- // or if it's the first WinUSB-like interface, we get a handle through Initialize().
+ // or if it's the first WinUSB interface, we get a handle through WinUsb_Initialize().
if ((is_using_usbccgp) || (iface == 0)) {
// composite device (independent interfaces) or interface 0
file_handle = handle_priv->interface_handle[iface].dev_handle;
@@ -2700,64 +2430,35 @@ static int winusbx_claim_interface(int sub_api, struct libusb_device_handle *dev
return LIBUSB_ERROR_NOT_FOUND;
}
- if (!WinUSBX[sub_api].Initialize(file_handle, &winusb_handle)) {
+ if (!WinUsb_Initialize(file_handle, &winusb_handle)) {
+ usbi_err(ctx, "could not access interface %d: %s", iface, windows_error_str(0));
handle_priv->interface_handle[iface].api_handle = INVALID_HANDLE_VALUE;
- err = GetLastError();
- switch(err) {
- case ERROR_BAD_COMMAND:
- // The device was disconnected
- usbi_err(ctx, "could not access interface %d: %s", iface, windows_error_str(0));
+
+ switch(GetLastError()) {
+ case ERROR_BAD_COMMAND: // The device was disconnected
return LIBUSB_ERROR_NO_DEVICE;
default:
- // it may be that we're using the libusb0 filter driver.
- // TODO: can we move this whole business into the K/0 DLL?
- for (i = 0; ; i++) {
- safe_free(dev_interface_details);
- safe_free(dev_path_no_guid);
- dev_interface_details = get_interface_details_filter(ctx, &dev_info, &dev_info_data, &GUID_DEVINTERFACE_LIBUSB0_FILTER, i, filter_path);
- if ((found_filter) || (dev_interface_details == NULL)) {
- break;
- }
- // ignore GUID part
- dev_path_no_guid = sanitize_path(strtok(dev_interface_details->DevicePath, "{"));
- if (safe_strncmp(dev_path_no_guid, priv->usb_interface[iface].path, safe_strlen(dev_path_no_guid)) == 0) {
- file_handle = CreateFileA(filter_path, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
- if (file_handle == INVALID_HANDLE_VALUE) {
- usbi_err(ctx, "could not open device %s: %s", filter_path, windows_error_str(0));
- } else {
- WinUSBX[sub_api].Free(winusb_handle);
- if (!WinUSBX[sub_api].Initialize(file_handle, &winusb_handle)) {
- continue;
- }
- found_filter = true;
- break;
- }
- }
- }
- if (!found_filter) {
- usbi_err(ctx, "could not access interface %d: %s", iface, windows_error_str(err));
- return LIBUSB_ERROR_ACCESS;
- }
+ usbi_err(ctx, "could not claim interface %d: %s", iface, windows_error_str(0));
+ return LIBUSB_ERROR_ACCESS;
}
}
handle_priv->interface_handle[iface].api_handle = winusb_handle;
} else {
- // For all other interfaces, use GetAssociatedInterface()
+ // For all other interfaces, use WinUsb_GetAssociatedInterface()
winusb_handle = handle_priv->interface_handle[0].api_handle;
- // It is a requirement for multiple interface devices on Windows that, to you
- // must first claim the first interface before you claim the others
+ // It is a requirement for multiple interface devices using WinUSB that you
+ // must first claim the first interface before you claim any other
if ((winusb_handle == 0) || (winusb_handle == INVALID_HANDLE_VALUE)) {
file_handle = handle_priv->interface_handle[0].dev_handle;
- if (WinUSBX[sub_api].Initialize(file_handle, &winusb_handle)) {
+ if (WinUsb_Initialize(file_handle, &winusb_handle)) {
handle_priv->interface_handle[0].api_handle = winusb_handle;
usbi_warn(ctx, "auto-claimed interface 0 (required to claim %d with WinUSB)", iface);
} else {
- usbi_warn(ctx, "failed to auto-claim interface 0 (required to claim %d with WinUSB): %s", iface, windows_error_str(0));
+ usbi_warn(ctx, "failed to auto-claim interface 0 (required to claim %d with WinUSB)", iface);
return LIBUSB_ERROR_ACCESS;
}
}
- if (!WinUSBX[sub_api].GetAssociatedInterface(winusb_handle, (UCHAR)(iface-1),
+ if (!WinUsb_GetAssociatedInterface(winusb_handle, (UCHAR)(iface-1),
&handle_priv->interface_handle[iface].api_handle)) {
handle_priv->interface_handle[iface].api_handle = INVALID_HANDLE_VALUE;
switch(GetLastError()) {
@@ -2779,20 +2480,19 @@ static int winusbx_claim_interface(int sub_api, struct libusb_device_handle *dev
return LIBUSB_SUCCESS;
}
-static int winusbx_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
+static int winusb_release_interface(struct libusb_device_handle *dev_handle, int iface)
{
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
HANDLE winusb_handle;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
winusb_handle = handle_priv->interface_handle[iface].api_handle;
if ((winusb_handle == 0) || (winusb_handle == INVALID_HANDLE_VALUE)) {
return LIBUSB_ERROR_NOT_FOUND;
}
- WinUSBX[sub_api].Free(winusb_handle);
+ WinUsb_Free(winusb_handle);
handle_priv->interface_handle[iface].api_handle = INVALID_HANDLE_VALUE;
return LIBUSB_SUCCESS;
@@ -2801,23 +2501,16 @@ static int winusbx_release_interface(int sub_api, struct libusb_device_handle *d
/*
* Return the first valid interface (of the same API type), for control transfers
*/
-static int get_valid_interface(struct libusb_device_handle *dev_handle, int api_id)
+static int winusb_get_valid_interface(struct libusb_device_handle *dev_handle)
{
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
int i;
- if ((api_id < USB_API_WINUSBX) || (api_id > USB_API_HID)) {
- usbi_dbg("unsupported API ID");
- return -1;
- }
-
for (i=0; i<USB_MAXINTERFACES; i++) {
if ( (handle_priv->interface_handle[i].dev_handle != 0)
&& (handle_priv->interface_handle[i].dev_handle != INVALID_HANDLE_VALUE)
&& (handle_priv->interface_handle[i].api_handle != 0)
- && (handle_priv->interface_handle[i].api_handle != INVALID_HANDLE_VALUE)
- && (priv->usb_interface[i].apib->id == api_id) ) {
+ && (handle_priv->interface_handle[i].api_handle != INVALID_HANDLE_VALUE) ) {
return i;
}
}
@@ -2847,7 +2540,7 @@ static int interface_by_endpoint(struct windows_device_priv *priv,
return -1;
}
-static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer)
+static int winusb_submit_control_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
@@ -2861,7 +2554,7 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
int current_interface;
struct winfd wfd;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
transfer_priv->pollable_fd = INVALID_WINFD;
size = transfer->length - LIBUSB_CONTROL_SETUP_SIZE;
@@ -2869,9 +2562,9 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
if (size > MAX_CTRL_BUFFER_LENGTH)
return LIBUSB_ERROR_INVALID_PARAM;
- current_interface = get_valid_interface(transfer->dev_handle, USB_API_WINUSBX);
+ current_interface = winusb_get_valid_interface(transfer->dev_handle);
if (current_interface < 0) {
- if (auto_claim(transfer, &current_interface, USB_API_WINUSBX) != LIBUSB_SUCCESS) {
+ if (auto_claim(transfer, &current_interface, USB_API_WINUSB) != LIBUSB_SUCCESS) {
return LIBUSB_ERROR_NOT_FOUND;
}
}
@@ -2879,7 +2572,7 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
usbi_dbg("will use interface %d", current_interface);
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
- wfd = usbi_create_fd(winusb_handle, RW_READ, NULL, NULL);
+ wfd = usbi_create_fd(winusb_handle, _O_RDONLY);
// Always use the handle returned from usbi_create_fd (wfd.handle)
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
@@ -2890,16 +2583,16 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
&& (setup->request == LIBUSB_REQUEST_SET_CONFIGURATION) ) {
if (setup->value != priv->active_config) {
usbi_warn(ctx, "cannot set configuration other than the default one");
- usbi_free_fd(&wfd);
+ usbi_free_fd(wfd.fd);
return LIBUSB_ERROR_INVALID_PARAM;
}
wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY;
wfd.overlapped->InternalHigh = 0;
} else {
- if (!WinUSBX[sub_api].ControlTransfer(wfd.handle, *setup, transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE, size, NULL, wfd.overlapped)) {
+ if (!WinUsb_ControlTransfer(wfd.handle, *setup, transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE, size, NULL, wfd.overlapped)) {
if(GetLastError() != ERROR_IO_PENDING) {
- usbi_warn(ctx, "ControlTransfer failed: %s", windows_error_str(0));
- usbi_free_fd(&wfd);
+ usbi_err(ctx, "WinUsb_ControlTransfer failed: %s", windows_error_str(0));
+ usbi_free_fd(wfd.fd);
return LIBUSB_ERROR_IO;
}
} else {
@@ -2915,14 +2608,13 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
return LIBUSB_SUCCESS;
}
-static int winusbx_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting)
+static int winusb_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
HANDLE winusb_handle;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
if (altsetting > 255) {
return LIBUSB_ERROR_INVALID_PARAM;
@@ -2934,15 +2626,15 @@ static int winusbx_set_interface_altsetting(int sub_api, struct libusb_device_ha
return LIBUSB_ERROR_NOT_FOUND;
}
- if (!WinUSBX[sub_api].SetCurrentAlternateSetting(winusb_handle, (UCHAR)altsetting)) {
- usbi_err(ctx, "SetCurrentAlternateSetting failed: %s", windows_error_str(0));
+ if (!WinUsb_SetCurrentAlternateSetting(winusb_handle, (UCHAR)altsetting)) {
+ usbi_err(ctx, "WinUsb_SetCurrentAlternateSetting failed: %s", windows_error_str(0));
return LIBUSB_ERROR_IO;
}
return LIBUSB_SUCCESS;
}
-static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer)
+static int winusb_submit_bulk_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
@@ -2954,7 +2646,7 @@ static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itran
int current_interface;
struct winfd wfd;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
transfer_priv->pollable_fd = INVALID_WINFD;
@@ -2968,7 +2660,7 @@ static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itran
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
- wfd = usbi_create_fd(winusb_handle, IS_XFERIN(transfer) ? RW_READ : RW_WRITE, NULL, NULL);
+ wfd = usbi_create_fd(winusb_handle, IS_XFERIN(transfer) ? _O_RDONLY : _O_WRONLY);
// Always use the handle returned from usbi_create_fd (wfd.handle)
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
@@ -2976,15 +2668,15 @@ static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itran
if (IS_XFERIN(transfer)) {
usbi_dbg("reading %d bytes", transfer->length);
- ret = WinUSBX[sub_api].ReadPipe(wfd.handle, transfer->endpoint, transfer->buffer, transfer->length, NULL, wfd.overlapped);
+ ret = WinUsb_ReadPipe(wfd.handle, transfer->endpoint, transfer->buffer, transfer->length, NULL, wfd.overlapped);
} else {
usbi_dbg("writing %d bytes", transfer->length);
- ret = WinUSBX[sub_api].WritePipe(wfd.handle, transfer->endpoint, transfer->buffer, transfer->length, NULL, wfd.overlapped);
+ ret = WinUsb_WritePipe(wfd.handle, transfer->endpoint, transfer->buffer, transfer->length, NULL, wfd.overlapped);
}
if (!ret) {
if(GetLastError() != ERROR_IO_PENDING) {
- usbi_err(ctx, "ReadPipe/WritePipe failed: %s", windows_error_str(0));
- usbi_free_fd(&wfd);
+ usbi_err(ctx, "WinUsb_Pipe Transfer failed: %s", windows_error_str(0));
+ usbi_free_fd(wfd.fd);
return LIBUSB_ERROR_IO;
}
} else {
@@ -2998,7 +2690,7 @@ static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itran
return LIBUSB_SUCCESS;
}
-static int winusbx_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint)
+static int winusb_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
@@ -3006,7 +2698,7 @@ static int winusbx_clear_halt(int sub_api, struct libusb_device_handle *dev_hand
HANDLE winusb_handle;
int current_interface;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
current_interface = interface_by_endpoint(priv, handle_priv, endpoint);
if (current_interface < 0) {
@@ -3017,8 +2709,8 @@ static int winusbx_clear_halt(int sub_api, struct libusb_device_handle *dev_hand
usbi_dbg("matched endpoint %02X with interface %d", endpoint, current_interface);
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
- if (!WinUSBX[sub_api].ResetPipe(winusb_handle, endpoint)) {
- usbi_err(ctx, "ResetPipe failed: %s", windows_error_str(0));
+ if (!WinUsb_ResetPipe(winusb_handle, endpoint)) {
+ usbi_err(ctx, "WinUsb_ResetPipe failed: %s", windows_error_str(0));
return LIBUSB_ERROR_NO_DEVICE;
}
@@ -3031,23 +2723,22 @@ static int winusbx_clear_halt(int sub_api, struct libusb_device_handle *dev_hand
* "You can not call WinUsb_AbortPipe on control pipe. You can possibly cancel
* the control transfer using CancelIo"
*/
-static int winusbx_abort_control(int sub_api, struct usbi_transfer *itransfer)
+static int winusb_abort_control(struct usbi_transfer *itransfer)
{
// Cancelling of the I/O is done in the parent
return LIBUSB_SUCCESS;
}
-static int winusbx_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
+static int winusb_abort_transfers(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
- struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
+ struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);
HANDLE winusb_handle;
int current_interface;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
current_interface = transfer_priv->interface_number;
if ((current_interface < 0) || (current_interface >= USB_MAXINTERFACES)) {
@@ -3058,8 +2749,8 @@ static int winusbx_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
- if (!WinUSBX[sub_api].AbortPipe(winusb_handle, transfer->endpoint)) {
- usbi_err(ctx, "AbortPipe failed: %s", windows_error_str(0));
+ if (!WinUsb_AbortPipe(winusb_handle, transfer->endpoint)) {
+ usbi_err(ctx, "WinUsb_AbortPipe failed: %s", windows_error_str(0));
return LIBUSB_ERROR_NO_DEVICE;
}
@@ -3074,8 +2765,8 @@ static int winusbx_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
* IOCTL_USB_HUB_CYCLE_PORT ioctl was removed from Vista => the best we can do is
* cycle the pipes (and even then, the control pipe can not be reset using WinUSB)
*/
-// TODO: (post hotplug): see if we can force eject the device and redetect it (reuse hotplug?)
-static int winusbx_reset_device(int sub_api, struct libusb_device_handle *dev_handle)
+// TODO (post hotplug): see if we can force eject the device and redetect it (reuse hotplug?)
+static int winusb_reset_device(struct libusb_device_handle *dev_handle)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
@@ -3084,7 +2775,7 @@ static int winusbx_reset_device(int sub_api, struct libusb_device_handle *dev_ha
HANDLE winusb_handle;
int i, j;
- CHECK_WINUSBX_AVAILABLE(sub_api);
+ CHECK_WINUSB_AVAILABLE;
// Reset any available pipe (except control)
for (i=0; i<USB_MAXINTERFACES; i++) {
@@ -3093,1205 +2784,124 @@ static int winusbx_reset_device(int sub_api, struct libusb_device_handle *dev_ha
{
// Cancel any pollable I/O
usbi_remove_pollfd(ctx, wfd.fd);
- usbi_free_fd(&wfd);
+ usbi_free_fd(wfd.fd);
wfd = handle_to_winfd(winusb_handle);
}
if ( (winusb_handle != 0) && (winusb_handle != INVALID_HANDLE_VALUE)) {
for (j=0; j<priv->usb_interface[i].nb_endpoints; j++) {
usbi_dbg("resetting ep %02X", priv->usb_interface[i].endpoint[j]);
- if (!WinUSBX[sub_api].AbortPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) {
- usbi_err(ctx, "AbortPipe (pipe address %02X) failed: %s",
+ if (!WinUsb_AbortPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) {
+ usbi_err(ctx, "WinUsb_AbortPipe (pipe address %02X) failed: %s",
priv->usb_interface[i].endpoint[j], windows_error_str(0));
}
// FlushPipe seems to fail on OUT pipes
if (IS_EPIN(priv->usb_interface[i].endpoint[j])
- && (!WinUSBX[sub_api].FlushPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) ) {
- usbi_err(ctx, "FlushPipe (pipe address %02X) failed: %s",
+ && (!WinUsb_FlushPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) ) {
+ usbi_err(ctx, "WinUsb_FlushPipe (pipe address %02X) failed: %s",
priv->usb_interface[i].endpoint[j], windows_error_str(0));
}
- if (!WinUSBX[sub_api].ResetPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) {
- usbi_err(ctx, "ResetPipe (pipe address %02X) failed: %s",
+ if (!WinUsb_ResetPipe(winusb_handle, priv->usb_interface[i].endpoint[j])) {
+ usbi_err(ctx, "WinUsb_ResetPipe (pipe address %02X) failed: %s",
priv->usb_interface[i].endpoint[j], windows_error_str(0));
}
}
}
}
- // libusbK & libusb0 have the ability to issue an actual device reset
- if (WinUSBX[sub_api].ResetDevice != NULL) {
- winusb_handle = handle_priv->interface_handle[0].api_handle;
- if ( (winusb_handle != 0) && (winusb_handle != INVALID_HANDLE_VALUE)) {
- WinUSBX[sub_api].ResetDevice(winusb_handle);
- }
- }
return LIBUSB_SUCCESS;
}
-static int winusbx_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size)
+static int winusb_copy_transfer_data(struct usbi_transfer *itransfer, uint32_t io_size)
{
itransfer->transferred += io_size;
return LIBUSB_TRANSFER_COMPLETED;
}
-/*
- * Internal HID Support functions (from libusb-win32)
- * Note that functions that complete data transfer synchronously must return
- * LIBUSB_COMPLETED instead of LIBUSB_SUCCESS
- */
-static int _hid_get_hid_descriptor(struct hid_device_priv* dev, void *data, size_t *size);
-static int _hid_get_report_descriptor(struct hid_device_priv* dev, void *data, size_t *size);
-
-static int _hid_wcslen(WCHAR *str)
-{
- int i = 0;
- while (str[i] && (str[i] != 0x409)) {
- i++;
- }
- return i;
-}
-
-static int _hid_get_device_descriptor(struct hid_device_priv* dev, void *data, size_t *size)
-{
- struct libusb_device_descriptor d;
-
- d.bLength = LIBUSB_DT_DEVICE_SIZE;
- d.bDescriptorType = LIBUSB_DT_DEVICE;
- d.bcdUSB = 0x0200; /* 2.00 */
- d.bDeviceClass = 0;
- d.bDeviceSubClass = 0;
- d.bDeviceProtocol = 0;
- d.bMaxPacketSize0 = 64; /* fix this! */
- d.idVendor = (uint16_t)dev->vid;
- d.idProduct = (uint16_t)dev->pid;
- d.bcdDevice = 0x0100;
- d.iManufacturer = dev->string_index[0];
- d.iProduct = dev->string_index[1];
- d.iSerialNumber = dev->string_index[2];
- d.bNumConfigurations = 1;
-
- if (*size > LIBUSB_DT_DEVICE_SIZE)
- *size = LIBUSB_DT_DEVICE_SIZE;
- memcpy(data, &d, *size);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_get_config_descriptor(struct hid_device_priv* dev, void *data, size_t *size)
-{
- char num_endpoints = 0;
- size_t config_total_len = 0;
- char tmp[HID_MAX_CONFIG_DESC_SIZE];
- struct libusb_config_descriptor *cd;
- struct libusb_interface_descriptor *id;
- struct libusb_hid_descriptor *hd;
- struct libusb_endpoint_descriptor *ed;
- size_t tmp_size;
-
- if (dev->input_report_size)
- num_endpoints++;
- if (dev->output_report_size)
- num_endpoints++;
-
- config_total_len = LIBUSB_DT_CONFIG_SIZE + LIBUSB_DT_INTERFACE_SIZE
- + LIBUSB_DT_HID_SIZE + num_endpoints * LIBUSB_DT_ENDPOINT_SIZE;
-
-
- cd = (struct libusb_config_descriptor *)tmp;
- id = (struct libusb_interface_descriptor *)(tmp + LIBUSB_DT_CONFIG_SIZE);
- hd = (struct libusb_hid_descriptor *)(tmp + LIBUSB_DT_CONFIG_SIZE
- + LIBUSB_DT_INTERFACE_SIZE);
- ed = (struct libusb_endpoint_descriptor *)(tmp + LIBUSB_DT_CONFIG_SIZE
- + LIBUSB_DT_INTERFACE_SIZE
- + LIBUSB_DT_HID_SIZE);
-
- cd->bLength = LIBUSB_DT_CONFIG_SIZE;
- cd->bDescriptorType = LIBUSB_DT_CONFIG;
- cd->wTotalLength = (uint16_t) config_total_len;
- cd->bNumInterfaces = 1;
- cd->bConfigurationValue = 1;
- cd->iConfiguration = 0;
- cd->bmAttributes = 1 << 7; /* bus powered */
- cd->MaxPower = 50;
-
- id->bLength = LIBUSB_DT_INTERFACE_SIZE;
- id->bDescriptorType = LIBUSB_DT_INTERFACE;
- id->bInterfaceNumber = 0;
- id->bAlternateSetting = 0;
- id->bNumEndpoints = num_endpoints;
- id->bInterfaceClass = 3;
- id->bInterfaceSubClass = 0;
- id->bInterfaceProtocol = 0;
- id->iInterface = 0;
-
- tmp_size = LIBUSB_DT_HID_SIZE;
- _hid_get_hid_descriptor(dev, hd, &tmp_size);
-
- if (dev->input_report_size) {
- ed->bLength = LIBUSB_DT_ENDPOINT_SIZE;
- ed->bDescriptorType = LIBUSB_DT_ENDPOINT;
- ed->bEndpointAddress = HID_IN_EP;
- ed->bmAttributes = 3;
- ed->wMaxPacketSize = dev->input_report_size - 1;
- ed->bInterval = 10;
- ed = (struct libusb_endpoint_descriptor *)((char*)ed + LIBUSB_DT_ENDPOINT_SIZE);
- }
-
- if (dev->output_report_size) {
- ed->bLength = LIBUSB_DT_ENDPOINT_SIZE;
- ed->bDescriptorType = LIBUSB_DT_ENDPOINT;
- ed->bEndpointAddress = HID_OUT_EP;
- ed->bmAttributes = 3;
- ed->wMaxPacketSize = dev->output_report_size - 1;
- ed->bInterval = 10;
- }
-
- if (*size > config_total_len)
- *size = config_total_len;
- memcpy(data, tmp, *size);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_get_string_descriptor(struct hid_device_priv* dev, int _index,
- void *data, size_t *size)
-{
- void *tmp = NULL;
- size_t tmp_size = 0;
- int i;
-
- /* language ID, EN-US */
- char string_langid[] = {
- 0x09,
- 0x04
- };
-
- if ((*size < 2) || (*size > 255)) {
- return LIBUSB_ERROR_OVERFLOW;
- }
-
- if (_index == 0) {
- tmp = string_langid;
- tmp_size = sizeof(string_langid)+2;
- } else {
- for (i=0; i<3; i++) {
- if (_index == (dev->string_index[i])) {
- tmp = dev->string[i];
- tmp_size = (_hid_wcslen(dev->string[i])+1) * sizeof(WCHAR);
- break;
- }
- }
- if (i == 3) { // not found
- return LIBUSB_ERROR_INVALID_PARAM;
- }
- }
-
- if(!tmp_size) {
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- if (tmp_size < *size) {
- *size = tmp_size;
- }
- // 2 byte header
- ((uint8_t*)data)[0] = (uint8_t)*size;
- ((uint8_t*)data)[1] = LIBUSB_DT_STRING;
- memcpy((uint8_t*)data+2, tmp, *size-2);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_get_hid_descriptor(struct hid_device_priv* dev, void *data, size_t *size)
-{
- struct libusb_hid_descriptor d;
- uint8_t tmp[MAX_HID_DESCRIPTOR_SIZE];
- size_t report_len = MAX_HID_DESCRIPTOR_SIZE;
-
- _hid_get_report_descriptor(dev, tmp, &report_len);
-
- d.bLength = LIBUSB_DT_HID_SIZE;
- d.bDescriptorType = LIBUSB_DT_HID;
- d.bcdHID = 0x0110; /* 1.10 */
- d.bCountryCode = 0;
- d.bNumDescriptors = 1;
- d.bClassDescriptorType = LIBUSB_DT_REPORT;
- d.wClassDescriptorLength = (uint16_t)report_len;
-
- if (*size > LIBUSB_DT_HID_SIZE)
- *size = LIBUSB_DT_HID_SIZE;
- memcpy(data, &d, *size);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_get_report_descriptor(struct hid_device_priv* dev, void *data, size_t *size)
-{
- uint8_t d[MAX_HID_DESCRIPTOR_SIZE];
- size_t i = 0;
-
- /* usage page (0xFFA0 == vendor defined) */
- d[i++] = 0x06; d[i++] = 0xA0; d[i++] = 0xFF;
- /* usage (vendor defined) */
- d[i++] = 0x09; d[i++] = 0x01;
- /* start collection (application) */
- d[i++] = 0xA1; d[i++] = 0x01;
- /* input report */
- if (dev->input_report_size) {
- /* usage (vendor defined) */
- d[i++] = 0x09; d[i++] = 0x01;
- /* logical minimum (0) */
- d[i++] = 0x15; d[i++] = 0x00;
- /* logical maximum (255) */
- d[i++] = 0x25; d[i++] = 0xFF;
- /* report size (8 bits) */
- d[i++] = 0x75; d[i++] = 0x08;
- /* report count */
- d[i++] = 0x95; d[i++] = (uint8_t)dev->input_report_size - 1;
- /* input (data, variable, absolute) */
- d[i++] = 0x81; d[i++] = 0x00;
- }
- /* output report */
- if (dev->output_report_size) {
- /* usage (vendor defined) */
- d[i++] = 0x09; d[i++] = 0x02;
- /* logical minimum (0) */
- d[i++] = 0x15; d[i++] = 0x00;
- /* logical maximum (255) */
- d[i++] = 0x25; d[i++] = 0xFF;
- /* report size (8 bits) */
- d[i++] = 0x75; d[i++] = 0x08;
- /* report count */
- d[i++] = 0x95; d[i++] = (uint8_t)dev->output_report_size - 1;
- /* output (data, variable, absolute) */
- d[i++] = 0x91; d[i++] = 0x00;
- }
- /* feature report */
- if (dev->feature_report_size) {
- /* usage (vendor defined) */
- d[i++] = 0x09; d[i++] = 0x03;
- /* logical minimum (0) */
- d[i++] = 0x15; d[i++] = 0x00;
- /* logical maximum (255) */
- d[i++] = 0x25; d[i++] = 0xFF;
- /* report size (8 bits) */
- d[i++] = 0x75; d[i++] = 0x08;
- /* report count */
- d[i++] = 0x95; d[i++] = (uint8_t)dev->feature_report_size - 1;
- /* feature (data, variable, absolute) */
- d[i++] = 0xb2; d[i++] = 0x02; d[i++] = 0x01;
- }
-
- /* end collection */
- d[i++] = 0xC0;
-
- if (*size > i)
- *size = i;
- memcpy(data, d, *size);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_get_descriptor(struct hid_device_priv* dev, HANDLE hid_handle, int recipient,
- int type, int _index, void *data, size_t *size)
-{
- switch(type) {
- case LIBUSB_DT_DEVICE:
- usbi_dbg("LIBUSB_DT_DEVICE");
- return _hid_get_device_descriptor(dev, data, size);
- case LIBUSB_DT_CONFIG:
- usbi_dbg("LIBUSB_DT_CONFIG");
- if (!_index)
- return _hid_get_config_descriptor(dev, data, size);
- return LIBUSB_ERROR_INVALID_PARAM;
- case LIBUSB_DT_STRING:
- usbi_dbg("LIBUSB_DT_STRING");
- return _hid_get_string_descriptor(dev, _index, data, size);
- case LIBUSB_DT_HID:
- usbi_dbg("LIBUSB_DT_HID");
- if (!_index)
- return _hid_get_hid_descriptor(dev, data, size);
- return LIBUSB_ERROR_INVALID_PARAM;
- case LIBUSB_DT_REPORT:
- usbi_dbg("LIBUSB_DT_REPORT");
- if (!_index)
- return _hid_get_report_descriptor(dev, data, size);
- return LIBUSB_ERROR_INVALID_PARAM;
- case LIBUSB_DT_PHYSICAL:
- usbi_dbg("LIBUSB_DT_PHYSICAL");
- if (HidD_GetPhysicalDescriptor(hid_handle, data, (ULONG)*size))
- return LIBUSB_COMPLETED;
- return LIBUSB_ERROR_OTHER;
- }
- usbi_dbg("unsupported");
- return LIBUSB_ERROR_INVALID_PARAM;
-}
-
-static int _hid_get_report(struct hid_device_priv* dev, HANDLE hid_handle, int id, void *data,
- struct windows_transfer_priv *tp, size_t *size, OVERLAPPED* overlapped,
- int report_type)
-{
- uint8_t *buf;
- DWORD ioctl_code, read_size, expected_size = (DWORD)*size;
- int r = LIBUSB_SUCCESS;
-
- if (tp->hid_buffer != NULL) {
- usbi_dbg("program assertion failed: hid_buffer is not NULL");
- }
-
- if ((*size == 0) || (*size > MAX_HID_REPORT_SIZE)) {
- usbi_dbg("invalid size (%d)", *size);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- switch (report_type) {
- case HID_REPORT_TYPE_INPUT:
- ioctl_code = IOCTL_HID_GET_INPUT_REPORT;
- break;
- case HID_REPORT_TYPE_FEATURE:
- ioctl_code = IOCTL_HID_GET_FEATURE;
- break;
- default:
- usbi_dbg("unknown HID report type %d", report_type);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- // Add a trailing byte to detect overflows
- buf = (uint8_t*)calloc(expected_size+1, 1);
- if (buf == NULL) {
- return LIBUSB_ERROR_NO_MEM;
- }
- buf[0] = (uint8_t)id; // Must be set always
- usbi_dbg("report ID: 0x%02X", buf[0]);
-
- tp->hid_expected_size = expected_size;
- read_size = expected_size;
-
- // NB: The size returned by DeviceIoControl doesn't include report IDs when not in use (0)
- if (!DeviceIoControl(hid_handle, ioctl_code, buf, expected_size+1,
- buf, expected_size+1, &read_size, overlapped)) {
- if (GetLastError() != ERROR_IO_PENDING) {
- usbi_dbg("Failed to Read HID Report: %s", windows_error_str(0));
- safe_free(buf);
- return LIBUSB_ERROR_IO;
- }
- // Asynchronous wait
- tp->hid_buffer = buf;
- tp->hid_dest = (uint8_t*)data; // copy dest, as not necessarily the start of the transfer buffer
- return LIBUSB_SUCCESS;
- }
-
- // Transfer completed synchronously => copy and discard extra buffer
- if (read_size == 0) {
- usbi_warn(NULL, "program assertion failed - read completed synchronously, but no data was read");
- *size = 0;
- } else {
- if (buf[0] != id) {
- usbi_warn(NULL, "mismatched report ID (data is %02X, parameter is %02X)", buf[0], id);
- }
- if ((size_t)read_size > expected_size) {
- r = LIBUSB_ERROR_OVERFLOW;
- usbi_dbg("OVERFLOW!");
- } else {
- r = LIBUSB_COMPLETED;
- }
-
- *size = MIN((size_t)read_size, *size);
- if (id == 0) {
- // Discard report ID
- memcpy(data, buf+1, *size);
- } else {
- memcpy(data, buf, *size);
- }
- }
- safe_free(buf);
- return r;
-}
-
-static int _hid_set_report(struct hid_device_priv* dev, HANDLE hid_handle, int id, void *data,
- struct windows_transfer_priv *tp, size_t *size, OVERLAPPED* overlapped,
- int report_type)
-{
- uint8_t *buf = NULL;
- DWORD ioctl_code, write_size= (DWORD)*size;
-
- if (tp->hid_buffer != NULL) {
- usbi_dbg("program assertion failed: hid_buffer is not NULL");
- }
-
- if ((*size == 0) || (*size > MAX_HID_REPORT_SIZE)) {
- usbi_dbg("invalid size (%d)", *size);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- switch (report_type) {
- case HID_REPORT_TYPE_OUTPUT:
- ioctl_code = IOCTL_HID_SET_OUTPUT_REPORT;
- break;
- case HID_REPORT_TYPE_FEATURE:
- ioctl_code = IOCTL_HID_SET_FEATURE;
- break;
- default:
- usbi_dbg("unknown HID report type %d", report_type);
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- usbi_dbg("report ID: 0x%02X", id);
- // When report IDs are not used (i.e. when id == 0), we must add
- // a null report ID. Otherwise, we just use original data buffer
- if (id == 0) {
- write_size++;
- }
- buf = (uint8_t*) malloc(write_size);
- if (buf == NULL) {
- return LIBUSB_ERROR_NO_MEM;
- }
- if (id == 0) {
- buf[0] = 0;
- memcpy(buf + 1, data, *size);
- } else {
- // This seems like a waste, but if we don't duplicate the
- // data, we'll get issues when freeing hid_buffer
- memcpy(buf, data, *size);
- if (buf[0] != id) {
- usbi_warn(NULL, "mismatched report ID (data is %02X, parameter is %02X)", buf[0], id);
- }
- }
-
- // NB: The size returned by DeviceIoControl doesn't include report IDs when not in use (0)
- if (!DeviceIoControl(hid_handle, ioctl_code, buf, write_size,
- buf, write_size, &write_size, overlapped)) {
- if (GetLastError() != ERROR_IO_PENDING) {
- usbi_dbg("Failed to Write HID Output Report: %s", windows_error_str(0));
- safe_free(buf);
- return LIBUSB_ERROR_IO;
- }
- tp->hid_buffer = buf;
- tp->hid_dest = NULL;
- return LIBUSB_SUCCESS;
- }
-
- // Transfer completed synchronously
- *size = write_size;
- if (write_size == 0) {
- usbi_dbg("program assertion failed - write completed synchronously, but no data was written");
- }
- safe_free(buf);
- return LIBUSB_COMPLETED;
-}
-
-static int _hid_class_request(struct hid_device_priv* dev, HANDLE hid_handle, int request_type,
- int request, int value, int _index, void *data, struct windows_transfer_priv *tp,
- size_t *size, OVERLAPPED* overlapped)
-{
- int report_type = (value >> 8) & 0xFF;
- int report_id = value & 0xFF;
-
- if ( (LIBUSB_REQ_RECIPIENT(request_type) != LIBUSB_RECIPIENT_INTERFACE)
- && (LIBUSB_REQ_RECIPIENT(request_type) != LIBUSB_RECIPIENT_DEVICE) )
- return LIBUSB_ERROR_INVALID_PARAM;
-
- if (LIBUSB_REQ_OUT(request_type) && request == HID_REQ_SET_REPORT)
- return _hid_set_report(dev, hid_handle, report_id, data, tp, size, overlapped, report_type);
-
- if (LIBUSB_REQ_IN(request_type) && request == HID_REQ_GET_REPORT)
- return _hid_get_report(dev, hid_handle, report_id, data, tp, size, overlapped, report_type);
-
- return LIBUSB_ERROR_INVALID_PARAM;
-}
-
-
-/*
- * HID API functions
- */
-static int hid_init(int sub_api, struct libusb_context *ctx)
-{
- DLL_LOAD(hid.dll, HidD_GetAttributes, TRUE);
- DLL_LOAD(hid.dll, HidD_GetHidGuid, TRUE);
- DLL_LOAD(hid.dll, HidD_GetPreparsedData, TRUE);
- DLL_LOAD(hid.dll, HidD_FreePreparsedData, TRUE);
- DLL_LOAD(hid.dll, HidD_GetManufacturerString, TRUE);
- DLL_LOAD(hid.dll, HidD_GetProductString, TRUE);
- DLL_LOAD(hid.dll, HidD_GetSerialNumberString, TRUE);
- DLL_LOAD(hid.dll, HidP_GetCaps, TRUE);
- DLL_LOAD(hid.dll, HidD_SetNumInputBuffers, TRUE);
- DLL_LOAD(hid.dll, HidD_SetFeature, TRUE);
- DLL_LOAD(hid.dll, HidD_GetFeature, TRUE);
- DLL_LOAD(hid.dll, HidD_GetPhysicalDescriptor, TRUE);
- DLL_LOAD(hid.dll, HidD_GetInputReport, FALSE);
- DLL_LOAD(hid.dll, HidD_SetOutputReport, FALSE);
- DLL_LOAD(hid.dll, HidD_FlushQueue, TRUE);
- DLL_LOAD(hid.dll, HidP_GetValueCaps, TRUE);
-
- api_hid_available = true;
- return LIBUSB_SUCCESS;
-}
-
-static int hid_exit(int sub_api)
-{
- return LIBUSB_SUCCESS;
-}
-
-// NB: open and close must ensure that they only handle interface of
-// the right API type, as these functions can be called wholesale from
-// composite_open(), with interfaces belonging to different APIs
-static int hid_open(int sub_api, struct libusb_device_handle *dev_handle)
-{
- struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
-
- HIDD_ATTRIBUTES hid_attributes;
- PHIDP_PREPARSED_DATA preparsed_data = NULL;
- HIDP_CAPS capabilities;
- HIDP_VALUE_CAPS *value_caps;
-
- HANDLE hid_handle = INVALID_HANDLE_VALUE;
- int i, j;
- // report IDs handling
- ULONG size[3];
- const char* type[3] = {"input", "output", "feature"};
- int nb_ids[2]; // zero and nonzero report IDs
-
- CHECK_HID_AVAILABLE;
- if (priv->hid == NULL) {
- usbi_err(ctx, "program assertion failed - private HID structure is unitialized");
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- for (i = 0; i < USB_MAXINTERFACES; i++) {
- if ( (priv->usb_interface[i].path != NULL)
- && (priv->usb_interface[i].apib->id == USB_API_HID) ) {
- hid_handle = CreateFileA(priv->usb_interface[i].path, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
- /*
- * http://www.lvr.com/hidfaq.htm: Why do I receive "Access denied" when attempting to access my HID?
- * "Windows 2000 and later have exclusive read/write access to HIDs that are configured as a system
- * keyboards or mice. An application can obtain a handle to a system keyboard or mouse by not
- * requesting READ or WRITE access with CreateFile. Applications can then use HidD_SetFeature and
- * HidD_GetFeature (if the device supports Feature reports)."
- */
- if (hid_handle == INVALID_HANDLE_VALUE) {
- usbi_warn(ctx, "could not open HID device in R/W mode (keyboard or mouse?) - trying without");
- hid_handle = CreateFileA(priv->usb_interface[i].path, 0, FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
- if (hid_handle == INVALID_HANDLE_VALUE) {
- usbi_err(ctx, "could not open device %s (interface %d): %s", priv->path, i, windows_error_str(0));
- switch(GetLastError()) {
- case ERROR_FILE_NOT_FOUND: // The device was disconnected
- return LIBUSB_ERROR_NO_DEVICE;
- case ERROR_ACCESS_DENIED:
- return LIBUSB_ERROR_ACCESS;
- default:
- return LIBUSB_ERROR_IO;
- }
- }
- priv->usb_interface[i].restricted_functionality = true;
- }
- handle_priv->interface_handle[i].api_handle = hid_handle;
- }
- }
-
- hid_attributes.Size = sizeof(hid_attributes);
- do {
- if (!HidD_GetAttributes(hid_handle, &hid_attributes)) {
- usbi_err(ctx, "could not gain access to HID top collection (HidD_GetAttributes)");
- break;
- }
-
- priv->hid->vid = hid_attributes.VendorID;
- priv->hid->pid = hid_attributes.ProductID;
-
- // Set the maximum available input buffer size
- for (i=32; HidD_SetNumInputBuffers(hid_handle, i); i*=2);
- usbi_dbg("set maximum input buffer size to %d", i/2);
-
- // Get the maximum input and output report size
- if (!HidD_GetPreparsedData(hid_handle, &preparsed_data) || !preparsed_data) {
- usbi_err(ctx, "could not read HID preparsed data (HidD_GetPreparsedData)");
- break;
- }
- if (HidP_GetCaps(preparsed_data, &capabilities) != HIDP_STATUS_SUCCESS) {
- usbi_err(ctx, "could not parse HID capabilities (HidP_GetCaps)");
- break;
- }
-
- // Find out if interrupt will need report IDs
- size[0] = capabilities.NumberInputValueCaps;
- size[1] = capabilities.NumberOutputValueCaps;
- size[2] = capabilities.NumberFeatureValueCaps;
- for (j=HidP_Input; j<=HidP_Feature; j++) {
- usbi_dbg("%d HID %s report value(s) found", size[j], type[j]);
- priv->hid->uses_report_ids[j] = false;
- if (size[j] > 0) {
- value_caps = (HIDP_VALUE_CAPS*) calloc(size[j], sizeof(HIDP_VALUE_CAPS));
- if ( (value_caps != NULL)
- && (HidP_GetValueCaps((HIDP_REPORT_TYPE)j, value_caps, &size[j], preparsed_data) == HIDP_STATUS_SUCCESS)
- && (size[j] >= 1) ) {
- nb_ids[0] = 0;
- nb_ids[1] = 0;
- for (i=0; i<(int)size[j]; i++) {
- usbi_dbg(" Report ID: 0x%02X", value_caps[i].ReportID);
- if (value_caps[i].ReportID != 0) {
- nb_ids[1]++;
- } else {
- nb_ids[0]++;
- }
- }
- if (nb_ids[1] != 0) {
- if (nb_ids[0] != 0) {
- usbi_warn(ctx, "program assertion failed: zero and nonzero report IDs used for %s",
- type[j]);
- }
- priv->hid->uses_report_ids[j] = true;
- }
- } else {
- usbi_warn(ctx, " could not process %s report IDs", type[j]);
- }
- safe_free(value_caps);
- }
- }
-
- // Set the report sizes
- priv->hid->input_report_size = capabilities.InputReportByteLength;
- priv->hid->output_report_size = capabilities.OutputReportByteLength;
- priv->hid->feature_report_size = capabilities.FeatureReportByteLength;
-
- // Fetch string descriptors
- priv->hid->string_index[0] = priv->dev_descriptor.iManufacturer;
- if (priv->hid->string_index[0] != 0) {
- HidD_GetManufacturerString(hid_handle, priv->hid->string[0],
- sizeof(priv->hid->string[0]));
- } else {
- priv->hid->string[0][0] = 0;
- }
- priv->hid->string_index[1] = priv->dev_descriptor.iProduct;
- if (priv->hid->string_index[1] != 0) {
- HidD_GetProductString(hid_handle, priv->hid->string[1],
- sizeof(priv->hid->string[1]));
- } else {
- priv->hid->string[1][0] = 0;
- }
- priv->hid->string_index[2] = priv->dev_descriptor.iSerialNumber;
- if (priv->hid->string_index[2] != 0) {
- HidD_GetSerialNumberString(hid_handle, priv->hid->string[2],
- sizeof(priv->hid->string[2]));
- } else {
- priv->hid->string[2][0] = 0;
- }
- } while(0);
-
- if (preparsed_data) {
- HidD_FreePreparsedData(preparsed_data);
- }
-
- return LIBUSB_SUCCESS;
-}
-
-static void hid_close(int sub_api, struct libusb_device_handle *dev_handle)
-{
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- HANDLE file_handle;
- int i;
-
- if (!api_hid_available)
- return;
-
- for (i = 0; i < USB_MAXINTERFACES; i++) {
- if (priv->usb_interface[i].apib->id == USB_API_HID) {
- file_handle = handle_priv->interface_handle[i].api_handle;
- if ( (file_handle != 0) && (file_handle != INVALID_HANDLE_VALUE)) {
- CloseHandle(file_handle);
- }
- }
- }
-}
-
-static int hid_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
-{
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
-
- CHECK_HID_AVAILABLE;
-
- // NB: Disconnection detection is not possible in this function
- if (priv->usb_interface[iface].path == NULL) {
- return LIBUSB_ERROR_NOT_FOUND; // invalid iface
- }
-
- // We use dev_handle as a flag for interface claimed
- if (handle_priv->interface_handle[iface].dev_handle == INTERFACE_CLAIMED) {
- return LIBUSB_ERROR_BUSY; // already claimed
- }
-
- handle_priv->interface_handle[iface].dev_handle = INTERFACE_CLAIMED;
-
- usbi_dbg("claimed interface %d", iface);
- handle_priv->active_interface = iface;
-
- return LIBUSB_SUCCESS;
-}
-
-static int hid_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
-{
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
-
- CHECK_HID_AVAILABLE;
-
- if (priv->usb_interface[iface].path == NULL) {
- return LIBUSB_ERROR_NOT_FOUND; // invalid iface
- }
-
- if (handle_priv->interface_handle[iface].dev_handle != INTERFACE_CLAIMED) {
- return LIBUSB_ERROR_NOT_FOUND; // invalid iface
- }
-
- handle_priv->interface_handle[iface].dev_handle = INVALID_HANDLE_VALUE;
-
- return LIBUSB_SUCCESS;
-}
-
-static int hid_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting)
-{
- struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
-
- CHECK_HID_AVAILABLE;
-
- if (altsetting > 255) {
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- if (altsetting != 0) {
- usbi_err(ctx, "set interface altsetting not supported for altsetting >0");
- return LIBUSB_ERROR_NOT_SUPPORTED;
- }
-
- return LIBUSB_SUCCESS;
-}
-
-static int hid_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
- struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
- WINUSB_SETUP_PACKET *setup = (WINUSB_SETUP_PACKET *) transfer->buffer;
- HANDLE hid_handle;
- struct winfd wfd;
- int current_interface, config;
- size_t size;
- int r = LIBUSB_ERROR_INVALID_PARAM;
-
- CHECK_HID_AVAILABLE;
-
- transfer_priv->pollable_fd = INVALID_WINFD;
- safe_free(transfer_priv->hid_buffer);
- transfer_priv->hid_dest = NULL;
- size = transfer->length - LIBUSB_CONTROL_SETUP_SIZE;
-
- if (size > MAX_CTRL_BUFFER_LENGTH) {
- return LIBUSB_ERROR_INVALID_PARAM;
- }
-
- current_interface = get_valid_interface(transfer->dev_handle, USB_API_HID);
- if (current_interface < 0) {
- if (auto_claim(transfer, &current_interface, USB_API_HID) != LIBUSB_SUCCESS) {
- return LIBUSB_ERROR_NOT_FOUND;
- }
- }
-
- usbi_dbg("will use interface %d", current_interface);
- hid_handle = handle_priv->interface_handle[current_interface].api_handle;
- // Always use the handle returned from usbi_create_fd (wfd.handle)
- wfd = usbi_create_fd(hid_handle, RW_READ, NULL, NULL);
- if (wfd.fd < 0) {
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- switch(LIBUSB_REQ_TYPE(setup->request_type)) {
- case LIBUSB_REQUEST_TYPE_STANDARD:
- switch(setup->request) {
- case LIBUSB_REQUEST_GET_DESCRIPTOR:
- r = _hid_get_descriptor(priv->hid, wfd.handle, LIBUSB_REQ_RECIPIENT(setup->request_type),
- (setup->value >> 8) & 0xFF, setup->value & 0xFF, transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE, &size);
- break;
- case LIBUSB_REQUEST_GET_CONFIGURATION:
- r = windows_get_configuration(transfer->dev_handle, &config);
- if (r == LIBUSB_SUCCESS) {
- size = 1;
- ((uint8_t*)transfer->buffer)[LIBUSB_CONTROL_SETUP_SIZE] = (uint8_t)config;
- r = LIBUSB_COMPLETED;
- }
- break;
- case LIBUSB_REQUEST_SET_CONFIGURATION:
- if (setup->value == priv->active_config) {
- r = LIBUSB_COMPLETED;
- } else {
- usbi_warn(ctx, "cannot set configuration other than the default one");
- r = LIBUSB_ERROR_INVALID_PARAM;
- }
- break;
- case LIBUSB_REQUEST_GET_INTERFACE:
- size = 1;
- ((uint8_t*)transfer->buffer)[LIBUSB_CONTROL_SETUP_SIZE] = 0;
- r = LIBUSB_COMPLETED;
- break;
- case LIBUSB_REQUEST_SET_INTERFACE:
- r = hid_set_interface_altsetting(0, transfer->dev_handle, setup->index, setup->value);
- if (r == LIBUSB_SUCCESS) {
- r = LIBUSB_COMPLETED;
- }
- break;
- default:
- usbi_warn(ctx, "unsupported HID control request");
- r = LIBUSB_ERROR_INVALID_PARAM;
- break;
- }
- break;
- case LIBUSB_REQUEST_TYPE_CLASS:
- r =_hid_class_request(priv->hid, wfd.handle, setup->request_type, setup->request, setup->value,
- setup->index, transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE, transfer_priv,
- &size, wfd.overlapped);
- break;
- default:
- usbi_warn(ctx, "unsupported HID control request");
- r = LIBUSB_ERROR_INVALID_PARAM;
- break;
- }
-
- if (r == LIBUSB_COMPLETED) {
- // Force request to be completed synchronously. Transferred size has been set by previous call
- wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY;
- // http://msdn.microsoft.com/en-us/library/ms684342%28VS.85%29.aspx
- // set InternalHigh to the number of bytes transferred
- wfd.overlapped->InternalHigh = (DWORD)size;
- r = LIBUSB_SUCCESS;
- }
-
- if (r == LIBUSB_SUCCESS) {
- // Use priv_transfer to store data needed for async polling
- transfer_priv->pollable_fd = wfd;
- transfer_priv->interface_number = (uint8_t)current_interface;
- } else {
- usbi_free_fd(&wfd);
- }
-
- return r;
-}
-
-static int hid_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer) {
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
- struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- struct winfd wfd;
- HANDLE hid_handle;
- bool direction_in, ret;
- int current_interface, length;
- DWORD size;
- int r = LIBUSB_SUCCESS;
-
- CHECK_HID_AVAILABLE;
-
- transfer_priv->pollable_fd = INVALID_WINFD;
- transfer_priv->hid_dest = NULL;
- safe_free(transfer_priv->hid_buffer);
-
- current_interface = interface_by_endpoint(priv, handle_priv, transfer->endpoint);
- if (current_interface < 0) {
- usbi_err(ctx, "unable to match endpoint to an open interface - cancelling transfer");
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- usbi_dbg("matched endpoint %02X with interface %d", transfer->endpoint, current_interface);
-
- hid_handle = handle_priv->interface_handle[current_interface].api_handle;
- direction_in = transfer->endpoint & LIBUSB_ENDPOINT_IN;
-
- wfd = usbi_create_fd(hid_handle, direction_in?RW_READ:RW_WRITE, NULL, NULL);
- // Always use the handle returned from usbi_create_fd (wfd.handle)
- if (wfd.fd < 0) {
- return LIBUSB_ERROR_NO_MEM;
- }
-
- // If report IDs are not in use, an extra prefix byte must be added
- if ( ((direction_in) && (!priv->hid->uses_report_ids[0]))
- || ((!direction_in) && (!priv->hid->uses_report_ids[1])) ) {
- length = transfer->length+1;
- } else {
- length = transfer->length;
- }
- // Add a trailing byte to detect overflows on input
- transfer_priv->hid_buffer = (uint8_t*)calloc(length+1, 1);
- if (transfer_priv->hid_buffer == NULL) {
- return LIBUSB_ERROR_NO_MEM;
- }
- transfer_priv->hid_expected_size = length;
-
- if (direction_in) {
- transfer_priv->hid_dest = transfer->buffer;
- usbi_dbg("reading %d bytes (report ID: 0x00)", length);
- ret = ReadFile(wfd.handle, transfer_priv->hid_buffer, length+1, &size, wfd.overlapped);
- } else {
- if (!priv->hid->uses_report_ids[1]) {
- memcpy(transfer_priv->hid_buffer+1, transfer->buffer, transfer->length);
- } else {
- // We could actually do without the calloc and memcpy in this case
- memcpy(transfer_priv->hid_buffer, transfer->buffer, transfer->length);
- }
- usbi_dbg("writing %d bytes (report ID: 0x%02X)", length, transfer_priv->hid_buffer[0]);
- ret = WriteFile(wfd.handle, transfer_priv->hid_buffer, length, &size, wfd.overlapped);
- }
- if (!ret) {
- if (GetLastError() != ERROR_IO_PENDING) {
- usbi_err(ctx, "HID transfer failed: %s", windows_error_str(0));
- usbi_free_fd(&wfd);
- safe_free(transfer_priv->hid_buffer);
- return LIBUSB_ERROR_IO;
- }
- } else {
- // Only write operations that completed synchronously need to free up
- // hid_buffer. For reads, copy_transfer_data() handles that process.
- if (!direction_in) {
- safe_free(transfer_priv->hid_buffer);
- }
- if (size == 0) {
- usbi_err(ctx, "program assertion failed - no data was transferred");
- size = 1;
- }
- if (size > (size_t)length) {
- usbi_err(ctx, "OVERFLOW!");
- r = LIBUSB_ERROR_OVERFLOW;
- }
- wfd.overlapped->Internal = STATUS_COMPLETED_SYNCHRONOUSLY;
- wfd.overlapped->InternalHigh = size;
- }
-
- transfer_priv->pollable_fd = wfd;
- transfer_priv->interface_number = (uint8_t)current_interface;
-
- return r;
-}
-
-static int hid_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
-{
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
- HANDLE hid_handle;
- int current_interface;
-
- CHECK_HID_AVAILABLE;
-
- current_interface = transfer_priv->interface_number;
- hid_handle = handle_priv->interface_handle[current_interface].api_handle;
- CancelIo(hid_handle);
-
- return LIBUSB_SUCCESS;
-}
-
-static int hid_reset_device(int sub_api, struct libusb_device_handle *dev_handle)
-{
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- HANDLE hid_handle;
- int current_interface;
-
- CHECK_HID_AVAILABLE;
-
- // Flushing the queues on all interfaces is the best we can achieve
- for (current_interface = 0; current_interface < USB_MAXINTERFACES; current_interface++) {
- hid_handle = handle_priv->interface_handle[current_interface].api_handle;
- if ((hid_handle != 0) && (hid_handle != INVALID_HANDLE_VALUE)) {
- HidD_FlushQueue(hid_handle);
- }
- }
- return LIBUSB_SUCCESS;
-}
-
-static int hid_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint)
-{
- struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
- struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
- struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- HANDLE hid_handle;
- int current_interface;
-
- CHECK_HID_AVAILABLE;
-
- current_interface = interface_by_endpoint(priv, handle_priv, endpoint);
- if (current_interface < 0) {
- usbi_err(ctx, "unable to match endpoint to an open interface - cannot clear");
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- usbi_dbg("matched endpoint %02X with interface %d", endpoint, current_interface);
- hid_handle = handle_priv->interface_handle[current_interface].api_handle;
-
- // No endpoint selection with Microsoft's implementation, so we try to flush the
- // whole interface. Should be OK for most case scenarios
- if (!HidD_FlushQueue(hid_handle)) {
- usbi_err(ctx, "Flushing of HID queue failed: %s", windows_error_str(0));
- // Device was probably disconnected
- return LIBUSB_ERROR_NO_DEVICE;
- }
-
- return LIBUSB_SUCCESS;
-}
-
-// This extra function is only needed for HID
-static int hid_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size) {
- struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
- struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
- struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);
- int r = LIBUSB_TRANSFER_COMPLETED;
- uint32_t corrected_size = io_size;
-
- if (transfer_priv->hid_buffer != NULL) {
- // If we have a valid hid_buffer, it means the transfer was async
- if (transfer_priv->hid_dest != NULL) { // Data readout
- // First, check for overflow
- if (corrected_size > transfer_priv->hid_expected_size) {
- usbi_err(ctx, "OVERFLOW!");
- corrected_size = (uint32_t)transfer_priv->hid_expected_size;
- r = LIBUSB_TRANSFER_OVERFLOW;
- }
-
- if (transfer_priv->hid_buffer[0] == 0) {
- // Discard the 1 byte report ID prefix
- corrected_size--;
- memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer+1, corrected_size);
- } else {
- memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer, corrected_size);
- }
- transfer_priv->hid_dest = NULL;
- }
- // For write, we just need to free the hid buffer
- safe_free(transfer_priv->hid_buffer);
- }
- itransfer->transferred += corrected_size;
- return r;
-}
-
/*
* Composite API functions
*/
-static int composite_init(int sub_api, struct libusb_context *ctx)
+static int composite_init(struct libusb_context *ctx)
{
return LIBUSB_SUCCESS;
}
-static int composite_exit(int sub_api)
+static int composite_exit(void)
{
return LIBUSB_SUCCESS;
}
-static int composite_open(int sub_api, struct libusb_device_handle *dev_handle)
+static int composite_open(struct libusb_device_handle *dev_handle)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- int r = LIBUSB_ERROR_NOT_FOUND;
- uint8_t i;
- // SUB_API_MAX+1 as the SUB_API_MAX pos is used to indicate availability of HID
- bool available[SUB_API_MAX+1] = {0};
-
- for (i=0; i<USB_MAXINTERFACES; i++) {
- switch (priv->usb_interface[i].apib->id) {
- case USB_API_WINUSBX:
- if (priv->usb_interface[i].sub_api != SUB_API_NOTSET)
- available[priv->usb_interface[i].sub_api] = true;
- break;
- case USB_API_HID:
- available[SUB_API_MAX] = true;
- break;
- default:
- break;
- }
- }
+ unsigned api;
+ int r;
+ uint8_t flag = 1<<USB_API_WINUSB;
- for (i=0; i<SUB_API_MAX; i++) { // WinUSB-like drivers
- if (available[i]) {
- r = usb_api_backend[USB_API_WINUSBX].open(i, dev_handle);
+ for (api=USB_API_WINUSB; api<USB_API_MAX; api++) {
+ if (priv->composite_api_flags & flag) {
+ r = usb_api_backend[api].open(dev_handle);
if (r != LIBUSB_SUCCESS) {
return r;
}
}
+ flag <<= 1;
}
- if (available[SUB_API_MAX]) { // HID driver
- r = hid_open(SUB_API_NOTSET, dev_handle);
- }
- return r;
+ return LIBUSB_SUCCESS;
}
-static void composite_close(int sub_api, struct libusb_device_handle *dev_handle)
+static void composite_close(struct libusb_device_handle *dev_handle)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- uint8_t i;
- bool available[SUB_API_MAX];
-
- for (i = 0; i<SUB_API_MAX; i++) {
- available[i] = false;
- }
-
- for (i=0; i<USB_MAXINTERFACES; i++) {
- if ( (priv->usb_interface[i].apib->id == USB_API_WINUSBX)
- && (priv->usb_interface[i].sub_api != SUB_API_NOTSET) ) {
- available[priv->usb_interface[i].sub_api] = true;
- }
- }
+ unsigned api;
+ uint8_t flag = 1<<USB_API_WINUSB;
- for (i=0; i<SUB_API_MAX; i++) {
- if (available[i]) {
- usb_api_backend[USB_API_WINUSBX].close(i, dev_handle);
+ for (api=USB_API_WINUSB; api<USB_API_MAX; api++) {
+ if (priv->composite_api_flags & flag) {
+ usb_api_backend[api].close(dev_handle);
}
+ flag <<= 1;
}
}
-static int composite_claim_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
+static int composite_claim_interface(struct libusb_device_handle *dev_handle, int iface)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->usb_interface[iface].apib->
- claim_interface(priv->usb_interface[iface].sub_api, dev_handle, iface);
+ return priv->usb_interface[iface].apib->claim_interface(dev_handle, iface);
}
-static int composite_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting)
+static int composite_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->usb_interface[iface].apib->
- set_interface_altsetting(priv->usb_interface[iface].sub_api, dev_handle, iface, altsetting);
+ return priv->usb_interface[iface].apib->set_interface_altsetting(dev_handle, iface, altsetting);
}
-static int composite_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface)
+static int composite_release_interface(struct libusb_device_handle *dev_handle, int iface)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
- return priv->usb_interface[iface].apib->
- release_interface(priv->usb_interface[iface].sub_api, dev_handle, iface);
+ return priv->usb_interface[iface].apib->release_interface(dev_handle, iface);
}
-static int composite_submit_control_transfer(int sub_api, struct usbi_transfer *itransfer)
+static int composite_submit_control_transfer(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- int i, pass;
-
- // Interface shouldn't matter for control, but it does in practice, with Windows'
- // restrictions with regards to accessing HID keyboards and mice. Try a 2 pass approach
- for (pass = 0; pass < 2; pass++) {
- for (i=0; i<USB_MAXINTERFACES; i++) {
- if (priv->usb_interface[i].path != NULL) {
- if ((pass == 0) && (priv->usb_interface[i].restricted_functionality)) {
- usbi_dbg("trying to skip restricted interface #%d (HID keyboard or mouse?)", i);
- continue;
- }
- usbi_dbg("using interface %d", i);
- return priv->usb_interface[i].apib->submit_control_transfer(priv->usb_interface[i].sub_api, itransfer);
- }
+ int i;
+
+ for (i=0; i<USB_MAXINTERFACES; i++) {
+ if (priv->usb_interface[i].path != NULL) {
+ usbi_dbg("using interface %d", i);
+ return priv->usb_interface[i].apib->submit_control_transfer(itransfer);
}
}
- usbi_err(ctx, "no libusbx supported interfaces to complete request");
+ usbi_err(ctx, "no libusb supported interfaces to complete request");
return LIBUSB_ERROR_NOT_FOUND;
}
-static int composite_submit_bulk_transfer(int sub_api, struct usbi_transfer *itransfer) {
+static int composite_submit_bulk_transfer(struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
@@ -4304,10 +2914,10 @@ static int composite_submit_bulk_transfer(int sub_api, struct usbi_transfer *itr
return LIBUSB_ERROR_NOT_FOUND;
}
- return priv->usb_interface[current_interface].apib->
- submit_bulk_transfer(priv->usb_interface[current_interface].sub_api, itransfer);}
+ return priv->usb_interface[current_interface].apib->submit_bulk_transfer(itransfer);
+}
-static int composite_submit_iso_transfer(int sub_api, struct usbi_transfer *itransfer) {
+static int composite_submit_iso_transfer(struct usbi_transfer *itransfer) {
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
@@ -4320,10 +2930,10 @@ static int composite_submit_iso_transfer(int sub_api, struct usbi_transfer *itra
return LIBUSB_ERROR_NOT_FOUND;
}
- return priv->usb_interface[current_interface].apib->
- submit_iso_transfer(priv->usb_interface[current_interface].sub_api, itransfer);}
+ return priv->usb_interface[current_interface].apib->submit_iso_transfer(itransfer);
+}
-static int composite_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint)
+static int composite_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint)
{
struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
@@ -4336,59 +2946,51 @@ static int composite_clear_halt(int sub_api, struct libusb_device_handle *dev_ha
return LIBUSB_ERROR_NOT_FOUND;
}
- return priv->usb_interface[current_interface].apib->
- clear_halt(priv->usb_interface[current_interface].sub_api, dev_handle, endpoint);}
+ return priv->usb_interface[current_interface].apib->clear_halt(dev_handle, endpoint);
+}
-static int composite_abort_control(int sub_api, struct usbi_transfer *itransfer)
+static int composite_abort_control(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- return priv->usb_interface[transfer_priv->interface_number].apib->
- abort_control(priv->usb_interface[transfer_priv->interface_number].sub_api, itransfer);}
+ return priv->usb_interface[transfer_priv->interface_number].apib->abort_control(itransfer);
+}
-static int composite_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
+static int composite_abort_transfers(struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- return priv->usb_interface[transfer_priv->interface_number].apib->
- abort_transfers(priv->usb_interface[transfer_priv->interface_number].sub_api, itransfer);}
+ return priv->usb_interface[transfer_priv->interface_number].apib->abort_transfers(itransfer);
+}
-static int composite_reset_device(int sub_api, struct libusb_device_handle *dev_handle)
+static int composite_reset_device(struct libusb_device_handle *dev_handle)
{
struct windows_device_priv *priv = _device_priv(dev_handle->dev);
+ unsigned api;
int r;
- uint8_t i;
- bool available[SUB_API_MAX];
- for (i = 0; i<SUB_API_MAX; i++) {
- available[i] = false;
- }
- for (i=0; i<USB_MAXINTERFACES; i++) {
- if ( (priv->usb_interface[i].apib->id == USB_API_WINUSBX)
- && (priv->usb_interface[i].sub_api != SUB_API_NOTSET) ) {
- available[priv->usb_interface[i].sub_api] = true;
- }
- }
- for (i=0; i<SUB_API_MAX; i++) {
- if (available[i]) {
- r = usb_api_backend[USB_API_WINUSBX].reset_device(i, dev_handle);
+ uint8_t flag = 1<<USB_API_WINUSB;
+
+ for (api=USB_API_WINUSB; api<USB_API_MAX; api++) {
+ if (priv->composite_api_flags & flag) {
+ r = usb_api_backend[api].reset_device(dev_handle);
if (r != LIBUSB_SUCCESS) {
return r;
}
}
+ flag <<= 1;
}
return LIBUSB_SUCCESS;
}
-static int composite_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size)
+static int composite_copy_transfer_data(struct usbi_transfer *itransfer, uint32_t io_size)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
- return priv->usb_interface[transfer_priv->interface_number].apib->
- copy_transfer_data(priv->usb_interface[transfer_priv->interface_number].sub_api, itransfer, io_size);
+ return priv->usb_interface[transfer_priv->interface_number].apib->copy_transfer_data(itransfer, io_size);
}
diff --git a/third_party/libusb/src/libusb/os/windows_usb.h b/third_party/libusb/src/libusb/os/windows_usb.h
index 5d67a56..7c2fae5 100644
--- a/third_party/libusb/src/libusb/os/windows_usb.h
+++ b/third_party/libusb/src/libusb/os/windows_usb.h
@@ -1,6 +1,6 @@
/*
- * Windows backend for libusbx 1.0
- * Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
+ * Windows backend for libusb 1.0
+ * Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
* With contributions from Michael Plante, Orin Eman et al.
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
* Major code testing contribution by Xiaofan Chen
@@ -22,8 +22,6 @@
#pragma once
-#include "windows_common.h"
-
#if defined(_MSC_VER)
// disable /W4 MSVC warnings that are benign
#pragma warning(disable:4127) // conditional expression is constant
@@ -32,6 +30,17 @@
#pragma warning(disable:4201) // nameless struct/union
#endif
+// Windows API default is uppercase - ugh!
+#if !defined(bool)
+#define bool BOOL
+#endif
+#if !defined(true)
+#define true TRUE
+#endif
+#if !defined(false)
+#define false FALSE
+#endif
+
// Missing from MSVC6 setupapi.h
#if !defined(SPDRP_ADDRESS)
#define SPDRP_ADDRESS 28
@@ -41,30 +50,45 @@
#endif
#if defined(__CYGWIN__ )
-#define _stricmp stricmp
// cygwin produces a warning unless these prototypes are defined
extern int _snprintf(char *buffer, size_t count, const char *format, ...);
extern char *_strdup(const char *strSource);
// _beginthreadex is MSVCRT => unavailable for cygwin. Fallback to using CreateThread
#define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, (LPTHREAD_START_ROUTINE)c, d, e, f)
#endif
+#define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0)
+#define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
+#define safe_min(a, b) min((size_t)(a), (size_t)(b))
+#define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \
+ ((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0)
+#define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1)
+#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1))
+#define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1)
+#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
+#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
+#define safe_strlen(str) ((str==NULL)?0:strlen(str))
+#define safe_sprintf _snprintf
+#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0)
+#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
+static inline void upperize(char* str) {
+ size_t i;
+ if (str == NULL) return;
+ for (i=0; i<safe_strlen(str); i++)
+ str[i] = (char)toupper((int)str[i]);
+}
#define MAX_CTRL_BUFFER_LENGTH 4096
#define MAX_USB_DEVICES 256
#define MAX_USB_STRING_LENGTH 128
-#define MAX_HID_REPORT_SIZE 1024
-#define MAX_HID_DESCRIPTOR_SIZE 256
#define MAX_GUID_STRING_LENGTH 40
#define MAX_PATH_LENGTH 128
#define MAX_KEY_LENGTH 256
+#define MAX_TIMER_SEMAPHORES 128
+#define TIMER_REQUEST_RETRY_MS 100
+#define ERR_BUFFER_SIZE 256
#define LIST_SEPARATOR ';'
#define HTAB_SIZE 1021
-// Handle code for HID interface that have been claimed ("dibs")
-#define INTERFACE_CLAIMED ((HANDLE)(intptr_t)0xD1B5)
-// Additional return code for HID operations that completed synchronously
-#define LIBUSB_COMPLETED (LIBUSB_SUCCESS + 1)
-
// http://msdn.microsoft.com/en-us/library/ff545978.aspx
// http://msdn.microsoft.com/en-us/library/ff545972.aspx
// http://msdn.microsoft.com/en-us/library/ff545982.aspx
@@ -77,9 +101,7 @@ const GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0
#if !defined(GUID_DEVINTERFACE_USB_HUB)
const GUID GUID_DEVINTERFACE_USB_HUB = { 0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8} };
#endif
-#if !defined(GUID_DEVINTERFACE_LIBUSB0_FILTER)
-const GUID GUID_DEVINTERFACE_LIBUSB0_FILTER = { 0xF9F3FF14, 0xAE21, 0x48A0, {0x8A, 0x25, 0x80, 0x11, 0xA7, 0xA9, 0x31, 0xD9} };
-#endif
+static const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
/*
@@ -88,43 +110,34 @@ const GUID GUID_DEVINTERFACE_LIBUSB0_FILTER = { 0xF9F3FF14, 0xAE21, 0x48A0, {0x8
#define USB_API_UNSUPPORTED 0
#define USB_API_HUB 1
#define USB_API_COMPOSITE 2
-#define USB_API_WINUSBX 3
-#define USB_API_HID 4
-#define USB_API_MAX 5
-// The following is used to indicate if the HID or composite extra props have already been set.
-#define USB_API_SET (1<<USB_API_MAX)
-
-// Sub-APIs for WinUSB-like driver APIs (WinUSB, libusbK, libusb-win32 through the libusbK DLL)
-// Must have the same values as the KUSB_DRVID enum from libusbk.h
-#define SUB_API_NOTSET -1
-#define SUB_API_LIBUSBK 0
-#define SUB_API_LIBUSB0 1
-#define SUB_API_WINUSB 2
-#define SUB_API_MAX 3
-
-#define WINUSBX_DRV_NAMES { "libusbK", "libusb0", "WinUSB"}
+#define USB_API_WINUSB 3
+#define USB_API_MAX 4
+
+#define CLASS_GUID_UNSUPPORTED GUID_NULL
+const GUID CLASS_GUID_LIBUSB_WINUSB = { 0x78A1C341, 0x4539, 0x11D3, {0xB8, 0x8D, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71} };
+const GUID CLASS_GUID_COMPOSITE = { 0x36FC9E60, 0xC465, 0x11cF, {0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} };
struct windows_usb_api_backend {
const uint8_t id;
const char* designation;
+ const GUID *class_guid; // The Class GUID (for fallback in case the driver name cannot be read)
const char **driver_name_list; // Driver name, without .sys, e.g. "usbccgp"
const uint8_t nb_driver_names;
- int (*init)(int sub_api, struct libusb_context *ctx);
- int (*exit)(int sub_api);
- int (*open)(int sub_api, struct libusb_device_handle *dev_handle);
- void (*close)(int sub_api, struct libusb_device_handle *dev_handle);
- int (*configure_endpoints)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
- int (*claim_interface)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
- int (*set_interface_altsetting)(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting);
- int (*release_interface)(int sub_api, struct libusb_device_handle *dev_handle, int iface);
- int (*clear_halt)(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint);
- int (*reset_device)(int sub_api, struct libusb_device_handle *dev_handle);
- int (*submit_bulk_transfer)(int sub_api, struct usbi_transfer *itransfer);
- int (*submit_iso_transfer)(int sub_api, struct usbi_transfer *itransfer);
- int (*submit_control_transfer)(int sub_api, struct usbi_transfer *itransfer);
- int (*abort_control)(int sub_api, struct usbi_transfer *itransfer);
- int (*abort_transfers)(int sub_api, struct usbi_transfer *itransfer);
- int (*copy_transfer_data)(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size);
+ int (*init)(struct libusb_context *ctx);
+ int (*exit)(void);
+ int (*open)(struct libusb_device_handle *dev_handle);
+ void (*close)(struct libusb_device_handle *dev_handle);
+ int (*claim_interface)(struct libusb_device_handle *dev_handle, int iface);
+ int (*set_interface_altsetting)(struct libusb_device_handle *dev_handle, int iface, int altsetting);
+ int (*release_interface)(struct libusb_device_handle *dev_handle, int iface);
+ int (*clear_halt)(struct libusb_device_handle *dev_handle, unsigned char endpoint);
+ int (*reset_device)(struct libusb_device_handle *dev_handle);
+ int (*submit_bulk_transfer)(struct usbi_transfer *itransfer);
+ int (*submit_iso_transfer)(struct usbi_transfer *itransfer);
+ int (*submit_control_transfer)(struct usbi_transfer *itransfer);
+ int (*abort_control)(struct usbi_transfer *itransfer);
+ int (*abort_transfers)(struct usbi_transfer *itransfer);
+ int (*copy_transfer_data)(struct usbi_transfer *itransfer, uint32_t io_size);
};
extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX];
@@ -138,90 +151,21 @@ extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX];
* private structures definition
* with inline pseudo constructors/destructors
*/
-
-// TODO (v2+): move hid desc to libusb.h?
-struct libusb_hid_descriptor {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint16_t bcdHID;
- uint8_t bCountryCode;
- uint8_t bNumDescriptors;
- uint8_t bClassDescriptorType;
- uint16_t wClassDescriptorLength;
-};
-#define LIBUSB_DT_HID_SIZE 9
-#define HID_MAX_CONFIG_DESC_SIZE (LIBUSB_DT_CONFIG_SIZE + LIBUSB_DT_INTERFACE_SIZE \
- + LIBUSB_DT_HID_SIZE + 2 * LIBUSB_DT_ENDPOINT_SIZE)
-#define HID_MAX_REPORT_SIZE 1024
-#define HID_IN_EP 0x81
-#define HID_OUT_EP 0x02
-#define LIBUSB_REQ_RECIPIENT(request_type) ((request_type) & 0x1F)
-#define LIBUSB_REQ_TYPE(request_type) ((request_type) & (0x03 << 5))
-#define LIBUSB_REQ_IN(request_type) ((request_type) & LIBUSB_ENDPOINT_IN)
-#define LIBUSB_REQ_OUT(request_type) (!LIBUSB_REQ_IN(request_type))
-
-// The following are used for HID reports IOCTLs
-#define HID_CTL_CODE(id) \
- CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
-#define HID_BUFFER_CTL_CODE(id) \
- CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define HID_IN_CTL_CODE(id) \
- CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
-#define HID_OUT_CTL_CODE(id) \
- CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
-
-#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
-#define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
-#define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
-#define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
-
-enum libusb_hid_request_type {
- HID_REQ_GET_REPORT = 0x01,
- HID_REQ_GET_IDLE = 0x02,
- HID_REQ_GET_PROTOCOL = 0x03,
- HID_REQ_SET_REPORT = 0x09,
- HID_REQ_SET_IDLE = 0x0A,
- HID_REQ_SET_PROTOCOL = 0x0B
-};
-
-enum libusb_hid_report_type {
- HID_REPORT_TYPE_INPUT = 0x01,
- HID_REPORT_TYPE_OUTPUT = 0x02,
- HID_REPORT_TYPE_FEATURE = 0x03
-};
-
-struct hid_device_priv {
- uint16_t vid;
- uint16_t pid;
- uint8_t config;
- uint8_t nb_interfaces;
- bool uses_report_ids[3]; // input, ouptput, feature
- uint16_t input_report_size;
- uint16_t output_report_size;
- uint16_t feature_report_size;
- WCHAR string[3][MAX_USB_STRING_LENGTH];
- uint8_t string_index[3]; // man, prod, ser
-};
-
typedef struct libusb_device_descriptor USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
struct windows_device_priv {
uint8_t depth; // distance to HCD
uint8_t port; // port number on the hub
- uint8_t active_config;
struct libusb_device *parent_dev; // access to parent is required for usermode ops
- struct windows_usb_api_backend const *apib;
char *path; // device interface path
- int sub_api; // for WinUSB-like APIs
+ struct windows_usb_api_backend const *apib;
struct {
char *path; // each interface needs a device interface path,
struct windows_usb_api_backend const *apib; // an API backend (multiple drivers support),
- int sub_api;
int8_t nb_endpoints; // and a set of endpoint addresses (USB_MAXENDPOINTS)
uint8_t *endpoint;
- bool restricted_functionality; // indicates if the interface functionality is restricted
- // by Windows (eg. HID keyboards or mice cannot do R/W)
} usb_interface[USB_MAXINTERFACES];
- struct hid_device_priv *hid;
+ uint8_t composite_api_flags; // composite devices require additional data
+ uint8_t active_config;
USB_DEVICE_DESCRIPTOR dev_descriptor;
unsigned char **config_descriptor; // list of pointers to the cached config descriptors
};
@@ -238,18 +182,15 @@ static inline void windows_device_priv_init(libusb_device* dev) {
p->parent_dev = NULL;
p->path = NULL;
p->apib = &usb_api_backend[USB_API_UNSUPPORTED];
- p->sub_api = SUB_API_NOTSET;
- p->hid = NULL;
+ p->composite_api_flags = 0;
p->active_config = 0;
p->config_descriptor = NULL;
memset(&(p->dev_descriptor), 0, sizeof(USB_DEVICE_DESCRIPTOR));
for (i=0; i<USB_MAXINTERFACES; i++) {
p->usb_interface[i].path = NULL;
p->usb_interface[i].apib = &usb_api_backend[USB_API_UNSUPPORTED];
- p->usb_interface[i].sub_api = SUB_API_NOTSET;
p->usb_interface[i].nb_endpoints = 0;
p->usb_interface[i].endpoint = NULL;
- p->usb_interface[i].restricted_functionality = false;
}
}
@@ -262,7 +203,6 @@ static inline void windows_device_priv_release(libusb_device* dev) {
safe_free(p->config_descriptor[i]);
}
safe_free(p->config_descriptor);
- safe_free(p->hid);
for (i=0; i<USB_MAXINTERFACES; i++) {
safe_free(p->usb_interface[i].path);
safe_free(p->usb_interface[i].endpoint);
@@ -290,9 +230,6 @@ static inline struct windows_device_handle_priv *_device_handle_priv(
struct windows_transfer_priv {
struct winfd pollable_fd;
uint8_t interface_number;
- uint8_t *hid_buffer; // 1 byte extended data buffer, required for HID
- uint8_t *hid_dest; // transfer buffer destination, required for HID
- size_t hid_expected_size;
};
// used to match a device driver (including filter drivers) against a supported API
@@ -302,6 +239,37 @@ struct driver_lookup {
const char* designation; // internal designation (for debug output)
};
+/*
+ * API macros - from libusb-win32 1.x
+ */
+#define DLL_DECLARE_PREFIXNAME(api, ret, prefixname, name, args) \
+ typedef ret (api * __dll_##name##_t)args; \
+ static __dll_##name##_t prefixname = NULL
+
+#define DLL_LOAD_PREFIXNAME(dll, prefixname, name, ret_on_failure) \
+ do { \
+ HMODULE h = GetModuleHandleA(#dll); \
+ if (!h) \
+ h = LoadLibraryA(#dll); \
+ if (!h) { \
+ if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; }\
+ else { break; } \
+ } \
+ prefixname = (__dll_##name##_t)GetProcAddress(h, #name); \
+ if (prefixname) break; \
+ prefixname = (__dll_##name##_t)GetProcAddress(h, #name "A"); \
+ if (prefixname) break; \
+ prefixname = (__dll_##name##_t)GetProcAddress(h, #name "W"); \
+ if (prefixname) break; \
+ if(ret_on_failure) \
+ return LIBUSB_ERROR_NOT_FOUND; \
+ } while(0)
+
+#define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXNAME(api, ret, name, name, args)
+#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure)
+#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args)
+#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure)
+
/* OLE32 dependency */
DLL_DECLARE_PREFIXED(WINAPI, HRESULT, p, CLSIDFromString, (LPCOLESTR, LPCLSID));
@@ -316,7 +284,6 @@ DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiDestroyDeviceInfoList, (HDEVINFO));
DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDevRegKey, (HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM));
DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceRegistryPropertyA, (HDEVINFO,
PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD));
-DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDeviceInterfaceRegKey, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA, DWORD, DWORD));
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegQueryValueExW, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD));
DLL_DECLARE_PREFIXED(WINAPI, LONG, p, RegCloseKey, (HKEY));
@@ -622,297 +589,20 @@ typedef struct {
typedef void *WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE;
-typedef BOOL (WINAPI *WinUsb_AbortPipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID
-);
-typedef BOOL (WINAPI *WinUsb_ControlTransfer_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- WINUSB_SETUP_PACKET SetupPacket,
- PUCHAR Buffer,
- ULONG BufferLength,
- PULONG LengthTransferred,
- LPOVERLAPPED Overlapped
-);
-typedef BOOL (WINAPI *WinUsb_FlushPipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID
-);
-typedef BOOL (WINAPI *WinUsb_Free_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle
-);
-typedef BOOL (WINAPI *WinUsb_GetAssociatedInterface_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR AssociatedInterfaceIndex,
- PWINUSB_INTERFACE_HANDLE AssociatedInterfaceHandle
-);
-typedef BOOL (WINAPI *WinUsb_GetCurrentAlternateSetting_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- PUCHAR AlternateSetting
-);
-typedef BOOL (WINAPI *WinUsb_GetDescriptor_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR DescriptorType,
- UCHAR Index,
- USHORT LanguageID,
- PUCHAR Buffer,
- ULONG BufferLength,
- PULONG LengthTransferred
-);
-typedef BOOL (WINAPI *WinUsb_GetOverlappedResult_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- LPOVERLAPPED lpOverlapped,
- LPDWORD lpNumberOfBytesTransferred,
- BOOL bWait
-);
-typedef BOOL (WINAPI *WinUsb_GetPipePolicy_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID,
- ULONG PolicyType,
- PULONG ValueLength,
- PVOID Value
-);
-typedef BOOL (WINAPI *WinUsb_GetPowerPolicy_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- ULONG PolicyType,
- PULONG ValueLength,
- PVOID Value
-);
-typedef BOOL (WINAPI *WinUsb_Initialize_t)(
- HANDLE DeviceHandle,
- PWINUSB_INTERFACE_HANDLE InterfaceHandle
-);
-typedef BOOL (WINAPI *WinUsb_QueryDeviceInformation_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- ULONG InformationType,
- PULONG BufferLength,
- PVOID Buffer
-);
-typedef BOOL (WINAPI *WinUsb_QueryInterfaceSettings_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR AlternateSettingNumber,
- PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor
-);
-typedef BOOL (WINAPI *WinUsb_QueryPipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR AlternateInterfaceNumber,
- UCHAR PipeIndex,
- PWINUSB_PIPE_INFORMATION PipeInformation
-);
-typedef BOOL (WINAPI *WinUsb_ReadPipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID,
- PUCHAR Buffer,
- ULONG BufferLength,
- PULONG LengthTransferred,
- LPOVERLAPPED Overlapped
-);
-typedef BOOL (WINAPI *WinUsb_ResetPipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID
-);
-typedef BOOL (WINAPI *WinUsb_SetCurrentAlternateSetting_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR AlternateSetting
-);
-typedef BOOL (WINAPI *WinUsb_SetPipePolicy_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID,
- ULONG PolicyType,
- ULONG ValueLength,
- PVOID Value
-);
-typedef BOOL (WINAPI *WinUsb_SetPowerPolicy_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- ULONG PolicyType,
- ULONG ValueLength,
- PVOID Value
-);
-typedef BOOL (WINAPI *WinUsb_WritePipe_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle,
- UCHAR PipeID,
- PUCHAR Buffer,
- ULONG BufferLength,
- PULONG LengthTransferred,
- LPOVERLAPPED Overlapped
-);
-typedef BOOL (WINAPI *WinUsb_ResetDevice_t)(
- WINUSB_INTERFACE_HANDLE InterfaceHandle
-);
-
-/* /!\ These must match the ones from the official libusbk.h */
-typedef enum _KUSB_FNID
-{
- KUSB_FNID_Init,
- KUSB_FNID_Free,
- KUSB_FNID_ClaimInterface,
- KUSB_FNID_ReleaseInterface,
- KUSB_FNID_SetAltInterface,
- KUSB_FNID_GetAltInterface,
- KUSB_FNID_GetDescriptor,
- KUSB_FNID_ControlTransfer,
- KUSB_FNID_SetPowerPolicy,
- KUSB_FNID_GetPowerPolicy,
- KUSB_FNID_SetConfiguration,
- KUSB_FNID_GetConfiguration,
- KUSB_FNID_ResetDevice,
- KUSB_FNID_Initialize,
- KUSB_FNID_SelectInterface,
- KUSB_FNID_GetAssociatedInterface,
- KUSB_FNID_Clone,
- KUSB_FNID_QueryInterfaceSettings,
- KUSB_FNID_QueryDeviceInformation,
- KUSB_FNID_SetCurrentAlternateSetting,
- KUSB_FNID_GetCurrentAlternateSetting,
- KUSB_FNID_QueryPipe,
- KUSB_FNID_SetPipePolicy,
- KUSB_FNID_GetPipePolicy,
- KUSB_FNID_ReadPipe,
- KUSB_FNID_WritePipe,
- KUSB_FNID_ResetPipe,
- KUSB_FNID_AbortPipe,
- KUSB_FNID_FlushPipe,
- KUSB_FNID_IsoReadPipe,
- KUSB_FNID_IsoWritePipe,
- KUSB_FNID_GetCurrentFrameNumber,
- KUSB_FNID_GetOverlappedResult,
- KUSB_FNID_GetProperty,
- KUSB_FNID_COUNT,
-} KUSB_FNID;
-
-typedef struct _KLIB_VERSION {
- INT Major;
- INT Minor;
- INT Micro;
- INT Nano;
-} KLIB_VERSION;
-typedef KLIB_VERSION* PKLIB_VERSION;
-
-typedef BOOL (WINAPI *LibK_GetProcAddress_t)(
- PVOID* ProcAddress,
- ULONG DriverID,
- ULONG FunctionID
-);
-
-typedef VOID (WINAPI *LibK_GetVersion_t)(
- PKLIB_VERSION Version
-);
-
-struct winusb_interface {
- bool initialized;
- WinUsb_AbortPipe_t AbortPipe;
- WinUsb_ControlTransfer_t ControlTransfer;
- WinUsb_FlushPipe_t FlushPipe;
- WinUsb_Free_t Free;
- WinUsb_GetAssociatedInterface_t GetAssociatedInterface;
- WinUsb_GetCurrentAlternateSetting_t GetCurrentAlternateSetting;
- WinUsb_GetDescriptor_t GetDescriptor;
- WinUsb_GetOverlappedResult_t GetOverlappedResult;
- WinUsb_GetPipePolicy_t GetPipePolicy;
- WinUsb_GetPowerPolicy_t GetPowerPolicy;
- WinUsb_Initialize_t Initialize;
- WinUsb_QueryDeviceInformation_t QueryDeviceInformation;
- WinUsb_QueryInterfaceSettings_t QueryInterfaceSettings;
- WinUsb_QueryPipe_t QueryPipe;
- WinUsb_ReadPipe_t ReadPipe;
- WinUsb_ResetPipe_t ResetPipe;
- WinUsb_SetCurrentAlternateSetting_t SetCurrentAlternateSetting;
- WinUsb_SetPipePolicy_t SetPipePolicy;
- WinUsb_SetPowerPolicy_t SetPowerPolicy;
- WinUsb_WritePipe_t WritePipe;
- WinUsb_ResetDevice_t ResetDevice;
-};
-
-/* hid.dll interface */
-
-#define HIDP_STATUS_SUCCESS 0x110000
-typedef void* PHIDP_PREPARSED_DATA;
-
-#pragma pack(1)
-typedef struct {
- ULONG Size;
- USHORT VendorID;
- USHORT ProductID;
- USHORT VersionNumber;
-} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
-#pragma pack()
-
-typedef USHORT USAGE;
-typedef struct {
- USAGE Usage;
- USAGE UsagePage;
- USHORT InputReportByteLength;
- USHORT OutputReportByteLength;
- USHORT FeatureReportByteLength;
- USHORT Reserved[17];
- USHORT NumberLinkCollectionNodes;
- USHORT NumberInputButtonCaps;
- USHORT NumberInputValueCaps;
- USHORT NumberInputDataIndices;
- USHORT NumberOutputButtonCaps;
- USHORT NumberOutputValueCaps;
- USHORT NumberOutputDataIndices;
- USHORT NumberFeatureButtonCaps;
- USHORT NumberFeatureValueCaps;
- USHORT NumberFeatureDataIndices;
-} HIDP_CAPS, *PHIDP_CAPS;
-
-typedef enum _HIDP_REPORT_TYPE {
- HidP_Input,
- HidP_Output,
- HidP_Feature
-} HIDP_REPORT_TYPE;
-
-typedef struct _HIDP_VALUE_CAPS {
- USAGE UsagePage;
- UCHAR ReportID;
- BOOLEAN IsAlias;
- USHORT BitField;
- USHORT LinkCollection;
- USAGE LinkUsage;
- USAGE LinkUsagePage;
- BOOLEAN IsRange;
- BOOLEAN IsStringRange;
- BOOLEAN IsDesignatorRange;
- BOOLEAN IsAbsolute;
- BOOLEAN HasNull;
- UCHAR Reserved;
- USHORT BitSize;
- USHORT ReportCount;
- USHORT Reserved2[5];
- ULONG UnitsExp;
- ULONG Units;
- LONG LogicalMin, LogicalMax;
- LONG PhysicalMin, PhysicalMax;
- union {
- struct {
- USAGE UsageMin, UsageMax;
- USHORT StringMin, StringMax;
- USHORT DesignatorMin, DesignatorMax;
- USHORT DataIndexMin, DataIndexMax;
- } Range;
- struct {
- USAGE Usage, Reserved1;
- USHORT StringIndex, Reserved2;
- USHORT DesignatorIndex, Reserved3;
- USHORT DataIndex, Reserved4;
- } NotRange;
- } u;
-} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
-
-DLL_DECLARE(WINAPI, BOOL, HidD_GetAttributes, (HANDLE, PHIDD_ATTRIBUTES));
-DLL_DECLARE(WINAPI, VOID, HidD_GetHidGuid, (LPGUID));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetPreparsedData, (HANDLE, PHIDP_PREPARSED_DATA *));
-DLL_DECLARE(WINAPI, BOOL, HidD_FreePreparsedData, (PHIDP_PREPARSED_DATA));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetManufacturerString, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetProductString, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetSerialNumberString, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, LONG, HidP_GetCaps, (PHIDP_PREPARSED_DATA, PHIDP_CAPS));
-DLL_DECLARE(WINAPI, BOOL, HidD_SetNumInputBuffers, (HANDLE, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_SetFeature, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetFeature, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetPhysicalDescriptor, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_GetInputReport, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_SetOutputReport, (HANDLE, PVOID, ULONG));
-DLL_DECLARE(WINAPI, BOOL, HidD_FlushQueue, (HANDLE));
-DLL_DECLARE(WINAPI, BOOL, HidP_GetValueCaps, (HIDP_REPORT_TYPE, PHIDP_VALUE_CAPS, PULONG, PHIDP_PREPARSED_DATA));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_Initialize, (HANDLE, PWINUSB_INTERFACE_HANDLE));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_Free, (WINUSB_INTERFACE_HANDLE));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_GetAssociatedInterface, (WINUSB_INTERFACE_HANDLE, UCHAR, PWINUSB_INTERFACE_HANDLE));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_GetDescriptor, (WINUSB_INTERFACE_HANDLE, UCHAR, UCHAR, USHORT, PUCHAR, ULONG, PULONG));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryInterfaceSettings, (WINUSB_INTERFACE_HANDLE, UCHAR, PUSB_INTERFACE_DESCRIPTOR));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryDeviceInformation, (WINUSB_INTERFACE_HANDLE, ULONG, PULONG, PVOID));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_SetCurrentAlternateSetting, (WINUSB_INTERFACE_HANDLE, UCHAR));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_GetCurrentAlternateSetting, (WINUSB_INTERFACE_HANDLE, PUCHAR));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_QueryPipe, (WINUSB_INTERFACE_HANDLE, UCHAR, UCHAR, PWINUSB_PIPE_INFORMATION));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_SetPipePolicy, (WINUSB_INTERFACE_HANDLE, UCHAR, ULONG, ULONG, PVOID));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_GetPipePolicy, (WINUSB_INTERFACE_HANDLE, UCHAR, ULONG, PULONG, PVOID));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_ReadPipe, (WINUSB_INTERFACE_HANDLE, UCHAR, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_WritePipe, (WINUSB_INTERFACE_HANDLE, UCHAR, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_ControlTransfer, (WINUSB_INTERFACE_HANDLE, WINUSB_SETUP_PACKET, PUCHAR, ULONG, PULONG, LPOVERLAPPED));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_ResetPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_AbortPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));
+DLL_DECLARE(WINAPI, BOOL, WinUsb_FlushPipe, (WINUSB_INTERFACE_HANDLE, UCHAR));
diff --git a/third_party/libusb/src/libusb/strerror.c b/third_party/libusb/src/libusb/strerror.c
deleted file mode 100644
index a3c3afa..0000000
--- a/third_party/libusb/src/libusb/strerror.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * libusb strerror code
- * Copyright © 2013 Hans de Goede <hdegoede@redhat.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
- */
-#include "config.h"
-
-#include <locale.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libusb.h"
-#include "libusbi.h"
-
-#if defined(_MSC_VER)
-#define strncasecmp _strnicmp
-#endif
-
-static size_t usbi_locale = 0;
-
-/** \ingroup misc
- * How to add a new \ref libusb_strerror() translation:
- * <ol>
- * <li> Download the latest \c strerror.c from:<br>
- * https://raw.github.com/libusbx/libusbx/master/libusb/sterror.c </li>
- * <li> Open the file in an UTF-8 capable editor </li>
- * <li> Add the 2 letter <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO 639-1</a>
- * code for your locale at the end of \c usbi_locale_supported[]<br>
- * Eg. for Chinese, you would add "zh" so that:
- * \code... usbi_locale_supported[] = { "en", "nl", "fr" };\endcode
- * becomes:
- * \code... usbi_locale_supported[] = { "en", "nl", "fr", "zh" };\endcode </li>
- * <li> Copy the <tt>{ / * English (en) * / ... }</tt> section and add it at the end of \c usbi_localized_errors<br>
- * Eg. for Chinese, the last section of \c usbi_localized_errors could look like:
- * \code
- * }, { / * Chinese (zh) * /
- * "Success",
- * ...
- * "Other error",
- * }
- * };\endcode </li>
- * <li> Translate each of the English messages from the section you copied into your language </li>
- * <li> Save the file (in UTF-8 format) and send it to \c libusbx-devel@lists.sourceforge.net </li>
- * </ol>
- */
-
-static const char* usbi_locale_supported[] = { "en", "nl", "fr" };
-static const char* usbi_localized_errors[ARRAYSIZE(usbi_locale_supported)][LIBUSB_ERROR_COUNT] = {
- { /* English (en) */
- "Success",
- "Input/Output Error",
- "Invalid parameter",
- "Access denied (insufficient permissions)",
- "No such device (it may have been disconnected)",
- "Entity not found",
- "Resource busy",
- "Operation timed out",
- "Overflow",
- "Pipe error",
- "System call interrupted (perhaps due to signal)",
- "Insufficient memory",
- "Operation not supported or unimplemented on this platform",
- "Other error",
- }, { /* Dutch (nl) */
- "Gelukt",
- "Invoer-/uitvoerfout",
- "Ongeldig argument",
- "Toegang geweigerd (onvoldoende toegangsrechten)",
- "Apparaat bestaat niet (verbinding met apparaat verbroken?)",
- "Niet gevonden",
- "Apparaat of hulpbron is bezig",
- "Bewerking verlopen",
- "Waarde is te groot",
- "Gebroken pijp",
- "Onderbroken systeemaanroep",
- "Onvoldoende geheugen beschikbaar",
- "Bewerking wordt niet ondersteund",
- "Andere fout",
- }, { /* French (fr) */
- "Succès",
- "Erreur d'entrée/sortie",
- "Paramètre invalide",
- "Accès refusé (permissions insuffisantes)",
- "Périphérique introuvable (peut-être déconnecté)",
- "Elément introuvable",
- "Resource déjà occupée",
- "Operation expirée",
- "Débordement",
- "Erreur de pipe",
- "Appel système abandonné (peut-être à cause d’un signal)",
- "Mémoire insuffisante",
- "Opération non supportée or non implémentée sur cette plateforme",
- "Autre erreur"
- }
-};
-
-/** \ingroup misc
- * Set the language, and only the language, not the encoding! used for
- * translatable libusb messages.
- *
- * This takes a locale string in the default setlocale format: lang[-region]
- * or lang[_country_region][.codeset]. Only the lang part of the string is
- * used, and only 2 letter ISO 639-1 codes are accepted for it, such as "de".
- * The optional region, country_region or codeset parts are ignored. This
- * means that functions which return translatable strings will NOT honor the
- * specified encoding.
- * All strings returned are encoded as UTF-8 strings.
- *
- * If libusb_setlocale() is not called, all messages will be in English.
- *
- * The following functions return translatable strings: libusb_strerror().
- * Note that the libusb log messages controlled through libusb_set_debug()
- * are not translated, they are always in English.
- *
- * For POSIX UTF-8 environments if you want libusb to follow the standard
- * locale settings, call libusb_setlocale(setlocale(LC_MESSAGES, NULL)),
- * after your app has done its locale setup.
- *
- * \param locale locale-string in the form of lang[_country_region][.codeset]
- * or lang[-region], where lang is a 2 letter ISO 639-1 code
- * \returns LIBUSB_SUCCESS on success
- * \returns LIBUSB_ERROR_INVALID_PARAM if the locale doesn't meet the requirements
- * \returns LIBUSB_ERROR_NOT_FOUND if the requested language is not supported
- * \returns a LIBUSB_ERROR code on other errors
- */
-
-int API_EXPORTED libusb_setlocale(const char *locale)
-{
- size_t i;
-
- if ( (locale == NULL) || (strlen(locale) < 2)
- || ((strlen(locale) > 2) && (locale[2] != '-') && (locale[2] != '_') && (locale[2] != '.')) )
- return LIBUSB_ERROR_INVALID_PARAM;
-
- for (i=0; i<ARRAYSIZE(usbi_locale_supported); i++) {
- if (strncasecmp(usbi_locale_supported[i], locale, 2) == 0)
- break;
- }
- if (i >= ARRAYSIZE(usbi_locale_supported)) {
- return LIBUSB_ERROR_NOT_FOUND;
- }
-
- usbi_locale = i;
-
- return LIBUSB_SUCCESS;
-}
-
-/** \ingroup misc
- * Returns a constant string with a short description of the given error code,
- * this description is intended for displaying to the end user and will be in
- * the language set by libusb_setlocale().
- *
- * The returned string is encoded in UTF-8.
- *
- * The messages always start with a capital letter and end without any dot.
- * The caller must not free() the returned string.
- *
- * \param errcode the error code whose description is desired
- * \returns a short description of the error code in UTF-8 encoding
- */
-DEFAULT_VISIBILITY const char* LIBUSB_CALL libusb_strerror(enum libusb_error errcode)
-{
- int errcode_index = -errcode;
-
- if ((errcode_index < 0) || (errcode_index >= LIBUSB_ERROR_COUNT)) {
- /* "Other Error", which should always be our last message, is returned */
- errcode_index = LIBUSB_ERROR_COUNT - 1;
- }
-
- return usbi_localized_errors[usbi_locale][errcode_index];
-}
diff --git a/third_party/libusb/src/libusb/sync.c b/third_party/libusb/src/libusb/sync.c
index 42e486d..8eed47b 100644
--- a/third_party/libusb/src/libusb/sync.c
+++ b/third_party/libusb/src/libusb/sync.c
@@ -1,6 +1,6 @@
/*
- * Synchronous I/O functions for libusbx
- * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
+ * Synchronous I/O functions for libusb
+ * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "config.h"
+#include <config.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
@@ -28,12 +28,12 @@
/**
* @defgroup syncio Synchronous device I/O
*
- * This page documents libusbx's synchronous (blocking) API for USB device I/O.
+ * This page documents libusb's synchronous (blocking) API for USB device I/O.
* This interface is easy to use but has some limitations. More advanced users
* may wish to consider using the \ref asyncio "asynchronous I/O API" instead.
*/
-static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
+static void LIBUSB_CALL ctrl_transfer_cb(struct libusb_transfer *transfer)
{
int *completed = transfer->user_data;
*completed = 1;
@@ -41,24 +41,6 @@ static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
/* caller interprets result and frees transfer */
}
-static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
-{
- int r, *completed = transfer->user_data;
- struct libusb_context *ctx = HANDLE_CTX(transfer->dev_handle);
-
- while (!*completed) {
- r = libusb_handle_events_completed(ctx, completed);
- if (r < 0) {
- if (r == LIBUSB_ERROR_INTERRUPTED)
- continue;
- usbi_err(ctx, "libusb_handle_events failed: %s, cancelling transfer and retrying",
- libusb_error_name(r));
- libusb_cancel_transfer(transfer);
- continue;
- }
- }
-}
-
/** \ingroup syncio
* Perform a USB control transfer.
*
@@ -99,7 +81,7 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
if (!transfer)
return LIBUSB_ERROR_NO_MEM;
- buffer = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
+ buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
if (!buffer) {
libusb_free_transfer(transfer);
return LIBUSB_ERROR_NO_MEM;
@@ -111,7 +93,7 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
memcpy(buffer + LIBUSB_CONTROL_SETUP_SIZE, data, wLength);
libusb_fill_control_transfer(transfer, dev_handle, buffer,
- sync_transfer_cb, &completed, timeout);
+ ctrl_transfer_cb, &completed, timeout);
transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;
r = libusb_submit_transfer(transfer);
if (r < 0) {
@@ -119,7 +101,19 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
return r;
}
- sync_transfer_wait_for_completion(transfer);
+ while (!completed) {
+ r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
+ if (r < 0) {
+ if (r == LIBUSB_ERROR_INTERRUPTED)
+ continue;
+ libusb_cancel_transfer(transfer);
+ while (!completed)
+ if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
+ break;
+ libusb_free_transfer(transfer);
+ return r;
+ }
+ }
if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
memcpy(data, libusb_control_transfer_get_data(transfer),
@@ -141,10 +135,6 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
case LIBUSB_TRANSFER_OVERFLOW:
r = LIBUSB_ERROR_OVERFLOW;
break;
- case LIBUSB_TRANSFER_ERROR:
- case LIBUSB_TRANSFER_CANCELLED:
- r = LIBUSB_ERROR_IO;
- break;
default:
usbi_warn(HANDLE_CTX(dev_handle),
"unrecognised status code %d", transfer->status);
@@ -155,6 +145,14 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
return r;
}
+static void LIBUSB_CALL bulk_transfer_cb(struct libusb_transfer *transfer)
+{
+ int *completed = transfer->user_data;
+ *completed = 1;
+ usbi_dbg("actual_length=%d", transfer->actual_length);
+ /* caller interprets results and frees transfer */
+}
+
static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
unsigned char endpoint, unsigned char *buffer, int length,
int *transferred, unsigned int timeout, unsigned char type)
@@ -167,7 +165,7 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
return LIBUSB_ERROR_NO_MEM;
libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,
- sync_transfer_cb, &completed, timeout);
+ bulk_transfer_cb, &completed, timeout);
transfer->type = type;
r = libusb_submit_transfer(transfer);
@@ -176,7 +174,19 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
return r;
}
- sync_transfer_wait_for_completion(transfer);
+ while (!completed) {
+ r = libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed);
+ if (r < 0) {
+ if (r == LIBUSB_ERROR_INTERRUPTED)
+ continue;
+ libusb_cancel_transfer(transfer);
+ while (!completed)
+ if (libusb_handle_events_completed(HANDLE_CTX(dev_handle), &completed) < 0)
+ break;
+ libusb_free_transfer(transfer);
+ return r;
+ }
+ }
*transferred = transfer->actual_length;
switch (transfer->status) {
@@ -195,10 +205,6 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
case LIBUSB_TRANSFER_NO_DEVICE:
r = LIBUSB_ERROR_NO_DEVICE;
break;
- case LIBUSB_TRANSFER_ERROR:
- case LIBUSB_TRANSFER_CANCELLED:
- r = LIBUSB_ERROR_IO;
- break;
default:
usbi_warn(HANDLE_CTX(dev_handle),
"unrecognised status code %d", transfer->status);
@@ -222,9 +228,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
* Not all of the data may have been written.
*
* Also check <tt>transferred</tt> when dealing with a timeout error code.
- * libusbx may have to split your transfer into a number of chunks to satisfy
+ * libusb may have to split your transfer into a number of chunks to satisfy
* underlying O/S requirements, meaning that the timeout may expire after
- * the first few chunks have completed. libusbx is careful not to lose any data
+ * the first few chunks have completed. libusb is careful not to lose any data
* that may have been transferred; do not assume that timeout conditions
* indicate a complete lack of I/O.
*
@@ -270,9 +276,9 @@ int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
* writes. Not all of the data may have been written.
*
* Also check <tt>transferred</tt> when dealing with a timeout error code.
- * libusbx may have to split your transfer into a number of chunks to satisfy
+ * libusb may have to split your transfer into a number of chunks to satisfy
* underlying O/S requirements, meaning that the timeout may expire after
- * the first few chunks have completed. libusbx is careful not to lose any data
+ * the first few chunks have completed. libusb is careful not to lose any data
* that may have been transferred; do not assume that timeout conditions
* indicate a complete lack of I/O.
*
@@ -305,3 +311,4 @@ int API_EXPORTED libusb_interrupt_transfer(
return do_sync_bulk_transfer(dev_handle, endpoint, data, length,
transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT);
}
+
diff --git a/third_party/libusb/src/libusb/version.h b/third_party/libusb/src/libusb/version.h
index cf37de9..62446da 100644
--- a/third_party/libusb/src/libusb/version.h
+++ b/third_party/libusb/src/libusb/version.h
@@ -1,5 +1,4 @@
/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */
-#include "version_nano.h"
#ifndef LIBUSB_MAJOR
#define LIBUSB_MAJOR 1
#endif
@@ -7,8 +6,9 @@
#define LIBUSB_MINOR 0
#endif
#ifndef LIBUSB_MICRO
-#define LIBUSB_MICRO 16
+#define LIBUSB_MICRO 9
#endif
+/* LIBUSB_NANO may be used for Windows internal versioning. 0 means unused. */
#ifndef LIBUSB_NANO
#define LIBUSB_NANO 0
#endif
diff --git a/third_party/libusb/src/libusb/version_nano.h b/third_party/libusb/src/libusb/version_nano.h
deleted file mode 100644
index 525cd7d..0000000
--- a/third_party/libusb/src/libusb/version_nano.h
+++ /dev/null
@@ -1 +0,0 @@
-#define LIBUSB_NANO 10774
diff --git a/third_party/libusb/src/msvc/config.h b/third_party/libusb/src/msvc/config.h
index bb542c5..43aa1f7 100644
--- a/third_party/libusb/src/msvc/config.h
+++ b/third_party/libusb/src/msvc/config.h
@@ -5,35 +5,20 @@
#error "Please make sure the msvc/ directory is removed from your build path."
#endif
-/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
-#pragma warning(disable:4200)
-/* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */
-#pragma warning(disable: 6258)
-#if defined(_PREFAST_)
-/* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */
-#pragma warning(disable:28719)
-/* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */
-#pragma warning(disable:28125)
-#endif
-
/* Default visibility */
#define DEFAULT_VISIBILITY /**/
-/* Enable global message logging */
+/* Debug message logging */
+//#define ENABLE_DEBUG_LOGGING 1
+
+/* Message logging */
#define ENABLE_LOGGING 1
-/* Uncomment to start with debug message logging enabled */
-// #define ENABLE_DEBUG_LOGGING 1
+/* Windows backend */
+#define OS_WINDOWS 1
/* type of second poll() argument */
#define POLL_NFDS_TYPE unsigned int
-/* Windows/WinCE backend */
-#if defined(_WIN32_WCE)
-#define OS_WINCE 1
-#define HAVE_MISSING_H
-#else
-#define OS_WINDOWS 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_SYS_TYPES_H 1
-#endif
+/* no way to run git describe from MSVC? */
+#define LIBUSB_DESCRIBE ""
diff --git a/third_party/libusb/src/msvc/ddk_build.cmd b/third_party/libusb/src/msvc/ddk_build.cmd
index aadab50..ed9b8a8 100644
--- a/third_party/libusb/src/msvc/ddk_build.cmd
+++ b/third_party/libusb/src/msvc/ddk_build.cmd
@@ -1,20 +1,18 @@
+@rem default builds static library.
+@rem you can pass the following arguments (case insensitive):
+@rem - "DLL" to build a DLL instead of a static library
+@rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
@echo off
-::# default builds static library.
-::# you can pass the following arguments (case insensitive):
-::# - "DLL" to build a DLL instead of a static library
-::# - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
if Test%BUILD_ALT_DIR%==Test goto usage
-::# process commandline parameters
+rem process commandline parameters
set TARGET=LIBRARY
set STATIC_LIBC=
set version=1.0
-set PWD=%~dp0
-set BUILD_CMD=build -bcwgZ -M2
if "%1" == "" goto no_more_args
-::# /I for case insensitive
+rem /I for case insensitive
if /I Test%1==TestDLL set TARGET=DYNLINK
if /I Test%1==Test/MT set STATIC_LIBC=1
:no_more_args
@@ -24,7 +22,7 @@ echo TARGETTYPE=%TARGET% > target
copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
del target
@echo on
-%BUILD_CMD%
+build -cwgZ
@echo off
if errorlevel 1 goto builderror
cd ..\..
@@ -75,9 +73,9 @@ md examples\listdevs_ddkbuild
cd examples\listdevs_ddkbuild
copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
@echo on
-%BUILD_CMD%
+build -cwgZ
@echo off
-if errorlevel 1 goto builderror
+if errorlevel 1 goto buildlistdevserror
cd ..\..
set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
@@ -86,81 +84,18 @@ set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
copy %srcPath%\listdevs.exe %dstPath%\examples
copy %srcPath%\listdevs.pdb %dstPath%\examples
-@echo off
-
-if exist examples\xusb_ddkbuild goto md8
-md examples\xusb_ddkbuild
-:md8
-
-cd examples\xusb_ddkbuild
-copy ..\..\msvc\xusb_sources sources >NUL 2>&1
-@echo on
-%BUILD_CMD%
-@echo off
-if errorlevel 1 goto builderror
-cd ..\..
-
-set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
-@echo on
-
-copy %srcPath%\xusb.exe %dstPath%\examples
-copy %srcPath%\xusb.pdb %dstPath%\examples
-
-@echo off
-
-if exist examples\getopt\getopt_ddkbuild goto md9
-md examples\getopt\getopt_ddkbuild
-:md9
-
-cd examples\getopt\getopt_ddkbuild
-copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
-@echo on
-%BUILD_CMD%
-@echo off
-if errorlevel 1 goto builderror
-cd ..\..\..
-
-if exist examples\fxload_ddkbuild goto md10
-md examples\fxload_ddkbuild
-:md10
-
-cd examples\fxload_ddkbuild
-copy ..\..\msvc\fxload_sources sources >NUL 2>&1
-@echo on
-%BUILD_CMD%
-@echo off
-if errorlevel 1 goto builderror
-cd ..\..
-
-set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
-@echo on
-
-copy %srcPath%\fxload.exe %dstPath%\examples
-copy %srcPath%\fxload.pdb %dstPath%\examples
-
-@echo off
-
-if exist examples\hotplugtest_ddkbuild goto md11
-md examples\hotplugtest_ddkbuild
-:md11
-
-cd examples\hotplugtest_ddkbuild
-copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
-@echo on
-%BUILD_CMD%
-@echo off
-if errorlevel 1 goto builderror
-cd ..\..
-
-set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
-@echo on
+cd msvc
+goto done
-copy %srcPath%\hotplugtest.exe %dstPath%\examples
-copy %srcPath%\hotplugtest.pdb %dstPath%\examples
-@echo off
+:builderror
+cd ..\..\msvc
+echo Build failed
+goto done
-cd msvc
+:buildlistdevserror
+cd ..\..\msvc
+echo listdevs build failed
goto done
:usage
@@ -168,8 +103,4 @@ echo ddk_build must be run in a WDK build environment
pause
goto done
-:builderror
-echo Build failed
-
:done
-cd %PWD%
diff --git a/third_party/libusb/src/msvc/errno.h b/third_party/libusb/src/msvc/errno.h
deleted file mode 100644
index 07d15e3..0000000
--- a/third_party/libusb/src/msvc/errno.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * errno.h
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Error numbers and access to error reporting.
- *
- */
-
-#ifndef _ERRNO_H_
-#define _ERRNO_H_
-
-#include <crtdefs.h>
-
-/*
- * Error numbers.
- * TODO: Can't be sure of some of these assignments, I guessed from the
- * names given by strerror and the defines in the Cygnus errno.h. A lot
- * of the names from the Cygnus errno.h are not represented, and a few
- * of the descriptions returned by strerror do not obviously match
- * their error naming.
- */
-#define EPERM 1 /* Operation not permitted */
-#define ENOFILE 2 /* No such file or directory */
-#define ENOENT 2
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted function call */
-#define EIO 5 /* Input/output error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file descriptor */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Resource temporarily unavailable */
-#define ENOMEM 12 /* Not enough space */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-/* 15 - Unknown Error */
-#define EBUSY 16 /* strerror reports "Resource device" */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Improper link (cross-device link?) */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* Too many open files in system */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Inappropriate I/O control operation */
-/* 26 - Unknown Error */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Domain error (math functions) */
-#define ERANGE 34 /* Result too large (possibly too small) */
-/* 35 - Unknown Error */
-#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
-#define EDEADLK 36
-#if 0
-/* 37 - Unknown Error */
-#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
-#define ENOLCK 39 /* No locks available (46 in Cyg?) */
-#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
-#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
-#define EILSEQ 42 /* Illegal byte sequence */
-#endif
-
-/*
- * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
- * sockets.h header provided with windows32api-0.1.2.
- * You should go and put an #if 0 ... #endif around the whole block
- * of errors (look at the comment above them).
- */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
- * stdlib.h.
- */
-#if defined(_UWIN) || defined(_WIN32_WCE)
-#undef errno
-extern int errno;
-#else
-_CRTIMP int* __cdecl _errno(void);
-#define errno (*_errno())
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _ERRNO_H_ */ \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/fxload_2010.vcxproj b/third_party/libusb/src/msvc/fxload_2010.vcxproj
deleted file mode 100644
index 56e5853..0000000
--- a/third_party/libusb/src/msvc/fxload_2010.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>fxload</ProjectName>
- <ProjectGuid>{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\ezusb.c" />
- <ClCompile Include="..\examples\fxload.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2010.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="getopt_2010.vcxproj">
- <Project>{ae83e1b4-ce06-47ee-b7a3-c3a1d7c2d71e}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\ezusb.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/fxload_2010.vcxproj.filters b/third_party/libusb/src/msvc/fxload_2010.vcxproj.filters
deleted file mode 100644
index 824ae40..0000000
--- a/third_party/libusb/src/msvc/fxload_2010.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{651ff73d-037b-4903-8dd3-56e9950be25c}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\fxload.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\examples\ezusb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\ezusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/fxload_2012.vcxproj b/third_party/libusb/src/msvc/fxload_2012.vcxproj
deleted file mode 100644
index fb53a43..0000000
--- a/third_party/libusb/src/msvc/fxload_2012.vcxproj
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>fxload</ProjectName>
- <ProjectGuid>{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\examples\getopt;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;__GNU_LIBRARY__;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\ezusb.c" />
- <ClCompile Include="..\examples\fxload.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2012.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="getopt_2012.vcxproj">
- <Project>{ae83e1b4-ce06-47ee-b7a3-c3a1d7c2d71e}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\ezusb.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/fxload_2012.vcxproj.filters b/third_party/libusb/src/msvc/fxload_2012.vcxproj.filters
deleted file mode 100644
index 824ae40..0000000
--- a/third_party/libusb/src/msvc/fxload_2012.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{651ff73d-037b-4903-8dd3-56e9950be25c}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\fxload.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\examples\ezusb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\ezusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/fxload_sources b/third_party/libusb/src/msvc/fxload_sources
deleted file mode 100644
index d6e31d6..0000000
--- a/third_party/libusb/src/msvc/fxload_sources
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGETNAME=fxload
-TARGETTYPE=PROGRAM
-386_STDCALL=0
-
-_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
-
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-!IFDEF STATIC_LIBC
-USE_LIBCMT=1
-!ELSE
-USE_MSVCRT=1
-!ENDIF
-
-UMTYPE=console
-INCLUDES=..\..\msvc;..\..\libusb;..\getopt;$(DDK_INC_PATH)
-C_DEFINES=$(C_DEFINES) /D__GNU_LIBRARY__
-UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib \
- ..\getopt\getopt_ddkbuild\obj$(BUILD_ALT_DIR)\*\getopt.lib
-SOURCES=..\ezusb.c \
- ..\fxload.c
diff --git a/third_party/libusb/src/msvc/getopt_2005.vcproj b/third_party/libusb/src/msvc/getopt_2005.vcproj
deleted file mode 100644
index a98a0a8..0000000
--- a/third_party/libusb/src/msvc/getopt_2005.vcproj
+++ /dev/null
@@ -1,288 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="getopt"
- ProjectGUID="{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}"
- RootNamespace="getopt"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\getopt"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- RuntimeLibrary="1"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- IgnoreAllDefaultLibraries="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\getopt"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="1"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- IgnoreAllDefaultLibraries="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\getopt"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- PreprocessorDefinitions="HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- IgnoreAllDefaultLibraries="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\getopt"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- IgnoreAllDefaultLibraries="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\examples\getopt\getopt.c"
- >
- </File>
- <File
- RelativePath="..\examples\getopt\getopt1.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\examples\getopt\getopt.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/getopt_2010.vcxproj b/third_party/libusb/src/msvc/getopt_2010.vcxproj
deleted file mode 100644
index 66c5e44..0000000
--- a/third_party/libusb/src/msvc/getopt_2010.vcxproj
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}</ProjectGuid>
- <RootNamespace>getopt</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\getopt\getopt.c" />
- <ClCompile Include="..\examples\getopt\getopt1.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\getopt\getopt.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/getopt_2010.vcxproj.filters b/third_party/libusb/src/msvc/getopt_2010.vcxproj.filters
deleted file mode 100644
index 7cf095b..0000000
--- a/third_party/libusb/src/msvc/getopt_2010.vcxproj.filters
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\getopt\getopt.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\examples\getopt\getopt1.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\getopt\getopt.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/getopt_2012.vcxproj b/third_party/libusb/src/msvc/getopt_2012.vcxproj
deleted file mode 100644
index 158ed79..0000000
--- a/third_party/libusb/src/msvc/getopt_2012.vcxproj
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}</ProjectGuid>
- <RootNamespace>getopt</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\getopt\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Lib>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- </Lib>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\getopt\getopt.c" />
- <ClCompile Include="..\examples\getopt\getopt1.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\getopt\getopt.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/getopt_2012.vcxproj.filters b/third_party/libusb/src/msvc/getopt_2012.vcxproj.filters
deleted file mode 100644
index 7cf095b..0000000
--- a/third_party/libusb/src/msvc/getopt_2012.vcxproj.filters
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\getopt\getopt.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\examples\getopt\getopt1.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\examples\getopt\getopt.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/getopt_sources b/third_party/libusb/src/msvc/getopt_sources
deleted file mode 100644
index b9adc1b..0000000
--- a/third_party/libusb/src/msvc/getopt_sources
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGETTYPE=LIBRARY
-TARGETNAME=getopt
-386_STDCALL=0
-
-_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
-
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-USE_MSVCRT=1
-
-INCLUDES=$(DDK_INC_PATH)
-C_DEFINES = $(C_DEFINES) /DDDKBUILD /DHAVE_STRING_H
-
-TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
- $(SDK_LIB_PATH)\user32.lib
-
-SOURCES=..\getopt1.c \
- ..\getopt.c
diff --git a/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj b/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj
deleted file mode 100644
index ae4afeb..0000000
--- a/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>hotplugtest</ProjectName>
- <ProjectGuid>{99D2AC64-DC66-4422-91CE-6715C403C9E5}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\hotplugtest.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2010.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj.filters b/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj.filters
deleted file mode 100644
index 125ac1b..0000000
--- a/third_party/libusb/src/msvc/hotplugtest_2010.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\hotplugtest.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj b/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj
deleted file mode 100644
index 4460e36..0000000
--- a/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>hotplugtest</ProjectName>
- <ProjectGuid>{99D2AC64-DC66-4422-91CE-6715C403C9E5}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\hotplugtest.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2012.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj.filters b/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj.filters
deleted file mode 100644
index 125ac1b..0000000
--- a/third_party/libusb/src/msvc/hotplugtest_2012.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\hotplugtest.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/hotplugtest_sources b/third_party/libusb/src/msvc/hotplugtest_sources
deleted file mode 100644
index 1b27cad..0000000
--- a/third_party/libusb/src/msvc/hotplugtest_sources
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGETNAME=hotplugtest
-TARGETTYPE=PROGRAM
-386_STDCALL=0
-
-_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
-
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-!IFDEF STATIC_LIBC
-USE_LIBCMT=1
-!ELSE
-USE_MSVCRT=1
-!ENDIF
-
-UMTYPE=console
-INCLUDES=..\..\msvc;..\..\libusb;$(DDK_INC_PATH)
-UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib
-SOURCES=..\hotplugtest.c
diff --git a/third_party/libusb/src/msvc/libusbx.dsw b/third_party/libusb/src/msvc/libusb.dsw
index 4e2652e..fbe3015 100644
--- a/third_party/libusb/src/msvc/libusbx.dsw
+++ b/third_party/libusb/src/msvc/libusb.dsw
@@ -1,71 +1,56 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libusb_dll"=".\libusb_dll.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libusb_static"=".\libusb_static.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "listdevs"=".\listdevs.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libusb_static
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xusb"=".\xusb.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libusb_static
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libusb_dll"=".\libusb_dll.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libusb_static"=".\libusb_static.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "listdevs"=".\listdevs.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libusb_static
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/third_party/libusb/src/msvc/libusb_dll.dsp b/third_party/libusb/src/msvc/libusb_dll.dsp
index 34f4bda..bad8d15 100644
--- a/third_party/libusb/src/msvc/libusb_dll.dsp
+++ b/third_party/libusb/src/msvc/libusb_dll.dsp
@@ -1,194 +1,190 @@
-# Microsoft Developer Studio Project File - Name="libusb_dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libusb_dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_dll.mak" CFG="libusb_dll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libusb_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libusb_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libusb_dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/dll"
-# PROP Intermediate_Dir "../Win32/Release/dll"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
-
-!ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/dll"
-# PROP Intermediate_Dir "../Win32/Debug/dll"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0.dll"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "libusb_dll - Win32 Release"
-# Name "libusb_dll - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\libusb\core.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\descriptor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\io.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\libusb\libusb-1.0.rc"
-# End Source File
-# Begin Source File
-
-SOURCE="..\libusb\libusb-1.0.def"
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\sync.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusbi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_common.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libusb_dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libusb_dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libusb_dll.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libusb_dll.mak" CFG="libusb_dll - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libusb_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libusb_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libusb_dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../Win32/Release/dll"
+# PROP Intermediate_Dir "../Win32/Release/dll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
+
+!ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../Win32/Debug/dll"
+# PROP Intermediate_Dir "../Win32/Debug/dll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo /n
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0.dll"
+# SUBTRACT LINK32 /pdb:none /incremental:no
+
+!ENDIF
+
+# Begin Target
+
+# Name "libusb_dll - Win32 Release"
+# Name "libusb_dll - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\libusb\core.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\darwin_usb.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\descriptor.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\io.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\libusb\libusb-1.0.rc"
+# End Source File
+# Begin Source File
+
+SOURCE="..\libusb\libusb-1.0.def"
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\linux_usbfs.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_windows.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\sync.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_windows.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\windows_usb.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\darwin_usb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\libusb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\libusbi.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\linux_usbfs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_posix.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_windows.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_posix.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_windows.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\windows_usb.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/third_party/libusb/src/msvc/libusb_dll_2005.vcproj b/third_party/libusb/src/msvc/libusb_dll_2005.vcproj
deleted file mode 100644
index 347aa95..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_2005.vcproj
+++ /dev/null
@@ -1,436 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libusb-1.0 (dll)"
- ProjectGUID="{8224C054-5968-4238-832C-167155E7ECC3}"
- RootNamespace="libusbdll"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- LinkIncremental="2"
- ModuleDefinitionFile="..\libusb\libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- LinkIncremental="2"
- ModuleDefinitionFile="..\libusb\libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- LinkIncremental="1"
- ModuleDefinitionFile="..\libusb\libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\dll"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- LinkIncremental="1"
- ModuleDefinitionFile="..\libusb\libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\libusb\core.c"
- >
- </File>
- <File
- RelativePath="..\libusb\descriptor.c"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.c"
- >
- </File>
- <File
- RelativePath="..\libusb\io.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\strerror.c"
- >
- </File>
- <File
- RelativePath="..\libusb\sync.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_usb.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\config.h"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusbi.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_usb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_common.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\libusb\libusb-1.0.def"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb-1.0.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj b/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj
deleted file mode 100644
index ca31ad6..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>libusb-1.0 (dll)</ProjectName>
- <ProjectGuid>{349EE8FA-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
- <RootNamespace>libusbdll</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c" />
- <ClCompile Include="..\libusb\descriptor.c" />
- <ClCompile Include="..\libusb\hotplug.c" />
- <ClCompile Include="..\libusb\io.c" />
- <ClCompile Include="..\libusb\os\poll_windows.c" />
- <ClCompile Include="..\libusb\strerror.c" />
- <ClCompile Include="..\libusb\sync.c" />
- <ClCompile Include="..\libusb\os\threads_windows.c" />
- <ClCompile Include="..\libusb\os\windows_usb.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h" />
- <ClCompile Include="..\libusb\hotplug.h" />
- <ClInclude Include="..\libusb\libusb.h" />
- <ClInclude Include="..\libusb\libusbi.h" />
- <ClInclude Include="..\libusb\os\poll_windows.h" />
- <ClInclude Include="..\libusb\os\threads_windows.h" />
- <ClInclude Include="..\libusb\os\windows_usb.h" />
- <ClInclude Include="..\libusb\os\windows_common.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\libusb\libusb-1.0.def" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\libusb\libusb-1.0.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj.filters b/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj.filters
deleted file mode 100644
index a6b6e3b..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_2010.vcxproj.filters
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{d81e81ca-b13e-4a15-b54b-b12b41361e6b}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\descriptor.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\hotplug.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\io.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\poll_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\strerror.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\sync.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\threads_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\windows_usb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClCompile Include="..\libusb\hotplug.h">
- <Filter>Header Files</Filter>
- </ClCompile>
- <ClInclude Include="..\libusb\libusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusbi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\poll_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\threads_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_usb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_common.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\libusb\libusb-1.0.def">
- <Filter>Resource Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\libusb\libusb-1.0.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj b/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj
deleted file mode 100644
index a26d240..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>libusb-1.0 (dll)</ProjectName>
- <ProjectGuid>{349EE8FA-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
- <RootNamespace>libusbdll</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\dll\libusb-1.0\</IntDir>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile>
- <ModuleDefinitionFile>..\libusb\libusb-1.0.def</ModuleDefinitionFile>
- <EmbedManagedResourceFile>libusb-1.0.rc;%(EmbedManagedResourceFile)</EmbedManagedResourceFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c" />
- <ClCompile Include="..\libusb\descriptor.c" />
- <ClCompile Include="..\libusb\hotplug.c" />
- <ClCompile Include="..\libusb\io.c" />
- <ClCompile Include="..\libusb\os\poll_windows.c" />
- <ClCompile Include="..\libusb\strerror.c" />
- <ClCompile Include="..\libusb\sync.c" />
- <ClCompile Include="..\libusb\os\threads_windows.c" />
- <ClCompile Include="..\libusb\os\windows_usb.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\libusb\hotplug.h" />
- <ClInclude Include="..\libusb\version.h" />
- <ClInclude Include="..\libusb\version_nano.h" />
- <ClInclude Include=".\config.h" />
- <ClInclude Include="..\libusb\libusb.h" />
- <ClInclude Include="..\libusb\libusbi.h" />
- <ClInclude Include="..\libusb\os\poll_windows.h" />
- <ClInclude Include="..\libusb\os\threads_windows.h" />
- <ClInclude Include="..\libusb\os\windows_usb.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\libusb\libusb-1.0.def" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\libusb\libusb-1.0.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj.filters b/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj.filters
deleted file mode 100644
index f00a0d0..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_2012.vcxproj.filters
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{d81e81ca-b13e-4a15-b54b-b12b41361e6b}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\descriptor.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\io.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\poll_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\strerror.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\sync.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\threads_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\windows_usb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\hotplug.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusbi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\poll_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\threads_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_usb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version_nano.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\hotplug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\libusb\libusb-1.0.def">
- <Filter>Resource Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\libusb\libusb-1.0.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_dll_wince.vcproj b/third_party/libusb/src/msvc/libusb_dll_wince.vcproj
deleted file mode 100644
index 77b1858b..0000000
--- a/third_party/libusb/src/msvc/libusb_dll_wince.vcproj
+++ /dev/null
@@ -1,1243 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libusb-1.0 (dll)"
- ProjectGUID="{6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}"
- RootNamespace="libusb"
- >
- <Platforms>
- <Platform
- Name="STANDARDSDK_500 (ARMV4I)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (SH4)"
- />
- <Platform
- Name="STANDARDSDK_500 (x86)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- ForcedIncludeFiles=""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\lsusb"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\dll"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\dll\libusb-1.0"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\libusb-1.0.dll"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- ModuleDefinitionFile="../libusb/libusb-1.0.def"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\libusb\core.c"
- >
- </File>
- <File
- RelativePath="..\libusb\descriptor.c"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.c"
- >
- </File>
- <File
- RelativePath="..\libusb\io.c"
- >
- </File>
- <File
- RelativePath="missing.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\strerror.c"
- >
- </File>
- <File
- RelativePath="..\libusb\sync.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\wince_usb.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="config.h"
- >
- </File>
- <File
- RelativePath="errno.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusbi.h"
- >
- </File>
- <File
- RelativePath="missing.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\version.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\wince_usb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_common.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\libusb\libusb-1.0.def"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb-1.0.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/libusb_sources b/third_party/libusb/src/msvc/libusb_sources
index 308a666..8e8e65c 100644
--- a/third_party/libusb/src/msvc/libusb_sources
+++ b/third_party/libusb/src/msvc/libusb_sources
@@ -29,9 +29,7 @@ TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib
SOURCES=..\core.c \
..\descriptor.c \
..\io.c \
- ..\strerror.c \
..\sync.c \
- ..\hotplug.c \
threads_windows.c \
poll_windows.c \
windows_usb.c \
diff --git a/third_party/libusb/src/msvc/libusb_static.dsp b/third_party/libusb/src/msvc/libusb_static.dsp
index d703a58..b636691 100644
--- a/third_party/libusb/src/msvc/libusb_static.dsp
+++ b/third_party/libusb/src/msvc/libusb_static.dsp
@@ -1,174 +1,170 @@
-# Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libusb_static - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_static.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libusb_static - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/lib"
-# PROP Intermediate_Dir "../Win32/Release/lib"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib"
-
-!ELSEIF "$(CFG)" == "libusb_static - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/lib"
-# PROP Intermediate_Dir "../Win32/Debug/lib"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "libusb_static - Win32 Release"
-# Name "libusb_static - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\libusb\core.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\descriptor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\io.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\sync.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusbi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_common.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libusb_static - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libusb_static.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libusb_static - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../Win32/Release/lib"
+# PROP Intermediate_Dir "../Win32/Release/lib"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib"
+
+!ELSEIF "$(CFG)" == "libusb_static - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../Win32/Debug/lib"
+# PROP Intermediate_Dir "../Win32/Debug/lib"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo /n
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libusb_static - Win32 Release"
+# Name "libusb_static - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\libusb\core.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\darwin_usb.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\descriptor.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\io.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\linux_usbfs.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_windows.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\sync.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_windows.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\windows_usb.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\darwin_usb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\libusb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\libusbi.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\linux_usbfs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_posix.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\poll_windows.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_posix.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\threads_windows.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\libusb\os\windows_usb.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/third_party/libusb/src/msvc/libusb_static_2005.vcproj b/third_party/libusb/src/msvc/libusb_static_2005.vcproj
deleted file mode 100644
index 18f92f9..0000000
--- a/third_party/libusb/src/msvc/libusb_static_2005.vcproj
+++ /dev/null
@@ -1,362 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libusb-1.0 (static)"
- ProjectGUID="{5AB6B770-1925-48D5-ABC2-930F3259C020}"
- RootNamespace="libusb"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\libusb\core.c"
- >
- </File>
- <File
- RelativePath="..\libusb\descriptor.c"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.c"
- >
- </File>
- <File
- RelativePath="..\libusb\io.c"
- >
- </File>
- <File
- RelativePath="..\libusb\strerror.c"
- >
- </File>
- <File
- RelativePath="..\libusb\sync.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_usb.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\config.h"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusbi.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_usb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_common.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/libusb_static_2010.vcxproj b/third_party/libusb/src/msvc/libusb_static_2010.vcxproj
deleted file mode 100644
index c6fea1b..0000000
--- a/third_party/libusb/src/msvc/libusb_static_2010.vcxproj
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>libusb-1.0 (static)</ProjectName>
- <ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
- <RootNamespace>libusb</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c" />
- <ClCompile Include="..\libusb\descriptor.c" />
- <ClCompile Include="..\libusb\hotplug.c" />
- <ClCompile Include="..\libusb\io.c" />
- <ClCompile Include="..\libusb\os\poll_windows.c" />
- <ClCompile Include="..\libusb\strerror.c" />
- <ClCompile Include="..\libusb\sync.c" />
- <ClCompile Include="..\libusb\os\threads_windows.c" />
- <ClCompile Include="..\libusb\os\windows_usb.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h" />
- <ClInclude Include="..\libusb\hotplug.h" />
- <ClInclude Include="..\libusb\version.h" />
- <ClInclude Include="..\libusb\version_nano.h" />
- <ClInclude Include="..\libusb\libusb.h" />
- <ClInclude Include="..\libusb\libusbi.h" />
- <ClInclude Include="..\libusb\os\poll_windows.h" />
- <ClInclude Include="..\libusb\os\threads_windows.h" />
- <ClInclude Include="..\libusb\os\windows_usb.h" />
- <ClInclude Include="..\libusb\os\windows_common.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_static_2010.vcxproj.filters b/third_party/libusb/src/msvc/libusb_static_2010.vcxproj.filters
deleted file mode 100644
index 62770c5..0000000
--- a/third_party/libusb/src/msvc/libusb_static_2010.vcxproj.filters
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\descriptor.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\io.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\poll_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\strerror.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\sync.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\threads_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\windows_usb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\hotplug.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusbi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\poll_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\threads_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_usb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_common.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version_nano.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\hotplug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_static_2012.vcxproj b/third_party/libusb/src/msvc/libusb_static_2012.vcxproj
deleted file mode 100644
index 7bd8c68..0000000
--- a/third_party/libusb/src/msvc/libusb_static_2012.vcxproj
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>libusb-1.0 (static)</ProjectName>
- <ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
- <RootNamespace>libusb</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\lib\libusb-1.0\</IntDir>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">libusb-1.0</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libusb-1.0</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Lib>
- <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
- </Lib>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c" />
- <ClCompile Include="..\libusb\descriptor.c" />
- <ClCompile Include="..\libusb\hotplug.c" />
- <ClCompile Include="..\libusb\io.c" />
- <ClCompile Include="..\libusb\os\poll_windows.c" />
- <ClCompile Include="..\libusb\strerror.c" />
- <ClCompile Include="..\libusb\sync.c" />
- <ClCompile Include="..\libusb\os\threads_windows.c" />
- <ClCompile Include="..\libusb\os\windows_usb.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\libusb\hotplug.h" />
- <ClInclude Include="..\libusb\version.h" />
- <ClInclude Include="..\libusb\version_nano.h" />
- <ClInclude Include=".\config.h" />
- <ClInclude Include="..\libusb\libusb.h" />
- <ClInclude Include="..\libusb\libusbi.h" />
- <ClInclude Include="..\libusb\os\poll_windows.h" />
- <ClInclude Include="..\libusb\os\threads_windows.h" />
- <ClInclude Include="..\libusb\os\windows_usb.h" />
- <ClInclude Include="..\libusb\os\windows_common.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_static_2012.vcxproj.filters b/third_party/libusb/src/msvc/libusb_static_2012.vcxproj.filters
deleted file mode 100644
index 62770c5..0000000
--- a/third_party/libusb/src/msvc/libusb_static_2012.vcxproj.filters
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\libusb\core.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\descriptor.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\io.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\poll_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\strerror.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\sync.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\threads_windows.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\os\windows_usb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\libusb\hotplug.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include=".\config.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\libusbi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\poll_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\threads_windows.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_usb.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\os\windows_common.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version_nano.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\libusb\hotplug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb_static_wince.vcproj b/third_party/libusb/src/msvc/libusb_static_wince.vcproj
deleted file mode 100644
index 57db8cd..0000000
--- a/third_party/libusb/src/msvc/libusb_static_wince.vcproj
+++ /dev/null
@@ -1,1185 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libusb-1.0 (static)"
- ProjectGUID="{CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}"
- RootNamespace="libusb"
- >
- <Platforms>
- <Platform
- Name="STANDARDSDK_500 (ARMV4I)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (SH4)"
- />
- <Platform
- Name="STANDARDSDK_500 (x86)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- ForcedIncludeFiles=""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\lsusb"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\lib"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\lib\libusb-1.0"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="WINCE;_WIN32_WCE"
- AdditionalIncludeDirectories="."
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libusb-1.0.lib"
- AdditionalOptions="/subsystem:$(CESubsystem)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\libusb\core.c"
- >
- </File>
- <File
- RelativePath="..\libusb\descriptor.c"
- >
- </File>
- <File
- RelativePath="..\libusb\hotplug.c"
- >
- </File>
- <File
- RelativePath="..\libusb\io.c"
- >
- </File>
- <File
- RelativePath="missing.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\strerror.c"
- >
- </File>
- <File
- RelativePath="..\libusb\sync.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.c"
- >
- </File>
- <File
- RelativePath="..\libusb\os\wince_usb.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="config.h"
- >
- </File>
- <File
- RelativePath="errno.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\libusbi.h"
- >
- </File>
- <File
- RelativePath="missing.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\poll_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\threads_windows.h"
- >
- </File>
- <File
- RelativePath="..\libusb\version.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\wince_usb.h"
- >
- </File>
- <File
- RelativePath="..\libusb\os\windows_common.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\libusb\libusb-1.0.def"
- >
- </File>
- <File
- RelativePath="..\libusb\libusb-1.0.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/libusbx_2005.sln b/third_party/libusb/src/msvc/libusbx_2005.sln
deleted file mode 100644
index c1dc442..0000000
--- a/third_party/libusb/src/msvc/libusbx_2005.sln
+++ /dev/null
@@ -1,95 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2005.vcproj", "{5AB6B770-1925-48D5-ABC2-930F3259C020}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2005.vcproj", "{8224C054-5968-4238-832C-167155E7ECC3}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2005.vcproj", "{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2005.vcproj", "{08A6FA39-21B7-4A05-9252-2F9864A5E5A4}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2005.vcproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.ActiveCfg = Debug|Win32
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.Build.0 = Debug|Win32
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.ActiveCfg = Debug|x64
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.Build.0 = Debug|x64
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.ActiveCfg = Release|Win32
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.Build.0 = Release|Win32
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.ActiveCfg = Release|x64
- {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.Build.0 = Release|x64
- {8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.ActiveCfg = Debug|Win32
- {8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.Build.0 = Debug|Win32
- {8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.ActiveCfg = Debug|x64
- {8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.Build.0 = Debug|x64
- {8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.ActiveCfg = Release|Win32
- {8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.Build.0 = Release|Win32
- {8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.ActiveCfg = Release|x64
- {8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.Build.0 = Release|x64
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.ActiveCfg = Debug|Win32
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.Build.0 = Debug|Win32
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.ActiveCfg = Debug|x64
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.Build.0 = Debug|x64
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.ActiveCfg = Release|Win32
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.Build.0 = Release|Win32
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.ActiveCfg = Release|x64
- {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.Build.0 = Release|x64
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|Win32.ActiveCfg = Debug|Win32
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|Win32.Build.0 = Debug|Win32
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|x64.ActiveCfg = Debug|x64
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|x64.Build.0 = Debug|x64
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|Win32.ActiveCfg = Release|Win32
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|Win32.Build.0 = Release|Win32
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|x64.ActiveCfg = Release|x64
- {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|x64.Build.0 = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/third_party/libusb/src/msvc/libusbx_2010.sln b/third_party/libusb/src/msvc/libusbx_2010.sln
deleted file mode 100644
index 25da867..0000000
--- a/third_party/libusb/src/msvc/libusbx_2010.sln
+++ /dev/null
@@ -1,94 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2010.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2010.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2010.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2010.vcxproj", "{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxload", "fxload_2010.vcxproj", "{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}"
- ProjectSection(ProjectDependencies) = postProject
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} = {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt_2010.vcxproj", "{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2010.vcxproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotplugtest", "hotplugtest_2010.vcxproj", "{99D2AC64-DC66-4422-91CE-6715C403C9E5}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.ActiveCfg = Debug|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.Build.0 = Debug|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.ActiveCfg = Debug|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.Build.0 = Debug|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.ActiveCfg = Release|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.Build.0 = Release|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.ActiveCfg = Release|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.Build.0 = Release|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.ActiveCfg = Debug|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.Build.0 = Debug|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.ActiveCfg = Debug|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.Build.0 = Debug|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.ActiveCfg = Release|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.Build.0 = Release|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.ActiveCfg = Release|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/third_party/libusb/src/msvc/libusbx_2012.sln b/third_party/libusb/src/msvc/libusbx_2012.sln
deleted file mode 100644
index d1e3e93..0000000
--- a/third_party/libusb/src/msvc/libusbx_2012.sln
+++ /dev/null
@@ -1,94 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2012.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2012.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2012.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2012.vcxproj", "{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxload", "fxload_2012.vcxproj", "{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}"
- ProjectSection(ProjectDependencies) = postProject
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} = {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt_2012.vcxproj", "{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2012.vcxproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotplugtest", "hotplugtest_2012.vcxproj", "{99D2AC64-DC66-4422-91CE-6715C403C9E5}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
- {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32
- {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64
- {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64
- {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.ActiveCfg = Debug|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.Build.0 = Debug|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.ActiveCfg = Debug|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.Build.0 = Debug|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.ActiveCfg = Release|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.Build.0 = Release|Win32
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.ActiveCfg = Release|x64
- {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.Build.0 = Release|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64
- {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64
- {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.ActiveCfg = Debug|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.Build.0 = Debug|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.ActiveCfg = Debug|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.Build.0 = Debug|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.ActiveCfg = Release|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.Build.0 = Release|Win32
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.ActiveCfg = Release|x64
- {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/third_party/libusb/src/msvc/libusbx_wince.sln b/third_party/libusb/src/msvc/libusbx_wince.sln
deleted file mode 100644
index 51c310d..0000000
--- a/third_party/libusb/src/msvc/libusbx_wince.sln
+++ /dev/null
@@ -1,246 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_wince.vcproj", "{6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_wince.vcproj", "{960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_wince.vcproj", "{93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_wince.vcproj", "{CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_wince.vcproj", "{61476624-3354-48C8-9334-85AC0D624640}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|STANDARDSDK_500 (ARMV4I) = Debug|STANDARDSDK_500 (ARMV4I)
- Debug|STANDARDSDK_500 (MIPSII) = Debug|STANDARDSDK_500 (MIPSII)
- Debug|STANDARDSDK_500 (MIPSII_FP) = Debug|STANDARDSDK_500 (MIPSII_FP)
- Debug|STANDARDSDK_500 (MIPSIV) = Debug|STANDARDSDK_500 (MIPSIV)
- Debug|STANDARDSDK_500 (MIPSIV_FP) = Debug|STANDARDSDK_500 (MIPSIV_FP)
- Debug|STANDARDSDK_500 (SH4) = Debug|STANDARDSDK_500 (SH4)
- Debug|STANDARDSDK_500 (x86) = Debug|STANDARDSDK_500 (x86)
- Release|STANDARDSDK_500 (ARMV4I) = Release|STANDARDSDK_500 (ARMV4I)
- Release|STANDARDSDK_500 (MIPSII) = Release|STANDARDSDK_500 (MIPSII)
- Release|STANDARDSDK_500 (MIPSII_FP) = Release|STANDARDSDK_500 (MIPSII_FP)
- Release|STANDARDSDK_500 (MIPSIV) = Release|STANDARDSDK_500 (MIPSIV)
- Release|STANDARDSDK_500 (MIPSIV_FP) = Release|STANDARDSDK_500 (MIPSIV_FP)
- Release|STANDARDSDK_500 (SH4) = Release|STANDARDSDK_500 (SH4)
- Release|STANDARDSDK_500 (x86) = Release|STANDARDSDK_500 (x86)
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (ARMV4I).ActiveCfg = Debug|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (ARMV4I).Build.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (ARMV4I).Deploy.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII).Build.0 = Debug|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV).Build.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (SH4).ActiveCfg = Debug|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (SH4).Build.0 = Debug|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (SH4).Deploy.0 = Debug|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (x86).ActiveCfg = Debug|STANDARDSDK_500 (x86)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (x86).Build.0 = Debug|STANDARDSDK_500 (x86)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Debug|STANDARDSDK_500 (x86).Deploy.0 = Debug|STANDARDSDK_500 (x86)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (ARMV4I).ActiveCfg = Release|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (ARMV4I).Build.0 = Release|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (ARMV4I).Deploy.0 = Release|STANDARDSDK_500 (ARMV4I)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII).ActiveCfg = Release|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII).Build.0 = Release|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII).Deploy.0 = Release|STANDARDSDK_500 (MIPSII)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII_FP).Build.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV).Build.0 = Release|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (SH4).ActiveCfg = Release|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (SH4).Build.0 = Release|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (SH4).Deploy.0 = Release|STANDARDSDK_500 (SH4)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (x86).ActiveCfg = Release|STANDARDSDK_500 (x86)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (x86).Build.0 = Release|STANDARDSDK_500 (x86)
- {6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}.Release|STANDARDSDK_500 (x86).Deploy.0 = Release|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (ARMV4I).ActiveCfg = Debug|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (ARMV4I).Build.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (ARMV4I).Deploy.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII).Build.0 = Debug|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV).Build.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (SH4).ActiveCfg = Debug|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (SH4).Build.0 = Debug|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (SH4).Deploy.0 = Debug|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (x86).ActiveCfg = Debug|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (x86).Build.0 = Debug|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Debug|STANDARDSDK_500 (x86).Deploy.0 = Debug|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (ARMV4I).ActiveCfg = Release|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (ARMV4I).Build.0 = Release|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (ARMV4I).Deploy.0 = Release|STANDARDSDK_500 (ARMV4I)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII).ActiveCfg = Release|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII).Build.0 = Release|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII).Deploy.0 = Release|STANDARDSDK_500 (MIPSII)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII_FP).Build.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV).Build.0 = Release|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (SH4).ActiveCfg = Release|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (SH4).Build.0 = Release|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (SH4).Deploy.0 = Release|STANDARDSDK_500 (SH4)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (x86).ActiveCfg = Release|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (x86).Build.0 = Release|STANDARDSDK_500 (x86)
- {960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}.Release|STANDARDSDK_500 (x86).Deploy.0 = Release|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (ARMV4I).ActiveCfg = Debug|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (ARMV4I).Build.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (ARMV4I).Deploy.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII).Build.0 = Debug|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV).Build.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (SH4).ActiveCfg = Debug|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (SH4).Build.0 = Debug|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (SH4).Deploy.0 = Debug|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (x86).ActiveCfg = Debug|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (x86).Build.0 = Debug|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Debug|STANDARDSDK_500 (x86).Deploy.0 = Debug|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (ARMV4I).ActiveCfg = Release|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (ARMV4I).Build.0 = Release|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (ARMV4I).Deploy.0 = Release|STANDARDSDK_500 (ARMV4I)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII).ActiveCfg = Release|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII).Build.0 = Release|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII).Deploy.0 = Release|STANDARDSDK_500 (MIPSII)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII_FP).Build.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV).Build.0 = Release|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (SH4).ActiveCfg = Release|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (SH4).Build.0 = Release|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (SH4).Deploy.0 = Release|STANDARDSDK_500 (SH4)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (x86).ActiveCfg = Release|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (x86).Build.0 = Release|STANDARDSDK_500 (x86)
- {93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}.Release|STANDARDSDK_500 (x86).Deploy.0 = Release|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (ARMV4I).ActiveCfg = Debug|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (ARMV4I).Build.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (ARMV4I).Deploy.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII).Build.0 = Debug|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV).Build.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (SH4).ActiveCfg = Debug|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (SH4).Build.0 = Debug|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (SH4).Deploy.0 = Debug|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (x86).ActiveCfg = Debug|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (x86).Build.0 = Debug|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Debug|STANDARDSDK_500 (x86).Deploy.0 = Debug|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (ARMV4I).ActiveCfg = Release|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (ARMV4I).Build.0 = Release|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (ARMV4I).Deploy.0 = Release|STANDARDSDK_500 (ARMV4I)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII).ActiveCfg = Release|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII).Build.0 = Release|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII).Deploy.0 = Release|STANDARDSDK_500 (MIPSII)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII_FP).Build.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV).Build.0 = Release|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (SH4).ActiveCfg = Release|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (SH4).Build.0 = Release|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (SH4).Deploy.0 = Release|STANDARDSDK_500 (SH4)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (x86).ActiveCfg = Release|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (x86).Build.0 = Release|STANDARDSDK_500 (x86)
- {CE67BEFB-37EA-4F5C-A60E-F2D0CC91B6AA}.Release|STANDARDSDK_500 (x86).Deploy.0 = Release|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (ARMV4I).ActiveCfg = Debug|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (ARMV4I).Build.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (ARMV4I).Deploy.0 = Debug|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII).Build.0 = Debug|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV).Build.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Debug|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (SH4).ActiveCfg = Debug|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (SH4).Build.0 = Debug|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (SH4).Deploy.0 = Debug|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (x86).ActiveCfg = Debug|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (x86).Build.0 = Debug|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Debug|STANDARDSDK_500 (x86).Deploy.0 = Debug|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (ARMV4I).ActiveCfg = Release|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (ARMV4I).Build.0 = Release|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (ARMV4I).Deploy.0 = Release|STANDARDSDK_500 (ARMV4I)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII).ActiveCfg = Release|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII).Build.0 = Release|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII).Deploy.0 = Release|STANDARDSDK_500 (MIPSII)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII_FP).Build.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSII_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSII_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV).Build.0 = Release|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV_FP).ActiveCfg = Release|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV_FP).Build.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (MIPSIV_FP).Deploy.0 = Release|STANDARDSDK_500 (MIPSIV_FP)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (SH4).ActiveCfg = Release|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (SH4).Build.0 = Release|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (SH4).Deploy.0 = Release|STANDARDSDK_500 (SH4)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (x86).ActiveCfg = Release|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (x86).Build.0 = Release|STANDARDSDK_500 (x86)
- {61476624-3354-48C8-9334-85AC0D624640}.Release|STANDARDSDK_500 (x86).Deploy.0 = Release|STANDARDSDK_500 (x86)
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/third_party/libusb/src/msvc/listdevs.dsp b/third_party/libusb/src/msvc/listdevs.dsp
index 2ed8aec..93a93e4 100644
--- a/third_party/libusb/src/msvc/listdevs.dsp
+++ b/third_party/libusb/src/msvc/listdevs.dsp
@@ -1,103 +1,103 @@
-# Microsoft Developer Studio Project File - Name="listdevs" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=listdevs - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "listdevs.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "listdevs.mak" CFG="listdevs - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "listdevs - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "listdevs - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "listdevs - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/examples"
-# PROP Intermediate_Dir "../Win32/Release/examples/listdevs"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "listdevs - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/examples"
-# PROP Intermediate_Dir "../Win32/Debug/examples/listdevs"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "listdevs - Win32 Release"
-# Name "listdevs - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\listdevs.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="listdevs" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=listdevs - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "listdevs.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "listdevs.mak" CFG="listdevs - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "listdevs - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "listdevs - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "listdevs - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../Win32/Release/examples"
+# PROP Intermediate_Dir "../Win32/Release/examples/listdevs"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "listdevs - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../Win32/Debug/examples"
+# PROP Intermediate_Dir "../Win32/Debug/examples/listdevs"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "listdevs - Win32 Release"
+# Name "listdevs - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\listdevs.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/third_party/libusb/src/msvc/listdevs_2005.vcproj b/third_party/libusb/src/msvc/listdevs_2005.vcproj
deleted file mode 100644
index cff754e0..0000000
--- a/third_party/libusb/src/msvc/listdevs_2005.vcproj
+++ /dev/null
@@ -1,360 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="listdevs"
- ProjectGUID="{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}"
- RootNamespace="examples"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\examples\listdevs.c"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/listdevs_2010.vcxproj b/third_party/libusb/src/msvc/listdevs_2010.vcxproj
deleted file mode 100644
index 173af38..0000000
--- a/third_party/libusb/src/msvc/listdevs_2010.vcxproj
+++ /dev/null
@@ -1,165 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>listdevs</ProjectName>
- <ProjectGuid>{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\listdevs.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2010.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/listdevs_2010.vcxproj.filters b/third_party/libusb/src/msvc/listdevs_2010.vcxproj.filters
deleted file mode 100644
index 1378e29..0000000
--- a/third_party/libusb/src/msvc/listdevs_2010.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\listdevs.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/listdevs_2012.vcxproj b/third_party/libusb/src/msvc/listdevs_2012.vcxproj
deleted file mode 100644
index 4ecc865..0000000
--- a/third_party/libusb/src/msvc/listdevs_2012.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>listdevs</ProjectName>
- <ProjectGuid>{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\listdevs.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2012.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/listdevs_2012.vcxproj.filters b/third_party/libusb/src/msvc/listdevs_2012.vcxproj.filters
deleted file mode 100644
index 1378e29..0000000
--- a/third_party/libusb/src/msvc/listdevs_2012.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\listdevs.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/listdevs_wince.vcproj b/third_party/libusb/src/msvc/listdevs_wince.vcproj
deleted file mode 100644
index 1bb6c6d..0000000
--- a/third_party/libusb/src/msvc/listdevs_wince.vcproj
+++ /dev/null
@@ -1,1120 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="listdevs"
- ProjectGUID="{960C3BC3-26D6-49C7-ACE4-0AE65CC049E6}"
- RootNamespace="listdevs"
- >
- <Platforms>
- <Platform
- Name="STANDARDSDK_500 (ARMV4I)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (SH4)"
- />
- <Platform
- Name="STANDARDSDK_500 (x86)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\listdevs"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- <ProjectReference
- ReferencedProjectIdentifier="{6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}"
- RelativePathToProject=".\libusb-1.0.vcproj"
- />
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\examples\listdevs.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/missing.c b/third_party/libusb/src/msvc/missing.c
deleted file mode 100644
index 85d9d6f..0000000
--- a/third_party/libusb/src/msvc/missing.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Source file for missing WinCE functionality
- * Copyright © 2012 RealVNC Ltd.
- *
- * 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
- */
-
-#include "missing.h"
-
-#include <config.h>
-#include <libusbi.h>
-
-#include <windows.h>
-
-// The registry path to store environment variables
-#define ENVIRONMENT_REG_PATH _T("Software\\libusb\\environment")
-
-/* Workaround getenv not being available on WinCE.
- * Instead look in HKLM\Software\libusb\environment */
-char *getenv(const char *name)
-{
- static char value[MAX_PATH];
- TCHAR wValue[MAX_PATH];
- WCHAR wName[MAX_PATH];
- DWORD dwType, dwData;
- HKEY hkey;
- LONG rc;
-
- if (!name)
- return NULL;
-
- if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) {
- usbi_dbg("Failed to convert environment variable name to wide string");
- return NULL;
- }
- wName[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
-
- rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ENVIRONMENT_REG_PATH, 0, KEY_QUERY_VALUE, &hkey);
- if (rc != ERROR_SUCCESS) {
- usbi_dbg("Failed to open registry key for getenv with error %d", rc);
- return NULL;
- }
-
- // Attempt to read the key
- dwData = sizeof(wValue);
- rc = RegQueryValueEx(hkey, wName, NULL, &dwType,
- (LPBYTE)&wValue, &dwData);
- RegCloseKey(hkey);
- if (rc != ERROR_SUCCESS) {
- usbi_dbg("Failed to read registry key value for getenv with error %d", rc);
- return NULL;
- }
- if (dwType != REG_SZ) {
- usbi_dbg("Registry value was of type %d instead of REG_SZ", dwType);
- return NULL;
- }
-
- // Success in reading the key, convert from WCHAR to char
- if (WideCharToMultiByte(CP_UTF8, 0,
- wValue, dwData / sizeof(*wValue),
- value, MAX_PATH,
- NULL, NULL) <= 0) {
- usbi_dbg("Failed to convert environment variable value to narrow string");
- return NULL;
- }
- value[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
- return value;
-}
diff --git a/third_party/libusb/src/msvc/missing.h b/third_party/libusb/src/msvc/missing.h
deleted file mode 100644
index 183b9d3..0000000
--- a/third_party/libusb/src/msvc/missing.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Header file for missing WinCE functionality
- * Copyright © 2012-2013 RealVNC Ltd.
- *
- * 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 MISSING_H
-#define MISSING_H
-
-/* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
-#define SleepEx(m, a) Sleep(m)
-
-/* Windows CE doesn't have any APIs to query environment variables.
- *
- * This contains a registry based implementation of getenv.
- */
-char *getenv(const char *name);
-
-#endif
diff --git a/third_party/libusb/src/msvc/stress_2005.vcproj b/third_party/libusb/src/msvc/stress_2005.vcproj
deleted file mode 100644
index a2f2788..0000000
--- a/third_party/libusb/src/msvc/stress_2005.vcproj
+++ /dev/null
@@ -1,390 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="stress"
- ProjectGUID="{53942EFF-C810-458D-B3CB-EE5CE9F1E781}"
- RootNamespace="tests"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\tests"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\tests\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\tests"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\tests\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\tests"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\tests\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\tests"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\tests\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\tests\testlib.c"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\tests\stress.c"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- Detect64BitPortabilityProblems="false"
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\tests\libusbx_testlib.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/stress_2010.vcxproj b/third_party/libusb/src/msvc/stress_2010.vcxproj
deleted file mode 100644
index 49e4761..0000000
--- a/third_party/libusb/src/msvc/stress_2010.vcxproj
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>stress</ProjectName>
- <ProjectGuid>{53942EFF-C810-458D-B3CB-EE5CE9F1E781}</ProjectGuid>
- <RootNamespace>tests</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\tests\stress.c" />
- <ClCompile Include="..\tests\testlib.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2010.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\tests\libusbx_testlib.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/stress_2010.vcxproj.filters b/third_party/libusb/src/msvc/stress_2010.vcxproj.filters
deleted file mode 100644
index 7313dab..0000000
--- a/third_party/libusb/src/msvc/stress_2010.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{28b6220e-d087-4f48-bd69-ffe0ac5bcc7a}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\tests\stress.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\tests\testlib.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\tests\libusbx_testlib.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/stress_2012.vcxproj b/third_party/libusb/src/msvc/stress_2012.vcxproj
deleted file mode 100644
index 0d8da7b..0000000
--- a/third_party/libusb/src/msvc/stress_2012.vcxproj
+++ /dev/null
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>stress</ProjectName>
- <ProjectGuid>{53942EFF-C810-458D-B3CB-EE5CE9F1E781}</ProjectGuid>
- <RootNamespace>tests</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\tests\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\tests\stress.c" />
- <ClCompile Include="..\tests\testlib.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2012.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\tests\libusbx_testlib.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/stress_2012.vcxproj.filters b/third_party/libusb/src/msvc/stress_2012.vcxproj.filters
deleted file mode 100644
index 7313dab..0000000
--- a/third_party/libusb/src/msvc/stress_2012.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{28b6220e-d087-4f48-bd69-ffe0ac5bcc7a}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\tests\stress.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\tests\testlib.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\tests\libusbx_testlib.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/stress_wince.vcproj b/third_party/libusb/src/msvc/stress_wince.vcproj
deleted file mode 100644
index 089feea..0000000
--- a/third_party/libusb/src/msvc/stress_wince.vcproj
+++ /dev/null
@@ -1,1128 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="stress"
- ProjectGUID="{61476624-3354-48C8-9334-85AC0D624640}"
- RootNamespace="stress"
- >
- <Platforms>
- <Platform
- Name="STANDARDSDK_500 (ARMV4I)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (SH4)"
- />
- <Platform
- Name="STANDARDSDK_500 (x86)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\stress"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\tests"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\tests\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- <ProjectReference
- ReferencedProjectIdentifier="{6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}"
- RelativePathToProject=".\libusb_dll.vcproj"
- />
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\tests\stress.c"
- >
- </File>
- <File
- RelativePath="..\tests\testlib.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\tests\libusbx_testlib.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/xusb.dsp b/third_party/libusb/src/msvc/xusb.dsp
deleted file mode 100644
index a99178c..0000000
--- a/third_party/libusb/src/msvc/xusb.dsp
+++ /dev/null
@@ -1,102 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xusb" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xusb - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xusb.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xusb.mak" CFG="xusb - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xusb - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xusb - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xusb - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/examples"
-# PROP Intermediate_Dir "../Win32/Release/examples/xusb"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "xusb - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "xusb___Win32_Debug"
-# PROP BASE Intermediate_Dir "xusb___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/examples"
-# PROP Intermediate_Dir "../Win32/Debug/examples/xusb"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-
-!ENDIF
-
-# Begin Target
-
-# Name "xusb - Win32 Release"
-# Name "xusb - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\xusb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/third_party/libusb/src/msvc/xusb_2005.vcproj b/third_party/libusb/src/msvc/xusb_2005.vcproj
deleted file mode 100644
index b12f5c1..0000000
--- a/third_party/libusb/src/msvc/xusb_2005.vcproj
+++ /dev/null
@@ -1,344 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="xusb"
- ProjectGUID="{08A6FA39-21B7-4A05-9252-2F9864A5E5A4}"
- RootNamespace="examples"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\$(PlatformName)\$(ConfigurationName)\examples"
- IntermediateDirectory="..\$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".;..\libusb"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\examples\xusb.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/msvc/xusb_2010.vcxproj b/third_party/libusb/src/msvc/xusb_2010.vcxproj
deleted file mode 100644
index 7c4811d..0000000
--- a/third_party/libusb/src/msvc/xusb_2010.vcxproj
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>xusb</ProjectName>
- <ProjectGuid>{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\xusb.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2010.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/xusb_2010.vcxproj.filters b/third_party/libusb/src/msvc/xusb_2010.vcxproj.filters
deleted file mode 100644
index f71902f..0000000
--- a/third_party/libusb/src/msvc/xusb_2010.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\xusb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/xusb_2012.vcxproj b/third_party/libusb/src/msvc/xusb_2012.vcxproj
deleted file mode 100644
index 7d64df5..0000000
--- a/third_party/libusb/src/msvc/xusb_2012.vcxproj
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>xusb</ProjectName>
- <ProjectGuid>{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}</ProjectGuid>
- <RootNamespace>examples</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\$(Platform)\$(Configuration)\examples\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)$(ProjectName).htm</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\xusb.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include=".\libusb_static_2012.vcxproj">
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/xusb_2012.vcxproj.filters b/third_party/libusb/src/msvc/xusb_2012.vcxproj.filters
deleted file mode 100644
index f71902f..0000000
--- a/third_party/libusb/src/msvc/xusb_2012.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\examples\xusb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/xusb_sources b/third_party/libusb/src/msvc/xusb_sources
deleted file mode 100644
index b43f94f..0000000
--- a/third_party/libusb/src/msvc/xusb_sources
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGETNAME=xusb
-TARGETTYPE=PROGRAM
-386_STDCALL=0
-
-_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
-
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-!IFDEF STATIC_LIBC
-USE_LIBCMT=1
-!ELSE
-USE_MSVCRT=1
-!ENDIF
-
-UMTYPE=console
-INCLUDES=..\..\msvc;..\..\libusb;$(DDK_INC_PATH)
-UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib
-SOURCES=..\xusb.c
diff --git a/third_party/libusb/src/msvc/xusb_wince.vcproj b/third_party/libusb/src/msvc/xusb_wince.vcproj
deleted file mode 100644
index f994678..0000000
--- a/third_party/libusb/src/msvc/xusb_wince.vcproj
+++ /dev/null
@@ -1,1120 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="xusb"
- ProjectGUID="{93F53A7E-6DEF-469A-ABD4-A5AD02A0A511}"
- RootNamespace="xusb"
- >
- <Platforms>
- <Platform
- Name="STANDARDSDK_500 (ARMV4I)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSII_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV)"
- />
- <Platform
- Name="STANDARDSDK_500 (MIPSIV_FP)"
- />
- <Platform
- Name="STANDARDSDK_500 (SH4)"
- />
- <Platform
- Name="STANDARDSDK_500 (x86)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory="%CSIDL_PROGRAM_FILES%\xusb"
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Debug|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (ARMV4I)"
- OutputDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\ARMV4I\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII)"
- OutputDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSII_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSII_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV)"
- OutputDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (MIPSIV_FP)"
- OutputDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\MIPSIV_FP\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (SH4)"
- OutputDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\SH4\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|STANDARDSDK_500 (x86)"
- OutputDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples"
- IntermediateDirectory="$(SolutionDir)..\x86\$(ConfigurationName)\examples\$(TargetName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- AdditionalIncludeDirectories="..\libusb;."
- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
- MinimalRebuild="true"
- RuntimeLibrary="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="9"
- IgnoreDefaultLibraryNames="oldnames.lib,libc.lib"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- EntryPointSymbol="mainACRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- <ProjectReference
- ReferencedProjectIdentifier="{6A49B75F-FB1C-45C0-B7C3-A7698255E7E9}"
- RelativePathToProject=".\libusb-1.0.vcproj"
- />
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\examples\xusb.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/third_party/libusb/src/tests/Makefile.am b/third_party/libusb/src/tests/Makefile.am
deleted file mode 100644
index bf53f3f..0000000
--- a/third_party/libusb/src/tests/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/libusb
-LDADD = ../libusb/libusb-1.0.la
-
-noinst_PROGRAMS = stress
-
-stress_SOURCES = stress.c libusbx_testlib.h testlib.c
diff --git a/third_party/libusb/src/tests/libusbx_testlib.h b/third_party/libusb/src/tests/libusbx_testlib.h
deleted file mode 100644
index 06dbc8e..0000000
--- a/third_party/libusb/src/tests/libusbx_testlib.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * libusbx test library helper functions
- * Copyright © 2012 Toby Gray <toby.gray@realvnc.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 LIBUSBX_TESTLIB_H
-#define LIBUSBX_TESTLIB_H
-
-#include <stdio.h>
-
-#if !defined(bool)
-#define bool int
-#endif
-#if !defined(true)
-#define true (1 == 1)
-#endif
-#if !defined(false)
-#define false (!true)
-#endif
-
-/** Values returned from a test function to indicate test result */
-typedef enum {
- /** Indicates that the test ran successfully. */
- TEST_STATUS_SUCCESS,
- /** Indicates that the test failed one or more test. */
- TEST_STATUS_FAILURE,
- /** Indicates that an unexpected error occurred. */
- TEST_STATUS_ERROR,
- /** Indicates that the test can't be run. For example this may be
- * due to no suitable device being connected to perform the tests.*/
- TEST_STATUS_SKIP
-} libusbx_testlib_result;
-
-/**
- * Context for test library functions
- */
-typedef struct {
- char ** test_names;
- int test_count;
- bool list_tests;
- bool verbose;
- int old_stdout;
- int old_stderr;
- FILE* output_file;
- int null_fd;
-} libusbx_testlib_ctx;
-
-/**
- * Logs some test information or state
- */
-void libusbx_testlib_logf(libusbx_testlib_ctx * ctx,
- const char* fmt, ...);
-
-/**
- * Function pointer for a libusbx test function.
- *
- * Should return TEST_STATUS_SUCCESS on success or another TEST_STATUS value.
- */
-typedef libusbx_testlib_result
-(*libusbx_testlib_test_function)(libusbx_testlib_ctx * ctx);
-
-/**
- * Structure holding a test description.
- */
-typedef struct {
- /** Human readable name of the test. */
- const char * name;
- /** The test library will call this function to run the test. */
- libusbx_testlib_test_function function;
-} libusbx_testlib_test;
-
-/**
- * Value to use at the end of a test array to indicate the last
- * element.
- */
-#define LIBUSBX_NULL_TEST {NULL, NULL}
-
-/**
- * Runs the tests provided.
- *
- * Before running any tests argc and argv will be processed
- * to determine the mode of operation.
- *
- * \param argc The argc from main
- * \param argv The argv from main
- * \param tests A NULL_TEST terminated array of tests
- * \return 0 on success, non-zero on failure
- */
-int libusbx_testlib_run_tests(int argc,
- char ** argv,
- const libusbx_testlib_test * tests);
-
-#endif //LIBUSBX_TESTLIB_H
diff --git a/third_party/libusb/src/tests/stress.c b/third_party/libusb/src/tests/stress.c
deleted file mode 100644
index e53f4159..0000000
--- a/third_party/libusb/src/tests/stress.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * libusbx stress test program to perform simple stress tests
- * Copyright © 2012 Toby Gray <toby.gray@realvnc.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
- */
-
-#include <stdio.h>
-#include <memory.h>
-
-#include "libusb.h"
-#include "libusbx_testlib.h"
-
-/** Test that creates and destroys a single concurrent context
- * 10000 times. */
-static libusbx_testlib_result test_init_and_exit(libusbx_testlib_ctx * tctx)
-{
- libusb_context * ctx = NULL;
- int i;
- for (i = 0; i < 10000; ++i) {
- int r = libusb_init(&ctx);
- if (r != LIBUSB_SUCCESS) {
- libusbx_testlib_logf(tctx,
- "Failed to init libusb on iteration %d: %d",
- i, r);
- return TEST_STATUS_FAILURE;
- }
- libusb_exit(ctx);
- ctx = NULL;
- }
-
- return TEST_STATUS_SUCCESS;
-}
-
-/** Tests that devices can be listed 1000 times. */
-static libusbx_testlib_result test_get_device_list(libusbx_testlib_ctx * tctx)
-{
- libusb_context * ctx = NULL;
- int r, i;
- r = libusb_init(&ctx);
- if (r != LIBUSB_SUCCESS) {
- libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r);
- return TEST_STATUS_FAILURE;
- }
- for (i = 0; i < 1000; ++i) {
- libusb_device ** device_list;
- ssize_t list_size = libusb_get_device_list(ctx, &device_list);
- if (list_size < 0 || device_list == NULL) {
- libusbx_testlib_logf(tctx,
- "Failed to get device list on iteration %d: %d (%p)",
- i, -list_size, device_list);
- return TEST_STATUS_FAILURE;
- }
- libusb_free_device_list(device_list, 1);
- }
- libusb_exit(ctx);
- return TEST_STATUS_SUCCESS;
-}
-
-/** Tests that 100 concurrent device lists can be open at a time. */
-static libusbx_testlib_result test_many_device_lists(libusbx_testlib_ctx * tctx)
-{
-#define LIST_COUNT 100
- libusb_context * ctx = NULL;
- libusb_device ** device_lists[LIST_COUNT];
- int r, i;
- memset(device_lists, 0, sizeof(device_lists));
-
- r = libusb_init(&ctx);
- if (r != LIBUSB_SUCCESS) {
- libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r);
- return TEST_STATUS_FAILURE;
- }
-
- /* Create the 100 device lists. */
- for (i = 0; i < LIST_COUNT; ++i) {
- ssize_t list_size = libusb_get_device_list(ctx, &(device_lists[i]));
- if (list_size < 0 || device_lists[i] == NULL) {
- libusbx_testlib_logf(tctx,
- "Failed to get device list on iteration %d: %d (%p)",
- i, -list_size, device_lists[i]);
- return TEST_STATUS_FAILURE;
- }
- }
-
- /* Destroy the 100 device lists. */
- for (i = 0; i < LIST_COUNT; ++i) {
- if (device_lists[i]) {
- libusb_free_device_list(device_lists[i], 1);
- device_lists[i] = NULL;
- }
- }
-
- libusb_exit(ctx);
- return TEST_STATUS_SUCCESS;
-#undef LIST_COUNT
-}
-
-/** Tests that the default context (used for various things including
- * logging) works correctly when the first context created in a
- * process is destroyed. */
-static libusbx_testlib_result test_default_context_change(libusbx_testlib_ctx * tctx)
-{
- libusb_context * ctx = NULL;
- int r, i;
-
- for (i = 0; i < 100; ++i) {
- /* First create a new context */
- r = libusb_init(&ctx);
- if (r != LIBUSB_SUCCESS) {
- libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r);
- return TEST_STATUS_FAILURE;
- }
-
- /* Enable debug output, to be sure to use the context */
- libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG);
- libusb_set_debug(ctx, LIBUSB_LOG_LEVEL_DEBUG);
-
- /* Now create a reference to the default context */
- r = libusb_init(NULL);
- if (r != LIBUSB_SUCCESS) {
- libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r);
- return TEST_STATUS_FAILURE;
- }
-
- /* Destroy the first context */
- libusb_exit(ctx);
- /* Destroy the default context */
- libusb_exit(NULL);
- }
-
- return TEST_STATUS_SUCCESS;
-}
-
-/* Fill in the list of tests. */
-static const libusbx_testlib_test tests[] = {
- {"init_and_exit", &test_init_and_exit},
- {"get_device_list", &test_get_device_list},
- {"many_device_lists", &test_many_device_lists},
- {"default_context_change", &test_default_context_change},
- LIBUSBX_NULL_TEST
-};
-
-int main (int argc, char ** argv)
-{
- return libusbx_testlib_run_tests(argc, argv, tests);
-}
diff --git a/third_party/libusb/src/tests/testlib.c b/third_party/libusb/src/tests/testlib.c
deleted file mode 100644
index e69aa39..0000000
--- a/third_party/libusb/src/tests/testlib.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * libusbx test library helper functions
- * Copyright © 2012 Toby Gray <toby.gray@realvnc.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
- */
-
-#include "libusbx_testlib.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#if !defined(_WIN32_WCE)
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
-#if defined(_WIN32_WCE)
-// No support for selective redirection of STDOUT on WinCE.
-#define DISABLE_STDOUT_REDIRECTION
-#define STDOUT_FILENO 1
-#elif defined(_WIN32)
-#include <io.h>
-#define dup _dup
-#define dup2 _dup2
-#define open _open
-#define close _close
-#define fdopen _fdopen
-#define NULL_PATH "nul"
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-#else
-#include <unistd.h>
-#define NULL_PATH "/dev/null"
-#endif
-#define INVALID_FD -1
-#define IGNORE_RETVAL(expr) do { (void)(expr); } while(0)
-
-/**
- * Converts a test result code into a human readable string.
- */
-static const char* test_result_to_str(libusbx_testlib_result result)
-{
- switch (result) {
- case TEST_STATUS_SUCCESS:
- return "Success";
- case TEST_STATUS_FAILURE:
- return "Failure";
- case TEST_STATUS_ERROR:
- return "Error";
- case TEST_STATUS_SKIP:
- return "Skip";
- default:
- return "Unknown";
- }
-}
-
-static void print_usage(int argc, char ** argv)
-{
- printf("Usage: %s [-l] [-v] [<test_name> ...]\n",
- argc > 0 ? argv[0] : "test_*");
- printf(" -l List available tests\n");
- printf(" -v Don't redirect STDERR/STDOUT during tests\n");
-}
-
-static void cleanup_test_output(libusbx_testlib_ctx * ctx)
-{
-#ifndef DISABLE_STDOUT_REDIRECTION
- if (!ctx->verbose) {
- if (ctx->old_stdout != INVALID_FD) {
- IGNORE_RETVAL(dup2(ctx->old_stdout, STDOUT_FILENO));
- ctx->old_stdout = INVALID_FD;
- }
- if (ctx->old_stderr != INVALID_FD) {
- IGNORE_RETVAL(dup2(ctx->old_stderr, STDERR_FILENO));
- ctx->old_stderr = INVALID_FD;
- }
- if (ctx->null_fd != INVALID_FD) {
- close(ctx->null_fd);
- ctx->null_fd = INVALID_FD;
- }
- if (ctx->output_file != stdout) {
- fclose(ctx->output_file);
- ctx->output_file = stdout;
- }
- }
-#endif
-}
-
-/**
- * Setup test output handles
- * \return zero on success, non-zero on failure
- */
-static int setup_test_output(libusbx_testlib_ctx * ctx)
-{
-#ifndef DISABLE_STDOUT_REDIRECTION
- /* Stop output to stdout and stderr from being displayed if using non-verbose output */
- if (!ctx->verbose) {
- /* Keep a copy of STDOUT and STDERR */
- ctx->old_stdout = dup(STDOUT_FILENO);
- if (ctx->old_stdout < 0) {
- ctx->old_stdout = INVALID_FD;
- printf("Failed to duplicate stdout handle: %d\n", errno);
- return 1;
- }
- ctx->old_stderr = dup(STDERR_FILENO);
- if (ctx->old_stderr < 0) {
- ctx->old_stderr = INVALID_FD;
- cleanup_test_output(ctx);
- printf("Failed to duplicate stderr handle: %d\n", errno);
- return 1;
- }
- /* Redirect STDOUT_FILENO and STDERR_FILENO to /dev/null or "nul"*/
- ctx->null_fd = open(NULL_PATH, O_WRONLY);
- if (ctx->null_fd < 0) {
- ctx->null_fd = INVALID_FD;
- cleanup_test_output(ctx);
- printf("Failed to open null handle: %d\n", errno);
- return 1;
- }
- if ((dup2(ctx->null_fd, STDOUT_FILENO) < 0) ||
- (dup2(ctx->null_fd, STDERR_FILENO) < 0)) {
- cleanup_test_output(ctx);
- return 1;
- }
- ctx->output_file = fdopen(ctx->old_stdout, "w");
- if (!ctx->output_file) {
- cleanup_test_output(ctx);
- printf("Failed to open FILE for output handle: %d\n", errno);
- return 1;
- }
- }
-#endif
- return 0;
-}
-
-void libusbx_testlib_logf(libusbx_testlib_ctx * ctx,
- const char* fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- vfprintf(ctx->output_file, fmt, va);
- va_end(va);
- fprintf(ctx->output_file, "\n");
- fflush(ctx->output_file);
-}
-
-int libusbx_testlib_run_tests(int argc,
- char ** argv,
- const libusbx_testlib_test * tests)
-{
- int run_count = 0;
- int idx = 0;
- int pass_count = 0;
- int fail_count = 0;
- int error_count = 0;
- int skip_count = 0;
- int r, j;
- size_t arglen;
- libusbx_testlib_result test_result;
- libusbx_testlib_ctx ctx;
-
- /* Setup default mode of operation */
- ctx.test_names = NULL;
- ctx.test_count = 0;
- ctx.list_tests = false;
- ctx.verbose = false;
- ctx.old_stdout = INVALID_FD;
- ctx.old_stderr = INVALID_FD;
- ctx.output_file = stdout;
- ctx.null_fd = INVALID_FD;
-
- /* Parse command line options */
- if (argc >= 2) {
- for (j = 1; j < argc; j++) {
- arglen = strlen(argv[j]);
- if ( ((argv[j][0] == '-') || (argv[j][0] == '/')) &&
- arglen >=2 ) {
- switch (argv[j][1]) {
- case 'l':
- ctx.list_tests = true;
- break;
- case 'v':
- ctx.verbose = true;
- break;
- default:
- printf("Unknown option: '%s'\n", argv[j]);
- print_usage(argc, argv);
- return 1;
- }
- } else {
- /* End of command line options, remaining must be list of tests to run */
- ctx.test_names = argv + j;
- ctx.test_count = argc - j;
- break;
- }
- }
- }
-
- /* Validate command line options */
- if (ctx.test_names && ctx.list_tests) {
- printf("List of tests requested but test list provided\n");
- print_usage(argc, argv);
- return 1;
- }
-
- /* Setup test log output */
- r = setup_test_output(&ctx);
- if (r != 0)
- return r;
-
- /* Act on any options not related to running tests */
- if (ctx.list_tests) {
- while (tests[idx].function != NULL) {
- libusbx_testlib_logf(&ctx, tests[idx].name);
- ++idx;
- }
- cleanup_test_output(&ctx);
- return 0;
- }
-
- /* Run any requested tests */
- while (tests[idx].function != NULL) {
- const libusbx_testlib_test * test = &tests[idx];
- ++idx;
- if (ctx.test_count > 0) {
- /* Filtering tests to run, check if this is one of them */
- int i;
- for (i = 0; i < ctx.test_count; ++i) {
- if (strcmp(ctx.test_names[i], test->name) == 0)
- /* Matches a requested test name */
- break;
- }
- if (i >= ctx.test_count) {
- /* Failed to find a test match, so do the next loop iteration */
- continue;
- }
- }
- libusbx_testlib_logf(&ctx,
- "Starting test run: %s...", test->name);
- test_result = test->function(&ctx);
- libusbx_testlib_logf(&ctx,
- "%s (%d)",
- test_result_to_str(test_result), test_result);
- switch (test_result) {
- case TEST_STATUS_SUCCESS: pass_count++; break;
- case TEST_STATUS_FAILURE: fail_count++; break;
- case TEST_STATUS_ERROR: error_count++; break;
- case TEST_STATUS_SKIP: skip_count++; break;
- }
- ++run_count;
- }
- libusbx_testlib_logf(&ctx, "---");
- libusbx_testlib_logf(&ctx, "Ran %d tests", run_count);
- libusbx_testlib_logf(&ctx, "Passed %d tests", pass_count);
- libusbx_testlib_logf(&ctx, "Failed %d tests", fail_count);
- libusbx_testlib_logf(&ctx, "Error in %d tests", error_count);
- libusbx_testlib_logf(&ctx, "Skipped %d tests", skip_count);
-
- cleanup_test_output(&ctx);
- return pass_count != run_count;
-}
diff --git a/third_party/libusb/windows-build.patch b/third_party/libusb/windows-build.patch
index ef2dc04..d2a478c 100644
--- a/third_party/libusb/windows-build.patch
+++ b/third_party/libusb/windows-build.patch
@@ -1,54 +1,41 @@
diff --git a/libusb/libusb.h b/libusb/libusb.h
-index e8e1201..15bd0d5 100644
+index 58b406f..1d0dd7d 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
-@@ -25,6 +25,12 @@
- #define LIBUSB_H
-
- #ifdef _MSC_VER
-+// Disable warning 4200 for [0].
+@@ -881,6 +881,12 @@ typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transf
+ * completed, the library populates the transfer with the results and passes
+ * it back to the user.
+ */
++
++#if defined(OS_WIN)
+#pragma warning(push)
-+#pragma warning(disable: 4200)
-+#endif
++#pragma warning(disable:4200)
++#endif // defined(OS_WIN)
+
-+#ifdef _MSC_VER
- /* on MS environments, the inline keyword is available in C++ only */
- #if !defined(__cplusplus)
- #define inline __inline
-@@ -1938,4 +1944,8 @@ void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
- }
- #endif
+ struct libusb_transfer {
+ /** Handle of the device that this transfer will be submitted to */
+ libusb_device_handle *dev_handle;
+@@ -939,6 +945,10 @@ struct libusb_transfer {
+ ;
+ };
-+#ifdef _MSC_VER
++#if defined(OS_WIN)
+#pragma warning(pop)
-+#endif
++#endif // defined(OS_WIN)
+
+ /** \ingroup misc
+ * Capabilities supported by this instance of libusb. Test if the loaded
+ * library supports a given capability by calling
+diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
+index ddbd680..7c2fae5 100644
+--- a/libusb/os/windows_usb.h
++++ b/libusb/os/windows_usb.h
+@@ -101,7 +101,7 @@ const GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0
+ #if !defined(GUID_DEVINTERFACE_USB_HUB)
+ const GUID GUID_DEVINTERFACE_USB_HUB = { 0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8} };
#endif
-diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c
-index 9769f58..46f6db7 100644
---- a/libusb/os/threads_posix.c
-+++ b/libusb/os/threads_posix.c
-@@ -20,11 +20,6 @@
- */
+-const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
++static const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
+
- #if defined(__linux__) || defined(__OpenBSD__)
--# if defined(__linux__)
--# define _GNU_SOURCE
--# else
--# define _BSD_SOURCE
--# endif
- # include <unistd.h>
- # include <sys/syscall.h>
- #elif defined(__APPLE__)
-diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
-index 63357b1..51ce55d 100644
---- a/libusb/os/windows_usb.c
-+++ b/libusb/os/windows_usb.c
-@@ -2142,6 +2142,7 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
- windows_handle_callback(transfer, io_result, io_size);
- } else {
- usbi_err(ctx, "could not find a matching transfer for fd %x", fds[i]);
-+ usbi_mutex_unlock(&ctx->open_devs_lock);
- return LIBUSB_ERROR_NOT_FOUND;
- }
- }
+ /*