usb 2.1.3 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +19 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/usb/bindings.d.ts +4 -0
- package/dist/usb/device.js +5 -0
- package/dist/usb/device.js.map +1 -1
- package/dist/usb/index.js +7 -16
- package/dist/usb/index.js.map +1 -1
- package/dist/webusb/webusb-device.d.ts +0 -1
- package/dist/webusb/webusb-device.js +149 -243
- package/dist/webusb/webusb-device.js.map +1 -1
- package/libusb/.gitattributes +2 -6
- package/libusb/.private/appveyor_build.sh +22 -0
- package/libusb/.private/bm.sh +1 -1
- package/libusb/.private/ci-build.sh +67 -0
- package/libusb/.private/ci-container-build.sh +70 -0
- package/libusb/.private/post-rewrite.sh +5 -1
- package/libusb/.private/pre-commit.sh +5 -1
- package/libusb/.private/wbs.txt +4 -19
- package/libusb/.travis.yml +32 -23
- package/libusb/AUTHORS +86 -3
- package/libusb/ChangeLog +54 -3
- package/libusb/INSTALL_WIN.txt +22 -44
- package/libusb/Makefile.am +32 -10
- package/libusb/{README.md → README} +2 -2
- package/libusb/README.git +3 -3
- package/libusb/Xcode/common.xcconfig +23 -19
- package/libusb/Xcode/config.h +25 -13
- package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +511 -109
- package/libusb/android/README +90 -54
- package/libusb/android/config.h +23 -43
- package/libusb/android/examples/unrooted_android.c +300 -0
- package/libusb/android/examples/unrooted_android.h +36 -0
- package/libusb/android/jni/Android.mk +1 -1
- package/libusb/android/jni/Application.mk +16 -0
- package/libusb/android/jni/examples.mk +63 -29
- package/libusb/android/jni/libusb.mk +14 -8
- package/libusb/android/jni/tests.mk +13 -24
- package/libusb/appveyor.yml +73 -30
- package/libusb/autogen.sh +5 -3
- package/libusb/bootstrap.sh +6 -2
- package/libusb/configure.ac +314 -227
- package/libusb/doc/Makefile.in +22 -0
- package/libusb/doc/doxygen.cfg.in +460 -223
- package/libusb/examples/Makefile.am +6 -13
- package/libusb/examples/dpfp.c +276 -73
- package/libusb/examples/ezusb.c +18 -8
- package/libusb/examples/ezusb.h +6 -17
- package/libusb/examples/fxload.c +4 -5
- package/libusb/examples/hotplugtest.c +1 -1
- package/libusb/examples/sam3u_benchmark.c +59 -24
- package/libusb/examples/testlibusb.c +138 -104
- package/libusb/examples/xusb.c +26 -22
- package/libusb/libusb/Makefile.am +57 -70
- package/libusb/libusb/Makefile.am.extra +26 -0
- package/libusb/libusb/core.c +432 -423
- package/libusb/libusb/descriptor.c +365 -419
- package/libusb/libusb/hotplug.c +200 -104
- package/libusb/libusb/io.c +522 -535
- package/libusb/libusb/libusb-1.0.def +7 -3
- package/libusb/libusb/libusb-1.0.rc +1 -9
- package/libusb/libusb/libusb.h +302 -226
- package/libusb/libusb/libusbi.h +607 -316
- package/libusb/libusb/os/darwin_usb.c +703 -329
- package/libusb/libusb/os/darwin_usb.h +39 -15
- package/libusb/libusb/os/events_posix.c +300 -0
- package/libusb/libusb/os/events_posix.h +59 -0
- package/libusb/libusb/os/events_windows.c +214 -0
- package/libusb/{msvc/missing.h → libusb/os/events_windows.h} +25 -11
- package/libusb/libusb/os/haiku_pollfs.cpp +14 -9
- package/libusb/libusb/os/haiku_usb.h +12 -12
- package/libusb/libusb/os/haiku_usb_backend.cpp +36 -37
- package/libusb/libusb/os/haiku_usb_raw.cpp +80 -116
- package/libusb/libusb/os/linux_netlink.c +55 -63
- package/libusb/libusb/os/linux_udev.c +61 -69
- package/libusb/libusb/os/linux_usbfs.c +926 -1015
- package/libusb/libusb/os/linux_usbfs.h +74 -57
- package/libusb/libusb/os/netbsd_usb.c +103 -168
- package/libusb/libusb/os/null_usb.c +111 -0
- package/libusb/libusb/os/openbsd_usb.c +71 -120
- package/libusb/libusb/os/sunos_usb.c +289 -375
- package/libusb/libusb/os/sunos_usb.h +0 -1
- package/libusb/libusb/os/threads_posix.c +81 -32
- package/libusb/libusb/os/threads_posix.h +19 -23
- package/libusb/libusb/os/threads_windows.c +9 -95
- package/libusb/libusb/os/threads_windows.h +33 -31
- package/libusb/libusb/os/windows_common.c +915 -0
- package/libusb/libusb/os/windows_common.h +330 -42
- package/libusb/libusb/os/windows_usbdk.c +161 -267
- package/libusb/libusb/os/windows_usbdk.h +5 -2
- package/libusb/libusb/os/windows_winusb.c +1355 -1192
- package/libusb/libusb/os/windows_winusb.h +167 -167
- package/libusb/libusb/strerror.c +20 -30
- package/libusb/libusb/sync.c +20 -21
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/msvc/.gitattributes +3 -0
- package/libusb/msvc/config.h +27 -20
- package/libusb/msvc/{hotplugtest_2012.vcxproj → dpfp_2013.vcxproj} +14 -10
- package/libusb/msvc/dpfp_2013.vcxproj.filters +26 -0
- package/libusb/msvc/{hotplugtest_2010.vcxproj → dpfp_2015.vcxproj} +14 -9
- package/libusb/msvc/dpfp_2015.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_2017.vcxproj +106 -0
- package/libusb/msvc/dpfp_2017.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_2019.vcxproj +106 -0
- package/libusb/msvc/dpfp_2019.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2013.vcxproj +87 -0
- package/libusb/msvc/dpfp_threaded_2013.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2015.vcxproj +87 -0
- package/libusb/msvc/dpfp_threaded_2015.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2017.vcxproj +106 -0
- package/libusb/msvc/dpfp_threaded_2017.vcxproj.filters +26 -0
- package/libusb/msvc/{fxload_2012.vcxproj → dpfp_threaded_2019.vcxproj} +32 -17
- package/libusb/msvc/dpfp_threaded_2019.vcxproj.filters +26 -0
- package/libusb/msvc/fxload_2013.vcxproj +6 -3
- package/libusb/msvc/fxload_2013.vcxproj.filters +35 -0
- package/libusb/msvc/fxload_2015.vcxproj +6 -3
- package/libusb/msvc/fxload_2015.vcxproj.filters +35 -0
- package/libusb/msvc/fxload_2017.vcxproj +6 -7
- package/libusb/msvc/fxload_2017.vcxproj.filters +35 -0
- package/libusb/msvc/{fxload_2010.vcxproj → fxload_2019.vcxproj} +29 -6
- package/libusb/msvc/fxload_2019.vcxproj.filters +35 -0
- package/libusb/{examples → msvc}/getopt/getopt.c +0 -0
- package/libusb/{examples → msvc}/getopt/getopt.h +0 -0
- package/libusb/{examples → msvc}/getopt/getopt1.c +0 -0
- package/libusb/msvc/getopt_2013.vcxproj +4 -5
- package/libusb/msvc/getopt_2013.vcxproj.filters +26 -0
- package/libusb/msvc/getopt_2015.vcxproj +4 -4
- package/libusb/msvc/getopt_2015.vcxproj.filters +26 -0
- package/libusb/msvc/getopt_2017.vcxproj +4 -10
- package/libusb/msvc/getopt_2017.vcxproj.filters +26 -0
- package/libusb/msvc/{getopt_2010.vcxproj → getopt_2019.vcxproj} +25 -5
- package/libusb/msvc/getopt_2019.vcxproj.filters +26 -0
- package/libusb/msvc/hotplugtest_2013.vcxproj +6 -3
- package/libusb/msvc/hotplugtest_2013.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2015.vcxproj +6 -3
- package/libusb/msvc/hotplugtest_2015.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2017.vcxproj +6 -7
- package/libusb/msvc/hotplugtest_2017.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2019.vcxproj +105 -0
- package/libusb/msvc/hotplugtest_2019.vcxproj.filters +23 -0
- package/libusb/msvc/libusb_2013.sln +50 -20
- package/libusb/msvc/libusb_2015.sln +51 -21
- package/libusb/msvc/libusb_2017.sln +90 -36
- package/libusb/msvc/libusb_2019.sln +240 -0
- package/libusb/msvc/libusb_dll_2013.vcxproj +6 -9
- package/libusb/msvc/libusb_dll_2013.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_dll_2015.vcxproj +6 -8
- package/libusb/msvc/libusb_dll_2015.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_dll_2017.vcxproj +6 -16
- package/libusb/msvc/libusb_dll_2017.vcxproj.filters +94 -0
- package/libusb/msvc/{libusb_dll_2010.vcxproj → libusb_dll_2019.vcxproj} +27 -9
- package/libusb/msvc/libusb_dll_2019.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_static_2013.vcxproj +5 -9
- package/libusb/msvc/libusb_static_2013.vcxproj.filters +80 -0
- package/libusb/msvc/libusb_static_2015.vcxproj +5 -8
- package/libusb/msvc/libusb_static_2015.vcxproj.filters +80 -0
- package/libusb/msvc/libusb_static_2017.vcxproj +5 -8
- package/libusb/msvc/libusb_static_2017.vcxproj.filters +80 -0
- package/libusb/msvc/{libusb_static_2010.vcxproj → libusb_static_2019.vcxproj} +26 -9
- package/libusb/msvc/libusb_static_2019.vcxproj.filters +80 -0
- package/libusb/msvc/listdevs_2013.vcxproj +6 -3
- package/libusb/msvc/listdevs_2013.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2015.vcxproj +6 -3
- package/libusb/msvc/listdevs_2015.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2017.vcxproj +6 -7
- package/libusb/msvc/listdevs_2017.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2019.vcxproj +105 -0
- package/libusb/msvc/listdevs_2019.vcxproj.filters +23 -0
- package/libusb/msvc/{listdevs_2010.vcxproj → sam3u_benchmark_2013.vcxproj} +13 -8
- package/libusb/msvc/sam3u_benchmark_2013.vcxproj.filters +26 -0
- package/libusb/msvc/{listdevs_2012.vcxproj → sam3u_benchmark_2015.vcxproj} +13 -9
- package/libusb/msvc/sam3u_benchmark_2015.vcxproj.filters +26 -0
- package/libusb/msvc/sam3u_benchmark_2017.vcxproj +106 -0
- package/libusb/msvc/sam3u_benchmark_2017.vcxproj.filters +26 -0
- package/libusb/msvc/sam3u_benchmark_2019.vcxproj +106 -0
- package/libusb/msvc/sam3u_benchmark_2019.vcxproj.filters +26 -0
- package/libusb/msvc/stress_2013.vcxproj +4 -2
- package/libusb/msvc/stress_2013.vcxproj.filters +32 -0
- package/libusb/msvc/stress_2015.vcxproj +4 -2
- package/libusb/msvc/stress_2015.vcxproj.filters +32 -0
- package/libusb/msvc/stress_2017.vcxproj +4 -6
- package/libusb/msvc/stress_2017.vcxproj.filters +32 -0
- package/libusb/msvc/{stress_2010.vcxproj → stress_2019.vcxproj} +26 -4
- package/libusb/msvc/stress_2019.vcxproj.filters +32 -0
- package/libusb/msvc/testlibusb_2013.vcxproj +6 -3
- package/libusb/msvc/testlibusb_2013.vcxproj.filters +23 -0
- package/libusb/msvc/testlibusb_2015.vcxproj +6 -3
- package/libusb/msvc/testlibusb_2015.vcxproj.filters +23 -0
- package/libusb/msvc/testlibusb_2017.vcxproj +6 -7
- package/libusb/msvc/testlibusb_2017.vcxproj.filters +23 -0
- package/libusb/msvc/{testlibusb_2010.vcxproj → testlibusb_2019.vcxproj} +28 -5
- package/libusb/msvc/testlibusb_2019.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2013.vcxproj +6 -3
- package/libusb/msvc/xusb_2013.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2015.vcxproj +6 -3
- package/libusb/msvc/xusb_2015.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2017.vcxproj +6 -7
- package/libusb/msvc/xusb_2017.vcxproj.filters +23 -0
- package/libusb/msvc/{xusb_2010.vcxproj → xusb_2019.vcxproj} +28 -5
- package/libusb/msvc/xusb_2019.vcxproj.filters +23 -0
- package/libusb/tests/Makefile.am +13 -1
- package/libusb/tests/libusb_testlib.h +12 -43
- package/libusb/tests/stress.c +59 -50
- package/libusb/tests/testlib.c +78 -171
- package/libusb/tests/umockdev.c +1175 -0
- package/libusb.gypi +10 -11
- package/package.json +1 -1
- package/prebuilds/android-arm/node.napi.armv7.node +0 -0
- package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/linux-ia32/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-ia32/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/device.cc +12 -7
- package/src/node_usb.cc +10 -0
- package/test/usb.coffee +6 -0
- package/tsc/index.ts +2 -0
- package/tsc/usb/bindings.ts +5 -0
- package/tsc/usb/device.ts +6 -0
- package/tsc/usb/index.ts +5 -8
- package/tsc/webusb/webusb-device.ts +67 -124
- package/dist/webusb/mutex.d.ts +0 -22
- package/dist/webusb/mutex.js +0 -89
- package/dist/webusb/mutex.js.map +0 -1
- package/libusb/.private/bd.cmd +0 -89
- package/libusb/.private/bwince.cmd +0 -57
- package/libusb/.private/wbs_wince.txt +0 -42
- package/libusb/Brewfile +0 -4
- package/libusb/appveyor_cygwin.bat +0 -11
- package/libusb/appveyor_minGW.bat +0 -19
- package/libusb/doc/Makefile.am +0 -9
- package/libusb/examples/dpfp_threaded.c +0 -557
- package/libusb/libusb/hotplug.h +0 -99
- package/libusb/libusb/os/poll_posix.c +0 -84
- package/libusb/libusb/os/poll_posix.h +0 -14
- package/libusb/libusb/os/poll_windows.c +0 -447
- package/libusb/libusb/os/poll_windows.h +0 -98
- package/libusb/libusb/os/wince_usb.c +0 -888
- package/libusb/libusb/os/wince_usb.h +0 -126
- package/libusb/libusb/os/windows_nt_common.c +0 -1010
- package/libusb/libusb/os/windows_nt_common.h +0 -110
- package/libusb/libusb/os/windows_nt_shared_types.h +0 -147
- package/libusb/msvc/appveyor.bat +0 -27
- package/libusb/msvc/ddk_build.cmd +0 -219
- package/libusb/msvc/errno.h +0 -102
- package/libusb/msvc/fxload_sources +0 -23
- package/libusb/msvc/getopt_2005.vcproj +0 -288
- package/libusb/msvc/getopt_2012.vcxproj +0 -73
- package/libusb/msvc/getopt_sources +0 -24
- package/libusb/msvc/hotplugtest_sources +0 -20
- package/libusb/msvc/inttypes.h +0 -295
- package/libusb/msvc/libusb.dsw +0 -71
- package/libusb/msvc/libusb_2005.sln +0 -95
- package/libusb/msvc/libusb_2010.sln +0 -105
- package/libusb/msvc/libusb_2012.sln +0 -105
- package/libusb/msvc/libusb_dll.dsp +0 -194
- package/libusb/msvc/libusb_dll_2005.vcproj +0 -464
- package/libusb/msvc/libusb_dll_2012.vcxproj +0 -107
- package/libusb/msvc/libusb_dll_wince.vcproj +0 -1251
- package/libusb/msvc/libusb_sources +0 -43
- package/libusb/msvc/libusb_static.dsp +0 -174
- package/libusb/msvc/libusb_static_2005.vcproj +0 -390
- package/libusb/msvc/libusb_static_2012.vcxproj +0 -98
- package/libusb/msvc/libusb_static_wince.vcproj +0 -1179
- package/libusb/msvc/libusb_wince.sln +0 -246
- package/libusb/msvc/listdevs.dsp +0 -103
- package/libusb/msvc/listdevs_2005.vcproj +0 -360
- package/libusb/msvc/listdevs_sources +0 -20
- package/libusb/msvc/listdevs_wince.vcproj +0 -1120
- package/libusb/msvc/missing.c +0 -80
- package/libusb/msvc/stdint.h +0 -256
- package/libusb/msvc/stress_2005.vcproj +0 -390
- package/libusb/msvc/stress_2012.vcxproj +0 -87
- package/libusb/msvc/stress_sources +0 -21
- package/libusb/msvc/stress_wince.vcproj +0 -1128
- package/libusb/msvc/testlibusb_2012.vcxproj +0 -83
- package/libusb/msvc/testlibusb_sources +0 -20
- package/libusb/msvc/xusb.dsp +0 -102
- package/libusb/msvc/xusb_2005.vcproj +0 -344
- package/libusb/msvc/xusb_2012.vcxproj +0 -83
- package/libusb/msvc/xusb_sources +0 -20
- package/libusb/msvc/xusb_wince.vcproj +0 -1120
- package/libusb/travis-autogen.sh +0 -39
- package/tsc/webusb/mutex.ts +0 -38
package/libusb/libusb/libusb.h
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
|
|
5
5
|
* Copyright © 2012 Pete Batard <pete@akeo.ie>
|
|
6
6
|
* Copyright © 2012-2018 Nathan Hjelm <hjelmn@cs.unm.edu>
|
|
7
|
+
* Copyright © 2014-2020 Chris Dickens <christopher.a.dickens@gmail.com>
|
|
7
8
|
* For more information, please visit: http://libusb.info
|
|
8
9
|
*
|
|
9
10
|
* This library is free software; you can redistribute it and/or
|
|
@@ -24,55 +25,42 @@
|
|
|
24
25
|
#ifndef LIBUSB_H
|
|
25
26
|
#define LIBUSB_H
|
|
26
27
|
|
|
27
|
-
#
|
|
28
|
+
#if defined(_MSC_VER)
|
|
29
|
+
#pragma warning(push)
|
|
30
|
+
/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
|
|
31
|
+
#pragma warning(disable:4200)
|
|
28
32
|
/* on MS environments, the inline keyword is available in C++ only */
|
|
29
33
|
#if !defined(__cplusplus)
|
|
30
34
|
#define inline __inline
|
|
31
35
|
#endif
|
|
32
|
-
/* ssize_t is also not available
|
|
36
|
+
/* ssize_t is also not available */
|
|
33
37
|
#ifndef _SSIZE_T_DEFINED
|
|
34
38
|
#define _SSIZE_T_DEFINED
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
typedef __int64 ssize_t;
|
|
38
|
-
#else
|
|
39
|
-
typedef int ssize_t;
|
|
40
|
-
#endif /* _WIN64 */
|
|
39
|
+
#include <basetsd.h>
|
|
40
|
+
typedef SSIZE_T ssize_t;
|
|
41
41
|
#endif /* _SSIZE_T_DEFINED */
|
|
42
42
|
#endif /* _MSC_VER */
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
|
|
46
|
-
typedef unsigned __int8 uint8_t;
|
|
47
|
-
typedef unsigned __int16 uint16_t;
|
|
48
|
-
typedef unsigned __int32 uint32_t;
|
|
49
|
-
#else
|
|
44
|
+
#include <limits.h>
|
|
50
45
|
#include <stdint.h>
|
|
51
|
-
#endif
|
|
52
|
-
|
|
53
|
-
#if !defined(_WIN32_WCE)
|
|
54
46
|
#include <sys/types.h>
|
|
55
|
-
#
|
|
56
|
-
|
|
57
|
-
#if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__HAIKU__)
|
|
47
|
+
#if !defined(_MSC_VER)
|
|
58
48
|
#include <sys/time.h>
|
|
59
49
|
#endif
|
|
60
|
-
|
|
61
50
|
#include <time.h>
|
|
62
|
-
#include <limits.h>
|
|
63
51
|
|
|
64
52
|
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
|
65
53
|
#define ZERO_SIZED_ARRAY /* [] - valid C99 code */
|
|
66
54
|
#else
|
|
67
55
|
#define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */
|
|
68
|
-
#endif
|
|
56
|
+
#endif /* __STDC_VERSION__ */
|
|
69
57
|
|
|
70
58
|
/* 'interface' might be defined as a macro on Windows, so we need to
|
|
71
59
|
* undefine it so as not to break the current libusb API, because
|
|
72
60
|
* libusb_config_descriptor has an 'interface' member
|
|
73
61
|
* As this can be problematic if you include windows.h after libusb.h
|
|
74
62
|
* in your sources, we force windows.h to be included first. */
|
|
75
|
-
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
63
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
76
64
|
#include <windows.h>
|
|
77
65
|
#if defined(interface)
|
|
78
66
|
#undef interface
|
|
@@ -80,17 +68,22 @@ typedef unsigned __int32 uint32_t;
|
|
|
80
68
|
#if !defined(__CYGWIN__)
|
|
81
69
|
#include <winsock.h>
|
|
82
70
|
#endif
|
|
83
|
-
#endif
|
|
71
|
+
#endif /* _WIN32 || __CYGWIN__ */
|
|
84
72
|
|
|
85
|
-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
|
86
|
-
#define LIBUSB_DEPRECATED_FOR(f)
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
#define LIBUSB_DEPRECATED_FOR(f) __attribute__((deprecated))
|
|
73
|
+
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
|
74
|
+
#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead")))
|
|
75
|
+
#elif defined(__GNUC__) && (__GNUC__ >= 3)
|
|
76
|
+
#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated))
|
|
90
77
|
#else
|
|
91
78
|
#define LIBUSB_DEPRECATED_FOR(f)
|
|
92
79
|
#endif /* __GNUC__ */
|
|
93
80
|
|
|
81
|
+
#if defined(__GNUC__)
|
|
82
|
+
#define LIBUSB_PACKED __attribute__ ((packed))
|
|
83
|
+
#else
|
|
84
|
+
#define LIBUSB_PACKED
|
|
85
|
+
#endif /* __GNUC__ */
|
|
86
|
+
|
|
94
87
|
/** \def LIBUSB_CALL
|
|
95
88
|
* \ingroup libusb_misc
|
|
96
89
|
* libusb's Windows calling convention.
|
|
@@ -123,11 +116,11 @@ typedef unsigned __int32 uint32_t;
|
|
|
123
116
|
* return type, before the function name. See internal documentation for
|
|
124
117
|
* API_EXPORTED.
|
|
125
118
|
*/
|
|
126
|
-
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
119
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
127
120
|
#define LIBUSB_CALL WINAPI
|
|
128
121
|
#else
|
|
129
122
|
#define LIBUSB_CALL
|
|
130
|
-
#endif
|
|
123
|
+
#endif /* _WIN32 || __CYGWIN__ */
|
|
131
124
|
|
|
132
125
|
/** \def LIBUSB_API_VERSION
|
|
133
126
|
* \ingroup libusb_misc
|
|
@@ -149,12 +142,12 @@ typedef unsigned __int32 uint32_t;
|
|
|
149
142
|
* Internally, LIBUSB_API_VERSION is defined as follows:
|
|
150
143
|
* (libusb major << 24) | (libusb minor << 16) | (16 bit incremental)
|
|
151
144
|
*/
|
|
152
|
-
#define LIBUSB_API_VERSION
|
|
145
|
+
#define LIBUSB_API_VERSION 0x01000109
|
|
153
146
|
|
|
154
147
|
/* The following is kept for compatibility, but will be deprecated in the future */
|
|
155
148
|
#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
|
|
156
149
|
|
|
157
|
-
#
|
|
150
|
+
#if defined(__cplusplus)
|
|
158
151
|
extern "C" {
|
|
159
152
|
#endif
|
|
160
153
|
|
|
@@ -196,35 +189,35 @@ enum libusb_class_code {
|
|
|
196
189
|
* this bDeviceClass value indicates that each interface specifies its
|
|
197
190
|
* own class information and all interfaces operate independently.
|
|
198
191
|
*/
|
|
199
|
-
LIBUSB_CLASS_PER_INTERFACE =
|
|
192
|
+
LIBUSB_CLASS_PER_INTERFACE = 0x00,
|
|
200
193
|
|
|
201
194
|
/** Audio class */
|
|
202
|
-
LIBUSB_CLASS_AUDIO =
|
|
195
|
+
LIBUSB_CLASS_AUDIO = 0x01,
|
|
203
196
|
|
|
204
197
|
/** Communications class */
|
|
205
|
-
LIBUSB_CLASS_COMM =
|
|
198
|
+
LIBUSB_CLASS_COMM = 0x02,
|
|
206
199
|
|
|
207
200
|
/** Human Interface Device class */
|
|
208
|
-
LIBUSB_CLASS_HID =
|
|
201
|
+
LIBUSB_CLASS_HID = 0x03,
|
|
209
202
|
|
|
210
203
|
/** Physical */
|
|
211
|
-
LIBUSB_CLASS_PHYSICAL =
|
|
212
|
-
|
|
213
|
-
/** Printer class */
|
|
214
|
-
LIBUSB_CLASS_PRINTER = 7,
|
|
204
|
+
LIBUSB_CLASS_PHYSICAL = 0x05,
|
|
215
205
|
|
|
216
206
|
/** Image class */
|
|
217
|
-
|
|
218
|
-
|
|
207
|
+
LIBUSB_CLASS_IMAGE = 0x06,
|
|
208
|
+
LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */
|
|
209
|
+
|
|
210
|
+
/** Printer class */
|
|
211
|
+
LIBUSB_CLASS_PRINTER = 0x07,
|
|
219
212
|
|
|
220
213
|
/** Mass storage class */
|
|
221
|
-
LIBUSB_CLASS_MASS_STORAGE =
|
|
214
|
+
LIBUSB_CLASS_MASS_STORAGE = 0x08,
|
|
222
215
|
|
|
223
216
|
/** Hub class */
|
|
224
|
-
LIBUSB_CLASS_HUB =
|
|
217
|
+
LIBUSB_CLASS_HUB = 0x09,
|
|
225
218
|
|
|
226
219
|
/** Data class */
|
|
227
|
-
LIBUSB_CLASS_DATA =
|
|
220
|
+
LIBUSB_CLASS_DATA = 0x0a,
|
|
228
221
|
|
|
229
222
|
/** Smart Card */
|
|
230
223
|
LIBUSB_CLASS_SMART_CARD = 0x0b,
|
|
@@ -244,6 +237,9 @@ enum libusb_class_code {
|
|
|
244
237
|
/** Wireless class */
|
|
245
238
|
LIBUSB_CLASS_WIRELESS = 0xe0,
|
|
246
239
|
|
|
240
|
+
/** Miscellaneous class */
|
|
241
|
+
LIBUSB_CLASS_MISCELLANEOUS = 0xef,
|
|
242
|
+
|
|
247
243
|
/** Application class */
|
|
248
244
|
LIBUSB_CLASS_APPLICATION = 0xfe,
|
|
249
245
|
|
|
@@ -311,12 +307,13 @@ enum libusb_descriptor_type {
|
|
|
311
307
|
#define LIBUSB_BT_CONTAINER_ID_SIZE 20
|
|
312
308
|
|
|
313
309
|
/* We unwrap the BOS => define its max size */
|
|
314
|
-
#define LIBUSB_DT_BOS_MAX_SIZE
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
310
|
+
#define LIBUSB_DT_BOS_MAX_SIZE \
|
|
311
|
+
(LIBUSB_DT_BOS_SIZE + \
|
|
312
|
+
LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \
|
|
313
|
+
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \
|
|
314
|
+
LIBUSB_BT_CONTAINER_ID_SIZE)
|
|
318
315
|
|
|
319
|
-
#define LIBUSB_ENDPOINT_ADDRESS_MASK
|
|
316
|
+
#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
|
|
320
317
|
#define LIBUSB_ENDPOINT_DIR_MASK 0x80
|
|
321
318
|
|
|
322
319
|
/** \ingroup libusb_desc
|
|
@@ -324,34 +321,31 @@ enum libusb_descriptor_type {
|
|
|
324
321
|
* \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme.
|
|
325
322
|
*/
|
|
326
323
|
enum libusb_endpoint_direction {
|
|
327
|
-
/** In: device-to-host */
|
|
328
|
-
LIBUSB_ENDPOINT_IN = 0x80,
|
|
329
|
-
|
|
330
324
|
/** Out: host-to-device */
|
|
331
|
-
LIBUSB_ENDPOINT_OUT = 0x00
|
|
325
|
+
LIBUSB_ENDPOINT_OUT = 0x00,
|
|
326
|
+
|
|
327
|
+
/** In: device-to-host */
|
|
328
|
+
LIBUSB_ENDPOINT_IN = 0x80
|
|
332
329
|
};
|
|
333
330
|
|
|
334
|
-
#define LIBUSB_TRANSFER_TYPE_MASK
|
|
331
|
+
#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
|
|
335
332
|
|
|
336
333
|
/** \ingroup libusb_desc
|
|
337
334
|
* Endpoint transfer type. Values for bits 0:1 of the
|
|
338
335
|
* \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field.
|
|
339
336
|
*/
|
|
340
|
-
enum
|
|
337
|
+
enum libusb_endpoint_transfer_type {
|
|
341
338
|
/** Control endpoint */
|
|
342
|
-
|
|
339
|
+
LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0,
|
|
343
340
|
|
|
344
341
|
/** Isochronous endpoint */
|
|
345
|
-
|
|
342
|
+
LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1,
|
|
346
343
|
|
|
347
344
|
/** Bulk endpoint */
|
|
348
|
-
|
|
345
|
+
LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2,
|
|
349
346
|
|
|
350
347
|
/** Interrupt endpoint */
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
/** Stream endpoint */
|
|
354
|
-
LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4,
|
|
348
|
+
LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3
|
|
355
349
|
};
|
|
356
350
|
|
|
357
351
|
/** \ingroup libusb_misc
|
|
@@ -386,20 +380,20 @@ enum libusb_standard_request {
|
|
|
386
380
|
LIBUSB_REQUEST_SET_CONFIGURATION = 0x09,
|
|
387
381
|
|
|
388
382
|
/** Return the selected alternate setting for the specified interface */
|
|
389
|
-
LIBUSB_REQUEST_GET_INTERFACE =
|
|
383
|
+
LIBUSB_REQUEST_GET_INTERFACE = 0x0a,
|
|
390
384
|
|
|
391
385
|
/** Select an alternate interface for the specified interface */
|
|
392
|
-
LIBUSB_REQUEST_SET_INTERFACE =
|
|
386
|
+
LIBUSB_REQUEST_SET_INTERFACE = 0x0b,
|
|
393
387
|
|
|
394
388
|
/** Set then report an endpoint's synchronization frame */
|
|
395
|
-
LIBUSB_REQUEST_SYNCH_FRAME =
|
|
389
|
+
LIBUSB_REQUEST_SYNCH_FRAME = 0x0c,
|
|
396
390
|
|
|
397
391
|
/** Sets both the U1 and U2 Exit Latency */
|
|
398
392
|
LIBUSB_REQUEST_SET_SEL = 0x30,
|
|
399
393
|
|
|
400
394
|
/** Delay from the time a host transmits a packet to the time it is
|
|
401
395
|
* received by the device. */
|
|
402
|
-
LIBUSB_SET_ISOCH_DELAY = 0x31
|
|
396
|
+
LIBUSB_SET_ISOCH_DELAY = 0x31
|
|
403
397
|
};
|
|
404
398
|
|
|
405
399
|
/** \ingroup libusb_misc
|
|
@@ -435,10 +429,10 @@ enum libusb_request_recipient {
|
|
|
435
429
|
LIBUSB_RECIPIENT_ENDPOINT = 0x02,
|
|
436
430
|
|
|
437
431
|
/** Other */
|
|
438
|
-
LIBUSB_RECIPIENT_OTHER = 0x03
|
|
432
|
+
LIBUSB_RECIPIENT_OTHER = 0x03
|
|
439
433
|
};
|
|
440
434
|
|
|
441
|
-
#define LIBUSB_ISO_SYNC_TYPE_MASK
|
|
435
|
+
#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c
|
|
442
436
|
|
|
443
437
|
/** \ingroup libusb_desc
|
|
444
438
|
* Synchronization type for isochronous endpoints. Values for bits 2:3 of the
|
|
@@ -447,19 +441,19 @@ enum libusb_request_recipient {
|
|
|
447
441
|
*/
|
|
448
442
|
enum libusb_iso_sync_type {
|
|
449
443
|
/** No synchronization */
|
|
450
|
-
LIBUSB_ISO_SYNC_TYPE_NONE =
|
|
444
|
+
LIBUSB_ISO_SYNC_TYPE_NONE = 0x0,
|
|
451
445
|
|
|
452
446
|
/** Asynchronous */
|
|
453
|
-
LIBUSB_ISO_SYNC_TYPE_ASYNC =
|
|
447
|
+
LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1,
|
|
454
448
|
|
|
455
449
|
/** Adaptive */
|
|
456
|
-
LIBUSB_ISO_SYNC_TYPE_ADAPTIVE =
|
|
450
|
+
LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2,
|
|
457
451
|
|
|
458
452
|
/** Synchronous */
|
|
459
|
-
LIBUSB_ISO_SYNC_TYPE_SYNC =
|
|
453
|
+
LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3
|
|
460
454
|
};
|
|
461
455
|
|
|
462
|
-
#define LIBUSB_ISO_USAGE_TYPE_MASK
|
|
456
|
+
#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
|
|
463
457
|
|
|
464
458
|
/** \ingroup libusb_desc
|
|
465
459
|
* Usage type for isochronous endpoints. Values for bits 4:5 of the
|
|
@@ -468,13 +462,68 @@ enum libusb_iso_sync_type {
|
|
|
468
462
|
*/
|
|
469
463
|
enum libusb_iso_usage_type {
|
|
470
464
|
/** Data endpoint */
|
|
471
|
-
LIBUSB_ISO_USAGE_TYPE_DATA =
|
|
465
|
+
LIBUSB_ISO_USAGE_TYPE_DATA = 0x0,
|
|
472
466
|
|
|
473
467
|
/** Feedback endpoint */
|
|
474
|
-
LIBUSB_ISO_USAGE_TYPE_FEEDBACK =
|
|
468
|
+
LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1,
|
|
475
469
|
|
|
476
470
|
/** Implicit feedback Data endpoint */
|
|
477
|
-
LIBUSB_ISO_USAGE_TYPE_IMPLICIT =
|
|
471
|
+
LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
/** \ingroup libusb_desc
|
|
475
|
+
* Supported speeds (wSpeedSupported) bitfield. Indicates what
|
|
476
|
+
* speeds the device supports.
|
|
477
|
+
*/
|
|
478
|
+
enum libusb_supported_speed {
|
|
479
|
+
/** Low speed operation supported (1.5MBit/s). */
|
|
480
|
+
LIBUSB_LOW_SPEED_OPERATION = (1 << 0),
|
|
481
|
+
|
|
482
|
+
/** Full speed operation supported (12MBit/s). */
|
|
483
|
+
LIBUSB_FULL_SPEED_OPERATION = (1 << 1),
|
|
484
|
+
|
|
485
|
+
/** High speed operation supported (480MBit/s). */
|
|
486
|
+
LIBUSB_HIGH_SPEED_OPERATION = (1 << 2),
|
|
487
|
+
|
|
488
|
+
/** Superspeed operation supported (5000MBit/s). */
|
|
489
|
+
LIBUSB_SUPER_SPEED_OPERATION = (1 << 3)
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
/** \ingroup libusb_desc
|
|
493
|
+
* Masks for the bits of the
|
|
494
|
+
* \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
|
|
495
|
+
* of the USB 2.0 Extension descriptor.
|
|
496
|
+
*/
|
|
497
|
+
enum libusb_usb_2_0_extension_attributes {
|
|
498
|
+
/** Supports Link Power Management (LPM) */
|
|
499
|
+
LIBUSB_BM_LPM_SUPPORT = (1 << 1)
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
/** \ingroup libusb_desc
|
|
503
|
+
* Masks for the bits of the
|
|
504
|
+
* \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
|
|
505
|
+
* field of the SuperSpeed USB Device Capability descriptor.
|
|
506
|
+
*/
|
|
507
|
+
enum libusb_ss_usb_device_capability_attributes {
|
|
508
|
+
/** Supports Latency Tolerance Messages (LTM) */
|
|
509
|
+
LIBUSB_BM_LTM_SUPPORT = (1 << 1)
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
/** \ingroup libusb_desc
|
|
513
|
+
* USB capability types
|
|
514
|
+
*/
|
|
515
|
+
enum libusb_bos_type {
|
|
516
|
+
/** Wireless USB device capability */
|
|
517
|
+
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01,
|
|
518
|
+
|
|
519
|
+
/** USB 2.0 extensions */
|
|
520
|
+
LIBUSB_BT_USB_2_0_EXTENSION = 0x02,
|
|
521
|
+
|
|
522
|
+
/** SuperSpeed USB device capability */
|
|
523
|
+
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03,
|
|
524
|
+
|
|
525
|
+
/** Container ID type */
|
|
526
|
+
LIBUSB_BT_CONTAINER_ID = 0x04
|
|
478
527
|
};
|
|
479
528
|
|
|
480
529
|
/** \ingroup libusb_desc
|
|
@@ -547,17 +596,15 @@ struct libusb_endpoint_descriptor {
|
|
|
547
596
|
|
|
548
597
|
/** The address of the endpoint described by this descriptor. Bits 0:3 are
|
|
549
598
|
* the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction,
|
|
550
|
-
* see \ref libusb_endpoint_direction.
|
|
551
|
-
*/
|
|
599
|
+
* see \ref libusb_endpoint_direction. */
|
|
552
600
|
uint8_t bEndpointAddress;
|
|
553
601
|
|
|
554
602
|
/** Attributes which apply to the endpoint when it is configured using
|
|
555
603
|
* the bConfigurationValue. Bits 0:1 determine the transfer type and
|
|
556
|
-
* correspond to \ref
|
|
557
|
-
* isochronous endpoints and correspond to \ref libusb_iso_sync_type.
|
|
604
|
+
* correspond to \ref libusb_endpoint_transfer_type. Bits 2:3 are only used
|
|
605
|
+
* for isochronous endpoints and correspond to \ref libusb_iso_sync_type.
|
|
558
606
|
* Bits 4:5 are also only used for isochronous endpoints and correspond to
|
|
559
|
-
* \ref libusb_iso_usage_type. Bits 6:7 are reserved.
|
|
560
|
-
*/
|
|
607
|
+
* \ref libusb_iso_usage_type. Bits 6:7 are reserved. */
|
|
561
608
|
uint8_t bmAttributes;
|
|
562
609
|
|
|
563
610
|
/** Maximum packet size this endpoint is capable of sending/receiving. */
|
|
@@ -698,7 +745,6 @@ struct libusb_config_descriptor {
|
|
|
698
745
|
* host-endian format.
|
|
699
746
|
*/
|
|
700
747
|
struct libusb_ss_endpoint_companion_descriptor {
|
|
701
|
-
|
|
702
748
|
/** Size of this descriptor (in bytes) */
|
|
703
749
|
uint8_t bLength;
|
|
704
750
|
|
|
@@ -707,19 +753,18 @@ struct libusb_ss_endpoint_companion_descriptor {
|
|
|
707
753
|
* this context. */
|
|
708
754
|
uint8_t bDescriptorType;
|
|
709
755
|
|
|
710
|
-
|
|
711
756
|
/** The maximum number of packets the endpoint can send or
|
|
712
757
|
* receive as part of a burst. */
|
|
713
758
|
uint8_t bMaxBurst;
|
|
714
759
|
|
|
715
|
-
/** In bulk EP:
|
|
716
|
-
* streams the
|
|
717
|
-
* represents the Mult
|
|
718
|
-
* the
|
|
760
|
+
/** In bulk EP: bits 4:0 represents the maximum number of
|
|
761
|
+
* streams the EP supports. In isochronous EP: bits 1:0
|
|
762
|
+
* represents the Mult - a zero based value that determines
|
|
763
|
+
* the maximum number of packets within a service interval */
|
|
719
764
|
uint8_t bmAttributes;
|
|
720
765
|
|
|
721
|
-
/** The
|
|
722
|
-
* service interval.
|
|
766
|
+
/** The total number of bytes this EP will transfer every
|
|
767
|
+
* service interval. Valid only for periodic EPs. */
|
|
723
768
|
uint16_t wBytesPerInterval;
|
|
724
769
|
};
|
|
725
770
|
|
|
@@ -730,15 +775,18 @@ struct libusb_ss_endpoint_companion_descriptor {
|
|
|
730
775
|
*/
|
|
731
776
|
struct libusb_bos_dev_capability_descriptor {
|
|
732
777
|
/** Size of this descriptor (in bytes) */
|
|
733
|
-
uint8_t
|
|
778
|
+
uint8_t bLength;
|
|
779
|
+
|
|
734
780
|
/** Descriptor type. Will have value
|
|
735
781
|
* \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
|
|
736
782
|
* LIBUSB_DT_DEVICE_CAPABILITY in this context. */
|
|
737
|
-
uint8_t
|
|
783
|
+
uint8_t bDescriptorType;
|
|
784
|
+
|
|
738
785
|
/** Device Capability type */
|
|
739
|
-
uint8_t
|
|
786
|
+
uint8_t bDevCapabilityType;
|
|
787
|
+
|
|
740
788
|
/** Device Capability data (bLength - 3 bytes) */
|
|
741
|
-
uint8_t
|
|
789
|
+
uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
|
|
742
790
|
};
|
|
743
791
|
|
|
744
792
|
/** \ingroup libusb_desc
|
|
@@ -789,7 +837,7 @@ struct libusb_usb_2_0_extension_descriptor {
|
|
|
789
837
|
* A value of one in a bit location indicates a feature is
|
|
790
838
|
* supported; a value of zero indicates it is not supported.
|
|
791
839
|
* See \ref libusb_usb_2_0_extension_attributes. */
|
|
792
|
-
uint32_t
|
|
840
|
+
uint32_t bmAttributes;
|
|
793
841
|
};
|
|
794
842
|
|
|
795
843
|
/** \ingroup libusb_desc
|
|
@@ -854,7 +902,7 @@ struct libusb_container_id_descriptor {
|
|
|
854
902
|
uint8_t bDevCapabilityType;
|
|
855
903
|
|
|
856
904
|
/** Reserved field */
|
|
857
|
-
uint8_t
|
|
905
|
+
uint8_t bReserved;
|
|
858
906
|
|
|
859
907
|
/** 128 bit UUID */
|
|
860
908
|
uint8_t ContainerID[16];
|
|
@@ -862,6 +910,9 @@ struct libusb_container_id_descriptor {
|
|
|
862
910
|
|
|
863
911
|
/** \ingroup libusb_asyncio
|
|
864
912
|
* Setup packet for control transfers. */
|
|
913
|
+
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
|
914
|
+
#pragma pack(push, 1)
|
|
915
|
+
#endif
|
|
865
916
|
struct libusb_control_setup {
|
|
866
917
|
/** Request type. Bits 0:4 determine recipient, see
|
|
867
918
|
* \ref libusb_request_recipient. Bits 5:6 determine type, see
|
|
@@ -886,7 +937,10 @@ struct libusb_control_setup {
|
|
|
886
937
|
|
|
887
938
|
/** Number of bytes to transfer */
|
|
888
939
|
uint16_t wLength;
|
|
889
|
-
};
|
|
940
|
+
} LIBUSB_PACKED;
|
|
941
|
+
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
|
942
|
+
#pragma pack(pop)
|
|
943
|
+
#endif
|
|
890
944
|
|
|
891
945
|
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
|
|
892
946
|
|
|
@@ -916,7 +970,7 @@ struct libusb_version {
|
|
|
916
970
|
const char *rc;
|
|
917
971
|
|
|
918
972
|
/** For ABI compatibility only. */
|
|
919
|
-
const char*
|
|
973
|
+
const char *describe;
|
|
920
974
|
};
|
|
921
975
|
|
|
922
976
|
/** \ingroup libusb_lib
|
|
@@ -931,8 +985,9 @@ struct libusb_version {
|
|
|
931
985
|
* Sessions are created by libusb_init() and destroyed through libusb_exit().
|
|
932
986
|
* If your application is guaranteed to only ever include a single libusb
|
|
933
987
|
* user (i.e. you), you do not have to worry about contexts: pass NULL in
|
|
934
|
-
* every function call where a context is required
|
|
935
|
-
* will be used.
|
|
988
|
+
* every function call where a context is required, and the default context
|
|
989
|
+
* will be used. Note that libusb_set_option(NULL, ...) is special, and adds
|
|
990
|
+
* an option to a list of default options for new contexts.
|
|
936
991
|
*
|
|
937
992
|
* For more information, see \ref libusb_contexts.
|
|
938
993
|
*/
|
|
@@ -941,7 +996,7 @@ typedef struct libusb_context libusb_context;
|
|
|
941
996
|
/** \ingroup libusb_dev
|
|
942
997
|
* Structure representing a USB device detected on the system. This is an
|
|
943
998
|
* opaque type for which you are only ever provided with a pointer, usually
|
|
944
|
-
* originating from libusb_get_device_list().
|
|
999
|
+
* originating from libusb_get_device_list() or libusb_hotplug_register_callback().
|
|
945
1000
|
*
|
|
946
1001
|
* Certain operations can be performed on a device, but in order to do any
|
|
947
1002
|
* I/O you will have to first obtain a device handle using libusb_open().
|
|
@@ -986,62 +1041,7 @@ enum libusb_speed {
|
|
|
986
1041
|
LIBUSB_SPEED_SUPER = 4,
|
|
987
1042
|
|
|
988
1043
|
/** The device is operating at super speed plus (10000MBit/s). */
|
|
989
|
-
LIBUSB_SPEED_SUPER_PLUS = 5
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
/** \ingroup libusb_dev
|
|
993
|
-
* Supported speeds (wSpeedSupported) bitfield. Indicates what
|
|
994
|
-
* speeds the device supports.
|
|
995
|
-
*/
|
|
996
|
-
enum libusb_supported_speed {
|
|
997
|
-
/** Low speed operation supported (1.5MBit/s). */
|
|
998
|
-
LIBUSB_LOW_SPEED_OPERATION = 1,
|
|
999
|
-
|
|
1000
|
-
/** Full speed operation supported (12MBit/s). */
|
|
1001
|
-
LIBUSB_FULL_SPEED_OPERATION = 2,
|
|
1002
|
-
|
|
1003
|
-
/** High speed operation supported (480MBit/s). */
|
|
1004
|
-
LIBUSB_HIGH_SPEED_OPERATION = 4,
|
|
1005
|
-
|
|
1006
|
-
/** Superspeed operation supported (5000MBit/s). */
|
|
1007
|
-
LIBUSB_SUPER_SPEED_OPERATION = 8,
|
|
1008
|
-
};
|
|
1009
|
-
|
|
1010
|
-
/** \ingroup libusb_dev
|
|
1011
|
-
* Masks for the bits of the
|
|
1012
|
-
* \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
|
|
1013
|
-
* of the USB 2.0 Extension descriptor.
|
|
1014
|
-
*/
|
|
1015
|
-
enum libusb_usb_2_0_extension_attributes {
|
|
1016
|
-
/** Supports Link Power Management (LPM) */
|
|
1017
|
-
LIBUSB_BM_LPM_SUPPORT = 2,
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
/** \ingroup libusb_dev
|
|
1021
|
-
* Masks for the bits of the
|
|
1022
|
-
* \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
|
|
1023
|
-
* field of the SuperSpeed USB Device Capability descriptor.
|
|
1024
|
-
*/
|
|
1025
|
-
enum libusb_ss_usb_device_capability_attributes {
|
|
1026
|
-
/** Supports Latency Tolerance Messages (LTM) */
|
|
1027
|
-
LIBUSB_BM_LTM_SUPPORT = 2,
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
/** \ingroup libusb_dev
|
|
1031
|
-
* USB capability types
|
|
1032
|
-
*/
|
|
1033
|
-
enum libusb_bos_type {
|
|
1034
|
-
/** Wireless USB device capability */
|
|
1035
|
-
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1,
|
|
1036
|
-
|
|
1037
|
-
/** USB 2.0 extensions */
|
|
1038
|
-
LIBUSB_BT_USB_2_0_EXTENSION = 2,
|
|
1039
|
-
|
|
1040
|
-
/** SuperSpeed USB device capability */
|
|
1041
|
-
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3,
|
|
1042
|
-
|
|
1043
|
-
/** Container ID type */
|
|
1044
|
-
LIBUSB_BT_CONTAINER_ID = 4,
|
|
1044
|
+
LIBUSB_SPEED_SUPER_PLUS = 5
|
|
1045
1045
|
};
|
|
1046
1046
|
|
|
1047
1047
|
/** \ingroup libusb_misc
|
|
@@ -1095,12 +1095,31 @@ enum libusb_error {
|
|
|
1095
1095
|
message strings in strerror.c when adding new error codes here. */
|
|
1096
1096
|
|
|
1097
1097
|
/** Other error */
|
|
1098
|
-
LIBUSB_ERROR_OTHER = -99
|
|
1098
|
+
LIBUSB_ERROR_OTHER = -99
|
|
1099
1099
|
};
|
|
1100
1100
|
|
|
1101
1101
|
/* Total number of error codes in enum libusb_error */
|
|
1102
1102
|
#define LIBUSB_ERROR_COUNT 14
|
|
1103
1103
|
|
|
1104
|
+
/** \ingroup libusb_asyncio
|
|
1105
|
+
* Transfer type */
|
|
1106
|
+
enum libusb_transfer_type {
|
|
1107
|
+
/** Control transfer */
|
|
1108
|
+
LIBUSB_TRANSFER_TYPE_CONTROL = 0U,
|
|
1109
|
+
|
|
1110
|
+
/** Isochronous transfer */
|
|
1111
|
+
LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U,
|
|
1112
|
+
|
|
1113
|
+
/** Bulk transfer */
|
|
1114
|
+
LIBUSB_TRANSFER_TYPE_BULK = 2U,
|
|
1115
|
+
|
|
1116
|
+
/** Interrupt transfer */
|
|
1117
|
+
LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U,
|
|
1118
|
+
|
|
1119
|
+
/** Bulk stream transfer */
|
|
1120
|
+
LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1104
1123
|
/** \ingroup libusb_asyncio
|
|
1105
1124
|
* Transfer status codes */
|
|
1106
1125
|
enum libusb_transfer_status {
|
|
@@ -1125,7 +1144,7 @@ enum libusb_transfer_status {
|
|
|
1125
1144
|
LIBUSB_TRANSFER_NO_DEVICE,
|
|
1126
1145
|
|
|
1127
1146
|
/** Device sent more data than requested */
|
|
1128
|
-
LIBUSB_TRANSFER_OVERFLOW
|
|
1147
|
+
LIBUSB_TRANSFER_OVERFLOW
|
|
1129
1148
|
|
|
1130
1149
|
/* NB! Remember to update libusb_error_name()
|
|
1131
1150
|
when adding new status codes here. */
|
|
@@ -1135,19 +1154,19 @@ enum libusb_transfer_status {
|
|
|
1135
1154
|
* libusb_transfer.flags values */
|
|
1136
1155
|
enum libusb_transfer_flags {
|
|
1137
1156
|
/** Report short frames as errors */
|
|
1138
|
-
LIBUSB_TRANSFER_SHORT_NOT_OK = 1U << 0,
|
|
1157
|
+
LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0),
|
|
1139
1158
|
|
|
1140
1159
|
/** Automatically free() transfer buffer during libusb_free_transfer().
|
|
1141
1160
|
* Note that buffers allocated with libusb_dev_mem_alloc() should not
|
|
1142
1161
|
* be attempted freed in this way, since free() is not an appropriate
|
|
1143
1162
|
* way to release such memory. */
|
|
1144
|
-
LIBUSB_TRANSFER_FREE_BUFFER = 1U << 1,
|
|
1163
|
+
LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1),
|
|
1145
1164
|
|
|
1146
1165
|
/** Automatically call libusb_free_transfer() after callback returns.
|
|
1147
1166
|
* If this flag is set, it is illegal to call libusb_free_transfer()
|
|
1148
1167
|
* from your transfer callback, as this will result in a double-free
|
|
1149
1168
|
* when this flag is acted upon. */
|
|
1150
|
-
LIBUSB_TRANSFER_FREE_TRANSFER = 1U << 2,
|
|
1169
|
+
LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2),
|
|
1151
1170
|
|
|
1152
1171
|
/** Terminate transfers that are a multiple of the endpoint's
|
|
1153
1172
|
* wMaxPacketSize with an extra zero length packet. This is useful
|
|
@@ -1172,7 +1191,7 @@ enum libusb_transfer_flags {
|
|
|
1172
1191
|
*
|
|
1173
1192
|
* Available since libusb-1.0.9.
|
|
1174
1193
|
*/
|
|
1175
|
-
LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1U << 3
|
|
1194
|
+
LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3)
|
|
1176
1195
|
};
|
|
1177
1196
|
|
|
1178
1197
|
/** \ingroup libusb_asyncio
|
|
@@ -1217,7 +1236,7 @@ struct libusb_transfer {
|
|
|
1217
1236
|
/** Address of the endpoint where this transfer will be sent. */
|
|
1218
1237
|
unsigned char endpoint;
|
|
1219
1238
|
|
|
1220
|
-
/** Type of the
|
|
1239
|
+
/** Type of the transfer from \ref libusb_transfer_type */
|
|
1221
1240
|
unsigned char type;
|
|
1222
1241
|
|
|
1223
1242
|
/** Timeout for this transfer in milliseconds. A value of 0 indicates no
|
|
@@ -1245,7 +1264,16 @@ struct libusb_transfer {
|
|
|
1245
1264
|
* fails, or is cancelled. */
|
|
1246
1265
|
libusb_transfer_cb_fn callback;
|
|
1247
1266
|
|
|
1248
|
-
/** User context data
|
|
1267
|
+
/** User context data. Useful for associating specific data to a transfer
|
|
1268
|
+
* that can be accessed from within the callback function.
|
|
1269
|
+
*
|
|
1270
|
+
* This field may be set manually or is taken as the `user_data` parameter
|
|
1271
|
+
* of the following functions:
|
|
1272
|
+
* - libusb_fill_bulk_transfer()
|
|
1273
|
+
* - libusb_fill_bulk_stream_transfer()
|
|
1274
|
+
* - libusb_fill_control_transfer()
|
|
1275
|
+
* - libusb_fill_interrupt_transfer()
|
|
1276
|
+
* - libusb_fill_iso_transfer() */
|
|
1249
1277
|
void *user_data;
|
|
1250
1278
|
|
|
1251
1279
|
/** Data buffer */
|
|
@@ -1266,46 +1294,55 @@ struct libusb_transfer {
|
|
|
1266
1294
|
*/
|
|
1267
1295
|
enum libusb_capability {
|
|
1268
1296
|
/** The libusb_has_capability() API is available. */
|
|
1269
|
-
LIBUSB_CAP_HAS_CAPABILITY =
|
|
1297
|
+
LIBUSB_CAP_HAS_CAPABILITY = 0x0000U,
|
|
1298
|
+
|
|
1270
1299
|
/** Hotplug support is available on this platform. */
|
|
1271
|
-
LIBUSB_CAP_HAS_HOTPLUG =
|
|
1300
|
+
LIBUSB_CAP_HAS_HOTPLUG = 0x0001U,
|
|
1301
|
+
|
|
1272
1302
|
/** The library can access HID devices without requiring user intervention.
|
|
1273
1303
|
* Note that before being able to actually access an HID device, you may
|
|
1274
1304
|
* still have to call additional libusb functions such as
|
|
1275
1305
|
* \ref libusb_detach_kernel_driver(). */
|
|
1276
|
-
LIBUSB_CAP_HAS_HID_ACCESS =
|
|
1277
|
-
|
|
1306
|
+
LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U,
|
|
1307
|
+
|
|
1308
|
+
/** The library supports detaching of the default USB driver, using
|
|
1278
1309
|
* \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
|
|
1279
|
-
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER =
|
|
1310
|
+
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U
|
|
1280
1311
|
};
|
|
1281
1312
|
|
|
1282
1313
|
/** \ingroup libusb_lib
|
|
1283
1314
|
* Log message levels.
|
|
1284
|
-
* - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default)
|
|
1285
|
-
* - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr
|
|
1286
|
-
* - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr
|
|
1287
|
-
* - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stderr
|
|
1288
|
-
* - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stderr
|
|
1289
1315
|
*/
|
|
1290
1316
|
enum libusb_log_level {
|
|
1317
|
+
/** (0) : No messages ever emitted by the library (default) */
|
|
1291
1318
|
LIBUSB_LOG_LEVEL_NONE = 0,
|
|
1319
|
+
|
|
1320
|
+
/** (1) : Error messages are emitted */
|
|
1292
1321
|
LIBUSB_LOG_LEVEL_ERROR = 1,
|
|
1322
|
+
|
|
1323
|
+
/** (2) : Warning and error messages are emitted */
|
|
1293
1324
|
LIBUSB_LOG_LEVEL_WARNING = 2,
|
|
1325
|
+
|
|
1326
|
+
/** (3) : Informational, warning and error messages are emitted */
|
|
1294
1327
|
LIBUSB_LOG_LEVEL_INFO = 3,
|
|
1295
|
-
|
|
1328
|
+
|
|
1329
|
+
/** (4) : All messages are emitted */
|
|
1330
|
+
LIBUSB_LOG_LEVEL_DEBUG = 4
|
|
1296
1331
|
};
|
|
1297
1332
|
|
|
1298
1333
|
/** \ingroup libusb_lib
|
|
1299
1334
|
* Log callback mode.
|
|
1335
|
+
*
|
|
1336
|
+
* Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
|
|
1337
|
+
*
|
|
1300
1338
|
* \see libusb_set_log_cb()
|
|
1301
1339
|
*/
|
|
1302
1340
|
enum libusb_log_cb_mode {
|
|
1341
|
+
/** Callback function handling all log messages. */
|
|
1342
|
+
LIBUSB_LOG_CB_GLOBAL = (1 << 0),
|
|
1303
1343
|
|
|
1304
|
-
/** Callback function handling
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
/** Callback function handling context related log mesages. */
|
|
1308
|
-
LIBUSB_LOG_CB_CONTEXT = 1 << 1
|
|
1344
|
+
/** Callback function handling context related log messages. */
|
|
1345
|
+
LIBUSB_LOG_CB_CONTEXT = (1 << 1)
|
|
1309
1346
|
};
|
|
1310
1347
|
|
|
1311
1348
|
/** \ingroup libusb_lib
|
|
@@ -1314,6 +1351,9 @@ enum libusb_log_cb_mode {
|
|
|
1314
1351
|
* is a global log message
|
|
1315
1352
|
* \param level the log level, see \ref libusb_log_level for a description
|
|
1316
1353
|
* \param str the log message
|
|
1354
|
+
*
|
|
1355
|
+
* Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
|
|
1356
|
+
*
|
|
1317
1357
|
* \see libusb_set_log_cb()
|
|
1318
1358
|
*/
|
|
1319
1359
|
typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx,
|
|
@@ -1328,7 +1368,7 @@ const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
|
|
|
1328
1368
|
int LIBUSB_CALL libusb_has_capability(uint32_t capability);
|
|
1329
1369
|
const char * LIBUSB_CALL libusb_error_name(int errcode);
|
|
1330
1370
|
int LIBUSB_CALL libusb_setlocale(const char *locale);
|
|
1331
|
-
const char * LIBUSB_CALL libusb_strerror(
|
|
1371
|
+
const char * LIBUSB_CALL libusb_strerror(int errcode);
|
|
1332
1372
|
|
|
1333
1373
|
ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
|
|
1334
1374
|
libusb_device ***list);
|
|
@@ -1350,7 +1390,7 @@ int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
|
|
|
1350
1390
|
void LIBUSB_CALL libusb_free_config_descriptor(
|
|
1351
1391
|
struct libusb_config_descriptor *config);
|
|
1352
1392
|
int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
|
|
1353
|
-
|
|
1393
|
+
libusb_context *ctx,
|
|
1354
1394
|
const struct libusb_endpoint_descriptor *endpoint,
|
|
1355
1395
|
struct libusb_ss_endpoint_companion_descriptor **ep_comp);
|
|
1356
1396
|
void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
|
|
@@ -1359,27 +1399,27 @@ int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
|
|
|
1359
1399
|
struct libusb_bos_descriptor **bos);
|
|
1360
1400
|
void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
|
|
1361
1401
|
int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
|
|
1362
|
-
|
|
1402
|
+
libusb_context *ctx,
|
|
1363
1403
|
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
|
1364
1404
|
struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
|
|
1365
1405
|
void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
|
|
1366
1406
|
struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
|
|
1367
1407
|
int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
|
|
1368
|
-
|
|
1408
|
+
libusb_context *ctx,
|
|
1369
1409
|
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
|
1370
1410
|
struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
|
|
1371
1411
|
void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
|
|
1372
1412
|
struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
|
|
1373
|
-
int LIBUSB_CALL libusb_get_container_id_descriptor(
|
|
1413
|
+
int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx,
|
|
1374
1414
|
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
|
1375
1415
|
struct libusb_container_id_descriptor **container_id);
|
|
1376
1416
|
void LIBUSB_CALL libusb_free_container_id_descriptor(
|
|
1377
1417
|
struct libusb_container_id_descriptor *container_id);
|
|
1378
1418
|
uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
|
|
1379
1419
|
uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
|
|
1380
|
-
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t*
|
|
1420
|
+
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
|
|
1381
1421
|
LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
|
|
1382
|
-
int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t*
|
|
1422
|
+
int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length);
|
|
1383
1423
|
libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
|
|
1384
1424
|
uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
|
|
1385
1425
|
int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
|
|
@@ -1463,7 +1503,7 @@ static inline unsigned char *libusb_control_transfer_get_data(
|
|
|
1463
1503
|
static inline struct libusb_control_setup *libusb_control_transfer_get_setup(
|
|
1464
1504
|
struct libusb_transfer *transfer)
|
|
1465
1505
|
{
|
|
1466
|
-
return (struct libusb_control_setup *)(void *)
|
|
1506
|
+
return (struct libusb_control_setup *)(void *)transfer->buffer;
|
|
1467
1507
|
}
|
|
1468
1508
|
|
|
1469
1509
|
/** \ingroup libusb_asyncio
|
|
@@ -1493,7 +1533,7 @@ static inline void libusb_fill_control_setup(unsigned char *buffer,
|
|
|
1493
1533
|
uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
|
|
1494
1534
|
uint16_t wLength)
|
|
1495
1535
|
{
|
|
1496
|
-
struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)
|
|
1536
|
+
struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
|
|
1497
1537
|
setup->bmRequestType = bmRequestType;
|
|
1498
1538
|
setup->bRequest = bRequest;
|
|
1499
1539
|
setup->wValue = libusb_cpu_to_le16(wValue);
|
|
@@ -1543,7 +1583,7 @@ static inline void libusb_fill_control_transfer(
|
|
|
1543
1583
|
unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
|
|
1544
1584
|
unsigned int timeout)
|
|
1545
1585
|
{
|
|
1546
|
-
struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)
|
|
1586
|
+
struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
|
|
1547
1587
|
transfer->dev_handle = dev_handle;
|
|
1548
1588
|
transfer->endpoint = 0;
|
|
1549
1589
|
transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
|
|
@@ -1682,6 +1722,7 @@ static inline void libusb_set_iso_packet_lengths(
|
|
|
1682
1722
|
struct libusb_transfer *transfer, unsigned int length)
|
|
1683
1723
|
{
|
|
1684
1724
|
int i;
|
|
1725
|
+
|
|
1685
1726
|
for (i = 0; i < transfer->num_iso_packets; i++)
|
|
1686
1727
|
transfer->iso_packet_desc[i].length = length;
|
|
1687
1728
|
}
|
|
@@ -1896,7 +1937,7 @@ void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
|
|
|
1896
1937
|
* Callbacks handles are generated by libusb_hotplug_register_callback()
|
|
1897
1938
|
* and can be used to deregister callbacks. Callback handles are unique
|
|
1898
1939
|
* per libusb_context and it is safe to call libusb_hotplug_deregister_callback()
|
|
1899
|
-
* on an already
|
|
1940
|
+
* on an already deregistered callback.
|
|
1900
1941
|
*
|
|
1901
1942
|
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
|
1902
1943
|
*
|
|
@@ -1908,29 +1949,30 @@ typedef int libusb_hotplug_callback_handle;
|
|
|
1908
1949
|
*
|
|
1909
1950
|
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
|
1910
1951
|
*
|
|
1911
|
-
*
|
|
1952
|
+
* Hotplug events */
|
|
1912
1953
|
typedef enum {
|
|
1913
|
-
/**
|
|
1914
|
-
|
|
1954
|
+
/** A device has been plugged in and is ready to use */
|
|
1955
|
+
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0),
|
|
1915
1956
|
|
|
1916
|
-
/**
|
|
1917
|
-
|
|
1918
|
-
|
|
1957
|
+
/** A device has left and is no longer available.
|
|
1958
|
+
* It is the user's responsibility to call libusb_close on any handle associated with a disconnected device.
|
|
1959
|
+
* It is safe to call libusb_get_device_descriptor on a device that has left */
|
|
1960
|
+
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1)
|
|
1961
|
+
} libusb_hotplug_event;
|
|
1919
1962
|
|
|
1920
1963
|
/** \ingroup libusb_hotplug
|
|
1921
1964
|
*
|
|
1922
1965
|
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
|
1923
1966
|
*
|
|
1924
|
-
* Hotplug
|
|
1967
|
+
* Hotplug flags */
|
|
1925
1968
|
typedef enum {
|
|
1926
|
-
/**
|
|
1927
|
-
|
|
1969
|
+
/** Arm the callback and fire it for all matching currently attached devices. */
|
|
1970
|
+
LIBUSB_HOTPLUG_ENUMERATE = (1 << 0)
|
|
1971
|
+
} libusb_hotplug_flag;
|
|
1928
1972
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02U,
|
|
1933
|
-
} libusb_hotplug_event;
|
|
1973
|
+
/** \ingroup libusb_hotplug
|
|
1974
|
+
* Convenience macro when not using any flags */
|
|
1975
|
+
#define LIBUSB_HOTPLUG_NO_FLAGS 0
|
|
1934
1976
|
|
|
1935
1977
|
/** \ingroup libusb_hotplug
|
|
1936
1978
|
* Wildcard matching for hotplug events */
|
|
@@ -1959,9 +2001,7 @@ typedef enum {
|
|
|
1959
2001
|
* returning 1 will cause this callback to be deregistered
|
|
1960
2002
|
*/
|
|
1961
2003
|
typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
|
1962
|
-
|
|
1963
|
-
libusb_hotplug_event event,
|
|
1964
|
-
void *user_data);
|
|
2004
|
+
libusb_device *device, libusb_hotplug_event event, void *user_data);
|
|
1965
2005
|
|
|
1966
2006
|
/** \ingroup libusb_hotplug
|
|
1967
2007
|
* Register a hotplug callback function
|
|
@@ -1986,9 +2026,10 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
|
|
1986
2026
|
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
|
1987
2027
|
*
|
|
1988
2028
|
* \param[in] ctx context to register this callback with
|
|
1989
|
-
* \param[in] events bitwise or of events that will trigger this callback.
|
|
1990
|
-
* libusb_hotplug_event
|
|
1991
|
-
* \param[in] flags hotplug
|
|
2029
|
+
* \param[in] events bitwise or of hotplug events that will trigger this callback.
|
|
2030
|
+
* See \ref libusb_hotplug_event
|
|
2031
|
+
* \param[in] flags bitwise or of hotplug flags that affect registration.
|
|
2032
|
+
* See \ref libusb_hotplug_flag
|
|
1992
2033
|
* \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
|
1993
2034
|
* \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
|
1994
2035
|
* \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
|
|
@@ -1998,13 +2039,10 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
|
|
1998
2039
|
* \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure
|
|
1999
2040
|
*/
|
|
2000
2041
|
int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
libusb_hotplug_callback_fn cb_fn,
|
|
2006
|
-
void *user_data,
|
|
2007
|
-
libusb_hotplug_callback_handle *callback_handle);
|
|
2042
|
+
int events, int flags,
|
|
2043
|
+
int vendor_id, int product_id, int dev_class,
|
|
2044
|
+
libusb_hotplug_callback_fn cb_fn, void *user_data,
|
|
2045
|
+
libusb_hotplug_callback_handle *callback_handle);
|
|
2008
2046
|
|
|
2009
2047
|
/** \ingroup libusb_hotplug
|
|
2010
2048
|
* Deregisters a hotplug callback.
|
|
@@ -2018,7 +2056,18 @@ int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
|
|
|
2018
2056
|
* \param[in] callback_handle the handle of the callback to deregister
|
|
2019
2057
|
*/
|
|
2020
2058
|
void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
|
|
2021
|
-
|
|
2059
|
+
libusb_hotplug_callback_handle callback_handle);
|
|
2060
|
+
|
|
2061
|
+
/** \ingroup libusb_hotplug
|
|
2062
|
+
* Gets the user_data associated with a hotplug callback.
|
|
2063
|
+
*
|
|
2064
|
+
* Since version v1.0.24 \ref LIBUSB_API_VERSION >= 0x01000108
|
|
2065
|
+
*
|
|
2066
|
+
* \param[in] ctx context this callback is registered with
|
|
2067
|
+
* \param[in] callback_handle the handle of the callback to get the user_data of
|
|
2068
|
+
*/
|
|
2069
|
+
void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx,
|
|
2070
|
+
libusb_hotplug_callback_handle callback_handle);
|
|
2022
2071
|
|
|
2023
2072
|
/** \ingroup libusb_lib
|
|
2024
2073
|
* Available option values for libusb_set_option().
|
|
@@ -2045,7 +2094,7 @@ enum libusb_option {
|
|
|
2045
2094
|
* If libusb was compiled with verbose debug message logging, this function
|
|
2046
2095
|
* does nothing: you'll always get messages from all levels.
|
|
2047
2096
|
*/
|
|
2048
|
-
LIBUSB_OPTION_LOG_LEVEL,
|
|
2097
|
+
LIBUSB_OPTION_LOG_LEVEL = 0,
|
|
2049
2098
|
|
|
2050
2099
|
/** Use the UsbDk backend for a specific context, if available.
|
|
2051
2100
|
*
|
|
@@ -2054,12 +2103,39 @@ enum libusb_option {
|
|
|
2054
2103
|
*
|
|
2055
2104
|
* Only valid on Windows.
|
|
2056
2105
|
*/
|
|
2057
|
-
LIBUSB_OPTION_USE_USBDK,
|
|
2106
|
+
LIBUSB_OPTION_USE_USBDK = 1,
|
|
2107
|
+
|
|
2108
|
+
/** Do not scan for devices
|
|
2109
|
+
*
|
|
2110
|
+
* With this option set, libusb will skip scanning devices in
|
|
2111
|
+
* libusb_init(). Must be set before calling libusb_init().
|
|
2112
|
+
*
|
|
2113
|
+
* Hotplug functionality will also be deactivated.
|
|
2114
|
+
*
|
|
2115
|
+
* The option is useful in combination with libusb_wrap_sys_device(),
|
|
2116
|
+
* which can access a device directly without prior device scanning.
|
|
2117
|
+
*
|
|
2118
|
+
* This is typically needed on Android, where access to USB devices
|
|
2119
|
+
* is limited.
|
|
2120
|
+
*
|
|
2121
|
+
* For LIBUSB_API_VERSION 0x01000108 it was called LIBUSB_OPTION_WEAK_AUTHORITY
|
|
2122
|
+
*
|
|
2123
|
+
* Only valid on Linux.
|
|
2124
|
+
*/
|
|
2125
|
+
LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2,
|
|
2126
|
+
|
|
2127
|
+
#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY
|
|
2128
|
+
|
|
2129
|
+
LIBUSB_OPTION_MAX = 3
|
|
2058
2130
|
};
|
|
2059
2131
|
|
|
2060
2132
|
int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
|
|
2061
2133
|
|
|
2062
|
-
#ifdef
|
|
2134
|
+
#ifdef _MSC_VER
|
|
2135
|
+
#pragma warning(pop)
|
|
2136
|
+
#endif
|
|
2137
|
+
|
|
2138
|
+
#if defined(__cplusplus)
|
|
2063
2139
|
}
|
|
2064
2140
|
#endif
|
|
2065
2141
|
|