usb 2.1.2 → 2.3.0
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 +24 -0
- package/README.md +20 -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 +2 -1
- package/dist/webusb/webusb-device.js +21 -14
- 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/{listdevs_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_2012.vcxproj → getopt_2019.vcxproj} +25 -6
- 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_2012.vcxproj → sam3u_benchmark_2013.vcxproj} +13 -9
- package/libusb/msvc/sam3u_benchmark_2013.vcxproj.filters +26 -0
- package/libusb/msvc/{hotplugtest_2010.vcxproj → sam3u_benchmark_2015.vcxproj} +13 -8
- 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 +2 -2
- 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 +12 -8
- 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_2010.vcxproj +0 -72
- 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
|
@@ -30,59 +30,63 @@
|
|
|
30
30
|
#include <IOKit/usb/IOUSBLib.h>
|
|
31
31
|
#include <IOKit/IOCFPlugIn.h>
|
|
32
32
|
|
|
33
|
+
#if defined(HAVE_IOKIT_USB_IOUSBHOSTFAMILYDEFINITIONS_H)
|
|
34
|
+
#include <IOKit/usb/IOUSBHostFamilyDefinitions.h>
|
|
35
|
+
#endif
|
|
36
|
+
|
|
33
37
|
/* IOUSBInterfaceInferface */
|
|
34
38
|
|
|
35
39
|
/* New in OS 10.12.0. */
|
|
36
|
-
#if defined (kIOUSBInterfaceInterfaceID800)
|
|
40
|
+
#if defined (kIOUSBInterfaceInterfaceID800)
|
|
37
41
|
|
|
38
42
|
#define usb_interface_t IOUSBInterfaceInterface800
|
|
39
43
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID800
|
|
40
44
|
#define InterfaceVersion 800
|
|
41
45
|
|
|
42
46
|
/* New in OS 10.10.0. */
|
|
43
|
-
#elif defined (kIOUSBInterfaceInterfaceID700)
|
|
47
|
+
#elif defined (kIOUSBInterfaceInterfaceID700)
|
|
44
48
|
|
|
45
49
|
#define usb_interface_t IOUSBInterfaceInterface700
|
|
46
50
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID700
|
|
47
51
|
#define InterfaceVersion 700
|
|
48
52
|
|
|
49
53
|
/* New in OS 10.9.0. */
|
|
50
|
-
#elif defined (kIOUSBInterfaceInterfaceID650)
|
|
54
|
+
#elif defined (kIOUSBInterfaceInterfaceID650)
|
|
51
55
|
|
|
52
56
|
#define usb_interface_t IOUSBInterfaceInterface650
|
|
53
57
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID650
|
|
54
58
|
#define InterfaceVersion 650
|
|
55
59
|
|
|
56
60
|
/* New in OS 10.8.2 but can't test deployment target to that granularity, so round up. */
|
|
57
|
-
#elif defined (kIOUSBInterfaceInterfaceID550)
|
|
61
|
+
#elif defined (kIOUSBInterfaceInterfaceID550)
|
|
58
62
|
|
|
59
63
|
#define usb_interface_t IOUSBInterfaceInterface550
|
|
60
64
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID550
|
|
61
65
|
#define InterfaceVersion 550
|
|
62
66
|
|
|
63
67
|
/* New in OS 10.7.3 but can't test deployment target to that granularity, so round up. */
|
|
64
|
-
#elif defined (kIOUSBInterfaceInterfaceID500)
|
|
68
|
+
#elif defined (kIOUSBInterfaceInterfaceID500)
|
|
65
69
|
|
|
66
70
|
#define usb_interface_t IOUSBInterfaceInterface500
|
|
67
71
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID500
|
|
68
72
|
#define InterfaceVersion 500
|
|
69
73
|
|
|
70
74
|
/* New in OS 10.5.0. */
|
|
71
|
-
#elif defined (kIOUSBInterfaceInterfaceID300)
|
|
75
|
+
#elif defined (kIOUSBInterfaceInterfaceID300)
|
|
72
76
|
|
|
73
77
|
#define usb_interface_t IOUSBInterfaceInterface300
|
|
74
78
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID300
|
|
75
79
|
#define InterfaceVersion 300
|
|
76
80
|
|
|
77
81
|
/* New in OS 10.4.5 (or 10.4.6?) but can't test deployment target to that granularity, so round up. */
|
|
78
|
-
#elif defined (kIOUSBInterfaceInterfaceID245)
|
|
82
|
+
#elif defined (kIOUSBInterfaceInterfaceID245)
|
|
79
83
|
|
|
80
84
|
#define usb_interface_t IOUSBInterfaceInterface245
|
|
81
85
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID245
|
|
82
86
|
#define InterfaceVersion 245
|
|
83
87
|
|
|
84
88
|
/* New in OS 10.4.0. */
|
|
85
|
-
#elif defined (kIOUSBInterfaceInterfaceID220)
|
|
89
|
+
#elif defined (kIOUSBInterfaceInterfaceID220)
|
|
86
90
|
|
|
87
91
|
#define usb_interface_t IOUSBInterfaceInterface220
|
|
88
92
|
#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220
|
|
@@ -97,42 +101,42 @@
|
|
|
97
101
|
/* IOUSBDeviceInterface */
|
|
98
102
|
|
|
99
103
|
/* New in OS 10.9.0. */
|
|
100
|
-
#if defined (kIOUSBDeviceInterfaceID650)
|
|
104
|
+
#if defined (kIOUSBDeviceInterfaceID650)
|
|
101
105
|
|
|
102
106
|
#define usb_device_t IOUSBDeviceInterface650
|
|
103
107
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID650
|
|
104
108
|
#define DeviceVersion 650
|
|
105
109
|
|
|
106
110
|
/* New in OS 10.7.3 but can't test deployment target to that granularity, so round up. */
|
|
107
|
-
#elif defined (kIOUSBDeviceInterfaceID500)
|
|
111
|
+
#elif defined (kIOUSBDeviceInterfaceID500)
|
|
108
112
|
|
|
109
113
|
#define usb_device_t IOUSBDeviceInterface500
|
|
110
114
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID500
|
|
111
115
|
#define DeviceVersion 500
|
|
112
116
|
|
|
113
117
|
/* New in OS 10.5.4 but can't test deployment target to that granularity, so round up. */
|
|
114
|
-
#elif defined (kIOUSBDeviceInterfaceID320)
|
|
118
|
+
#elif defined (kIOUSBDeviceInterfaceID320)
|
|
115
119
|
|
|
116
120
|
#define usb_device_t IOUSBDeviceInterface320
|
|
117
121
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID320
|
|
118
122
|
#define DeviceVersion 320
|
|
119
123
|
|
|
120
124
|
/* New in OS 10.5.0. */
|
|
121
|
-
#elif defined (kIOUSBDeviceInterfaceID300)
|
|
125
|
+
#elif defined (kIOUSBDeviceInterfaceID300)
|
|
122
126
|
|
|
123
127
|
#define usb_device_t IOUSBDeviceInterface300
|
|
124
128
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID300
|
|
125
129
|
#define DeviceVersion 300
|
|
126
130
|
|
|
127
131
|
/* New in OS 10.4.5 (or 10.4.6?) but can't test deployment target to that granularity, so round up. */
|
|
128
|
-
#elif defined (kIOUSBDeviceInterfaceID245)
|
|
132
|
+
#elif defined (kIOUSBDeviceInterfaceID245)
|
|
129
133
|
|
|
130
134
|
#define usb_device_t IOUSBDeviceInterface245
|
|
131
135
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID245
|
|
132
136
|
#define DeviceVersion 245
|
|
133
137
|
|
|
134
138
|
/* New in OS 10.2.3 but can't test deployment target to that granularity, so round up. */
|
|
135
|
-
#elif defined (kIOUSBDeviceInterfaceID197)
|
|
139
|
+
#elif defined (kIOUSBDeviceInterfaceID197)
|
|
136
140
|
|
|
137
141
|
#define usb_device_t IOUSBDeviceInterface197
|
|
138
142
|
#define DeviceInterfaceID kIOUSBDeviceInterfaceID197
|
|
@@ -144,10 +148,28 @@
|
|
|
144
148
|
|
|
145
149
|
#endif
|
|
146
150
|
|
|
151
|
+
#if !defined(kIOUSBHostInterfaceClassName)
|
|
152
|
+
#define kIOUSBHostInterfaceClassName "IOUSBHostInterface"
|
|
153
|
+
#endif
|
|
154
|
+
|
|
155
|
+
#if !defined(kUSBHostMatchingPropertyInterfaceNumber)
|
|
156
|
+
#define kUSBHostMatchingPropertyInterfaceNumber "bInterfaceNumber"
|
|
157
|
+
#endif
|
|
158
|
+
|
|
147
159
|
#if !defined(IO_OBJECT_NULL)
|
|
148
160
|
#define IO_OBJECT_NULL ((io_object_t) 0)
|
|
149
161
|
#endif
|
|
150
162
|
|
|
163
|
+
/* Testing availability */
|
|
164
|
+
#ifndef __has_builtin
|
|
165
|
+
#define __has_builtin(x) 0 // Compatibility with non-clang compilers.
|
|
166
|
+
#endif
|
|
167
|
+
#if __has_builtin(__builtin_available)
|
|
168
|
+
#define HAS_CAPTURE_DEVICE() __builtin_available(macOS 10.10, *)
|
|
169
|
+
#else
|
|
170
|
+
#define HAS_CAPTURE_DEVICE() 0
|
|
171
|
+
#endif
|
|
172
|
+
|
|
151
173
|
typedef IOCFPlugInInterface *io_cf_plugin_ref_t;
|
|
152
174
|
typedef IONotificationPortRef io_notification_port_t;
|
|
153
175
|
|
|
@@ -161,11 +183,13 @@ struct darwin_cached_device {
|
|
|
161
183
|
USBDeviceAddress address;
|
|
162
184
|
char sys_path[21];
|
|
163
185
|
usb_device_t **device;
|
|
186
|
+
io_service_t service;
|
|
164
187
|
int open_count;
|
|
165
|
-
UInt8 first_config, active_config, port;
|
|
188
|
+
UInt8 first_config, active_config, port;
|
|
166
189
|
int can_enumerate;
|
|
167
190
|
int refcount;
|
|
168
191
|
bool in_reenumerate;
|
|
192
|
+
int capture_count;
|
|
169
193
|
};
|
|
170
194
|
|
|
171
195
|
struct darwin_device_priv {
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* libusb event abstraction on POSIX platforms
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2020 Chris Dickens <christopher.a.dickens@gmail.com>
|
|
5
|
+
*
|
|
6
|
+
* This library is free software; you can redistribute it and/or
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
|
8
|
+
* License as published by the Free Software Foundation; either
|
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
+
* Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
* License along with this library; if not, write to the Free Software
|
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "libusbi.h"
|
|
22
|
+
|
|
23
|
+
#include <errno.h>
|
|
24
|
+
#include <fcntl.h>
|
|
25
|
+
#ifdef HAVE_EVENTFD
|
|
26
|
+
#include <sys/eventfd.h>
|
|
27
|
+
#endif
|
|
28
|
+
#ifdef HAVE_TIMERFD
|
|
29
|
+
#include <sys/timerfd.h>
|
|
30
|
+
#endif
|
|
31
|
+
#include <unistd.h>
|
|
32
|
+
|
|
33
|
+
#ifdef HAVE_EVENTFD
|
|
34
|
+
#define EVENT_READ_FD(e) ((e)->eventfd)
|
|
35
|
+
#define EVENT_WRITE_FD(e) ((e)->eventfd)
|
|
36
|
+
#else
|
|
37
|
+
#define EVENT_READ_FD(e) ((e)->pipefd[0])
|
|
38
|
+
#define EVENT_WRITE_FD(e) ((e)->pipefd[1])
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#ifdef HAVE_NFDS_T
|
|
42
|
+
typedef nfds_t usbi_nfds_t;
|
|
43
|
+
#else
|
|
44
|
+
typedef unsigned int usbi_nfds_t;
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
int usbi_create_event(usbi_event_t *event)
|
|
48
|
+
{
|
|
49
|
+
#ifdef HAVE_EVENTFD
|
|
50
|
+
event->eventfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
|
|
51
|
+
if (event->eventfd == -1) {
|
|
52
|
+
usbi_err(NULL, "failed to create eventfd, errno=%d", errno);
|
|
53
|
+
return LIBUSB_ERROR_OTHER;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return 0;
|
|
57
|
+
#else
|
|
58
|
+
#if defined(HAVE_PIPE2)
|
|
59
|
+
int ret = pipe2(event->pipefd, O_CLOEXEC);
|
|
60
|
+
#else
|
|
61
|
+
int ret = pipe(event->pipefd);
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
if (ret != 0) {
|
|
65
|
+
usbi_err(NULL, "failed to create pipe, errno=%d", errno);
|
|
66
|
+
return LIBUSB_ERROR_OTHER;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#if !defined(HAVE_PIPE2) && defined(FD_CLOEXEC)
|
|
70
|
+
ret = fcntl(event->pipefd[0], F_GETFD);
|
|
71
|
+
if (ret == -1) {
|
|
72
|
+
usbi_err(NULL, "failed to get pipe fd flags, errno=%d", errno);
|
|
73
|
+
goto err_close_pipe;
|
|
74
|
+
}
|
|
75
|
+
ret = fcntl(event->pipefd[0], F_SETFD, ret | FD_CLOEXEC);
|
|
76
|
+
if (ret == -1) {
|
|
77
|
+
usbi_err(NULL, "failed to set pipe fd flags, errno=%d", errno);
|
|
78
|
+
goto err_close_pipe;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ret = fcntl(event->pipefd[1], F_GETFD);
|
|
82
|
+
if (ret == -1) {
|
|
83
|
+
usbi_err(NULL, "failed to get pipe fd flags, errno=%d", errno);
|
|
84
|
+
goto err_close_pipe;
|
|
85
|
+
}
|
|
86
|
+
ret = fcntl(event->pipefd[1], F_SETFD, ret | FD_CLOEXEC);
|
|
87
|
+
if (ret == -1) {
|
|
88
|
+
usbi_err(NULL, "failed to set pipe fd flags, errno=%d", errno);
|
|
89
|
+
goto err_close_pipe;
|
|
90
|
+
}
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
ret = fcntl(event->pipefd[1], F_GETFL);
|
|
94
|
+
if (ret == -1) {
|
|
95
|
+
usbi_err(NULL, "failed to get pipe fd status flags, errno=%d", errno);
|
|
96
|
+
goto err_close_pipe;
|
|
97
|
+
}
|
|
98
|
+
ret = fcntl(event->pipefd[1], F_SETFL, ret | O_NONBLOCK);
|
|
99
|
+
if (ret == -1) {
|
|
100
|
+
usbi_err(NULL, "failed to set pipe fd status flags, errno=%d", errno);
|
|
101
|
+
goto err_close_pipe;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return 0;
|
|
105
|
+
|
|
106
|
+
err_close_pipe:
|
|
107
|
+
close(event->pipefd[1]);
|
|
108
|
+
close(event->pipefd[0]);
|
|
109
|
+
return LIBUSB_ERROR_OTHER;
|
|
110
|
+
#endif
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void usbi_destroy_event(usbi_event_t *event)
|
|
114
|
+
{
|
|
115
|
+
#ifdef HAVE_EVENTFD
|
|
116
|
+
if (close(event->eventfd) == -1)
|
|
117
|
+
usbi_warn(NULL, "failed to close eventfd, errno=%d", errno);
|
|
118
|
+
#else
|
|
119
|
+
if (close(event->pipefd[1]) == -1)
|
|
120
|
+
usbi_warn(NULL, "failed to close pipe write end, errno=%d", errno);
|
|
121
|
+
if (close(event->pipefd[0]) == -1)
|
|
122
|
+
usbi_warn(NULL, "failed to close pipe read end, errno=%d", errno);
|
|
123
|
+
#endif
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
void usbi_signal_event(usbi_event_t *event)
|
|
127
|
+
{
|
|
128
|
+
uint64_t dummy = 1;
|
|
129
|
+
ssize_t r;
|
|
130
|
+
|
|
131
|
+
r = write(EVENT_WRITE_FD(event), &dummy, sizeof(dummy));
|
|
132
|
+
if (r != sizeof(dummy))
|
|
133
|
+
usbi_warn(NULL, "event write failed");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void usbi_clear_event(usbi_event_t *event)
|
|
137
|
+
{
|
|
138
|
+
uint64_t dummy;
|
|
139
|
+
ssize_t r;
|
|
140
|
+
|
|
141
|
+
r = read(EVENT_READ_FD(event), &dummy, sizeof(dummy));
|
|
142
|
+
if (r != sizeof(dummy))
|
|
143
|
+
usbi_warn(NULL, "event read failed");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#ifdef HAVE_TIMERFD
|
|
147
|
+
int usbi_create_timer(usbi_timer_t *timer)
|
|
148
|
+
{
|
|
149
|
+
timer->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
|
|
150
|
+
if (timer->timerfd == -1) {
|
|
151
|
+
usbi_warn(NULL, "failed to create timerfd, errno=%d", errno);
|
|
152
|
+
return LIBUSB_ERROR_OTHER;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
void usbi_destroy_timer(usbi_timer_t *timer)
|
|
159
|
+
{
|
|
160
|
+
if (close(timer->timerfd) == -1)
|
|
161
|
+
usbi_warn(NULL, "failed to close timerfd, errno=%d", errno);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
int usbi_arm_timer(usbi_timer_t *timer, const struct timespec *timeout)
|
|
165
|
+
{
|
|
166
|
+
const struct itimerspec it = { { 0, 0 }, { timeout->tv_sec, timeout->tv_nsec } };
|
|
167
|
+
|
|
168
|
+
if (timerfd_settime(timer->timerfd, TFD_TIMER_ABSTIME, &it, NULL) == -1) {
|
|
169
|
+
usbi_warn(NULL, "failed to arm timerfd, errno=%d", errno);
|
|
170
|
+
return LIBUSB_ERROR_OTHER;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
int usbi_disarm_timer(usbi_timer_t *timer)
|
|
177
|
+
{
|
|
178
|
+
const struct itimerspec it = { { 0, 0 }, { 0, 0 } };
|
|
179
|
+
|
|
180
|
+
if (timerfd_settime(timer->timerfd, 0, &it, NULL) == -1) {
|
|
181
|
+
usbi_warn(NULL, "failed to disarm timerfd, errno=%d", errno);
|
|
182
|
+
return LIBUSB_ERROR_OTHER;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return 0;
|
|
186
|
+
}
|
|
187
|
+
#endif
|
|
188
|
+
|
|
189
|
+
int usbi_alloc_event_data(struct libusb_context *ctx)
|
|
190
|
+
{
|
|
191
|
+
struct usbi_event_source *ievent_source;
|
|
192
|
+
struct pollfd *fds;
|
|
193
|
+
size_t i = 0;
|
|
194
|
+
|
|
195
|
+
if (ctx->event_data) {
|
|
196
|
+
free(ctx->event_data);
|
|
197
|
+
ctx->event_data = NULL;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
ctx->event_data_cnt = 0;
|
|
201
|
+
for_each_event_source(ctx, ievent_source)
|
|
202
|
+
ctx->event_data_cnt++;
|
|
203
|
+
|
|
204
|
+
fds = calloc(ctx->event_data_cnt, sizeof(*fds));
|
|
205
|
+
if (!fds)
|
|
206
|
+
return LIBUSB_ERROR_NO_MEM;
|
|
207
|
+
|
|
208
|
+
for_each_event_source(ctx, ievent_source) {
|
|
209
|
+
fds[i].fd = ievent_source->data.os_handle;
|
|
210
|
+
fds[i].events = ievent_source->data.poll_events;
|
|
211
|
+
i++;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
ctx->event_data = fds;
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
int usbi_wait_for_events(struct libusb_context *ctx,
|
|
219
|
+
struct usbi_reported_events *reported_events, int timeout_ms)
|
|
220
|
+
{
|
|
221
|
+
struct pollfd *fds = ctx->event_data;
|
|
222
|
+
usbi_nfds_t nfds = (usbi_nfds_t)ctx->event_data_cnt;
|
|
223
|
+
int internal_fds, num_ready;
|
|
224
|
+
|
|
225
|
+
usbi_dbg(ctx, "poll() %u fds with timeout in %dms", (unsigned int)nfds, timeout_ms);
|
|
226
|
+
num_ready = poll(fds, nfds, timeout_ms);
|
|
227
|
+
usbi_dbg(ctx, "poll() returned %d", num_ready);
|
|
228
|
+
if (num_ready == 0) {
|
|
229
|
+
if (usbi_using_timer(ctx))
|
|
230
|
+
goto done;
|
|
231
|
+
return LIBUSB_ERROR_TIMEOUT;
|
|
232
|
+
} else if (num_ready == -1) {
|
|
233
|
+
if (errno == EINTR)
|
|
234
|
+
return LIBUSB_ERROR_INTERRUPTED;
|
|
235
|
+
usbi_err(ctx, "poll() failed, errno=%d", errno);
|
|
236
|
+
return LIBUSB_ERROR_IO;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* fds[0] is always the internal signalling event */
|
|
240
|
+
if (fds[0].revents) {
|
|
241
|
+
reported_events->event_triggered = 1;
|
|
242
|
+
num_ready--;
|
|
243
|
+
} else {
|
|
244
|
+
reported_events->event_triggered = 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
#ifdef HAVE_OS_TIMER
|
|
248
|
+
/* on timer configurations, fds[1] is the timer */
|
|
249
|
+
if (usbi_using_timer(ctx) && fds[1].revents) {
|
|
250
|
+
reported_events->timer_triggered = 1;
|
|
251
|
+
num_ready--;
|
|
252
|
+
} else {
|
|
253
|
+
reported_events->timer_triggered = 0;
|
|
254
|
+
}
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
if (!num_ready)
|
|
258
|
+
goto done;
|
|
259
|
+
|
|
260
|
+
/* the backend will never need to attempt to handle events on the
|
|
261
|
+
* library's internal file descriptors, so we determine how many are
|
|
262
|
+
* in use internally for this context and skip these when passing any
|
|
263
|
+
* remaining pollfds to the backend. */
|
|
264
|
+
internal_fds = usbi_using_timer(ctx) ? 2 : 1;
|
|
265
|
+
fds += internal_fds;
|
|
266
|
+
nfds -= internal_fds;
|
|
267
|
+
|
|
268
|
+
usbi_mutex_lock(&ctx->event_data_lock);
|
|
269
|
+
if (ctx->event_flags & USBI_EVENT_EVENT_SOURCES_MODIFIED) {
|
|
270
|
+
struct usbi_event_source *ievent_source;
|
|
271
|
+
|
|
272
|
+
for_each_removed_event_source(ctx, ievent_source) {
|
|
273
|
+
usbi_nfds_t n;
|
|
274
|
+
|
|
275
|
+
for (n = 0; n < nfds; n++) {
|
|
276
|
+
if (ievent_source->data.os_handle != fds[n].fd)
|
|
277
|
+
continue;
|
|
278
|
+
if (!fds[n].revents)
|
|
279
|
+
continue;
|
|
280
|
+
/* pollfd was removed between the creation of the fds array and
|
|
281
|
+
* here. remove triggered revent as it is no longer relevant. */
|
|
282
|
+
usbi_dbg(ctx, "fd %d was removed, ignoring raised events", fds[n].fd);
|
|
283
|
+
fds[n].revents = 0;
|
|
284
|
+
num_ready--;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
usbi_mutex_unlock(&ctx->event_data_lock);
|
|
290
|
+
|
|
291
|
+
if (num_ready) {
|
|
292
|
+
assert(num_ready > 0);
|
|
293
|
+
reported_events->event_data = fds;
|
|
294
|
+
reported_events->event_data_count = (unsigned int)nfds;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
done:
|
|
298
|
+
reported_events->num_ready = num_ready;
|
|
299
|
+
return LIBUSB_SUCCESS;
|
|
300
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* libusb event abstraction on POSIX platforms
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2020 Chris Dickens <christopher.a.dickens@gmail.com>
|
|
5
|
+
*
|
|
6
|
+
* This library is free software; you can redistribute it and/or
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
|
8
|
+
* License as published by the Free Software Foundation; either
|
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
+
* Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
* License along with this library; if not, write to the Free Software
|
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBUSB_EVENTS_POSIX_H
|
|
22
|
+
#define LIBUSB_EVENTS_POSIX_H
|
|
23
|
+
|
|
24
|
+
#include <poll.h>
|
|
25
|
+
|
|
26
|
+
typedef int usbi_os_handle_t;
|
|
27
|
+
#define USBI_OS_HANDLE_FORMAT_STRING "fd %d"
|
|
28
|
+
|
|
29
|
+
#ifdef HAVE_EVENTFD
|
|
30
|
+
typedef struct usbi_event {
|
|
31
|
+
int eventfd;
|
|
32
|
+
} usbi_event_t;
|
|
33
|
+
#define USBI_EVENT_OS_HANDLE(e) ((e)->eventfd)
|
|
34
|
+
#define USBI_EVENT_POLL_EVENTS POLLIN
|
|
35
|
+
#define USBI_INVALID_EVENT { -1 }
|
|
36
|
+
#else
|
|
37
|
+
typedef struct usbi_event {
|
|
38
|
+
int pipefd[2];
|
|
39
|
+
} usbi_event_t;
|
|
40
|
+
#define USBI_EVENT_OS_HANDLE(e) ((e)->pipefd[0])
|
|
41
|
+
#define USBI_EVENT_POLL_EVENTS POLLIN
|
|
42
|
+
#define USBI_INVALID_EVENT { { -1, -1 } }
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#ifdef HAVE_TIMERFD
|
|
46
|
+
#define HAVE_OS_TIMER 1
|
|
47
|
+
typedef struct usbi_timer {
|
|
48
|
+
int timerfd;
|
|
49
|
+
} usbi_timer_t;
|
|
50
|
+
#define USBI_TIMER_OS_HANDLE(t) ((t)->timerfd)
|
|
51
|
+
#define USBI_TIMER_POLL_EVENTS POLLIN
|
|
52
|
+
|
|
53
|
+
static inline int usbi_timer_valid(usbi_timer_t *timer)
|
|
54
|
+
{
|
|
55
|
+
return timer->timerfd >= 0;
|
|
56
|
+
}
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#endif
|