summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-03-10 13:19:38 +0000
committerPete Batard <pbatard@gmail.com>2010-03-10 13:19:38 +0000
commitea78e1ce73c018eff041555ab41448fc889ce278 (patch)
tree44e7f8b5448b5310b83c2e6abc3cc5fd2cc85b64
parentfae9c17bd2405813d44186c94367d6e66d3994e6 (diff)
downloadlibusb-ea78e1ce73c018eff041555ab41448fc889ce278.tar.gz
merge up to r202c191
-rwxr-xr-xautogen.sh9
-rw-r--r--configure.ac16
-rw-r--r--ddk_build.cmd2
-rw-r--r--examples/lsusb.dsp4
-rw-r--r--examples/lsusb_2008.vcproj4
-rw-r--r--examples/xusb.c128
-rw-r--r--examples/xusb.dsp4
-rw-r--r--examples/xusb_2008.vcproj4
-rw-r--r--libusb-dll_2005.vcproj6
-rw-r--r--libusb-dll_2008.vcproj2
-rw-r--r--libusb-static_2008.vcproj4
-rw-r--r--libusb/Makefile.am4
-rw-r--r--libusb/core.c2
-rw-r--r--libusb/libusb-1.0.rc (renamed from msvc/libusb-1.0.rc)10
-rw-r--r--libusb/libusb.h2
-rw-r--r--libusb/os/poll_posix.h6
-rw-r--r--libusb/os/threads_windows.c2
-rw-r--r--libusb/os/windows_usb.c27
-rw-r--r--libusb/os/windows_usb.h10
-rw-r--r--libusb_dll.dsp8
-rw-r--r--libusb_static.dsp4
-rw-r--r--msvc/resource.h15
22 files changed, 144 insertions, 129 deletions
diff --git a/autogen.sh b/autogen.sh
index d5c6a19..3295d8d 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -4,9 +4,14 @@
(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize
$LIBTOOLIZE --copy --force || exit 1
+# Force ltmain's NLS test to set locale to C always. Prevents an
+# issue when compiling shared libs with MinGW on Chinese locale.
+type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; }
+sed -e s/\\\\\${\$lt_var+set}/set/g ltmain.sh > lttmp.sh
+mv lttmp.sh ltmain.sh
+#
aclocal || exit 1
autoheader || exit 1
autoconf || exit 1
automake -a -c || exit 1
-./configure --enable-maintainer-mode --enable-debug-log \
- --enable-examples-build $*
+./configure --enable-debug-log --enable-examples-build $*
diff --git a/configure.ac b/configure.ac
index 8d3ba9d..a0abae3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,17 +43,19 @@ case $host in
threads="windows"
LIBS="-lsetupapi -lole32"
AM_CFLAGS="-Wshadow"
- AM_LDFLAGS="-no-undefined"
+ AM_LDFLAGS="-no-undefined -avoid-version"
+ AC_CHECK_TOOL(RC, windres, no)
;;
*-cygwin*)
AC_DEFINE(OS_WINDOWS, [], [Windows backend])
AC_SUBST(OS_WINDOWS)
AC_MSG_RESULT([Windows])
backend="windows"
- threads="posix"
+ threads="posix"
LIBS="-lpthread -lsetupapi -lole32"
AM_CFLAGS=""
- AM_LDFLAGS="-no-undefined"
+ AM_LDFLAGS="-no-undefined -avoid-version"
+ AC_CHECK_TOOL(RC, windres, no)
;;
*)
AC_MSG_ERROR([unsupported operating system])
@@ -64,14 +66,6 @@ AM_CONDITIONAL([OS_DARWIN], [test "x$backend" == "xdarwin"])
AM_CONDITIONAL([OS_WINDOWS], [test "x$backend" == "xwindows"])
AM_CONDITIONAL([POSIX_THREADS], [test "x$threads" == "xposix"])
-# Library versioning
-lt_major="0"
-lt_revision="0"
-lt_age="0"
-AC_SUBST(lt_major)
-AC_SUBST(lt_revision)
-AC_SUBST(lt_age)
-
# timerfd
AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0])
AC_ARG_ENABLE([timerfd],
diff --git a/ddk_build.cmd b/ddk_build.cmd
index 06ddcec..df22b66 100644
--- a/ddk_build.cmd
+++ b/ddk_build.cmd
@@ -15,7 +15,7 @@ set destType=x64
:isI386
set dstPath=%destType%\Debug
-if %_BuildType%==chk goto isDebug
+if %DDKBUILDENV%==chk goto isDebug
set dstPath=%destType%\Release
:isDebug
diff --git a/examples/lsusb.dsp b/examples/lsusb.dsp
index d7b223f..bf16c4e 100644
--- a/examples/lsusb.dsp
+++ b/examples/lsusb.dsp
@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "lsusb - Win32 Debug"
@@ -74,7 +74,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /subsystem:console /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
!ENDIF
diff --git a/examples/lsusb_2008.vcproj b/examples/lsusb_2008.vcproj
index a550240..560f296 100644
--- a/examples/lsusb_2008.vcproj
+++ b/examples/lsusb_2008.vcproj
@@ -53,7 +53,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -131,7 +130,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -209,7 +207,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -290,7 +287,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/examples/xusb.c b/examples/xusb.c
index 6bc3b4f..5664ce6 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -154,7 +154,7 @@ void display_buffer_hex(unsigned char *buffer, unsigned size)
}
-// The XBOX Controller is really a HID device that got its HID Report Descriptors
+// The XBOX Controller is really a HID device that got its HID Report Descriptors
// removed by Microsoft.
// Input/Output reports described at http://euc.jp/periphs/xbox-controller.ja.html
int display_xbox_status(libusb_device_handle *handle)
@@ -691,7 +691,10 @@ __cdecl
#endif
main(int argc, char** argv)
{
+ int show_help = 0;
+ int got_vidpid = 0;
int r;
+ size_t i, arglen1, arglen2;
unsigned tmp_vid, tmp_pid;
uint16_t endian_test = 0xBE00;
@@ -707,63 +710,94 @@ main(int argc, char** argv)
}
if (argc >= 2) {
- if ((argv[1][0] != '-') || (argv[1][1] == 'h')) {
- printf("usage: %s [-h] [-i] [-j] [-k] [-l] [-s] [-x] [vid:pid]\n", argv[0]);
- printf(" -h: display usage\n");
- printf(" -i: test HID device\n");
- printf(" -j: test OLIMEX ARM-USB-TINY JTAG, 2 channel composite device\n");
- printf(" -k: test Mass Storage USB device\n");
- printf(" -l: test Plantronics Headset (HID)\n");
- printf(" -s: test Microsoft Sidewinder Precision Pro (HID)\n");
- printf(" -x: test Microsoft XBox Controller Type S (default)\n");
-
- return 0;
+ arglen1 = strlen(argv[1]);
+ if ( ((argv[1][0] == '-') || (argv[1][0] == '/'))
+ && (arglen1 >= 2) ) {
+ switch(argv[1][1]) {
+ case 'i':
+ // IBM HID Optical mouse - 1 interface
+ VID = 0x04B3;
+ PID = 0x3108;
+ test_mode = USE_HID;
+ break;
+ case 'j':
+ // OLIMEX ARM-USB-TINY JTAG, 2 channel composite device - 2 interfaces
+ VID = 0x15BA;
+ PID = 0x0004;
+ test_mode = USE_JTAG;
+ break;
+ case 'k':
+ // Generic 2 GB USB Key (SCSI Transparent/Bulk Only) - 1 interface
+ VID = 0x0204;
+ PID = 0x6025;
+ test_mode = USE_KEY;
+ break;
+ case 'l':
+ // Plantronics DSP 400, 2 channel HID composite device - 1 HID interface
+ VID = 0x047F;
+ PID = 0x0CA1;
+ test_mode = USE_HID;
+ break;
+ case 's':
+ // Microsoft Sidewinder Precision Pro Joystick - 1 HID interface
+ VID = 0x045E;
+ PID = 0x0008;
+ test_mode = USE_HID;
+ break;
+ default:
+ show_help = -1;
+ break;
+ }
+ } else {
+ for (i=0; i<arglen1; i++) {
+ if (argv[1][i] == ':')
+ break;
+ }
+ if (i != arglen1) {
+ if (sscanf_s(argv[1], "%x:%x" , &tmp_vid, &tmp_pid) != 2) {
+ printf(" Please specify VID & PID as \"vid:pid\" in hexadecimal format\n");
+ return 1;
+ }
+ VID = (uint16_t)tmp_vid;
+ PID = (uint16_t)tmp_pid;
+ test_mode = USE_KEY;
+ got_vidpid = -1;
+ } else {
+ show_help = -1;
+ }
}
- switch(argv[1][1]) {
- case 'i':
- // IBM HID Optical mouse - 1 interface
- VID = 0x04B3;
- PID = 0x3108;
- test_mode = USE_HID;
- break;
- case 'j':
- // OLIMEX ARM-USB-TINY JTAG, 2 channel composite device - 2 interfaces
- VID = 0x15BA;
- PID = 0x0004;
- test_mode = USE_JTAG;
- break;
- case 'k':
- // Generic 2 GB USB Key (SCSI Transparent/Bulk Only) - 1 interface
- VID = 0x0204;
- PID = 0x6025;
- test_mode = USE_KEY;
- break;
- case 'l':
- // Plantronics DSP 400, 2 channel HID composite device - 1 HID interface
- VID = 0x047F;
- PID = 0x0CA1;
- test_mode = USE_HID;
- break;
- case 's':
- // Microsoft Sidewinder Precision Pro Joystick - 1 HID interface
- VID = 0x045E;
- PID = 0x0008;
- test_mode = USE_HID;
- break;
- default:
- break;
+ }
+
+ if ((argc == 3) && (!got_vidpid)) {
+ arglen2 = strlen(argv[2]);
+ for (i=0; i<arglen2; i++) {
+ if (argv[2][i] == ':')
+ break;
}
- if (argc == 3) {
+ if (i != arglen2) {
if (sscanf_s(argv[2], "%x:%x" , &tmp_vid, &tmp_pid) != 2) {
printf(" Please specify VID & PID as \"vid:pid\" in hexadecimal format\n");
return 1;
}
VID = (uint16_t)tmp_vid;
PID = (uint16_t)tmp_pid;
- printf("%04X:%04X\n", VID, PID);
+ } else {
+ show_help = -1;
}
}
+ if ((show_help) || (argc == 1) || (argc >= 4)) {
+ printf("usage: %s [-h] [-i] [-j] [-k] [-l] [-s] [-x] [vid:pid]\n", argv[0]);
+ printf(" -h: display usage\n");
+ printf(" -i: test HID device\n");
+ printf(" -j: test OLIMEX ARM-USB-TINY JTAG, 2 channel composite device\n");
+ printf(" -k: test Mass Storage USB device\n");
+ printf(" -l: test Plantronics Headset (HID)\n");
+ printf(" -s: test Microsoft Sidewinder Precision Pro (HID)\n");
+ printf(" -x: test Microsoft XBox Controller Type S (default)\n");
+ return 0;
+ }
+
r = libusb_init(NULL);
if (r < 0)
return r;
diff --git a/examples/xusb.dsp b/examples/xusb.dsp
index 981ac47..9bd5e38 100644
--- a/examples/xusb.dsp
+++ b/examples/xusb.dsp
@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "xusb - Win32 Debug"
@@ -74,7 +74,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /subsystem:console /debug /machine:I386
!ENDIF
diff --git a/examples/xusb_2008.vcproj b/examples/xusb_2008.vcproj
index f604ecc..224249a 100644
--- a/examples/xusb_2008.vcproj
+++ b/examples/xusb_2008.vcproj
@@ -53,7 +53,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -131,7 +130,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -209,7 +207,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -290,7 +287,6 @@
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/libusb-dll_2005.vcproj b/libusb-dll_2005.vcproj
index 09271b3..18d301b 100644
--- a/libusb-dll_2005.vcproj
+++ b/libusb-dll_2005.vcproj
@@ -52,6 +52,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
+ CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -129,6 +130,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
+ CallingConvention="2
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -211,6 +213,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
+ CallingConvention="2
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -289,6 +292,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
+ CallingConvention="2
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -447,7 +451,7 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
- RelativePath=".\msvc\libusb-1.0.rc"
+ RelativePath=".\libusb\libusb-1.0.rc"
>
</File>
</Filter>
diff --git a/libusb-dll_2008.vcproj b/libusb-dll_2008.vcproj
index a31fdee..85fa353 100644
--- a/libusb-dll_2008.vcproj
+++ b/libusb-dll_2008.vcproj
@@ -388,7 +388,7 @@
>
</File>
<File
- RelativePath=".\msvc\libusb-1.0.rc"
+ RelativePath=".\libusb\libusb-1.0.rc"
>
</File>
</Filter>
diff --git a/libusb-static_2008.vcproj b/libusb-static_2008.vcproj
index 98f37c7..16c7c0e 100644
--- a/libusb-static_2008.vcproj
+++ b/libusb-static_2008.vcproj
@@ -50,7 +50,6 @@
RuntimeLibrary="1"
WarningLevel="3"
DebugInformationFormat="4"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -114,7 +113,6 @@
RuntimeLibrary="1"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -178,7 +176,6 @@
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -243,7 +240,6 @@
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
- CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
index c252b3d..48b28fb 100644
--- a/libusb/Makefile.am
+++ b/libusb/Makefile.am
@@ -8,7 +8,7 @@ endif
LINUX_USBFS_SRC = $(THREADS_SRC) os/poll_posix.h os/linux_usbfs.h os/linux_usbfs.c
DARWIN_USB_SRC = $(THREADS_SRC) os/poll_posix.h os/darwin_usb.h os/darwin_usb.c
-WINDOWS_USB_SRC = $(THREADS_SRC) os/poll_windows.h os/poll_windows.c os/windows_usb.h os/windows_usb.c
+WINDOWS_USB_SRC = $(THREADS_SRC) os/poll_windows.h os/poll_windows.c os/windows_usb.h os/windows_usb.c libusb-1.0.rc
EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(WINDOWS_USB_SRC)
@@ -23,6 +23,8 @@ endif
if OS_WINDOWS
OS_SRC = $(WINDOWS_USB_SRC)
+.rc.lo:
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
endif
libusb_1_0_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS)
diff --git a/libusb/core.c b/libusb/core.c
index 7be7f11..47d5108 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -831,8 +831,8 @@ API_EXPORTED void libusb_unref_device(libusb_device *dev)
usbi_mutex_lock(&dev->ctx->usb_devs_lock);
list_del(&dev->list);
usbi_mutex_unlock(&dev->ctx->usb_devs_lock);
- usbi_mutex_destroy(&dev->lock);
+ usbi_mutex_destroy(&dev->lock);
free(dev);
}
}
diff --git a/msvc/libusb-1.0.rc b/libusb/libusb-1.0.rc
index 769ddb6..5dea80c 100644
--- a/msvc/libusb-1.0.rc
+++ b/libusb/libusb-1.0.rc
@@ -1,6 +1,5 @@
//Microsoft Developer Studio generated resource script.
//
-#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -46,16 +45,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
1 TEXTINCLUDE DISCARDABLE
BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
"#include ""winresrc.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@@ -117,7 +111,7 @@ END
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
-// Generated from the TEXTINCLUDE 3 resource.
+// Generated from the TEXTINCLUDE 2 resource.
//
diff --git a/libusb/libusb.h b/libusb/libusb.h
index 8986013..0127d9f 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -28,8 +28,8 @@
#include <sys/time.h>
#endif
#include <sys/types.h>
-#include <limits.h>
#include <time.h>
+#include <limits.h>
/* 'interface' might be defined as a macro on Windows, so we need to
* undefine it so as not to break the current libusb API, because
diff --git a/libusb/os/poll_posix.h b/libusb/os/poll_posix.h
index 0e9981d..17298a5 100644
--- a/libusb/os/poll_posix.h
+++ b/libusb/os/poll_posix.h
@@ -1,5 +1,5 @@
-#ifndef __LIBUSB_UNISTD_POSIX_H__
-#define __LIBUSB_UNISTD_POSIX_H__
+#ifndef __LIBUSB_POLL_POSIX_H__
+#define __LIBUSB_POLL_POSIX_H__
#include <unistd.h>
#include <poll.h>
@@ -9,4 +9,4 @@
#define usbi_pipe pipe
#define usbi_poll poll
-#endif /* __LIBUSB_UNISTD_POSIX_H__ */
+#endif /* __LIBUSB_POLL_POSIX_H__ */
diff --git a/libusb/os/threads_windows.c b/libusb/os/threads_windows.c
index da49eec..7762190 100644
--- a/libusb/os/threads_windows.c
+++ b/libusb/os/threads_windows.c
@@ -61,7 +61,7 @@ int usbi_mutex_lock(usbi_mutex_t *mutex) {
// so don't know proper errno
}
int usbi_mutex_unlock(usbi_mutex_t *mutex) {
- if(!mutex) return ((errno=EINVAL));
+ if(!mutex) return ((errno=EINVAL));
if(!ReleaseMutex(*mutex)) return ((errno=EPERM ));
return 0;
}
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 689a4e1..42ab75b 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -676,8 +676,10 @@ static int force_hcd_device_descriptor(struct libusb_device *dev, HANDLE handle)
priv->dev_descriptor.bLength = sizeof(USB_DEVICE_DESCRIPTOR);
priv->dev_descriptor.bDescriptorType = USB_DEVICE_DESCRIPTOR_TYPE;
dev->num_configurations = priv->dev_descriptor.bNumConfigurations = 1;
- priv->dev_descriptor.idVendor = 0x1d6b; // Linux Foundation root hub
+ // The following is used to set the VIS:PID of root HUBs similarly to what
+ // Linux does: 1d6b:0001 is for 1x root hubs, 1d6b:0002 for 2x
+ priv->dev_descriptor.idVendor = 0x1d6b; // Linux Foundation root hub
if (windows_version >= WINDOWS_VISTA_AND_LATER) {
size = sizeof(USB_HUB_CAPABILITIES_EX);
if (DeviceIoControl(handle, IOCTL_USB_GET_HUB_CAPABILITIES_EX, &hub_caps_ex,
@@ -694,8 +696,7 @@ static int force_hcd_device_descriptor(struct libusb_device *dev, HANDLE handle)
size, &hub_caps, size, &size, NULL)) {
usbi_warn(ctx, "could not read hub capabilities (std) for hub %s: %s",
priv->path, windows_error_str(0));
- /* Hmm. */
- priv->dev_descriptor.idProduct = 0;
+ priv->dev_descriptor.idProduct = 1; // Indicate 1x speed
} else {
priv->dev_descriptor.idProduct = hub_caps.HubIs2xCapable?2:1;
}
@@ -823,7 +824,7 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
USB_HUB_NAME_FIXED s_hubname;
USB_NODE_CONNECTION_INFORMATION conn_info;
USB_NODE_INFORMATION hub_node;
- bool is_hcd;
+ bool is_hcd, need_unref = false;
int i, r;
LPCWSTR wstr;
char *tmp_str = NULL, *path_str = NULL;
@@ -856,7 +857,10 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
for (i = 1, r = LIBUSB_SUCCESS; ; i++)
{
// safe loop: release all dynamic resources
- safe_unref_device(dev);
+ if (need_unref) {
+ safe_unref_device(dev);
+ need_unref = false;
+ }
safe_free(tmp_str);
safe_free(path_str);
safe_closehandle(handle);
@@ -969,6 +973,7 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
if ((dev = usbi_alloc_device(ctx, session_id)) == NULL) {
LOOP_BREAK(LIBUSB_ERROR_NO_MEM);
}
+ need_unref = true;
LOOP_CHECK(initialize_device(dev, busnum, devaddr, path_str, i,
conn_info.CurrentConfigurationValue, parent_dev));
@@ -2097,12 +2102,12 @@ unsigned __stdcall windows_clock_gettime_threaded(void* param)
if (!QueryPerformanceFrequency(&li_frequency)) {
usbi_dbg("no hires timer available on this platform");
hires_frequency = 0;
- hires_ticks_to_ps = 0;
+ hires_ticks_to_ps = UINT64_C(0);
} else {
hires_frequency = li_frequency.QuadPart;
// The hires frequency can go as high as 4 GHz, so we'll use a conversion
// to picoseconds to compute the tv_nsecs part in clock_gettime
- hires_ticks_to_ps = UINT64_C(1000000000000) / hires_frequency;
+ hires_ticks_to_ps = UINT64_C(1000000000000) / hires_frequency;
usbi_dbg("hires timer available (Frequency: %"PRIu64" Hz)", hires_frequency);
}
@@ -2708,7 +2713,7 @@ static int winusb_submit_control_transfer(struct usbi_transfer *itransfer)
usbi_dbg("will use interface %d", current_interface);
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
- wfd = usbi_create_fd(winusb_handle, _O_RDONLY, ctx);
+ wfd = usbi_create_fd(winusb_handle, _O_RDONLY, ctx);
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
}
@@ -2784,7 +2789,7 @@ static int winusb_submit_bulk_transfer(struct usbi_transfer *itransfer)
winusb_handle = handle_priv->interface_handle[current_interface].api_handle;
direction_in = transfer->endpoint & LIBUSB_ENDPOINT_IN;
- wfd = usbi_create_fd(winusb_handle, direction_in?_O_RDONLY:_O_WRONLY, ctx);
+ wfd = usbi_create_fd(winusb_handle, direction_in?_O_RDONLY:_O_WRONLY, ctx);
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
}
@@ -4486,7 +4491,7 @@ static int hid_submit_control_transfer(struct usbi_transfer *itransfer)
usbi_dbg("will use interface %d", current_interface);
hid_handle = handle_priv->interface_handle[current_interface].api_handle;
- wfd = usbi_create_fd(hid_handle, _O_RDONLY, ctx);
+ wfd = usbi_create_fd(hid_handle, _O_RDONLY, ctx);
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
}
@@ -4588,7 +4593,7 @@ static int hid_submit_bulk_transfer(struct usbi_transfer *itransfer) {
hid_handle = handle_priv->interface_handle[current_interface].api_handle;
direction_in = transfer->endpoint & LIBUSB_ENDPOINT_IN;
- wfd = usbi_create_fd(hid_handle, direction_in?_O_RDONLY:_O_WRONLY, ctx);
+ wfd = usbi_create_fd(hid_handle, direction_in?_O_RDONLY:_O_WRONLY, ctx);
if (wfd.fd < 0) {
return LIBUSB_ERROR_NO_MEM;
}
diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
index 59bb074..921b1c0 100644
--- a/libusb/os/windows_usb.h
+++ b/libusb/os/windows_usb.h
@@ -351,11 +351,11 @@ typedef RETURN_TYPE CONFIGRET;
#define CR_SUCCESS 0x00000000
#define CR_NO_SUCH_DEVNODE 0x0000000D
-#if defined(_CFGMGR32_)
-#define CMAPI DECLSPEC_EXPORT
-#else
-#define CMAPI DECLSPEC_IMPORT
-#endif
+//#if defined(_CFGMGR32_)
+//#define CMAPI DECLSPEC_EXPORT
+//#else
+//#define CMAPI DECLSPEC_IMPORT
+//#endif
#define USB_DEVICE_DESCRIPTOR_TYPE LIBUSB_DT_DEVICE
#define USB_CONFIGURATION_DESCRIPTOR_TYPE LIBUSB_DT_CONFIG
diff --git a/libusb_dll.dsp b/libusb_dll.dsp
index 9f00d99..e937eff 100644
--- a/libusb_dll.dsp
+++ b/libusb_dll.dsp
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
!ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug"
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo /n
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "D:/Program Files/Microsoft SDK/Lib/setupapi.lib" /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0_debug.dll"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0_debug.dll"
# SUBTRACT LINK32 /pdb:none /incremental:no
!ENDIF
@@ -114,7 +114,7 @@ SOURCE=".\libusb\libusb-1.0.def"
# End Source File
# Begin Source File
-SOURCE=".\msvc\libusb-1.0.rc"
+SOURCE=".\libusb\libusb-1.0.rc"
# End Source File
# Begin Source File
@@ -163,7 +163,7 @@ SOURCE=.\libusb\os\linux_usbfs.h
# End Source File
# Begin Source File
-SOURCE=.\msvc\resource.h
+SOURCE=.\libusb\os\poll_posix.h
# End Source File
# Begin Source File
diff --git a/libusb_static.dsp b/libusb_static.dsp
index 922c974..ae6879b 100644
--- a/libusb_static.dsp
+++ b/libusb_static.dsp
@@ -147,6 +147,10 @@ SOURCE=.\libusb\os\linux_usbfs.h
# End Source File
# Begin Source File
+SOURCE=.\libusb\os\poll_posix.h
+# End Source File
+# Begin Source File
+
SOURCE=.\libusb\os\threads_posix.h
# End Source File
# Begin Source File
diff --git a/msvc/resource.h b/msvc/resource.h
deleted file mode 100644
index d973f20..0000000
--- a/msvc/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by libusb-1.0.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif