libusb 0.4.0 → 0.4.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.
- data/.travis.yml +2 -2
- data/Gemfile +0 -8
- data/History.md +5 -0
- data/README.md +6 -6
- data/Rakefile +9 -9
- data/ext/extconf.rb +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/AUTHORS +10 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/COPYING +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/ChangeLog +17 -9
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/INSTALL +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Makefile.am +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Makefile.in +153 -178
- data/ext/libusb-1.0.18/NEWS +2 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/PORTING +13 -13
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/README +9 -11
- data/ext/libusb-1.0.18/TODO +2 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/common.xcconfig +3 -3
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/config.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/debug.xcconfig +2 -2
- data/ext/{libusbx-1.0.17/Xcode/libusbx.xcconfig → libusb-1.0.18/Xcode/libusb.xcconfig} +2 -2
- data/ext/libusb-1.0.18/Xcode/libusb.xcodeproj/project.pbxproj +1 -0
- data/ext/{libusbx-1.0.17/Xcode/libusbx_debug.xcconfig → libusb-1.0.18/Xcode/libusb_debug.xcconfig} +3 -3
- data/ext/{libusbx-1.0.17/Xcode/libusbx_release.xcconfig → libusb-1.0.18/Xcode/libusb_release.xcconfig} +3 -3
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/release.xcconfig +2 -2
- data/ext/{libusbx-1.0.17/m4/libtool.m4 → libusb-1.0.18/aclocal.m4} +1731 -27
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/README +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/config.h +1 -10
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/Android.mk +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/Application.mk +6 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/examples.mk +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/libusb.mk +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/tests.mk +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/compile +3 -7
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.guess +19 -24
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.h.in +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.sub +30 -47
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/configure +118 -172
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/configure.ac +24 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/depcomp +186 -268
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/Makefile.am +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/Makefile.in +36 -73
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/doxygen.cfg.in +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/Makefile.am +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/Makefile.in +68 -132
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/dpfp.c +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/dpfp_threaded.c +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/ezusb.c +57 -26
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/ezusb.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/fxload.c +3 -3
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt1.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/hotplugtest.c +9 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/listdevs.c +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/sam3u_benchmark.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/xusb.c +20 -4
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/install-sh +7 -7
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb-1.0.pc.in +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/Makefile.am +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/Makefile.in +94 -134
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/core.c +95 -74
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/descriptor.c +2 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/hotplug.c +3 -3
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/hotplug.h +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/io.c +127 -116
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb-1.0.def +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb-1.0.rc +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb.h +42 -39
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusbi.h +20 -11
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/darwin_usb.c +20 -16
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/darwin_usb.h +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_netlink.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_udev.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_usbfs.c +15 -12
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_usbfs.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/netbsd_usb.c +2 -4
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/openbsd_usb.c +5 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_posix.c +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_posix.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_windows.c +2 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_windows.h +0 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_posix.c +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_posix.h +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_windows.c +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_windows.h +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/wince_usb.c +1 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/wince_usb.h +2 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_common.h +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_usb.c +53 -33
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_usb.h +6 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/strerror.c +2 -2
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/sync.c +6 -6
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/version.h +1 -1
- data/ext/libusb-1.0.18/libusb/version_nano.h +1 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/ltmain.sh +3 -3
- data/ext/libusb-1.0.18/missing +331 -0
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/Makefile.am +1 -1
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/Makefile.in +69 -127
- data/ext/{libusbx-1.0.17/tests/libusbx_testlib.h → libusb-1.0.18/tests/libusb_testlib.h} +15 -15
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/stress.c +16 -16
- data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/testlib.c +21 -20
- data/lib/libusb/version_gem.rb +1 -1
- data/libusb.gemspec +1 -6
- metadata +117 -135
- checksums.yaml +0 -7
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ext/libusbx-1.0.17/NEWS +0 -2
- data/ext/libusbx-1.0.17/TODO +0 -2
- data/ext/libusbx-1.0.17/Xcode/libusbx.xcodeproj/project.pbxproj +0 -864
- data/ext/libusbx-1.0.17/aclocal.m4 +0 -1112
- data/ext/libusbx-1.0.17/libusb/version_nano.h +0 -1
- data/ext/libusbx-1.0.17/m4/ltoptions.m4 +0 -384
- data/ext/libusbx-1.0.17/m4/ltsugar.m4 +0 -123
- data/ext/libusbx-1.0.17/m4/ltversion.m4 +0 -23
- data/ext/libusbx-1.0.17/m4/lt~obsolete.m4 +0 -98
- data/ext/libusbx-1.0.17/missing +0 -215
- metadata.gz.sig +0 -0
|
@@ -52,7 +52,7 @@ OS_SRC = $(WINDOWS_USB_SRC)
|
|
|
52
52
|
libusb-1.0.rc: version.h version_nano.h
|
|
53
53
|
endif
|
|
54
54
|
|
|
55
|
-
libusb-1.0.dll: libusb-1.0.def
|
|
55
|
+
libusb-1.0.dll: libusb-1.0.def libusb-1.0.la
|
|
56
56
|
if CREATE_IMPORT_LIB
|
|
57
57
|
# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
|
|
58
58
|
$(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
# Makefile.in generated by automake 1.
|
|
1
|
+
# Makefile.in generated by automake 1.11.5 from Makefile.am.
|
|
2
2
|
# @configure_input@
|
|
3
3
|
|
|
4
|
-
# Copyright (C) 1994
|
|
5
|
-
|
|
4
|
+
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
5
|
+
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
|
6
|
+
# Foundation, Inc.
|
|
6
7
|
# This Makefile.in is free software; the Free Software Foundation
|
|
7
8
|
# gives unlimited permission to copy and/or distribute it,
|
|
8
9
|
# with or without modifications, as long as this notice is preserved.
|
|
@@ -16,51 +17,23 @@
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
VPATH = @srcdir@
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
?) ;; \
|
|
23
|
-
*) echo "am__make_running_with_option: internal error: invalid" \
|
|
24
|
-
"target option '$${target_option-}' specified" >&2; \
|
|
25
|
-
exit 1;; \
|
|
26
|
-
esac; \
|
|
27
|
-
has_opt=no; \
|
|
28
|
-
sane_makeflags=$$MAKEFLAGS; \
|
|
29
|
-
if $(am__is_gnu_make); then \
|
|
30
|
-
sane_makeflags=$$MFLAGS; \
|
|
31
|
-
else \
|
|
20
|
+
am__make_dryrun = \
|
|
21
|
+
{ \
|
|
22
|
+
am__dry=no; \
|
|
32
23
|
case $$MAKEFLAGS in \
|
|
33
24
|
*\\[\ \ ]*) \
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}; \
|
|
44
|
-
for flg in $$sane_makeflags; do \
|
|
45
|
-
test $$skip_next = yes && { skip_next=no; continue; }; \
|
|
46
|
-
case $$flg in \
|
|
47
|
-
*=*|--*) continue;; \
|
|
48
|
-
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
|
49
|
-
-*I?*) strip_trailopt 'I';; \
|
|
50
|
-
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
|
51
|
-
-*O?*) strip_trailopt 'O';; \
|
|
52
|
-
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
|
53
|
-
-*l?*) strip_trailopt 'l';; \
|
|
54
|
-
-[dEDm]) skip_next=yes;; \
|
|
55
|
-
-[JT]) skip_next=yes;; \
|
|
25
|
+
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
|
26
|
+
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
|
27
|
+
*) \
|
|
28
|
+
for am__flg in $$MAKEFLAGS; do \
|
|
29
|
+
case $$am__flg in \
|
|
30
|
+
*=*|--*) ;; \
|
|
31
|
+
*n*) am__dry=yes; break;; \
|
|
32
|
+
esac; \
|
|
33
|
+
done;; \
|
|
56
34
|
esac; \
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
esac; \
|
|
60
|
-
done; \
|
|
61
|
-
test $$has_opt = yes
|
|
62
|
-
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
|
63
|
-
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
|
35
|
+
test $$am__dry = yes; \
|
|
36
|
+
}
|
|
64
37
|
pkgdatadir = $(datadir)/@PACKAGE@
|
|
65
38
|
pkgincludedir = $(includedir)/@PACKAGE@
|
|
66
39
|
pkglibdir = $(libdir)/@PACKAGE@
|
|
@@ -80,13 +53,11 @@ POST_UNINSTALL = :
|
|
|
80
53
|
build_triplet = @build@
|
|
81
54
|
host_triplet = @host@
|
|
82
55
|
subdir = libusb
|
|
83
|
-
DIST_COMMON = $(
|
|
84
|
-
$(
|
|
56
|
+
DIST_COMMON = $(hdr_HEADERS) $(srcdir)/Makefile.am \
|
|
57
|
+
$(srcdir)/Makefile.in
|
|
85
58
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
86
|
-
am__aclocal_m4_deps = $(top_srcdir)/
|
|
87
|
-
$(top_srcdir)/
|
|
88
|
-
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
|
89
|
-
$(top_srcdir)/libusb/version.h $(top_srcdir)/configure.ac
|
|
59
|
+
am__aclocal_m4_deps = $(top_srcdir)/libusb/version.h \
|
|
60
|
+
$(top_srcdir)/configure.ac
|
|
90
61
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
|
91
62
|
$(ACLOCAL_M4)
|
|
92
63
|
mkinstalldirs = $(install_sh) -d
|
|
@@ -163,22 +134,9 @@ libusb_1_0_la_OBJECTS = $(am_libusb_1_0_la_OBJECTS)
|
|
|
163
134
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
|
164
135
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
|
165
136
|
am__v_lt_0 = --silent
|
|
166
|
-
am__v_lt_1 =
|
|
167
137
|
libusb_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|
168
138
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libusb_1_0_la_CFLAGS) \
|
|
169
139
|
$(CFLAGS) $(libusb_1_0_la_LDFLAGS) $(LDFLAGS) -o $@
|
|
170
|
-
AM_V_P = $(am__v_P_@AM_V@)
|
|
171
|
-
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
|
172
|
-
am__v_P_0 = false
|
|
173
|
-
am__v_P_1 = :
|
|
174
|
-
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
|
175
|
-
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
|
176
|
-
am__v_GEN_0 = @echo " GEN " $@;
|
|
177
|
-
am__v_GEN_1 =
|
|
178
|
-
AM_V_at = $(am__v_at_@AM_V@)
|
|
179
|
-
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
|
180
|
-
am__v_at_0 = @
|
|
181
|
-
am__v_at_1 =
|
|
182
140
|
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
|
183
141
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
|
184
142
|
am__depfiles_maybe = depfiles
|
|
@@ -191,16 +149,20 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|
|
191
149
|
$(AM_CFLAGS) $(CFLAGS)
|
|
192
150
|
AM_V_CC = $(am__v_CC_@AM_V@)
|
|
193
151
|
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
|
194
|
-
am__v_CC_0 = @echo " CC
|
|
195
|
-
|
|
152
|
+
am__v_CC_0 = @echo " CC " $@;
|
|
153
|
+
AM_V_at = $(am__v_at_@AM_V@)
|
|
154
|
+
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
|
155
|
+
am__v_at_0 = @
|
|
196
156
|
CCLD = $(CC)
|
|
197
157
|
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|
198
158
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
|
199
159
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
|
200
160
|
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
|
201
161
|
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
|
202
|
-
am__v_CCLD_0 = @echo " CCLD
|
|
203
|
-
|
|
162
|
+
am__v_CCLD_0 = @echo " CCLD " $@;
|
|
163
|
+
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
|
164
|
+
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
|
165
|
+
am__v_GEN_0 = @echo " GEN " $@;
|
|
204
166
|
SOURCES = $(libusb_1_0_la_SOURCES)
|
|
205
167
|
DIST_SOURCES = $(am__libusb_1_0_la_SOURCES_DIST)
|
|
206
168
|
am__can_run_installinfo = \
|
|
@@ -209,23 +171,6 @@ am__can_run_installinfo = \
|
|
|
209
171
|
*) (install-info --version) >/dev/null 2>&1;; \
|
|
210
172
|
esac
|
|
211
173
|
HEADERS = $(hdr_HEADERS)
|
|
212
|
-
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
|
213
|
-
# Read a list of newline-separated strings from the standard input,
|
|
214
|
-
# and print each of them once, without duplicates. Input order is
|
|
215
|
-
# *not* preserved.
|
|
216
|
-
am__uniquify_input = $(AWK) '\
|
|
217
|
-
BEGIN { nonempty = 0; } \
|
|
218
|
-
{ items[$$0] = 1; nonempty = 1; } \
|
|
219
|
-
END { if (nonempty) { for (i in items) print i; }; } \
|
|
220
|
-
'
|
|
221
|
-
# Make sure the list of sources is unique. This is necessary because,
|
|
222
|
-
# e.g., the same source file might be shared among _SOURCES variables
|
|
223
|
-
# for different programs/libraries.
|
|
224
|
-
am__define_uniq_tagged_files = \
|
|
225
|
-
list='$(am__tagged_files)'; \
|
|
226
|
-
unique=`for i in $$list; do \
|
|
227
|
-
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
228
|
-
done | $(am__uniquify_input)`
|
|
229
174
|
ETAGS = etags
|
|
230
175
|
CTAGS = ctags
|
|
231
176
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
@@ -424,7 +369,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
|
|
424
369
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
|
425
370
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
|
426
371
|
$(am__aclocal_m4_deps):
|
|
427
|
-
|
|
428
372
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|
429
373
|
@$(NORMAL_INSTALL)
|
|
430
374
|
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
|
@@ -451,14 +395,12 @@ uninstall-libLTLIBRARIES:
|
|
|
451
395
|
|
|
452
396
|
clean-libLTLIBRARIES:
|
|
453
397
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
|
454
|
-
@list='$(lib_LTLIBRARIES)'; \
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
rm -f $${locs}; \
|
|
461
|
-
}
|
|
398
|
+
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
|
399
|
+
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
|
400
|
+
test "$$dir" != "$$p" || dir=.; \
|
|
401
|
+
echo "rm -f \"$${dir}/so_locations\""; \
|
|
402
|
+
rm -f "$${dir}/so_locations"; \
|
|
403
|
+
done
|
|
462
404
|
os/$(am__dirstamp):
|
|
463
405
|
@$(MKDIR_P) os
|
|
464
406
|
@: > os/$(am__dirstamp)
|
|
@@ -487,14 +429,33 @@ os/libusb_1_0_la-poll_windows.lo: os/$(am__dirstamp) \
|
|
|
487
429
|
os/$(DEPDIR)/$(am__dirstamp)
|
|
488
430
|
os/libusb_1_0_la-windows_usb.lo: os/$(am__dirstamp) \
|
|
489
431
|
os/$(DEPDIR)/$(am__dirstamp)
|
|
490
|
-
|
|
491
432
|
libusb-1.0.la: $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_DEPENDENCIES) $(EXTRA_libusb_1_0_la_DEPENDENCIES)
|
|
492
433
|
$(AM_V_CCLD)$(libusb_1_0_la_LINK) -rpath $(libdir) $(libusb_1_0_la_OBJECTS) $(libusb_1_0_la_LIBADD) $(LIBS)
|
|
493
434
|
|
|
494
435
|
mostlyclean-compile:
|
|
495
436
|
-rm -f *.$(OBJEXT)
|
|
496
|
-
-rm -f os
|
|
497
|
-
-rm -f os
|
|
437
|
+
-rm -f os/libusb_1_0_la-darwin_usb.$(OBJEXT)
|
|
438
|
+
-rm -f os/libusb_1_0_la-darwin_usb.lo
|
|
439
|
+
-rm -f os/libusb_1_0_la-linux_netlink.$(OBJEXT)
|
|
440
|
+
-rm -f os/libusb_1_0_la-linux_netlink.lo
|
|
441
|
+
-rm -f os/libusb_1_0_la-linux_udev.$(OBJEXT)
|
|
442
|
+
-rm -f os/libusb_1_0_la-linux_udev.lo
|
|
443
|
+
-rm -f os/libusb_1_0_la-linux_usbfs.$(OBJEXT)
|
|
444
|
+
-rm -f os/libusb_1_0_la-linux_usbfs.lo
|
|
445
|
+
-rm -f os/libusb_1_0_la-netbsd_usb.$(OBJEXT)
|
|
446
|
+
-rm -f os/libusb_1_0_la-netbsd_usb.lo
|
|
447
|
+
-rm -f os/libusb_1_0_la-openbsd_usb.$(OBJEXT)
|
|
448
|
+
-rm -f os/libusb_1_0_la-openbsd_usb.lo
|
|
449
|
+
-rm -f os/libusb_1_0_la-poll_posix.$(OBJEXT)
|
|
450
|
+
-rm -f os/libusb_1_0_la-poll_posix.lo
|
|
451
|
+
-rm -f os/libusb_1_0_la-poll_windows.$(OBJEXT)
|
|
452
|
+
-rm -f os/libusb_1_0_la-poll_windows.lo
|
|
453
|
+
-rm -f os/libusb_1_0_la-threads_posix.$(OBJEXT)
|
|
454
|
+
-rm -f os/libusb_1_0_la-threads_posix.lo
|
|
455
|
+
-rm -f os/libusb_1_0_la-threads_windows.$(OBJEXT)
|
|
456
|
+
-rm -f os/libusb_1_0_la-threads_windows.lo
|
|
457
|
+
-rm -f os/libusb_1_0_la-windows_usb.$(OBJEXT)
|
|
458
|
+
-rm -f os/libusb_1_0_la-windows_usb.lo
|
|
498
459
|
|
|
499
460
|
distclean-compile:
|
|
500
461
|
-rm -f *.tab.c
|
|
@@ -688,15 +649,26 @@ uninstall-hdrHEADERS:
|
|
|
688
649
|
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
|
689
650
|
dir='$(DESTDIR)$(hdrdir)'; $(am__uninstall_files_from_dir)
|
|
690
651
|
|
|
691
|
-
ID: $(
|
|
692
|
-
$(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
652
|
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|
653
|
+
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
654
|
+
unique=`for i in $$list; do \
|
|
655
|
+
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
656
|
+
done | \
|
|
657
|
+
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
658
|
+
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
659
|
+
mkid -fID $$unique
|
|
660
|
+
tags: TAGS
|
|
661
|
+
|
|
662
|
+
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
663
|
+
$(TAGS_FILES) $(LISP)
|
|
697
664
|
set x; \
|
|
698
665
|
here=`pwd`; \
|
|
699
|
-
$(
|
|
666
|
+
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
667
|
+
unique=`for i in $$list; do \
|
|
668
|
+
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
669
|
+
done | \
|
|
670
|
+
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
671
|
+
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
700
672
|
shift; \
|
|
701
673
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
|
702
674
|
test -n "$$unique" || unique=$$empty_fix; \
|
|
@@ -708,11 +680,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
|
|
708
680
|
$$unique; \
|
|
709
681
|
fi; \
|
|
710
682
|
fi
|
|
711
|
-
ctags:
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
683
|
+
ctags: CTAGS
|
|
684
|
+
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
685
|
+
$(TAGS_FILES) $(LISP)
|
|
686
|
+
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
687
|
+
unique=`for i in $$list; do \
|
|
688
|
+
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
689
|
+
done | \
|
|
690
|
+
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
691
|
+
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
716
692
|
test -z "$(CTAGS_ARGS)$$unique" \
|
|
717
693
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|
718
694
|
$$unique
|
|
@@ -721,21 +697,6 @@ GTAGS:
|
|
|
721
697
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
|
722
698
|
&& $(am__cd) $(top_srcdir) \
|
|
723
699
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
|
724
|
-
cscopelist: cscopelist-am
|
|
725
|
-
|
|
726
|
-
cscopelist-am: $(am__tagged_files)
|
|
727
|
-
list='$(am__tagged_files)'; \
|
|
728
|
-
case "$(srcdir)" in \
|
|
729
|
-
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
|
730
|
-
*) sdir=$(subdir)/$(srcdir) ;; \
|
|
731
|
-
esac; \
|
|
732
|
-
for i in $$list; do \
|
|
733
|
-
if test -f "$$i"; then \
|
|
734
|
-
echo "$(subdir)/$$i"; \
|
|
735
|
-
else \
|
|
736
|
-
echo "$$sdir/$$i"; \
|
|
737
|
-
fi; \
|
|
738
|
-
done >> $(top_builddir)/cscope.files
|
|
739
700
|
|
|
740
701
|
distclean-tags:
|
|
741
702
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
|
@@ -882,20 +843,19 @@ uninstall-am: uninstall-hdrHEADERS uninstall-libLTLIBRARIES
|
|
|
882
843
|
|
|
883
844
|
.MAKE: install-am install-strip
|
|
884
845
|
|
|
885
|
-
.PHONY: CTAGS GTAGS
|
|
886
|
-
clean-libLTLIBRARIES clean-libtool
|
|
887
|
-
|
|
888
|
-
distclean-
|
|
889
|
-
|
|
890
|
-
install-
|
|
891
|
-
install-
|
|
892
|
-
install-html-am install-info install-info-am \
|
|
846
|
+
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
|
847
|
+
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
|
848
|
+
distclean-compile distclean-generic distclean-libtool \
|
|
849
|
+
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
|
850
|
+
install install-am install-data install-data-am install-dvi \
|
|
851
|
+
install-dvi-am install-exec install-exec-am install-hdrHEADERS \
|
|
852
|
+
install-html install-html-am install-info install-info-am \
|
|
893
853
|
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
|
894
854
|
install-ps install-ps-am install-strip installcheck \
|
|
895
855
|
installcheck-am installdirs maintainer-clean \
|
|
896
856
|
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
|
897
857
|
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
|
898
|
-
tags
|
|
858
|
+
tags uninstall uninstall-am uninstall-hdrHEADERS \
|
|
899
859
|
uninstall-libLTLIBRARIES
|
|
900
860
|
|
|
901
861
|
all: libusb-1.0.la libusb-1.0.dll
|
|
@@ -905,7 +865,7 @@ all: libusb-1.0.la libusb-1.0.dll
|
|
|
905
865
|
|
|
906
866
|
@OS_WINDOWS_TRUE@libusb-1.0.rc: version.h version_nano.h
|
|
907
867
|
|
|
908
|
-
libusb-1.0.dll: libusb-1.0.def
|
|
868
|
+
libusb-1.0.dll: libusb-1.0.def libusb-1.0.la
|
|
909
869
|
# Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
|
|
910
870
|
@CREATE_IMPORT_LIB_TRUE@ $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
|
|
911
871
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Core functions for
|
|
3
|
+
* Core functions for libusb
|
|
4
4
|
* Copyright © 2012-2013 Nathan Hjelm <hjelmn@cs.unm.edu>
|
|
5
5
|
* Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
|
|
6
6
|
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
|
@@ -63,7 +63,7 @@ const struct usbi_os_backend * const usbi_backend = &wince_backend;
|
|
|
63
63
|
struct libusb_context *usbi_default_context = NULL;
|
|
64
64
|
static const struct libusb_version libusb_version_internal =
|
|
65
65
|
{ LIBUSB_MAJOR, LIBUSB_MINOR, LIBUSB_MICRO, LIBUSB_NANO,
|
|
66
|
-
LIBUSB_RC, "http://
|
|
66
|
+
LIBUSB_RC, "http://libusb.info" };
|
|
67
67
|
static int default_context_refcnt = 0;
|
|
68
68
|
static usbi_mutex_static_t default_context_lock = USBI_MUTEX_INITIALIZER;
|
|
69
69
|
static struct timeval timestamp_origin = { 0, 0 };
|
|
@@ -72,18 +72,18 @@ usbi_mutex_static_t active_contexts_lock = USBI_MUTEX_INITIALIZER;
|
|
|
72
72
|
struct list_head active_contexts_list;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* \mainpage
|
|
75
|
+
* \mainpage libusb-1.0 API Reference
|
|
76
76
|
*
|
|
77
77
|
* \section intro Introduction
|
|
78
78
|
*
|
|
79
|
-
*
|
|
79
|
+
* libusb is an open source library that allows you to communicate with USB
|
|
80
80
|
* devices from userspace. For more info, see the
|
|
81
|
-
* <a href="http://
|
|
81
|
+
* <a href="http://libusb.info">libusb homepage</a>.
|
|
82
82
|
*
|
|
83
83
|
* This documentation is aimed at application developers wishing to
|
|
84
84
|
* communicate with USB peripherals from their own software. After reviewing
|
|
85
85
|
* this documentation, feedback and questions can be sent to the
|
|
86
|
-
* <a href="http://mailing-list.
|
|
86
|
+
* <a href="http://mailing-list.libusb.info">libusb-devel mailing list</a>.
|
|
87
87
|
*
|
|
88
88
|
* This documentation assumes knowledge of how to operate USB devices from
|
|
89
89
|
* a software standpoint (descriptors, configurations, interfaces, endpoints,
|
|
@@ -107,25 +107,25 @@ struct list_head active_contexts_list;
|
|
|
107
107
|
* \section gettingstarted Getting Started
|
|
108
108
|
*
|
|
109
109
|
* To begin reading the API documentation, start with the Modules page which
|
|
110
|
-
* links to the different categories of
|
|
110
|
+
* links to the different categories of libusb's functionality.
|
|
111
111
|
*
|
|
112
112
|
* One decision you will have to make is whether to use the synchronous
|
|
113
113
|
* or the asynchronous data transfer interface. The \ref io documentation
|
|
114
114
|
* provides some insight into this topic.
|
|
115
115
|
*
|
|
116
|
-
* Some example programs can be found in the
|
|
117
|
-
* the "examples" subdirectory. The
|
|
118
|
-
* real-life project examples which use
|
|
116
|
+
* Some example programs can be found in the libusb source distribution under
|
|
117
|
+
* the "examples" subdirectory. The libusb homepage includes a list of
|
|
118
|
+
* real-life project examples which use libusb.
|
|
119
119
|
*
|
|
120
120
|
* \section errorhandling Error handling
|
|
121
121
|
*
|
|
122
|
-
*
|
|
122
|
+
* libusb functions typically return 0 on success or a negative error code
|
|
123
123
|
* on failure. These negative error codes relate to LIBUSB_ERROR constants
|
|
124
124
|
* which are listed on the \ref misc "miscellaneous" documentation page.
|
|
125
125
|
*
|
|
126
126
|
* \section msglog Debug message logging
|
|
127
127
|
*
|
|
128
|
-
*
|
|
128
|
+
* libusb uses stderr for all logging. By default, logging is set to NONE,
|
|
129
129
|
* which means that no output will be produced. However, unless the library
|
|
130
130
|
* has been compiled with logging disabled, then any application calls to
|
|
131
131
|
* libusb_set_debug(), or the setting of the environmental variable
|
|
@@ -134,19 +134,19 @@ struct list_head active_contexts_list;
|
|
|
134
134
|
* direct it to the null device if its output is undesireable.
|
|
135
135
|
*
|
|
136
136
|
* The libusb_set_debug() function can be used to enable logging of certain
|
|
137
|
-
* messages. Under standard configuration,
|
|
137
|
+
* messages. Under standard configuration, libusb doesn't really log much
|
|
138
138
|
* so you are advised to use this function to enable all error/warning/
|
|
139
139
|
* informational messages. It will help debug problems with your software.
|
|
140
140
|
*
|
|
141
141
|
* The logged messages are unstructured. There is no one-to-one correspondence
|
|
142
142
|
* between messages being logged and success or failure return codes from
|
|
143
|
-
*
|
|
143
|
+
* libusb functions. There is no format to the messages, so you should not
|
|
144
144
|
* try to capture or parse them. They are not and will not be localized.
|
|
145
145
|
* These messages are not intended to being passed to your application user;
|
|
146
|
-
* instead, you should interpret the error codes returned from
|
|
146
|
+
* instead, you should interpret the error codes returned from libusb functions
|
|
147
147
|
* and provide appropriate notification to the user. The messages are simply
|
|
148
148
|
* there to aid you as a programmer, and if you're confused because you're
|
|
149
|
-
* getting a strange error code from a
|
|
149
|
+
* getting a strange error code from a libusb function, enabling message
|
|
150
150
|
* logging may give you a suitable explanation.
|
|
151
151
|
*
|
|
152
152
|
* The LIBUSB_DEBUG environment variable can be used to enable message logging
|
|
@@ -155,18 +155,18 @@ struct list_head active_contexts_list;
|
|
|
155
155
|
* environment variable is set, the message logging verbosity level is fixed
|
|
156
156
|
* and libusb_set_debug() effectively does nothing.
|
|
157
157
|
*
|
|
158
|
-
*
|
|
158
|
+
* libusb can be compiled without any logging functions, useful for embedded
|
|
159
159
|
* systems. In this case, libusb_set_debug() and the LIBUSB_DEBUG environment
|
|
160
160
|
* variable have no effects.
|
|
161
161
|
*
|
|
162
|
-
*
|
|
162
|
+
* libusb can also be compiled with verbose debugging messages always. When
|
|
163
163
|
* the library is compiled in this way, all messages of all verbosities are
|
|
164
164
|
* always logged. libusb_set_debug() and the LIBUSB_DEBUG environment variable
|
|
165
165
|
* have no effects.
|
|
166
166
|
*
|
|
167
167
|
* \section remarks Other remarks
|
|
168
168
|
*
|
|
169
|
-
*
|
|
169
|
+
* libusb does have imperfections. The \ref caveats "caveats" page attempts
|
|
170
170
|
* to document these.
|
|
171
171
|
*/
|
|
172
172
|
|
|
@@ -181,7 +181,7 @@ struct list_head active_contexts_list;
|
|
|
181
181
|
* reset).
|
|
182
182
|
*
|
|
183
183
|
* The problem is that any other program could reset the device your program
|
|
184
|
-
* is working with, at any time.
|
|
184
|
+
* is working with, at any time. libusb does not offer a mechanism to inform
|
|
185
185
|
* you when this has happened, so if someone else resets your device it will
|
|
186
186
|
* not be clear to your own program why the device state has changed.
|
|
187
187
|
*
|
|
@@ -206,7 +206,7 @@ struct list_head active_contexts_list;
|
|
|
206
206
|
*
|
|
207
207
|
* \section configsel Configuration selection and handling
|
|
208
208
|
*
|
|
209
|
-
* When
|
|
209
|
+
* When libusb presents a device handle to an application, there is a chance
|
|
210
210
|
* that the corresponding device may be in unconfigured state. For devices
|
|
211
211
|
* with multiple configurations, there is also a chance that the configuration
|
|
212
212
|
* currently selected is not the one that the application wants to use.
|
|
@@ -217,13 +217,13 @@ struct list_head active_contexts_list;
|
|
|
217
217
|
* -# If the device is already in the desired configuration, calling
|
|
218
218
|
* libusb_set_configuration() using the same configuration value will cause
|
|
219
219
|
* a lightweight device reset. This may not be desirable behaviour.
|
|
220
|
-
* -#
|
|
220
|
+
* -# libusb will be unable to change configuration if the device is in
|
|
221
221
|
* another configuration and other programs or drivers have claimed
|
|
222
222
|
* interfaces under that configuration.
|
|
223
|
-
* -# In the case where the desired configuration is already active,
|
|
223
|
+
* -# In the case where the desired configuration is already active, libusb
|
|
224
224
|
* may not even be able to perform a lightweight device reset. For example,
|
|
225
225
|
* take my USB keyboard with fingerprint reader: I'm interested in driving
|
|
226
|
-
* the fingerprint reader interface through
|
|
226
|
+
* the fingerprint reader interface through libusb, but the kernel's
|
|
227
227
|
* USB-HID driver will almost always have claimed the keyboard interface.
|
|
228
228
|
* Because the kernel has claimed an interface, it is not even possible to
|
|
229
229
|
* perform the lightweight device reset, so libusb_set_configuration() will
|
|
@@ -263,13 +263,13 @@ if (cfg != desired)
|
|
|
263
263
|
* considerations apply to Darwin or other platforms.
|
|
264
264
|
*
|
|
265
265
|
* When a transfer completes early (i.e. when less data is received/sent in
|
|
266
|
-
* any one packet than the transfer buffer allows for) then
|
|
266
|
+
* any one packet than the transfer buffer allows for) then libusb is designed
|
|
267
267
|
* to terminate the transfer immediately, not transferring or receiving any
|
|
268
268
|
* more data unless other transfers have been queued by the user.
|
|
269
269
|
*
|
|
270
|
-
* On legacy platforms,
|
|
270
|
+
* On legacy platforms, libusb is unable to do this in all situations. After
|
|
271
271
|
* the incomplete packet occurs, "surplus" data may be transferred. For recent
|
|
272
|
-
* versions of
|
|
272
|
+
* versions of libusb, this information is kept (the data length of the
|
|
273
273
|
* transfer is updated) and, for device-to-host transfers, any surplus data was
|
|
274
274
|
* added to the buffer. Still, this is not a nice solution because it loses the
|
|
275
275
|
* information about the end of the short packet, and the user probably wanted
|
|
@@ -278,7 +278,7 @@ if (cfg != desired)
|
|
|
278
278
|
*
|
|
279
279
|
* \section zlp Zero length packets
|
|
280
280
|
*
|
|
281
|
-
* -
|
|
281
|
+
* - libusb is able to send a packet of zero length to an endpoint simply by
|
|
282
282
|
* submitting a transfer of zero length.
|
|
283
283
|
* - The \ref libusb_transfer_flags::LIBUSB_TRANSFER_ADD_ZERO_PACKET
|
|
284
284
|
* "LIBUSB_TRANSFER_ADD_ZERO_PACKET" flag is currently only supported on Linux.
|
|
@@ -287,24 +287,24 @@ if (cfg != desired)
|
|
|
287
287
|
/**
|
|
288
288
|
* \page contexts Contexts
|
|
289
289
|
*
|
|
290
|
-
* It is possible that
|
|
290
|
+
* It is possible that libusb may be used simultaneously from two independent
|
|
291
291
|
* libraries linked into the same executable. For example, if your application
|
|
292
292
|
* has a plugin-like system which allows the user to dynamically load a range
|
|
293
293
|
* of modules into your program, it is feasible that two independently
|
|
294
|
-
* developed modules may both use
|
|
294
|
+
* developed modules may both use libusb.
|
|
295
295
|
*
|
|
296
|
-
*
|
|
297
|
-
* "instances" of
|
|
296
|
+
* libusb is written to allow for these multiple user scenarios. The two
|
|
297
|
+
* "instances" of libusb will not interfere: libusb_set_debug() calls
|
|
298
298
|
* from one user will not affect the same settings for other users, other
|
|
299
|
-
* users can continue using
|
|
299
|
+
* users can continue using libusb after one of them calls libusb_exit(), etc.
|
|
300
300
|
*
|
|
301
|
-
* This is made possible through
|
|
301
|
+
* This is made possible through libusb's <em>context</em> concept. When you
|
|
302
302
|
* call libusb_init(), you are (optionally) given a context. You can then pass
|
|
303
|
-
* this context pointer back into future
|
|
303
|
+
* this context pointer back into future libusb functions.
|
|
304
304
|
*
|
|
305
305
|
* In order to keep things simple for more simplistic applications, it is
|
|
306
306
|
* legal to pass NULL to all functions requiring a context pointer (as long as
|
|
307
|
-
* you're sure no other code will attempt to use
|
|
307
|
+
* you're sure no other code will attempt to use libusb from the same process).
|
|
308
308
|
* When you pass NULL, the default context will be used. The default context
|
|
309
309
|
* is created the first time a process calls libusb_init() when no other
|
|
310
310
|
* context is alive. Contexts are destroyed during libusb_exit().
|
|
@@ -317,17 +317,17 @@ if (cfg != desired)
|
|
|
317
317
|
* reference count goes from 0 to 1, and is deinitialized and destroyed when
|
|
318
318
|
* its reference count goes from 1 to 0.
|
|
319
319
|
*
|
|
320
|
-
* You may be wondering why only a subset of
|
|
321
|
-
* context pointer in their function definition. Internally,
|
|
320
|
+
* You may be wondering why only a subset of libusb functions require a
|
|
321
|
+
* context pointer in their function definition. Internally, libusb stores
|
|
322
322
|
* context pointers in other objects (e.g. libusb_device instances) and hence
|
|
323
323
|
* can infer the context from those objects.
|
|
324
324
|
*/
|
|
325
325
|
|
|
326
326
|
/**
|
|
327
327
|
* @defgroup lib Library initialization/deinitialization
|
|
328
|
-
* This page details how to initialize and deinitialize
|
|
329
|
-
* must be performed before using any
|
|
330
|
-
* must not call any
|
|
328
|
+
* This page details how to initialize and deinitialize libusb. Initialization
|
|
329
|
+
* must be performed before using any libusb functionality, and similarly you
|
|
330
|
+
* must not call any libusb functions after deinitialization.
|
|
331
331
|
*/
|
|
332
332
|
|
|
333
333
|
/**
|
|
@@ -384,7 +384,7 @@ libusb_free_device_list(list, 1);
|
|
|
384
384
|
* device.
|
|
385
385
|
*
|
|
386
386
|
* \section devshandles Devices and device handles
|
|
387
|
-
*
|
|
387
|
+
* libusb has a concept of a USB device, represented by the
|
|
388
388
|
* \ref libusb_device opaque type. A device represents a USB device that
|
|
389
389
|
* is currently or was previously connected to the system. Using a reference
|
|
390
390
|
* to a device, you can determine certain information about the device (e.g.
|
|
@@ -400,8 +400,8 @@ libusb_free_device_list(list, 1);
|
|
|
400
400
|
* using the device.
|
|
401
401
|
*
|
|
402
402
|
* When you've found a device that you'd like to operate, you must ask
|
|
403
|
-
*
|
|
404
|
-
* success,
|
|
403
|
+
* libusb to open the device using the libusb_open() function. Assuming
|
|
404
|
+
* success, libusb then returns you a <em>device handle</em>
|
|
405
405
|
* (a \ref libusb_device_handle pointer). All "real" I/O operations then
|
|
406
406
|
* operate on the handle rather than the original device pointer.
|
|
407
407
|
*
|
|
@@ -409,10 +409,10 @@ libusb_free_device_list(list, 1);
|
|
|
409
409
|
*
|
|
410
410
|
* Device discovery (i.e. calling libusb_get_device_list()) returns a
|
|
411
411
|
* freshly-allocated list of devices. The list itself must be freed when
|
|
412
|
-
* you are done with it.
|
|
412
|
+
* you are done with it. libusb also needs to know when it is OK to free
|
|
413
413
|
* the contents of the list - the devices themselves.
|
|
414
414
|
*
|
|
415
|
-
* To handle these issues,
|
|
415
|
+
* To handle these issues, libusb provides you with two separate items:
|
|
416
416
|
* - A function to free the list itself
|
|
417
417
|
* - A reference counting system for the devices inside
|
|
418
418
|
*
|
|
@@ -608,7 +608,7 @@ int usbi_sanitize_device(struct libusb_device *dev)
|
|
|
608
608
|
return 0;
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
/* Examine
|
|
611
|
+
/* Examine libusb's internal list of known devices, looking for one with
|
|
612
612
|
* a specific session ID. Returns the matching device if it was found, and
|
|
613
613
|
* NULL otherwise. */
|
|
614
614
|
struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
|
|
@@ -620,7 +620,7 @@ struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
|
|
|
620
620
|
usbi_mutex_lock(&ctx->usb_devs_lock);
|
|
621
621
|
list_for_each_entry(dev, &ctx->usb_devs, list, struct libusb_device)
|
|
622
622
|
if (dev->session_data == session_id) {
|
|
623
|
-
ret = dev;
|
|
623
|
+
ret = libusb_ref_device(dev);
|
|
624
624
|
break;
|
|
625
625
|
}
|
|
626
626
|
usbi_mutex_unlock(&ctx->usb_devs_lock);
|
|
@@ -763,7 +763,7 @@ uint8_t API_EXPORTED libusb_get_port_number(libusb_device *dev)
|
|
|
763
763
|
/** \ingroup dev
|
|
764
764
|
* Get the list of all port numbers from root for the specified device
|
|
765
765
|
*
|
|
766
|
-
* Since version 1.0.16, \ref
|
|
766
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
|
767
767
|
* \param dev a device
|
|
768
768
|
* \param port_numbers the array that should contain the port numbers
|
|
769
769
|
* \param port_numbers_len the maximum length of the array. As per the USB 3.0
|
|
@@ -811,7 +811,7 @@ int API_EXPORTED libusb_get_port_path(libusb_context *ctx, libusb_device *dev,
|
|
|
811
811
|
* \returns the device parent or NULL if not available
|
|
812
812
|
* You should issue a \ref libusb_get_device_list() before calling this
|
|
813
813
|
* function and make sure that you only access the parent before issuing
|
|
814
|
-
* \ref libusb_free_device_list(). The reason is that
|
|
814
|
+
* \ref libusb_free_device_list(). The reason is that libusb currently does
|
|
815
815
|
* not maintain a permanent list of device instances, and therefore can
|
|
816
816
|
* only guarantee that parents are fully instantiated within a
|
|
817
817
|
* libusb_get_device_list() - libusb_free_device_list() block.
|
|
@@ -1120,7 +1120,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
|
|
|
1120
1120
|
/* At this point, we want to interrupt any existing event handlers so
|
|
1121
1121
|
* that they realise the addition of the new device's poll fd. One
|
|
1122
1122
|
* example when this is desirable is if the user is running a separate
|
|
1123
|
-
* dedicated
|
|
1123
|
+
* dedicated libusb events handling thread, which is running with a long
|
|
1124
1124
|
* or infinite timeout. We want to interrupt that iteration of the loop,
|
|
1125
1125
|
* so that it picks up the new fd, and then continues. */
|
|
1126
1126
|
usbi_fd_notification(ctx);
|
|
@@ -1131,7 +1131,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
|
|
|
1131
1131
|
/** \ingroup dev
|
|
1132
1132
|
* Convenience function for finding a device with a particular
|
|
1133
1133
|
* <tt>idVendor</tt>/<tt>idProduct</tt> combination. This function is intended
|
|
1134
|
-
* for those scenarios where you are using
|
|
1134
|
+
* for those scenarios where you are using libusb to knock up a quick test
|
|
1135
1135
|
* application - it allows you to avoid calling libusb_get_device_list() and
|
|
1136
1136
|
* worrying about traversing/freeing the list.
|
|
1137
1137
|
*
|
|
@@ -1425,7 +1425,7 @@ int API_EXPORTED libusb_set_configuration(libusb_device_handle *dev,
|
|
|
1425
1425
|
* you wish to use before you can perform I/O on any of its endpoints.
|
|
1426
1426
|
*
|
|
1427
1427
|
* It is legal to attempt to claim an already-claimed interface, in which
|
|
1428
|
-
* case
|
|
1428
|
+
* case libusb just returns 0 without doing anything.
|
|
1429
1429
|
*
|
|
1430
1430
|
* If auto_detach_kernel_driver is set to 1 for <tt>dev</tt>, the kernel driver
|
|
1431
1431
|
* will be detached if necessary, on failure the detach error is returned.
|
|
@@ -1617,7 +1617,7 @@ int API_EXPORTED libusb_reset_device(libusb_device_handle *dev)
|
|
|
1617
1617
|
|
|
1618
1618
|
/** \ingroup dev
|
|
1619
1619
|
* Determine if a kernel driver is active on an interface. If a kernel driver
|
|
1620
|
-
* is active, you cannot claim the interface, and
|
|
1620
|
+
* is active, you cannot claim the interface, and libusb will be unable to
|
|
1621
1621
|
* perform I/O.
|
|
1622
1622
|
*
|
|
1623
1623
|
* This functionality is not available on Windows.
|
|
@@ -1652,7 +1652,7 @@ int API_EXPORTED libusb_kernel_driver_active(libusb_device_handle *dev,
|
|
|
1652
1652
|
*
|
|
1653
1653
|
* This functionality is not available on Darwin or Windows.
|
|
1654
1654
|
*
|
|
1655
|
-
* Note that
|
|
1655
|
+
* Note that libusb itself also talks to the device through a special kernel
|
|
1656
1656
|
* driver, if this driver is already attached to the device, this call will
|
|
1657
1657
|
* not detach it and return LIBUSB_ERROR_NOT_FOUND.
|
|
1658
1658
|
*
|
|
@@ -1716,15 +1716,15 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev,
|
|
|
1716
1716
|
}
|
|
1717
1717
|
|
|
1718
1718
|
/** \ingroup dev
|
|
1719
|
-
* Enable/disable
|
|
1720
|
-
* enabled
|
|
1719
|
+
* Enable/disable libusb's automatic kernel driver detachment. When this is
|
|
1720
|
+
* enabled libusb will automatically detach the kernel driver on an interface
|
|
1721
1721
|
* when claiming the interface, and attach it when releasing the interface.
|
|
1722
1722
|
*
|
|
1723
1723
|
* Automatic kernel driver detachment is disabled on newly opened device
|
|
1724
1724
|
* handles by default.
|
|
1725
1725
|
*
|
|
1726
1726
|
* On platforms which do not have LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
|
|
1727
|
-
* this function will return LIBUSB_ERROR_NOT_SUPPORTED, and
|
|
1727
|
+
* this function will return LIBUSB_ERROR_NOT_SUPPORTED, and libusb will
|
|
1728
1728
|
* continue as if this function was never called.
|
|
1729
1729
|
*
|
|
1730
1730
|
* \param dev a device handle
|
|
@@ -1754,19 +1754,19 @@ int API_EXPORTED libusb_set_auto_detach_kernel_driver(
|
|
|
1754
1754
|
* printed. If you choose to increase the message verbosity level, ensure
|
|
1755
1755
|
* that your application does not close the stdout/stderr file descriptors.
|
|
1756
1756
|
*
|
|
1757
|
-
* You are advised to use level LIBUSB_LOG_LEVEL_WARNING.
|
|
1757
|
+
* You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusb is conservative
|
|
1758
1758
|
* with its message logging and most of the time, will only log messages that
|
|
1759
1759
|
* explain error conditions and other oddities. This will help you debug
|
|
1760
1760
|
* your software.
|
|
1761
1761
|
*
|
|
1762
|
-
* If the LIBUSB_DEBUG environment variable was set when
|
|
1762
|
+
* If the LIBUSB_DEBUG environment variable was set when libusb was
|
|
1763
1763
|
* initialized, this function does nothing: the message verbosity is fixed
|
|
1764
1764
|
* to the value in the environment variable.
|
|
1765
1765
|
*
|
|
1766
|
-
* If
|
|
1766
|
+
* If libusb was compiled without any message logging, this function does
|
|
1767
1767
|
* nothing: you'll never get any messages.
|
|
1768
1768
|
*
|
|
1769
|
-
* If
|
|
1769
|
+
* If libusb was compiled with verbose debug message logging, this function
|
|
1770
1770
|
* does nothing: you'll always get messages from all levels.
|
|
1771
1771
|
*
|
|
1772
1772
|
* \param ctx the context to operate on, or NULL for the default context
|
|
@@ -1781,7 +1781,7 @@ void API_EXPORTED libusb_set_debug(libusb_context *ctx, int level)
|
|
|
1781
1781
|
|
|
1782
1782
|
/** \ingroup lib
|
|
1783
1783
|
* Initialize libusb. This function must be called before calling any other
|
|
1784
|
-
*
|
|
1784
|
+
* libusb function.
|
|
1785
1785
|
*
|
|
1786
1786
|
* If you do not provide an output location for a context pointer, a default
|
|
1787
1787
|
* context will be created. If there was already a default context, it will
|
|
@@ -1836,7 +1836,7 @@ int API_EXPORTED libusb_init(libusb_context **context)
|
|
|
1836
1836
|
usbi_dbg("created default context");
|
|
1837
1837
|
}
|
|
1838
1838
|
|
|
1839
|
-
usbi_dbg("
|
|
1839
|
+
usbi_dbg("libusb v%d.%d.%d.%d", libusb_version_internal.major, libusb_version_internal.minor,
|
|
1840
1840
|
libusb_version_internal.micro, libusb_version_internal.nano);
|
|
1841
1841
|
|
|
1842
1842
|
usbi_mutex_init(&ctx->usb_devs_lock, NULL);
|
|
@@ -1907,6 +1907,7 @@ err_unlock:
|
|
|
1907
1907
|
void API_EXPORTED libusb_exit(struct libusb_context *ctx)
|
|
1908
1908
|
{
|
|
1909
1909
|
struct libusb_device *dev, *next;
|
|
1910
|
+
struct timeval tv = { 0, 0 };
|
|
1910
1911
|
|
|
1911
1912
|
usbi_dbg("");
|
|
1912
1913
|
USBI_GET_CONTEXT(ctx);
|
|
@@ -1931,6 +1932,19 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx)
|
|
|
1931
1932
|
|
|
1932
1933
|
if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) {
|
|
1933
1934
|
usbi_hotplug_deregister_all(ctx);
|
|
1935
|
+
|
|
1936
|
+
/*
|
|
1937
|
+
* Ensure any pending unplug events are read from the hotplug
|
|
1938
|
+
* pipe. The usb_device-s hold in the events are no longer part
|
|
1939
|
+
* of usb_devs, but the events still hold a reference!
|
|
1940
|
+
*
|
|
1941
|
+
* Note we don't do this if the application has left devices
|
|
1942
|
+
* open (which implies a buggy app) to avoid packet completion
|
|
1943
|
+
* handlers running when the app does not expect them to run.
|
|
1944
|
+
*/
|
|
1945
|
+
if (list_empty(&ctx->open_devs))
|
|
1946
|
+
libusb_handle_events_timeout(ctx, &tv);
|
|
1947
|
+
|
|
1934
1948
|
usbi_mutex_lock(&ctx->usb_devs_lock);
|
|
1935
1949
|
list_for_each_entry_safe(dev, next, &ctx->usb_devs, list, struct libusb_device) {
|
|
1936
1950
|
list_del(&dev->list);
|
|
@@ -2082,17 +2096,24 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
|
|
|
2082
2096
|
global_debug = 1;
|
|
2083
2097
|
UNUSED(ctx);
|
|
2084
2098
|
#else
|
|
2099
|
+
int ctx_level = 0;
|
|
2100
|
+
|
|
2085
2101
|
USBI_GET_CONTEXT(ctx);
|
|
2086
|
-
if (ctx
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2102
|
+
if (ctx) {
|
|
2103
|
+
ctx_level = ctx->debug;
|
|
2104
|
+
} else {
|
|
2105
|
+
char *dbg = getenv("LIBUSB_DEBUG");
|
|
2106
|
+
if (dbg)
|
|
2107
|
+
ctx_level = atoi(dbg);
|
|
2108
|
+
}
|
|
2109
|
+
global_debug = (ctx_level == LIBUSB_LOG_LEVEL_DEBUG);
|
|
2110
|
+
if (!ctx_level)
|
|
2090
2111
|
return;
|
|
2091
|
-
if (level == LIBUSB_LOG_LEVEL_WARNING &&
|
|
2112
|
+
if (level == LIBUSB_LOG_LEVEL_WARNING && ctx_level < LIBUSB_LOG_LEVEL_WARNING)
|
|
2092
2113
|
return;
|
|
2093
|
-
if (level == LIBUSB_LOG_LEVEL_INFO &&
|
|
2114
|
+
if (level == LIBUSB_LOG_LEVEL_INFO && ctx_level < LIBUSB_LOG_LEVEL_INFO)
|
|
2094
2115
|
return;
|
|
2095
|
-
if (level == LIBUSB_LOG_LEVEL_DEBUG &&
|
|
2116
|
+
if (level == LIBUSB_LOG_LEVEL_DEBUG && ctx_level < LIBUSB_LOG_LEVEL_DEBUG)
|
|
2096
2117
|
return;
|
|
2097
2118
|
#endif
|
|
2098
2119
|
|
|
@@ -2131,11 +2152,11 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
|
|
|
2131
2152
|
|
|
2132
2153
|
if (global_debug) {
|
|
2133
2154
|
header_len = snprintf(buf, sizeof(buf),
|
|
2134
|
-
"[%2d.%06d] [%08x]
|
|
2155
|
+
"[%2d.%06d] [%08x] libusb: %s [%s] ",
|
|
2135
2156
|
(int)now.tv_sec, (int)now.tv_usec, usbi_get_tid(), prefix, function);
|
|
2136
2157
|
} else {
|
|
2137
2158
|
header_len = snprintf(buf, sizeof(buf),
|
|
2138
|
-
"
|
|
2159
|
+
"libusb: %s [%s] ", prefix, function);
|
|
2139
2160
|
}
|
|
2140
2161
|
|
|
2141
2162
|
if (header_len < 0 || header_len >= sizeof(buf)) {
|
|
@@ -2172,7 +2193,7 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
|
|
|
2172
2193
|
}
|
|
2173
2194
|
|
|
2174
2195
|
/** \ingroup misc
|
|
2175
|
-
* Returns a constant NULL-terminated string with the ASCII name of a
|
|
2196
|
+
* Returns a constant NULL-terminated string with the ASCII name of a libusb
|
|
2176
2197
|
* error or transfer status code. The caller must not free() the returned
|
|
2177
2198
|
* string.
|
|
2178
2199
|
*
|