usb 1.7.2 → 1.8.1-libusb.4
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/.gitmodules +1 -1
- package/Readme.md +2 -2
- package/binding.gyp +2 -2
- package/libusb/.private/pre-commit.sh +7 -1
- package/libusb/.travis.yml +49 -0
- package/libusb/AUTHORS +44 -3
- package/libusb/Brewfile +4 -0
- package/libusb/ChangeLog +74 -2
- package/libusb/README.md +32 -0
- package/libusb/TODO +1 -1
- package/libusb/Xcode/common.xcconfig +12 -0
- package/libusb/Xcode/config.h +25 -0
- package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
- package/libusb/android/README +4 -2
- package/libusb/android/config.h +75 -0
- package/libusb/appveyor.yml +41 -0
- package/libusb/appveyor_cygwin.bat +11 -0
- package/libusb/appveyor_minGW.bat +19 -0
- package/libusb/autogen.sh +1 -1
- package/libusb/bootstrap.sh +3 -16
- package/libusb/configure.ac +108 -80
- package/libusb/doc/doxygen.cfg.in +1785 -739
- package/libusb/examples/Makefile.am +1 -1
- package/libusb/examples/dpfp.c +3 -1
- package/libusb/examples/dpfp_threaded.c +23 -10
- package/libusb/examples/ezusb.c +3 -3
- package/libusb/examples/ezusb.h +2 -2
- package/libusb/examples/fxload.c +31 -9
- package/libusb/examples/hotplugtest.c +35 -7
- package/libusb/examples/listdevs.c +3 -1
- package/libusb/examples/sam3u_benchmark.c +3 -3
- package/libusb/examples/testlibusb.c +277 -0
- package/libusb/examples/xusb.c +40 -34
- package/libusb/libusb/Makefile.am +49 -23
- package/libusb/libusb/core.c +855 -457
- package/libusb/libusb/descriptor.c +72 -78
- package/libusb/libusb/hotplug.c +122 -76
- package/libusb/libusb/hotplug.h +42 -25
- package/libusb/libusb/io.c +625 -390
- package/libusb/libusb/libusb-1.0.def +12 -0
- package/libusb/libusb/libusb.h +218 -150
- package/libusb/libusb/libusbi.h +346 -176
- package/libusb/libusb/os/darwin_usb.c +604 -319
- package/libusb/libusb/os/darwin_usb.h +61 -20
- package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
- package/libusb/libusb/os/haiku_usb.h +113 -0
- package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
- package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
- package/libusb/libusb/os/haiku_usb_raw.h +188 -0
- package/libusb/libusb/os/linux_netlink.c +186 -146
- package/libusb/libusb/os/linux_udev.c +36 -14
- package/libusb/libusb/os/linux_usbfs.c +426 -225
- package/libusb/libusb/os/linux_usbfs.h +5 -3
- package/libusb/libusb/os/netbsd_usb.c +21 -77
- package/libusb/libusb/os/openbsd_usb.c +32 -115
- package/libusb/libusb/os/poll_posix.c +38 -5
- package/libusb/libusb/os/poll_posix.h +3 -0
- package/libusb/libusb/os/poll_windows.c +277 -626
- package/libusb/libusb/os/poll_windows.h +11 -44
- package/libusb/libusb/os/sunos_usb.c +1695 -0
- package/libusb/libusb/os/sunos_usb.h +80 -0
- package/libusb/libusb/os/threads_posix.c +24 -26
- package/libusb/libusb/os/threads_posix.h +73 -21
- package/libusb/libusb/os/threads_windows.c +71 -157
- package/libusb/libusb/os/threads_windows.h +68 -44
- package/libusb/libusb/os/wince_usb.c +276 -420
- package/libusb/libusb/os/wince_usb.h +23 -28
- package/libusb/libusb/os/windows_common.h +78 -58
- package/libusb/libusb/os/windows_nt_common.c +1010 -0
- package/libusb/libusb/os/windows_nt_common.h +110 -0
- package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
- package/libusb/libusb/os/windows_usbdk.c +830 -0
- package/libusb/libusb/os/windows_usbdk.h +103 -0
- package/libusb/libusb/os/windows_winusb.c +4391 -0
- package/libusb/libusb/os/windows_winusb.h +783 -0
- package/libusb/libusb/strerror.c +41 -7
- package/libusb/libusb/sync.c +41 -13
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/libusb-1.0.pc.in +1 -1
- package/libusb/msvc/appveyor.bat +27 -0
- package/libusb/msvc/config.h +5 -4
- package/libusb/msvc/ddk_build.cmd +87 -43
- package/libusb/msvc/fxload_2010.vcxproj +24 -104
- package/libusb/msvc/fxload_2012.vcxproj +24 -107
- package/libusb/msvc/fxload_2013.vcxproj +24 -107
- package/libusb/msvc/fxload_2015.vcxproj +91 -0
- package/libusb/msvc/fxload_2017.vcxproj +114 -0
- package/libusb/msvc/fxload_sources +1 -1
- package/libusb/msvc/getopt_2010.vcxproj +16 -75
- package/libusb/msvc/getopt_2012.vcxproj +16 -79
- package/libusb/msvc/getopt_2013.vcxproj +16 -79
- package/libusb/msvc/getopt_2015.vcxproj +73 -0
- package/libusb/msvc/getopt_2017.vcxproj +98 -0
- package/libusb/msvc/getopt_sources +6 -2
- package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
- package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
- package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
- package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
- package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
- package/libusb/msvc/hotplugtest_sources +1 -1
- package/libusb/msvc/libusb_2005.sln +20 -20
- package/libusb/msvc/libusb_2010.sln +57 -46
- package/libusb/msvc/libusb_2012.sln +57 -46
- package/libusb/msvc/libusb_2013.sln +57 -50
- package/libusb/msvc/libusb_2015.sln +59 -52
- package/libusb/msvc/libusb_2017.sln +186 -0
- package/libusb/msvc/libusb_dll.dsp +2 -2
- package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
- package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
- package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
- package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
- package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
- package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
- package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
- package/libusb/msvc/libusb_sources +10 -5
- package/libusb/msvc/libusb_static.dsp +2 -2
- package/libusb/msvc/libusb_static_2005.vcproj +32 -4
- package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
- package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
- package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
- package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
- package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
- package/libusb/msvc/libusb_static_wince.vcproj +20 -26
- package/libusb/msvc/libusb_wince.sln +88 -88
- package/libusb/msvc/listdevs_2010.vcxproj +16 -99
- package/libusb/msvc/listdevs_2012.vcxproj +16 -102
- package/libusb/msvc/listdevs_2013.vcxproj +16 -102
- package/libusb/msvc/listdevs_2015.vcxproj +83 -0
- package/libusb/msvc/listdevs_2017.vcxproj +106 -0
- package/libusb/msvc/listdevs_sources +2 -1
- package/libusb/msvc/stress_2010.vcxproj +20 -101
- package/libusb/msvc/stress_2012.vcxproj +20 -104
- package/libusb/msvc/stress_2013.vcxproj +20 -104
- package/libusb/msvc/stress_2015.vcxproj +87 -0
- package/libusb/msvc/stress_2017.vcxproj +110 -0
- package/libusb/msvc/stress_sources +21 -0
- package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
- package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
- package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
- package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
- package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
- package/libusb/msvc/testlibusb_sources +20 -0
- package/libusb/msvc/xusb_2010.vcxproj +17 -98
- package/libusb/msvc/xusb_2012.vcxproj +17 -101
- package/libusb/msvc/xusb_2013.vcxproj +17 -101
- package/libusb/msvc/xusb_2015.vcxproj +83 -0
- package/libusb/msvc/xusb_2017.vcxproj +106 -0
- package/libusb/msvc/xusb_sources +1 -1
- package/libusb/tests/stress.c +2 -2
- package/libusb/tests/testlib.c +0 -4
- package/libusb/travis-autogen.sh +39 -0
- package/libusb.gypi +13 -2
- package/package.json +20 -11
- 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 +1 -1
- package/usb.js +51 -5
- package/.github/workflows/prebuild.yml +0 -49
- package/libusb/INSTALL +0 -234
- package/libusb/README +0 -28
- package/libusb/libusb/os/windows_usb.c +0 -5347
- package/libusb/libusb/os/windows_usb.h +0 -971
- package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
- package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
- package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
- package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
- package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
- package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
- package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
- package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
- package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
- package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
- package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
- package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
- package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
- package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
- package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
- package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
package/libusb/examples/xusb.c
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
#if defined(_WIN32)
|
|
30
30
|
#define msleep(msecs) Sleep(msecs)
|
|
31
31
|
#else
|
|
32
|
-
#include <
|
|
33
|
-
#define msleep(msecs)
|
|
32
|
+
#include <time.h>
|
|
33
|
+
#define msleep(msecs) nanosleep(&(struct timespec){msecs / 1000, (msecs * 1000000) % 1000000000UL}, NULL);
|
|
34
34
|
#endif
|
|
35
35
|
|
|
36
36
|
#if defined(_MSC_VER)
|
|
@@ -58,20 +58,18 @@ static bool extra_info = false;
|
|
|
58
58
|
static bool force_device_request = false; // For WCID descriptor queries
|
|
59
59
|
static const char* binary_name = NULL;
|
|
60
60
|
|
|
61
|
-
static
|
|
61
|
+
static void perr(char const *format, ...)
|
|
62
62
|
{
|
|
63
63
|
va_list args;
|
|
64
|
-
int r;
|
|
65
64
|
|
|
66
65
|
va_start (args, format);
|
|
67
|
-
|
|
66
|
+
vfprintf(stderr, format, args);
|
|
68
67
|
va_end(args);
|
|
69
|
-
|
|
70
|
-
return r;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
#define ERR_EXIT(errcode) do { perr(" %s\n", libusb_strerror((enum libusb_error)errcode)); return -1; } while (0)
|
|
74
|
-
#define CALL_CHECK(fcall) do {
|
|
71
|
+
#define CALL_CHECK(fcall) do { int _r=fcall; if (_r < 0) ERR_EXIT(_r); } while (0)
|
|
72
|
+
#define CALL_CHECK_CLOSE(fcall, hdl) do { int _r=fcall; if (_r < 0) { libusb_close(hdl); ERR_EXIT(_r); } } while (0)
|
|
75
73
|
#define B(x) (((x)!=0)?1:0)
|
|
76
74
|
#define be_to_int32(buf) (((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|(buf)[3])
|
|
77
75
|
|
|
@@ -95,6 +93,16 @@ static int perr(char const *format, ...)
|
|
|
95
93
|
#define BOMS_RESET 0xFF
|
|
96
94
|
#define BOMS_GET_MAX_LUN 0xFE
|
|
97
95
|
|
|
96
|
+
// Microsoft OS Descriptor
|
|
97
|
+
#define MS_OS_DESC_STRING_INDEX 0xEE
|
|
98
|
+
#define MS_OS_DESC_STRING_LENGTH 0x12
|
|
99
|
+
#define MS_OS_DESC_VENDOR_CODE_OFFSET 0x10
|
|
100
|
+
static const uint8_t ms_os_desc_string[] = {
|
|
101
|
+
MS_OS_DESC_STRING_LENGTH,
|
|
102
|
+
LIBUSB_DT_STRING,
|
|
103
|
+
'M', 0, 'S', 0, 'F', 0, 'T', 0, '1', 0, '0', 0, '0', 0,
|
|
104
|
+
};
|
|
105
|
+
|
|
98
106
|
// Section 5.1: Command Block Wrapper (CBW)
|
|
99
107
|
struct command_block_wrapper {
|
|
100
108
|
uint8_t dCBWSignature[4];
|
|
@@ -114,7 +122,7 @@ struct command_status_wrapper {
|
|
|
114
122
|
uint8_t bCSWStatus;
|
|
115
123
|
};
|
|
116
124
|
|
|
117
|
-
static uint8_t cdb_length[256] = {
|
|
125
|
+
static const uint8_t cdb_length[256] = {
|
|
118
126
|
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
119
127
|
06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 0
|
|
120
128
|
06,06,06,06,06,06,06,06,06,06,06,06,06,06,06,06, // 1
|
|
@@ -175,7 +183,8 @@ static char* uuid_to_string(const uint8_t* uuid)
|
|
|
175
183
|
{
|
|
176
184
|
static char uuid_string[40];
|
|
177
185
|
if (uuid == NULL) return NULL;
|
|
178
|
-
|
|
186
|
+
snprintf(uuid_string, sizeof(uuid_string),
|
|
187
|
+
"{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
|
179
188
|
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
|
|
180
189
|
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
|
|
181
190
|
return uuid_string;
|
|
@@ -185,7 +194,6 @@ static char* uuid_to_string(const uint8_t* uuid)
|
|
|
185
194
|
// removed by Sony
|
|
186
195
|
static int display_ps3_status(libusb_device_handle *handle)
|
|
187
196
|
{
|
|
188
|
-
int r;
|
|
189
197
|
uint8_t input_report[49];
|
|
190
198
|
uint8_t master_bt_address[8];
|
|
191
199
|
uint8_t device_bt_address[18];
|
|
@@ -276,7 +284,6 @@ static int display_ps3_status(libusb_device_handle *handle)
|
|
|
276
284
|
// Input/Output reports described at http://euc.jp/periphs/xbox-controller.ja.html
|
|
277
285
|
static int display_xbox_status(libusb_device_handle *handle)
|
|
278
286
|
{
|
|
279
|
-
int r;
|
|
280
287
|
uint8_t input_report[20];
|
|
281
288
|
printf("\nReading XBox Input Report...\n");
|
|
282
289
|
CALL_CHECK(libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE,
|
|
@@ -297,7 +304,6 @@ static int display_xbox_status(libusb_device_handle *handle)
|
|
|
297
304
|
|
|
298
305
|
static int set_xbox_actuators(libusb_device_handle *handle, uint8_t left, uint8_t right)
|
|
299
306
|
{
|
|
300
|
-
int r;
|
|
301
307
|
uint8_t output_report[6];
|
|
302
308
|
|
|
303
309
|
printf("\nWriting XBox Controller Output Report...\n");
|
|
@@ -525,7 +531,7 @@ static int test_mass_storage(libusb_device_handle *handle, uint8_t endpoint_in,
|
|
|
525
531
|
}
|
|
526
532
|
|
|
527
533
|
// Send Read
|
|
528
|
-
printf("Attempting to read %
|
|
534
|
+
printf("Attempting to read %u bytes:\n", block_size);
|
|
529
535
|
memset(cdb, 0, sizeof(cdb));
|
|
530
536
|
|
|
531
537
|
cdb[0] = 0x28; // Read(10)
|
|
@@ -621,7 +627,7 @@ static int test_hid(libusb_device_handle *handle, uint8_t endpoint_in)
|
|
|
621
627
|
}
|
|
622
628
|
display_buffer_hex(hid_report_descriptor, descriptor_size);
|
|
623
629
|
if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) {
|
|
624
|
-
if (fwrite(hid_report_descriptor, 1, descriptor_size, fd) != descriptor_size) {
|
|
630
|
+
if (fwrite(hid_report_descriptor, 1, descriptor_size, fd) != (size_t)descriptor_size) {
|
|
625
631
|
printf(" Error writing descriptor to file\n");
|
|
626
632
|
}
|
|
627
633
|
fclose(fd);
|
|
@@ -790,7 +796,7 @@ static void print_device_cap(struct libusb_bos_dev_capability_descriptor *dev_ca
|
|
|
790
796
|
}
|
|
791
797
|
default:
|
|
792
798
|
printf(" Unknown BOS device capability %02x:\n", dev_cap->bDevCapabilityType);
|
|
793
|
-
}
|
|
799
|
+
}
|
|
794
800
|
}
|
|
795
801
|
|
|
796
802
|
static int test_device(uint16_t vid, uint16_t pid)
|
|
@@ -804,8 +810,8 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|
|
804
810
|
int i, j, k, r;
|
|
805
811
|
int iface, nb_ifaces, first_iface = -1;
|
|
806
812
|
struct libusb_device_descriptor dev_desc;
|
|
807
|
-
const char* speed_name[
|
|
808
|
-
"480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)"};
|
|
813
|
+
const char* const speed_name[6] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
|
|
814
|
+
"480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)", "10000 Mbit/s (USB SuperSpeedPlus)" };
|
|
809
815
|
char string[128];
|
|
810
816
|
uint8_t string_index[3]; // indexes of the string descriptors
|
|
811
817
|
uint8_t endpoint_in = 0, endpoint_out = 0; // default IN and OUT endpoints
|
|
@@ -832,12 +838,12 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|
|
832
838
|
printf(" (from root hub)\n");
|
|
833
839
|
}
|
|
834
840
|
r = libusb_get_device_speed(dev);
|
|
835
|
-
if ((r<0) || (r>
|
|
841
|
+
if ((r<0) || (r>5)) r=0;
|
|
836
842
|
printf(" speed: %s\n", speed_name[r]);
|
|
837
843
|
}
|
|
838
844
|
|
|
839
845
|
printf("\nReading device descriptor:\n");
|
|
840
|
-
|
|
846
|
+
CALL_CHECK_CLOSE(libusb_get_device_descriptor(dev, &dev_desc), handle);
|
|
841
847
|
printf(" length: %d\n", dev_desc.bLength);
|
|
842
848
|
printf(" device class: %d\n", dev_desc.bDeviceClass);
|
|
843
849
|
printf(" S/N: %d\n", dev_desc.iSerialNumber);
|
|
@@ -861,7 +867,7 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|
|
861
867
|
}
|
|
862
868
|
|
|
863
869
|
printf("\nReading first configuration descriptor:\n");
|
|
864
|
-
|
|
870
|
+
CALL_CHECK_CLOSE(libusb_get_config_descriptor(dev, 0, &conf_desc), handle);
|
|
865
871
|
nb_ifaces = conf_desc->bNumInterfaces;
|
|
866
872
|
printf(" nb interfaces: %d\n", nb_ifaces);
|
|
867
873
|
if (nb_ifaces > 0)
|
|
@@ -925,34 +931,33 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|
|
925
931
|
if (string_index[i] == 0) {
|
|
926
932
|
continue;
|
|
927
933
|
}
|
|
928
|
-
if (libusb_get_string_descriptor_ascii(handle, string_index[i], (unsigned char*)string,
|
|
934
|
+
if (libusb_get_string_descriptor_ascii(handle, string_index[i], (unsigned char*)string, sizeof(string)) > 0) {
|
|
929
935
|
printf(" String (0x%02X): \"%s\"\n", string_index[i], string);
|
|
930
936
|
}
|
|
931
937
|
}
|
|
932
938
|
// Read the OS String Descriptor
|
|
933
|
-
|
|
934
|
-
|
|
939
|
+
r = libusb_get_string_descriptor(handle, MS_OS_DESC_STRING_INDEX, 0, (unsigned char*)string, MS_OS_DESC_STRING_LENGTH);
|
|
940
|
+
if (r == MS_OS_DESC_STRING_LENGTH && memcmp(ms_os_desc_string, string, sizeof(ms_os_desc_string)) == 0) {
|
|
935
941
|
// If this is a Microsoft OS String Descriptor,
|
|
936
942
|
// attempt to read the WinUSB extended Feature Descriptors
|
|
937
|
-
|
|
938
|
-
read_ms_winsub_feature_descriptors(handle, string[7], first_iface);
|
|
943
|
+
read_ms_winsub_feature_descriptors(handle, string[MS_OS_DESC_VENDOR_CODE_OFFSET], first_iface);
|
|
939
944
|
}
|
|
940
945
|
|
|
941
946
|
switch(test_mode) {
|
|
942
947
|
case USE_PS3:
|
|
943
|
-
|
|
948
|
+
CALL_CHECK_CLOSE(display_ps3_status(handle), handle);
|
|
944
949
|
break;
|
|
945
950
|
case USE_XBOX:
|
|
946
|
-
|
|
947
|
-
|
|
951
|
+
CALL_CHECK_CLOSE(display_xbox_status(handle), handle);
|
|
952
|
+
CALL_CHECK_CLOSE(set_xbox_actuators(handle, 128, 222), handle);
|
|
948
953
|
msleep(2000);
|
|
949
|
-
|
|
954
|
+
CALL_CHECK_CLOSE(set_xbox_actuators(handle, 0, 0), handle);
|
|
950
955
|
break;
|
|
951
956
|
case USE_HID:
|
|
952
957
|
test_hid(handle, endpoint_in);
|
|
953
958
|
break;
|
|
954
959
|
case USE_SCSI:
|
|
955
|
-
|
|
960
|
+
CALL_CHECK_CLOSE(test_mass_storage(handle, endpoint_in, endpoint_out), handle);
|
|
956
961
|
case USE_GENERIC:
|
|
957
962
|
break;
|
|
958
963
|
}
|
|
@@ -1095,10 +1100,11 @@ int main(int argc, char** argv)
|
|
|
1095
1100
|
}
|
|
1096
1101
|
|
|
1097
1102
|
// xusb is commonly used as a debug tool, so it's convenient to have debug output during libusb_init(),
|
|
1098
|
-
// but since we can't call on
|
|
1103
|
+
// but since we can't call on libusb_set_option() before libusb_init(), we use the env variable method
|
|
1099
1104
|
old_dbg_str = getenv("LIBUSB_DEBUG");
|
|
1100
1105
|
if (debug_mode) {
|
|
1101
|
-
putenv("LIBUSB_DEBUG=4")
|
|
1106
|
+
if (putenv("LIBUSB_DEBUG=4") != 0) // LIBUSB_LOG_LEVEL_DEBUG
|
|
1107
|
+
printf("Unable to set debug level\n");
|
|
1102
1108
|
}
|
|
1103
1109
|
|
|
1104
1110
|
version = libusb_get_version();
|
|
@@ -1109,7 +1115,7 @@ int main(int argc, char** argv)
|
|
|
1109
1115
|
|
|
1110
1116
|
// If not set externally, and no debug option was given, use info log level
|
|
1111
1117
|
if ((old_dbg_str == NULL) && (!debug_mode))
|
|
1112
|
-
|
|
1118
|
+
libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO);
|
|
1113
1119
|
if (error_lang != NULL) {
|
|
1114
1120
|
r = libusb_setlocale(error_lang);
|
|
1115
1121
|
if (r < 0)
|
|
@@ -4,43 +4,64 @@ AUTOMAKE_OPTIONS = subdir-objects
|
|
|
4
4
|
|
|
5
5
|
lib_LTLIBRARIES = libusb-1.0.la
|
|
6
6
|
|
|
7
|
-
POSIX_POLL_SRC = os/poll_posix.c
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
POSIX_POLL_SRC = os/poll_posix.h os/poll_posix.c
|
|
8
|
+
POSIX_THREADS_SRC = os/threads_posix.h os/threads_posix.c
|
|
9
|
+
WINDOWS_POLL_SRC = os/poll_windows.h os/poll_windows.c
|
|
10
|
+
WINDOWS_THREADS_SRC = os/threads_windows.h os/threads_windows.c
|
|
11
|
+
LINUX_USBFS_SRC = os/linux_usbfs.h os/linux_usbfs.c
|
|
12
|
+
DARWIN_USB_SRC = os/darwin_usb.h os/darwin_usb.c
|
|
10
13
|
OPENBSD_USB_SRC = os/openbsd_usb.c
|
|
11
14
|
NETBSD_USB_SRC = os/netbsd_usb.c
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
SUNOS_USB_SRC = os/sunos_usb.c os/sunos_usb.h
|
|
16
|
+
WINDOWS_USB_SRC = libusb-1.0.def libusb-1.0.rc \
|
|
17
|
+
os/windows_common.h \
|
|
18
|
+
os/windows_nt_common.h os/windows_nt_common.c \
|
|
19
|
+
os/windows_nt_shared_types.h \
|
|
20
|
+
os/windows_usbdk.h os/windows_usbdk.c \
|
|
21
|
+
os/windows_winusb.h os/windows_winusb.c
|
|
22
|
+
WINCE_USB_SRC = os/wince_usb.h os/wince_usb.c
|
|
23
|
+
HAIKU_USB_SRC = os/haiku_usb.h os/haiku_usb_backend.cpp \
|
|
24
|
+
os/haiku_usb_raw.h os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
|
|
25
|
+
|
|
26
|
+
EXTRA_DIST = $(POSIX_POLL_SRC) $(POSIX_THREADS_SRC) \
|
|
27
|
+
$(WINDOWS_POLL_SRC) $(WINDOWS_THREADS_SRC) \
|
|
28
|
+
$(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) \
|
|
29
|
+
$(OPENBSD_USB_SRC) $(NETBSD_USB_SRC) \
|
|
30
|
+
$(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \
|
|
31
|
+
$(HAIKU_USB_SRC) \
|
|
19
32
|
os/linux_udev.c os/linux_netlink.c
|
|
20
33
|
|
|
21
34
|
if OS_LINUX
|
|
22
35
|
|
|
23
36
|
if USE_UDEV
|
|
24
|
-
OS_SRC = $(LINUX_USBFS_SRC)
|
|
25
|
-
os/linux_udev.c
|
|
37
|
+
OS_SRC = $(LINUX_USBFS_SRC) os/linux_udev.c
|
|
26
38
|
else
|
|
27
|
-
OS_SRC = $(LINUX_USBFS_SRC)
|
|
28
|
-
os/linux_netlink.c
|
|
39
|
+
OS_SRC = $(LINUX_USBFS_SRC) os/linux_netlink.c
|
|
29
40
|
endif
|
|
30
41
|
|
|
31
42
|
endif
|
|
32
43
|
|
|
33
44
|
if OS_DARWIN
|
|
34
|
-
OS_SRC = $(DARWIN_USB_SRC)
|
|
45
|
+
OS_SRC = $(DARWIN_USB_SRC)
|
|
35
46
|
AM_CFLAGS_EXT = -no-cpp-precomp
|
|
36
47
|
endif
|
|
37
48
|
|
|
38
49
|
if OS_OPENBSD
|
|
39
|
-
OS_SRC = $(OPENBSD_USB_SRC)
|
|
50
|
+
OS_SRC = $(OPENBSD_USB_SRC)
|
|
40
51
|
endif
|
|
41
52
|
|
|
42
53
|
if OS_NETBSD
|
|
43
|
-
OS_SRC = $(NETBSD_USB_SRC)
|
|
54
|
+
OS_SRC = $(NETBSD_USB_SRC)
|
|
55
|
+
endif
|
|
56
|
+
|
|
57
|
+
if OS_SUNOS
|
|
58
|
+
OS_SRC = $(SUNOS_USB_SRC)
|
|
59
|
+
endif
|
|
60
|
+
|
|
61
|
+
if OS_HAIKU
|
|
62
|
+
noinst_LTLIBRARIES = libusb_haiku.la
|
|
63
|
+
libusb_haiku_la_SOURCES = $(HAIKU_USB_SRC)
|
|
64
|
+
libusb_1_0_la_LIBADD = libusb_haiku.la
|
|
44
65
|
endif
|
|
45
66
|
|
|
46
67
|
if OS_WINDOWS
|
|
@@ -58,18 +79,23 @@ if CREATE_IMPORT_LIB
|
|
|
58
79
|
$(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
|
|
59
80
|
endif
|
|
60
81
|
|
|
82
|
+
if OS_WINDOWS
|
|
83
|
+
POLL_SRC = $(WINDOWS_POLL_SRC)
|
|
84
|
+
else
|
|
85
|
+
POLL_SRC = $(POSIX_POLL_SRC)
|
|
86
|
+
endif
|
|
87
|
+
|
|
61
88
|
if THREADS_POSIX
|
|
62
|
-
THREADS_SRC =
|
|
89
|
+
THREADS_SRC = $(POSIX_THREADS_SRC)
|
|
63
90
|
else
|
|
64
|
-
THREADS_SRC =
|
|
91
|
+
THREADS_SRC = $(WINDOWS_THREADS_SRC)
|
|
65
92
|
endif
|
|
66
93
|
|
|
67
94
|
libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
|
|
68
95
|
libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
|
|
69
|
-
libusb_1_0_la_SOURCES = libusbi.h
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
os/poll_posix.h os/poll_windows.h
|
|
96
|
+
libusb_1_0_la_SOURCES = libusbi.h libusb.h version.h version_nano.h \
|
|
97
|
+
core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
|
|
98
|
+
$(POLL_SRC) $(THREADS_SRC) $(OS_SRC)
|
|
73
99
|
|
|
74
100
|
hdrdir = $(includedir)/libusb-1.0
|
|
75
101
|
hdr_HEADERS = libusb.h
|