libusb 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
File without changes
|
@@ -41,7 +41,7 @@ BEGIN
|
|
41
41
|
BEGIN
|
42
42
|
BLOCK "040904b0"
|
43
43
|
BEGIN
|
44
|
-
VALUE "CompanyName", "
|
44
|
+
VALUE "CompanyName", "libusb.info\0"
|
45
45
|
VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0"
|
46
46
|
VALUE "FileVersion", LIBUSB_VERSIONSTRING
|
47
47
|
VALUE "InternalName", "libusb\0"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/*
|
2
|
-
* Public
|
2
|
+
* Public libusb header file
|
3
3
|
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
4
4
|
* Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
|
5
5
|
* Copyright © 2012 Pete Batard <pete@akeo.ie>
|
6
6
|
* Copyright © 2012 Nathan Hjelm <hjelmn@cs.unm.edu>
|
7
|
-
* For more information, please visit: http://
|
7
|
+
* For more information, please visit: http://libusb.info
|
8
8
|
*
|
9
9
|
* This library is free software; you can redistribute it and/or
|
10
10
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -62,7 +62,7 @@ typedef unsigned __int32 uint32_t;
|
|
62
62
|
#include <limits.h>
|
63
63
|
|
64
64
|
/* 'interface' might be defined as a macro on Windows, so we need to
|
65
|
-
* undefine it so as not to break the current
|
65
|
+
* undefine it so as not to break the current libusb API, because
|
66
66
|
* libusb_config_descriptor has an 'interface' member
|
67
67
|
* As this can be problematic if you include windows.h after libusb.h
|
68
68
|
* in your sources, we force windows.h to be included first. */
|
@@ -85,14 +85,14 @@ typedef unsigned __int32 uint32_t;
|
|
85
85
|
|
86
86
|
/** \def LIBUSB_CALL
|
87
87
|
* \ingroup misc
|
88
|
-
*
|
88
|
+
* libusb's Windows calling convention.
|
89
89
|
*
|
90
90
|
* Under Windows, the selection of available compilers and configurations
|
91
91
|
* means that, unlike other platforms, there is not <em>one true calling
|
92
92
|
* convention</em> (calling convention: the manner in which parameters are
|
93
93
|
* passed to funcions in the generated assembly code).
|
94
94
|
*
|
95
|
-
* Matching the Windows API itself,
|
95
|
+
* Matching the Windows API itself, libusb uses the WINAPI convention (which
|
96
96
|
* translates to the <tt>stdcall</tt> convention) and guarantees that the
|
97
97
|
* library is compiled in this way. The public header file also includes
|
98
98
|
* appropriate annotations so that your own software will use the right
|
@@ -100,7 +100,7 @@ typedef unsigned __int32 uint32_t;
|
|
100
100
|
* your codebase.
|
101
101
|
*
|
102
102
|
* The one consideration that you must apply in your software is to mark
|
103
|
-
* all functions which you use as
|
103
|
+
* all functions which you use as libusb callbacks with this LIBUSB_CALL
|
104
104
|
* annotation, so that they too get compiled for the correct calling
|
105
105
|
* convention.
|
106
106
|
*
|
@@ -108,7 +108,7 @@ typedef unsigned __int32 uint32_t;
|
|
108
108
|
* means that you can apply it to your code without worrying about
|
109
109
|
* cross-platform compatibility.
|
110
110
|
*/
|
111
|
-
/* LIBUSB_CALL must be defined on both definition and declaration of
|
111
|
+
/* LIBUSB_CALL must be defined on both definition and declaration of libusb
|
112
112
|
* functions. You'd think that declaration would be enough, but cygwin will
|
113
113
|
* complain about conflicting types unless both are marked this way.
|
114
114
|
* The placement of this macro is important too; it must appear after the
|
@@ -121,36 +121,39 @@ typedef unsigned __int32 uint32_t;
|
|
121
121
|
#define LIBUSB_CALL
|
122
122
|
#endif
|
123
123
|
|
124
|
-
/** \def
|
124
|
+
/** \def LIBUSB_API_VERSION
|
125
125
|
* \ingroup misc
|
126
|
-
*
|
126
|
+
* libusb's API version.
|
127
127
|
*
|
128
|
-
* Since version 1.0.13, to help with feature detection,
|
129
|
-
* a
|
128
|
+
* Since version 1.0.13, to help with feature detection, libusb defines
|
129
|
+
* a LIBUSB_API_VERSION macro that gets increased every time there is a
|
130
130
|
* significant change to the API, such as the introduction of a new call,
|
131
131
|
* the definition of a new macro/enum member, or any other element that
|
132
|
-
*
|
132
|
+
* libusb applications may want to detect at compilation time.
|
133
133
|
*
|
134
134
|
* The macro is typically used in an application as follows:
|
135
135
|
* \code
|
136
|
-
* #if defined(
|
137
|
-
* // Use one of the newer features from the
|
136
|
+
* #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01001234)
|
137
|
+
* // Use one of the newer features from the libusb API
|
138
138
|
* #endif
|
139
139
|
* \endcode
|
140
140
|
*
|
141
|
-
* Another feature of
|
142
|
-
* whether you are compiling against the libusb or the
|
141
|
+
* Another feature of LIBUSB_API_VERSION is that it can be used to detect
|
142
|
+
* whether you are compiling against the libusb or the libusb library.
|
143
143
|
*
|
144
|
-
* Internally,
|
145
|
-
* (
|
144
|
+
* Internally, LIBUSB_API_VERSION is defined as follows:
|
145
|
+
* (libusb major << 24) | (libusb minor << 16) | (16 bit incremental)
|
146
146
|
*/
|
147
|
-
#define
|
147
|
+
#define LIBUSB_API_VERSION 0x01000102
|
148
|
+
|
149
|
+
/* The following is kept for compatibility, but will be deprecated in the future */
|
150
|
+
#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
|
148
151
|
|
149
152
|
#ifdef __cplusplus
|
150
153
|
extern "C" {
|
151
154
|
#endif
|
152
155
|
|
153
|
-
/**
|
156
|
+
/**
|
154
157
|
* \ingroup misc
|
155
158
|
* Convert a 16-bit value from host-endian to little-endian format. On
|
156
159
|
* little endian systems, this function does nothing. On big endian systems,
|
@@ -562,7 +565,7 @@ struct libusb_endpoint_descriptor {
|
|
562
565
|
/** For audio devices only: the address if the synch endpoint */
|
563
566
|
uint8_t bSynchAddress;
|
564
567
|
|
565
|
-
/** Extra descriptors. If
|
568
|
+
/** Extra descriptors. If libusb encounters unknown endpoint descriptors,
|
566
569
|
* it will store them here, should you wish to parse them. */
|
567
570
|
const unsigned char *extra;
|
568
571
|
|
@@ -612,7 +615,7 @@ struct libusb_interface_descriptor {
|
|
612
615
|
* by the bNumEndpoints field. */
|
613
616
|
const struct libusb_endpoint_descriptor *endpoint;
|
614
617
|
|
615
|
-
/** Extra descriptors. If
|
618
|
+
/** Extra descriptors. If libusb encounters unknown interface descriptors,
|
616
619
|
* it will store them here, should you wish to parse them. */
|
617
620
|
const unsigned char *extra;
|
618
621
|
|
@@ -670,7 +673,7 @@ struct libusb_config_descriptor {
|
|
670
673
|
* this array is determined by the bNumInterfaces field. */
|
671
674
|
const struct libusb_interface *interface;
|
672
675
|
|
673
|
-
/** Extra descriptors. If
|
676
|
+
/** Extra descriptors. If libusb encounters unknown configuration
|
674
677
|
* descriptors, it will store them here, should you wish to parse them. */
|
675
678
|
const unsigned char *extra;
|
676
679
|
|
@@ -889,7 +892,7 @@ struct libusb_control_setup {
|
|
889
892
|
|
890
893
|
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
|
891
894
|
|
892
|
-
/*
|
895
|
+
/* libusb */
|
893
896
|
|
894
897
|
struct libusb_context;
|
895
898
|
struct libusb_device;
|
@@ -897,7 +900,7 @@ struct libusb_device_handle;
|
|
897
900
|
struct libusb_hotplug_callback;
|
898
901
|
|
899
902
|
/** \ingroup lib
|
900
|
-
* Structure providing the version of the
|
903
|
+
* Structure providing the version of the libusb runtime
|
901
904
|
*/
|
902
905
|
struct libusb_version {
|
903
906
|
/** Library major version. */
|
@@ -920,16 +923,16 @@ struct libusb_version {
|
|
920
923
|
};
|
921
924
|
|
922
925
|
/** \ingroup lib
|
923
|
-
* Structure representing a
|
926
|
+
* Structure representing a libusb session. The concept of individual libusb
|
924
927
|
* sessions allows for your program to use two libraries (or dynamically
|
925
928
|
* load two modules) which both independently use libusb. This will prevent
|
926
|
-
* interference between the individual
|
929
|
+
* interference between the individual libusb users - for example
|
927
930
|
* libusb_set_debug() will not affect the other user of the library, and
|
928
931
|
* libusb_exit() will not destroy resources that the other user is still
|
929
932
|
* using.
|
930
933
|
*
|
931
934
|
* Sessions are created by libusb_init() and destroyed through libusb_exit().
|
932
|
-
* If your application is guaranteed to only ever include a single
|
935
|
+
* If your application is guaranteed to only ever include a single libusb
|
933
936
|
* user (i.e. you), you do not have to worry about contexts: pass NULL in
|
934
937
|
* every function call where a context is required. The default context
|
935
938
|
* will be used.
|
@@ -1042,7 +1045,7 @@ enum libusb_bos_type {
|
|
1042
1045
|
};
|
1043
1046
|
|
1044
1047
|
/** \ingroup misc
|
1045
|
-
* Error codes. Most
|
1048
|
+
* Error codes. Most libusb functions return 0 on success or one of these
|
1046
1049
|
* codes on failure.
|
1047
1050
|
* You can call libusb_error_name() to retrieve a string representation of an
|
1048
1051
|
* error code or libusb_strerror() to get an end-user suitable description of
|
@@ -1188,7 +1191,7 @@ struct libusb_transfer;
|
|
1188
1191
|
* Asynchronous transfer callback function type. When submitting asynchronous
|
1189
1192
|
* transfers, you pass a pointer to a callback function of this type via the
|
1190
1193
|
* \ref libusb_transfer::callback "callback" member of the libusb_transfer
|
1191
|
-
* structure.
|
1194
|
+
* structure. libusb will call this function later, when the transfer has
|
1192
1195
|
* completed or failed. See \ref asyncio for more information.
|
1193
1196
|
* \param transfer The libusb_transfer struct the callback function is being
|
1194
1197
|
* notified about.
|
@@ -1271,7 +1274,7 @@ enum libusb_capability {
|
|
1271
1274
|
LIBUSB_CAP_HAS_HOTPLUG = 0x0001,
|
1272
1275
|
/** The library can access HID devices without requiring user intervention.
|
1273
1276
|
* Note that before being able to actually access an HID device, you may
|
1274
|
-
* still have to call additional
|
1277
|
+
* still have to call additional libusb functions such as
|
1275
1278
|
* \ref libusb_detach_kernel_driver(). */
|
1276
1279
|
LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
|
1277
1280
|
/** The library supports detaching of the default USB driver, using
|
@@ -1829,7 +1832,7 @@ void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
|
|
1829
1832
|
* per libusb_context and it is safe to call libusb_hotplug_deregister_callback()
|
1830
1833
|
* on an already deregisted callback.
|
1831
1834
|
*
|
1832
|
-
* Since version 1.0.16, \ref
|
1835
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1833
1836
|
*
|
1834
1837
|
* For more information, see \ref hotplug.
|
1835
1838
|
*/
|
@@ -1837,7 +1840,7 @@ typedef int libusb_hotplug_callback_handle;
|
|
1837
1840
|
|
1838
1841
|
/** \ingroup hotplug
|
1839
1842
|
*
|
1840
|
-
* Since version 1.0.16, \ref
|
1843
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1841
1844
|
*
|
1842
1845
|
* Flags for hotplug events */
|
1843
1846
|
typedef enum {
|
@@ -1847,7 +1850,7 @@ typedef enum {
|
|
1847
1850
|
|
1848
1851
|
/** \ingroup hotplug
|
1849
1852
|
*
|
1850
|
-
* Since version 1.0.16, \ref
|
1853
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1851
1854
|
*
|
1852
1855
|
* Hotplug events */
|
1853
1856
|
typedef enum {
|
@@ -1871,13 +1874,13 @@ typedef enum {
|
|
1871
1874
|
* This callback may be called by an internal event thread and as such it is
|
1872
1875
|
* recommended the callback do minimal processing before returning.
|
1873
1876
|
*
|
1874
|
-
*
|
1877
|
+
* libusb will call this function later, when a matching event had happened on
|
1875
1878
|
* a matching device. See \ref hotplug for more information.
|
1876
1879
|
*
|
1877
1880
|
* It is safe to call either libusb_hotplug_register_callback() or
|
1878
1881
|
* libusb_hotplug_deregister_callback() from within a callback function.
|
1879
1882
|
*
|
1880
|
-
* Since version 1.0.16, \ref
|
1883
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1881
1884
|
*
|
1882
1885
|
* \param ctx context of this notification
|
1883
1886
|
* \param device libusb_device this event occurred on
|
@@ -1901,7 +1904,7 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
|
1901
1904
|
*
|
1902
1905
|
* If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be
|
1903
1906
|
* called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices
|
1904
|
-
* already plugged into the machine. Note that
|
1907
|
+
* already plugged into the machine. Note that libusb modifies its internal
|
1905
1908
|
* device list from a separate thread, while calling hotplug callbacks from
|
1906
1909
|
* libusb_handle_events(), so it is possible for a device to already be present
|
1907
1910
|
* on, or removed from, its internal device list, while the hotplug callbacks
|
@@ -1911,7 +1914,7 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
|
|
1911
1914
|
* from libusb_handle_events(); and/or your callback may be called for the
|
1912
1915
|
* removal of a device for which an arrived call was never made.
|
1913
1916
|
*
|
1914
|
-
* Since version 1.0.16, \ref
|
1917
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1915
1918
|
*
|
1916
1919
|
* \param[in] ctx context to register this callback with
|
1917
1920
|
* \param[in] events bitwise or of events that will trigger this callback. See \ref
|
@@ -1940,7 +1943,7 @@ int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
|
|
1940
1943
|
* Deregister a callback from a libusb_context. This function is safe to call from within
|
1941
1944
|
* a hotplug callback.
|
1942
1945
|
*
|
1943
|
-
* Since version 1.0.16, \ref
|
1946
|
+
* Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
|
1944
1947
|
*
|
1945
1948
|
* \param[in] ctx context this callback is registered with
|
1946
1949
|
* \param[in] handle the handle of the callback to deregister
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Internal header for
|
2
|
+
* Internal header for libusb
|
3
3
|
* Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
|
4
4
|
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
5
5
|
*
|
@@ -39,11 +39,11 @@
|
|
39
39
|
#include "libusb.h"
|
40
40
|
#include "version.h"
|
41
41
|
|
42
|
-
/* Inside the
|
42
|
+
/* Inside the libusb code, mark all public functions as follows:
|
43
43
|
* return_type API_EXPORTED function_name(params) { ... }
|
44
44
|
* But if the function returns a pointer, mark it as follows:
|
45
45
|
* DEFAULT_VISIBILITY return_type * LIBUSB_CALL function_name(params) { ... }
|
46
|
-
* In the
|
46
|
+
* In the libusb public header, mark all declarations as:
|
47
47
|
* return_type LIBUSB_CALL function_name(params);
|
48
48
|
*/
|
49
49
|
#define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY
|
@@ -149,6 +149,15 @@ static inline void *usbi_reallocf(void *ptr, size_t size)
|
|
149
149
|
|
150
150
|
#define TIMESPEC_IS_SET(ts) ((ts)->tv_sec != 0 || (ts)->tv_nsec != 0)
|
151
151
|
|
152
|
+
/* Some platforms don't have this define */
|
153
|
+
#ifndef TIMESPEC_TO_TIMEVAL
|
154
|
+
#define TIMESPEC_TO_TIMEVAL(tv, ts) \
|
155
|
+
do { \
|
156
|
+
(tv)->tv_sec = (ts)->tv_sec; \
|
157
|
+
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
|
158
|
+
} while (0)
|
159
|
+
#endif
|
160
|
+
|
152
161
|
void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
|
153
162
|
const char *function, const char *format, ...);
|
154
163
|
|
@@ -503,7 +512,7 @@ struct usbi_os_backend {
|
|
503
512
|
* to determine specific capabilities of the system, allocate required
|
504
513
|
* data structures for later, etc.
|
505
514
|
*
|
506
|
-
* This function is called when a
|
515
|
+
* This function is called when a libusb user initializes the library
|
507
516
|
* prior to use.
|
508
517
|
*
|
509
518
|
* Return 0 on success, or a LIBUSB_ERROR code on failure.
|
@@ -533,9 +542,9 @@ struct usbi_os_backend {
|
|
533
542
|
* but that is an unlikely case.
|
534
543
|
*
|
535
544
|
* After computing a session ID for a device, call
|
536
|
-
* usbi_get_device_by_session_id(). This function checks if
|
537
|
-
* knows about the device, and if so, it provides you with a
|
538
|
-
* structure for it.
|
545
|
+
* usbi_get_device_by_session_id(). This function checks if libusb already
|
546
|
+
* knows about the device, and if so, it provides you with a reference
|
547
|
+
* to a libusb_device structure for it.
|
539
548
|
*
|
540
549
|
* If usbi_get_device_by_session_id() returns NULL, it is time to allocate
|
541
550
|
* a new device structure for the device. Call usbi_alloc_device() to
|
@@ -594,7 +603,7 @@ struct usbi_os_backend {
|
|
594
603
|
*
|
595
604
|
* Your backend should allocate any internal resources required for I/O
|
596
605
|
* and other operations so that those operations can happen (hopefully)
|
597
|
-
* without hiccup. This is also a good place to inform
|
606
|
+
* without hiccup. This is also a good place to inform libusb that it
|
598
607
|
* should monitor certain file descriptors related to this device -
|
599
608
|
* see the usbi_add_pollfd() function.
|
600
609
|
*
|
@@ -618,7 +627,7 @@ struct usbi_os_backend {
|
|
618
627
|
/* Close a device such that the handle cannot be used again. Your backend
|
619
628
|
* should destroy any resources that were allocated in the open path.
|
620
629
|
* This may also be a good place to call usbi_remove_pollfd() to inform
|
621
|
-
*
|
630
|
+
* libusb of any file descriptors associated with this device that should
|
622
631
|
* no longer be monitored.
|
623
632
|
*
|
624
633
|
* This function is called when the user closes a device handle.
|
@@ -719,7 +728,7 @@ struct usbi_os_backend {
|
|
719
728
|
*
|
720
729
|
* If you cannot retrieve this from cache, either do not implement this
|
721
730
|
* function, or return LIBUSB_ERROR_NOT_SUPPORTED. This will cause
|
722
|
-
*
|
731
|
+
* libusb to retrieve the information through a standard control transfer.
|
723
732
|
*
|
724
733
|
* This function must be non-blocking.
|
725
734
|
* Return:
|
@@ -918,7 +927,7 @@ struct usbi_os_backend {
|
|
918
927
|
* all private data from the transfer as if you were just about to report
|
919
928
|
* completion or cancellation.
|
920
929
|
*
|
921
|
-
* This function might seem a bit out of place. It is used when
|
930
|
+
* This function might seem a bit out of place. It is used when libusb
|
922
931
|
* detects a disconnected device - it calls this function for all pending
|
923
932
|
* transfers before reporting completion (with the disconnect code) to
|
924
933
|
* the user. Maybe we can improve upon this internal interface in future.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- Mode: C; indent-tabs-mode:nil -*- */
|
2
2
|
/*
|
3
|
-
* darwin backend for
|
3
|
+
* darwin backend for libusb 1.0
|
4
4
|
* Copyright © 2008-2013 Nathan Hjelm <hjelmn@users.sourceforge.net>
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -71,6 +71,7 @@ static int process_new_device (struct libusb_context *ctx, io_service_t service)
|
|
71
71
|
|
72
72
|
#if defined(ENABLE_LOGGING)
|
73
73
|
static const char *darwin_error_str (int result) {
|
74
|
+
static char string_buffer[50];
|
74
75
|
switch (result) {
|
75
76
|
case kIOReturnSuccess:
|
76
77
|
return "no error";
|
@@ -103,7 +104,8 @@ static const char *darwin_error_str (int result) {
|
|
103
104
|
case kIOUSBHighSpeedSplitError:
|
104
105
|
return "high speed split error";
|
105
106
|
default:
|
106
|
-
|
107
|
+
snprintf(string_buffer, sizeof(string_buffer), "unknown error (0x%x)", result);
|
108
|
+
return string_buffer;
|
107
109
|
}
|
108
110
|
}
|
109
111
|
#endif
|
@@ -293,6 +295,7 @@ static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
|
|
293
295
|
/* signal the core that this device has been disconnected. the core will tear down this device
|
294
296
|
when the reference count reaches 0 */
|
295
297
|
usbi_disconnect_device(dev);
|
298
|
+
libusb_unref_device(dev);
|
296
299
|
}
|
297
300
|
}
|
298
301
|
|
@@ -747,7 +750,7 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser
|
|
747
750
|
(void) get_ioregistry_value_number (service, CFSTR("sessionID"), kCFNumberSInt64Type, &sessionID);
|
748
751
|
(void) get_ioregistry_value_number (service, CFSTR("PortNum"), kCFNumberSInt8Type, &port);
|
749
752
|
|
750
|
-
usbi_dbg("finding cached device for sessionID 0x
|
753
|
+
usbi_dbg("finding cached device for sessionID 0x%" PRIx64, sessionID);
|
751
754
|
|
752
755
|
result = IORegistryEntryGetParentEntry (service, kIOUSBPlane, &parent);
|
753
756
|
|
@@ -761,7 +764,7 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser
|
|
761
764
|
*cached_out = NULL;
|
762
765
|
|
763
766
|
list_for_each_entry(new_device, &darwin_cached_devices, list, struct darwin_cached_device) {
|
764
|
-
usbi_dbg("matching sessionID 0x%
|
767
|
+
usbi_dbg("matching sessionID 0x%" PRIx64 " against cached device with sessionID 0x%" PRIx64, sessionID, new_device->session);
|
765
768
|
if (new_device->session == sessionID) {
|
766
769
|
usbi_dbg("using cached device for device");
|
767
770
|
*cached_out = new_device;
|
@@ -772,7 +775,7 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser
|
|
772
775
|
if (*cached_out)
|
773
776
|
break;
|
774
777
|
|
775
|
-
usbi_dbg("caching new device with sessionID 0x%
|
778
|
+
usbi_dbg("caching new device with sessionID 0x%" PRIx64, sessionID);
|
776
779
|
|
777
780
|
device = darwin_device_from_service (service);
|
778
781
|
if (!device) {
|
@@ -842,7 +845,7 @@ static int process_new_device (struct libusb_context *ctx, io_service_t service)
|
|
842
845
|
if (ret)
|
843
846
|
break;
|
844
847
|
|
845
|
-
usbi_dbg ("allocating new device in context %p for with session 0x%
|
848
|
+
usbi_dbg ("allocating new device in context %p for with session 0x%" PRIx64,
|
846
849
|
ctx, cached_device->session);
|
847
850
|
|
848
851
|
dev = usbi_alloc_device(ctx, (unsigned long) cached_device->session);
|
@@ -864,11 +867,6 @@ static int process_new_device (struct libusb_context *ctx, io_service_t service)
|
|
864
867
|
dev->bus_number = cached_device->location >> 24;
|
865
868
|
dev->device_address = cached_device->address;
|
866
869
|
|
867
|
-
/* need to add a reference to the parent device */
|
868
|
-
if (dev->parent_dev) {
|
869
|
-
libusb_ref_device(dev->parent_dev);
|
870
|
-
}
|
871
|
-
|
872
870
|
(*(priv->dev->device))->GetDeviceSpeed (priv->dev->device, &devSpeed);
|
873
871
|
|
874
872
|
switch (devSpeed) {
|
@@ -1433,7 +1431,7 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
|
|
1433
1431
|
|
1434
1432
|
IOReturn ret;
|
1435
1433
|
uint8_t transferType;
|
1436
|
-
/* None of the values below are used in
|
1434
|
+
/* None of the values below are used in libusb for bulk transfers */
|
1437
1435
|
uint8_t direction, number, interval, pipeRef, iface;
|
1438
1436
|
uint16_t maxPacketSize;
|
1439
1437
|
|
@@ -1447,8 +1445,14 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
|
|
1447
1445
|
|
1448
1446
|
cInterface = &priv->interfaces[iface];
|
1449
1447
|
|
1450
|
-
(*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
|
1451
|
-
|
1448
|
+
ret = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
|
1449
|
+
&transferType, &maxPacketSize, &interval);
|
1450
|
+
|
1451
|
+
if (ret) {
|
1452
|
+
usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
|
1453
|
+
darwin_error_str(ret), ret);
|
1454
|
+
return darwin_to_libusb (ret);
|
1455
|
+
}
|
1452
1456
|
|
1453
1457
|
if (0 != (transfer->length % maxPacketSize)) {
|
1454
1458
|
/* do not need a zero packet */
|
@@ -1511,7 +1515,7 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
|
|
1511
1515
|
return LIBUSB_ERROR_NO_MEM;
|
1512
1516
|
}
|
1513
1517
|
|
1514
|
-
/* copy the frame list from the
|
1518
|
+
/* copy the frame list from the libusb descriptor (the structures differ only is member order) */
|
1515
1519
|
for (i = 0 ; i < transfer->num_iso_packets ; i++)
|
1516
1520
|
tpriv->isoc_framelist[i].frReqCount = transfer->iso_packet_desc[i].length;
|
1517
1521
|
|
@@ -1592,7 +1596,7 @@ static int submit_control_transfer(struct usbi_transfer *itransfer) {
|
|
1592
1596
|
tpriv->req.wValue = OSSwapLittleToHostInt16 (setup->wValue);
|
1593
1597
|
tpriv->req.wIndex = OSSwapLittleToHostInt16 (setup->wIndex);
|
1594
1598
|
tpriv->req.wLength = OSSwapLittleToHostInt16 (setup->wLength);
|
1595
|
-
/* data is stored after the
|
1599
|
+
/* data is stored after the libusb control block */
|
1596
1600
|
tpriv->req.pData = transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
|
1597
1601
|
tpriv->req.completionTimeout = transfer->timeout;
|
1598
1602
|
tpriv->req.noDataTimeout = transfer->timeout;
|