diff options
author | Pete Batard <pbatard@gmail.com> | 2010-10-28 11:33:17 +0100 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-10-28 11:33:17 +0100 |
commit | 1b538f0e2bd84f500e02a9abdf7d0489fc1b5c0e (patch) | |
tree | a1131d6f4c8390576c76c825b4f1291a8af11edf | |
parent | 80c0b7e852bee78bcff78b78b35105f9b504d1d9 (diff) | |
download | libusb-1b538f0e2bd84f500e02a9abdf7d0489fc1b5c0e.tar.gz |
merge -> pbr319, part 1
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | examples/dpfp.c | 3 | ||||
-rw-r--r-- | examples/dpfp_threaded.c | 3 | ||||
-rw-r--r-- | examples/lsusb.vcproj | 8 | ||||
-rw-r--r-- | examples/lsusb_2008.vcproj | 12 | ||||
-rw-r--r-- | examples/lsusb_sources | 15 | ||||
-rw-r--r-- | examples/xusb.c | 10 | ||||
-rw-r--r-- | examples/xusb.vcproj | 12 | ||||
-rw-r--r-- | examples/xusb_2008.vcproj | 12 | ||||
-rw-r--r-- | examples/xusb_sources | 14 | ||||
-rw-r--r-- | libusb/os/linux_usbfs.c | 112 | ||||
-rw-r--r-- | libusb/os/poll_windows.c | 2 | ||||
-rw-r--r-- | libusb/os/windows_usb.c | 74 | ||||
-rw-r--r-- | libusb/os/windows_usb.h | 41 | ||||
-rw-r--r-- | libusb_dll.vcproj | 12 | ||||
-rw-r--r-- | libusb_dll_2008.vcproj | 12 | ||||
-rw-r--r-- | libusb_static.vcproj | 8 | ||||
-rw-r--r-- | libusb_static_2008.vcproj | 8 |
18 files changed, 166 insertions, 194 deletions
diff --git a/configure.ac b/configure.ac index a45d577..251eb39 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,6 @@ case $host in backend="windows" threads="windows" create_import_lib="yes" - PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32" LIBS="${LIBS} ${PC_LIBS_PRIVATE}" # -avoid-version to avoid a naming scheme such as libusb-0.dll AM_LDFLAGS="-no-undefined -avoid-version -Wl,--add-stdcall-alias" @@ -88,7 +87,6 @@ case $host in AC_MSG_RESULT([Windows]) backend="windows" threads="posix" - PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32" LIBS="${LIBS} ${PC_LIBS_PRIVATE}" AM_CFLAGS="-std=c99 -DWINVER=0x500" AM_LDFLAGS="-no-undefined -avoid-version" diff --git a/examples/dpfp.c b/examples/dpfp.c index af51e0f..a35a373 100644 --- a/examples/dpfp.c +++ b/examples/dpfp.c @@ -225,6 +225,7 @@ static int save_to_file(unsigned char *data) { FILE *fd; char filename[64]; + size_t ignore; sprintf(filename, "finger%d.pgm", img_idx++); fd = fopen(filename, "w"); @@ -232,7 +233,7 @@ static int save_to_file(unsigned char *data) return -1; fputs("P5 384 289 255 ", fd); - fwrite(data + 64, 1, 384*289, fd); + ignore = fwrite(data + 64, 1, 384*289, fd); fclose(fd); printf("saved image to %s\n", filename); return 0; diff --git a/examples/dpfp_threaded.c b/examples/dpfp_threaded.c index 4641a50..7b98192 100644 --- a/examples/dpfp_threaded.c +++ b/examples/dpfp_threaded.c @@ -254,6 +254,7 @@ static int save_to_file(unsigned char *data) { FILE *fd; char filename[64]; + size_t ignore; sprintf(filename, "finger%d.pgm", img_idx++); fd = fopen(filename, "w"); @@ -261,7 +262,7 @@ static int save_to_file(unsigned char *data) return -1; fputs("P5 384 289 255 ", fd); - fwrite(data + 64, 1, 384*289, fd); + ignore = fwrite(data + 64, 1, 384*289, fd); fclose(fd); printf("saved image to %s\n", filename); return 0; diff --git a/examples/lsusb.vcproj b/examples/lsusb.vcproj index dcc0666..ec6c439 100644 --- a/examples/lsusb.vcproj +++ b/examples/lsusb.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -64,7 +64,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -140,7 +139,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -179,7 +177,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -221,7 +219,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -298,7 +295,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
diff --git a/examples/lsusb_2008.vcproj b/examples/lsusb_2008.vcproj index d841dd0..70de59d 100644 --- a/examples/lsusb_2008.vcproj +++ b/examples/lsusb_2008.vcproj @@ -24,7 +24,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
<Tool
@@ -62,7 +62,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(TargetDir)$(ProjectName).pdb"
@@ -96,7 +95,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
<Tool
@@ -135,7 +134,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(TargetDir)$(ProjectName).pdb"
@@ -169,7 +167,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
@@ -206,7 +204,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
ProgramDatabaseFile="$(TargetDir)$(ProjectName).pdb"
SubSystem="1"
@@ -239,7 +236,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
@@ -277,7 +274,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
ProgramDatabaseFile="$(TargetDir)$(ProjectName).pdb"
SubSystem="1"
diff --git a/examples/lsusb_sources b/examples/lsusb_sources index dcc871b..8600180 100644 --- a/examples/lsusb_sources +++ b/examples/lsusb_sources @@ -3,27 +3,12 @@ TARGETTYPE=PROGRAM 386_STDCALL=0 _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) - !IFNDEF MSC_WARNING_LEVEL - MSC_WARNING_LEVEL=/W3 - !ENDIF - - USE_MSVCRT=1 - UMTYPE=console - INCLUDES=..\..\msvc;..\..;$(DDK_INC_PATH) - UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib - -TARGETLIBS=$(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ole32.lib \ - $(SDK_LIB_PATH)\advapi32.lib - SOURCES=..\lsusb.c - diff --git a/examples/xusb.c b/examples/xusb.c index 70f3997..dd8be1d 100644 --- a/examples/xusb.c +++ b/examples/xusb.c @@ -31,19 +31,11 @@ #include <libusb/libusb.h> -#if defined(_MSC_VER) -// On Windows, the libusb library has a dependency on the libraries below. -// for MinGW/cygwin, make sure you link with -lsetupapi -lole32 -ladvapi32 -#pragma comment( lib, "setupapi.lib" ) -#pragma comment( lib, "ole32.lib" ) -#pragma comment( lib, "advapi32.lib" ) -#endif - #ifdef OS_WINDOWS #define msleep(msecs) Sleep(msecs) #else #include <unistd.h> -#define msleep(msecs) usleep(1000*msecs) +#define msleep(msecs) usleep(1000*msecs) #endif #if !defined(_MSC_VER) || _MSC_VER<=1200 diff --git a/examples/xusb.vcproj b/examples/xusb.vcproj index 52d93c8..d65163f 100644 --- a/examples/xusb.vcproj +++ b/examples/xusb.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -64,7 +64,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -101,7 +100,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -140,7 +139,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -179,7 +177,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -221,7 +219,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
@@ -258,7 +255,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -298,7 +295,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\msvc"
GenerateDebugInformation="true"
diff --git a/examples/xusb_2008.vcproj b/examples/xusb_2008.vcproj index 0430c1f..71dcf44 100644 --- a/examples/xusb_2008.vcproj +++ b/examples/xusb_2008.vcproj @@ -24,7 +24,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
<Tool
@@ -63,7 +63,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="1"
@@ -96,7 +95,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
<Tool
@@ -136,7 +135,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="1"
@@ -169,7 +167,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
@@ -206,7 +204,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
SubSystem="1"
TargetMachine="1"
@@ -238,7 +235,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\examples\$(ProjectName)"
ConfigurationType="1"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\$(ProjectName).htm"
>
@@ -276,7 +273,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
AdditionalLibraryDirectories=""
SubSystem="1"
TargetMachine="17"
diff --git a/examples/xusb_sources b/examples/xusb_sources index 52662ac..f7bd1a0 100644 --- a/examples/xusb_sources +++ b/examples/xusb_sources @@ -5,25 +5,11 @@ TARGETTYPE=PROGRAM _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) !IFNDEF MSC_WARNING_LEVEL - MSC_WARNING_LEVEL=/W3 - !ENDIF - - USE_MSVCRT=1 - UMTYPE=console - INCLUDES=..\..\msvc;..\..;$(DDK_INC_PATH) - UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib - -TARGETLIBS=$(SDK_LIB_PATH)\setupapi.lib \ - $(SDK_LIB_PATH)\user32.lib \ - $(SDK_LIB_PATH)\ole32.lib \ - $(SDK_LIB_PATH)\advapi32.lib - SOURCES=..\xusb.c - diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index f006fff..e334db8 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -128,6 +128,9 @@ enum reap_action { /* completed multi-URB transfer in non-final URB */ COMPLETED_EARLY, + + /* one or more urbs encountered a low-level error */ + ERROR, }; struct linux_transfer_priv { @@ -139,6 +142,7 @@ struct linux_transfer_priv { enum reap_action reap_action; int num_urbs; unsigned int num_retired; + enum libusb_transfer_status reap_status; /* next iso packet in user-supplied transfer to be populated */ int iso_packet_offset; @@ -1428,6 +1432,7 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer, tpriv->num_urbs = num_urbs; tpriv->num_retired = 0; tpriv->reap_action = NORMAL; + tpriv->reap_status = LIBUSB_TRANSFER_COMPLETED; for (i = 0; i < num_urbs; i++) { struct usbfs_urb *urb = &urbs[i]; @@ -1771,7 +1776,9 @@ static int cancel_bulk_transfer(struct usbi_transfer *itransfer) if (!tpriv->urbs) return LIBUSB_ERROR_NOT_FOUND; - tpriv->reap_action = CANCELLED; + if (tpriv->reap_action != ERROR) + tpriv->reap_action = CANCELLED; + for (i = 0; i < tpriv->num_urbs; i++) { int tmp = ioctl(dpriv->fd, IOCTL_USBFS_DISCARDURB, &tpriv->urbs[i]); if (tmp && errno != EINVAL) @@ -1849,14 +1856,13 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer, struct usbfs_urb *urb) { struct linux_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer); - int num_urbs = tpriv->num_urbs; + struct libusb_transfer *transfer = __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); + struct linux_device_handle_priv *dpriv = __device_handle_priv(transfer->dev_handle); int urb_idx = urb - tpriv->urbs; - enum libusb_transfer_status status = LIBUSB_TRANSFER_COMPLETED; - int r = 0; usbi_mutex_lock(&itransfer->lock); usbi_dbg("handling completion status %d of bulk urb %d/%d", urb->status, - urb_idx + 1, num_urbs); + urb_idx + 1, tpriv->num_urbs); tpriv->num_retired++; @@ -1880,8 +1886,6 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer, * transferred data and presents it in a contiguous chunk. */ if (urb->actual_length > 0) { - struct libusb_transfer *transfer = - __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); unsigned char *target = transfer->buffer + itransfer->transferred; usbi_dbg("received %d bytes of surplus data", urb->actual_length); if (urb->buffer != target) { @@ -1893,17 +1897,11 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer, itransfer->transferred += urb->actual_length; } - if (tpriv->num_retired == num_urbs) { + if (tpriv->num_retired == tpriv->num_urbs) { usbi_dbg("abnormal reap: last URB handled, reporting"); - if (tpriv->reap_action == CANCELLED) { - free(tpriv->urbs); - tpriv->urbs = NULL; - usbi_mutex_unlock(&itransfer->lock); - r = usbi_handle_transfer_cancellation(itransfer); - goto out_unlock; - } - if (tpriv->reap_action != COMPLETED_EARLY) - status = LIBUSB_TRANSFER_ERROR; + if (tpriv->reap_action != COMPLETED_EARLY && + tpriv->reap_status == LIBUSB_TRANSFER_COMPLETED) + tpriv->reap_status = LIBUSB_TRANSFER_ERROR; goto completed; } goto out_unlock; @@ -1921,66 +1919,74 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer, break; case -EPIPE: usbi_dbg("detected endpoint stall"); - status = LIBUSB_TRANSFER_STALL; - goto completed; + if (tpriv->reap_status == LIBUSB_TRANSFER_COMPLETED) + tpriv->reap_status = LIBUSB_TRANSFER_STALL; + goto cancel_remaining; case -EOVERFLOW: /* overflow can only ever occur in the last urb */ usbi_dbg("overflow, actual_length=%d", urb->actual_length); - status = LIBUSB_TRANSFER_OVERFLOW; + if (tpriv->reap_status == LIBUSB_TRANSFER_COMPLETED) + tpriv->reap_status = LIBUSB_TRANSFER_OVERFLOW; goto completed; case -ETIME: case -EPROTO: case -EILSEQ: + /* These can happen on *any* urb of a multi-urb transfer, so + * save a status and tear down rest of the transfer */ usbi_dbg("low level error %d", urb->status); - status = LIBUSB_TRANSFER_ERROR; - goto completed; + tpriv->reap_action = ERROR; + if (tpriv->reap_status == LIBUSB_TRANSFER_COMPLETED) + tpriv->reap_status = LIBUSB_TRANSFER_ERROR; + goto cancel_remaining; default: usbi_warn(ITRANSFER_CTX(itransfer), "unrecognised urb status %d", urb->status); - status = LIBUSB_TRANSFER_ERROR; - goto completed; + if (tpriv->reap_status == LIBUSB_TRANSFER_COMPLETED) + tpriv->reap_status = LIBUSB_TRANSFER_ERROR; + goto cancel_remaining; } /* if we're the last urb or we got less data than requested then we're * done */ - if (urb_idx == num_urbs - 1) { + if (urb_idx == tpriv->num_urbs - 1) { usbi_dbg("last URB in transfer --> complete!"); + goto completed; } else if (urb->actual_length < urb->buffer_length) { - struct libusb_transfer *transfer = - __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); - struct linux_device_handle_priv *dpriv = - __device_handle_priv(transfer->dev_handle); - int i; - - usbi_dbg("short transfer %d/%d --> complete!", urb->actual_length, - urb->buffer_length); - - /* we have to cancel the remaining urbs and wait for their completion - * before reporting results */ - tpriv->reap_action = COMPLETED_EARLY; - for (i = urb_idx + 1; i < tpriv->num_urbs; i++) { - /* remaining URBs with continuation flag are automatically - * cancelled by the kernel */ - if (tpriv->urbs[i].flags & USBFS_URB_BULK_CONTINUATION) - continue; - int tmp = ioctl(dpriv->fd, IOCTL_USBFS_DISCARDURB, &tpriv->urbs[i]); - if (tmp && errno != EINVAL) - usbi_warn(TRANSFER_CTX(transfer), - "unrecognised discard errno %d", errno); - } - goto out_unlock; - } else { + usbi_dbg("short transfer %d/%d --> complete!", + urb->actual_length, urb->buffer_length); + if (tpriv->reap_action == NORMAL) + tpriv->reap_action = COMPLETED_EARLY; + } else goto out_unlock; + +cancel_remaining: + if (tpriv->num_retired == tpriv->num_urbs) /* nothing to cancel */ + goto completed; + + /* cancel remaining urbs and wait for their completion before + * reporting results */ + while (++urb_idx < tpriv->num_urbs) { + /* remaining URBs with continuation flag are + * automatically cancelled by the kernel */ + if (tpriv->urbs[urb_idx].flags & USBFS_URB_BULK_CONTINUATION) + continue; + int tmp = ioctl(dpriv->fd, IOCTL_USBFS_DISCARDURB, &tpriv->urbs[urb_idx]); + if (tmp && errno != EINVAL) + usbi_warn(TRANSFER_CTX(transfer), + "unrecognised discard errno %d", errno); } +out_unlock: + usbi_mutex_unlock(&itransfer->lock); + return 0; + completed: free(tpriv->urbs); tpriv->urbs = NULL; usbi_mutex_unlock(&itransfer->lock); - return usbi_handle_transfer_completion(itransfer, status); -out_unlock: - usbi_mutex_unlock(&itransfer->lock); - return r; + return CANCELLED == tpriv->reap_action ? + usbi_handle_transfer_cancellation(itransfer) : + usbi_handle_transfer_completion(itransfer, tpriv->reap_status); } static int handle_iso_completion(struct usbi_transfer *itransfer, diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index 370d61e..3657be5 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -169,7 +169,7 @@ void init_polling(void) } if (!is_polling_set) { pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED)) - GetProcAddress(GetModuleHandle("KERNEL32"), "CancelIoEx"); + GetProcAddress(GetModuleHandleA("KERNEL32"), "CancelIoEx"); usbi_dbg("Will use CancelIo%s for I/O cancellation", CancelIoEx_Available?"Ex":""); for (i=0; i<MAX_FDS; i++) { diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 6019bbb..0093bb8 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -41,7 +41,7 @@ #include <process.h> #include <stdio.h> #include <inttypes.h> -#include <objbase.h> // for string to GUID conv. requires libole32.a +#include <objbase.h> #include <winioctl.h> #include <dbt.h> @@ -197,7 +197,7 @@ static char err_string[ERR_BUFFER_SIZE]; safe_sprintf(err_string, ERR_BUFFER_SIZE, "[%d] ", error_code); size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &err_string[safe_strlen(err_string)], + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[safe_strlen(err_string)], ERR_BUFFER_SIZE - (DWORD)safe_strlen(err_string), NULL); if (size == 0) { format_error = GetLastError(); @@ -259,15 +259,23 @@ static char* sanitize_path(const char* path) } /* - * Cfgmgr32 API functions + * Cfgmgr32, OLE32 and SetupAPI DLL functions */ -static int Cfgmgr32_init(void) +static int init_dlls(void) { DLL_LOAD(Cfgmgr32.dll, CM_Get_Parent, TRUE); DLL_LOAD(Cfgmgr32.dll, CM_Get_Child, TRUE); DLL_LOAD(Cfgmgr32.dll, CM_Get_Sibling, TRUE); DLL_LOAD(Cfgmgr32.dll, CM_Get_Device_IDA, TRUE); - + // Prefixed to avoid conflict with header files + DLL_LOAD_PREFIXED(OLE32.dll, p, CLSIDFromString, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiGetClassDevsA, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiEnumDeviceInfo, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiEnumDeviceInterfaces, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiGetDeviceInterfaceDetailA, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiDestroyDeviceInfoList, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiOpenDevRegKey, TRUE); + DLL_LOAD_PREFIXED(SetupAPI.dll, p, SetupDiGetDeviceRegistryPropertyA, TRUE); return LIBUSB_SUCCESS; } @@ -288,19 +296,19 @@ bool get_devinfo_data(struct libusb_context *ctx, HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, unsigned _index) { if (_index <= 0) { - *dev_info = SetupDiGetClassDevs(NULL, "USB", NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES); + *dev_info = pSetupDiGetClassDevsA(NULL, "USB", NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES); if (*dev_info == INVALID_HANDLE_VALUE) { return false; } } dev_info_data->cbSize = sizeof(SP_DEVINFO_DATA); - if (!SetupDiEnumDeviceInfo(*dev_info, _index, dev_info_data)) { + if (!pSetupDiEnumDeviceInfo(*dev_info, _index, dev_info_data)) { if (GetLastError() != ERROR_NO_MORE_ITEMS) { usbi_err(ctx, "Could not obtain device info data for index %u: %s", _index, windows_error_str(0)); } - SetupDiDestroyDeviceInfoList(*dev_info); + pSetupDiDestroyDeviceInfoList(*dev_info); *dev_info = INVALID_HANDLE_VALUE; return false; } @@ -320,15 +328,15 @@ bool get_devinfo_data(struct libusb_context *ctx, * structure returned and call this function repeatedly using the same guid (with an * incremented index starting at zero) until all interfaces have been returned. */ -SP_DEVICE_INTERFACE_DETAIL_DATA *get_interface_details(struct libusb_context *ctx, +SP_DEVICE_INTERFACE_DETAIL_DATA_A *get_interface_details(struct libusb_context *ctx, HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, const GUID* guid, unsigned _index) { SP_DEVICE_INTERFACE_DATA dev_interface_data; - SP_DEVICE_INTERFACE_DETAIL_DATA *dev_interface_details = NULL; + SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details = NULL; DWORD size; if (_index <= 0) { - *dev_info = SetupDiGetClassDevs(guid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE); + *dev_info = pSetupDiGetClassDevsA(guid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE); } if (*dev_info == INVALID_HANDLE_VALUE) { return NULL; @@ -336,30 +344,30 @@ SP_DEVICE_INTERFACE_DETAIL_DATA *get_interface_details(struct libusb_context *ct if (dev_info_data != NULL) { dev_info_data->cbSize = sizeof(SP_DEVINFO_DATA); - if (!SetupDiEnumDeviceInfo(*dev_info, _index, dev_info_data)) { + if (!pSetupDiEnumDeviceInfo(*dev_info, _index, dev_info_data)) { if (GetLastError() != ERROR_NO_MORE_ITEMS) { usbi_err(ctx, "Could not obtain device info data for index %u: %s", _index, windows_error_str(0)); } - SetupDiDestroyDeviceInfoList(*dev_info); + pSetupDiDestroyDeviceInfoList(*dev_info); *dev_info = INVALID_HANDLE_VALUE; return NULL; } } dev_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); - if (!SetupDiEnumDeviceInterfaces(*dev_info, NULL, guid, _index, &dev_interface_data)) { + if (!pSetupDiEnumDeviceInterfaces(*dev_info, NULL, guid, _index, &dev_interface_data)) { if (GetLastError() != ERROR_NO_MORE_ITEMS) { usbi_err(ctx, "Could not obtain interface data for index %u: %s", _index, windows_error_str(0)); } - SetupDiDestroyDeviceInfoList(*dev_info); + pSetupDiDestroyDeviceInfoList(*dev_info); *dev_info = INVALID_HANDLE_VALUE; return NULL; } // Read interface data (dummy + actual) to access the device path - if (!SetupDiGetDeviceInterfaceDetail(*dev_info, &dev_interface_data, NULL, 0, &size, NULL)) { + if (!pSetupDiGetDeviceInterfaceDetailA(*dev_info, &dev_interface_data, NULL, 0, &size, NULL)) { // The dummy call should fail with ERROR_INSUFFICIENT_BUFFER if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { usbi_err(ctx, "could not access interface data (dummy) for index %u: %s", @@ -376,8 +384,8 @@ SP_DEVICE_INTERFACE_DETAIL_DATA *get_interface_details(struct libusb_context *ct goto err_exit; } - dev_interface_details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); - if (!SetupDiGetDeviceInterfaceDetail(*dev_info, &dev_interface_data, + dev_interface_details->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); + if (!pSetupDiGetDeviceInterfaceDetailA(*dev_info, &dev_interface_data, dev_interface_details, size, &size, NULL)) { usbi_err(ctx, "could not access interface data (actual) for index %u: %s", _index, windows_error_str(0)); @@ -386,7 +394,7 @@ SP_DEVICE_INTERFACE_DETAIL_DATA *get_interface_details(struct libusb_context *ct return dev_interface_details; err_exit: - SetupDiDestroyDeviceInfoList(*dev_info); + pSetupDiDestroyDeviceInfoList(*dev_info); *dev_info = INVALID_HANDLE_VALUE; return NULL; } @@ -743,10 +751,10 @@ static int windows_init(struct libusb_context *ctx) int i, r = LIBUSB_ERROR_OTHER; OSVERSIONINFO os_version; HANDLE semaphore; - TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) + char sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) sprintf(sem_name, "libusb_init%08X", (unsigned int)GetCurrentProcessId()&0xFFFFFFFF); - semaphore = CreateSemaphore(NULL, 1, 1, sem_name); + semaphore = CreateSemaphoreA(NULL, 1, 1, sem_name); if (semaphore == NULL) { usbi_err(ctx, "could not create semaphore: %s", windows_error_str(0)); return LIBUSB_ERROR_NO_MEM; @@ -790,9 +798,9 @@ static int windows_init(struct libusb_context *ctx) // Initialize pollable file descriptors init_polling(); - // Load missing CFGMGR32.DLL imports - if (Cfgmgr32_init() != LIBUSB_SUCCESS) { - usbi_err(ctx, "could not resolve Cfgmgr32.dll functions"); + // Load DLL imports + if (init_dlls() != LIBUSB_SUCCESS) { + usbi_err(ctx, "could not resolve DLL functions"); return LIBUSB_ERROR_NOT_FOUND; } @@ -1101,7 +1109,7 @@ static uint8_t get_api_type(struct libusb_context *ctx, // Check the service & filter names to know the API we should use for (k=0; k<3; k++) { - if (SetupDiGetDeviceRegistryPropertyA(*dev_info, dev_info_data, lookup[k].reg_prop, + if (pSetupDiGetDeviceRegistryPropertyA(*dev_info, dev_info_data, lookup[k].reg_prop, ®_type, (BYTE*)lookup[k].list, MAX_KEY_LENGTH, &size)) { // Turn the REG_SZ SPDRP_SERVICE into REG_MULTI_SZ if (lookup[k].reg_prop == SPDRP_SERVICE) { @@ -1214,7 +1222,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered struct discovered_devs *discdevs = *_discdevs; HDEVINFO dev_info; SP_DEVINFO_DATA dev_info_data; - SP_DEVICE_INTERFACE_DETAIL_DATA *dev_interface_details = NULL; + SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details = NULL; GUID hid_guid; #define MAX_ENUM_GUIDS 64 const GUID* guid[MAX_ENUM_GUIDS]; @@ -1318,7 +1326,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered // The SPDRP_ADDRESS for USB devices is the device port number on the hub port_nr = 0; if ((pass >= HUB_PASS) && (pass <= GEN_PASS)) { - if ( (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_ADDRESS, + if ( (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_ADDRESS, ®_type, (BYTE*)&port_nr, 4, &size)) || (size != 4) ) { usbi_warn(ctx, "could not retrieve port number for device %s, skipping: %s", @@ -1336,13 +1344,13 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered case GEN_PASS: // We use the GEN pass to detect driverless devices... size = sizeof(strbuf); - if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_DRIVER, + if (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_DRIVER, ®_type, (BYTE*)strbuf, size, &size)) { usbi_info(ctx, "The following device has no driver: '%s'", dev_id_path); usbi_info(ctx, "libusb will not be able to access it."); } // ...and to add the additional device interface GUIDs - key = SetupDiOpenDevRegKey(dev_info, &dev_info_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); + key = pSetupDiOpenDevRegKey(dev_info, &dev_info_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); if (key != INVALID_HANDLE_VALUE) { size = sizeof(guid_string_w); s = RegQueryValueExW(key, L"DeviceInterfaceGUIDs", NULL, ®_type, @@ -1355,7 +1363,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered LOOP_BREAK(LIBUSB_ERROR_OVERFLOW); } if_guid = calloc(1, sizeof(GUID)); - CLSIDFromString(guid_string_w, if_guid); + pCLSIDFromString(guid_string_w, if_guid); guid[nb_guids++] = if_guid; usbi_dbg("extra GUID: %s", guid_to_string(if_guid)); } @@ -1366,7 +1374,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered break; default: // DEV_PASS or EXT_PASS // Get the API type (after checking that the driver installation is OK) - if ( (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_INSTALL_STATE, + if ( (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_INSTALL_STATE, ®_type, (BYTE*)&install_state, 4, &size)) || (size != 4) ){ usbi_warn(ctx, "could not detect installation state of driver for '%s': %s", @@ -1559,10 +1567,10 @@ static void windows_exit(struct libusb_context *ctx) struct windows_context_priv *ctx_priv = __context_priv(ctx); int i; HANDLE semaphore; - TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) + char sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) sprintf(sem_name, "libusb_init%08X", (unsigned int)GetCurrentProcessId()&0xFFFFFFFF); - semaphore = CreateSemaphore(NULL, 1, 1, sem_name); + semaphore = CreateSemaphoreA(NULL, 1, 1, sem_name); if (semaphore == NULL) { return; } diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h index a1319ca..8ee7146 100644 --- a/libusb/os/windows_usb.h +++ b/libusb/os/windows_usb.h @@ -337,28 +337,47 @@ struct driver_lookup { /* * API macros - from libusb-win32 1.x */ -#define DLL_DECLARE(api, ret, name, args) \ - typedef ret (api * __dll_##name##_t)args; __dll_##name##_t name = NULL +#define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) \ + typedef ret (api * __dll_##name##_t)args; \ + static __dll_##name##_t prefix##name = NULL -#define DLL_LOAD(dll, name, ret_on_failure) \ +#define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) \ do { \ - HMODULE h = GetModuleHandle(#dll); \ + HMODULE h = GetModuleHandleA(#dll); \ if (!h) \ - h = LoadLibrary(#dll); \ + h = LoadLibraryA(#dll); \ if (!h) { \ if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; }\ else { break; } \ } \ - name = (__dll_##name##_t)GetProcAddress(h, #name); \ - if (name) break; \ - name = (__dll_##name##_t)GetProcAddress(h, #name "A"); \ - if (name) break; \ - name = (__dll_##name##_t)GetProcAddress(h, #name "W"); \ - if (name) break; \ + prefix##name = (__dll_##name##_t)GetProcAddress(h, #name);\ + if (prefix##name) break; \ + prefix##name = (__dll_##name##_t)GetProcAddress(h, #name "A");\ + if (prefix##name) break; \ + prefix##name = (__dll_##name##_t)GetProcAddress(h, #name "W");\ + if (prefix##name) break; \ if(ret_on_failure) \ return LIBUSB_ERROR_NOT_FOUND; \ } while(0) +#define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXED(api, ret, , name, args) +#define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXED(dll, , name, ret_on_failure) + +/* OLE32 dependency */ +DLL_DECLARE_PREFIXED(WINAPI, HRESULT, p, CLSIDFromString, (LPCOLESTR, LPCLSID)); + +/* SetupAPI dependencies */ +DLL_DECLARE_PREFIXED(WINAPI, HDEVINFO, p, SetupDiGetClassDevsA, (const GUID*, PCSTR, HWND, DWORD)); +DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInfo, (HDEVINFO, DWORD, PSP_DEVINFO_DATA)); +DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiEnumDeviceInterfaces, (HDEVINFO, PSP_DEVINFO_DATA, + const GUID*, DWORD, PSP_DEVICE_INTERFACE_DATA)); +DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceInterfaceDetailA, (HDEVINFO, PSP_DEVICE_INTERFACE_DATA, + PSP_DEVICE_INTERFACE_DETAIL_DATA_A, DWORD, PDWORD, PSP_DEVINFO_DATA)); +DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiDestroyDeviceInfoList, (HDEVINFO)); +DLL_DECLARE_PREFIXED(WINAPI, HKEY, p, SetupDiOpenDevRegKey, (HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM)); +DLL_DECLARE_PREFIXED(WINAPI, BOOL, p, SetupDiGetDeviceRegistryPropertyA, (HDEVINFO, + PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD)); + /* * Windows DDK API definitions. Most of it copied from MinGW's includes diff --git a/libusb_dll.vcproj b/libusb_dll.vcproj index 5c3f712..aa4343e 100644 --- a/libusb_dll.vcproj +++ b/libusb_dll.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -64,7 +64,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="2"
ModuleDefinitionFile="libusb\libusb-1.0.def"
@@ -102,7 +101,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -141,7 +140,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib ole32.lib advapi32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="1"
ModuleDefinitionFile="libusb\libusb-1.0.def"
@@ -181,7 +179,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -223,7 +221,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="2"
ModuleDefinitionFile="libusb\libusb-1.0.def"
@@ -261,7 +258,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -301,7 +298,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
LinkIncremental="1"
ModuleDefinitionFile="libusb\libusb-1.0.def"
diff --git a/libusb_dll_2008.vcproj b/libusb_dll_2008.vcproj index 735c282..3512b98 100644 --- a/libusb_dll_2008.vcproj +++ b/libusb_dll_2008.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -60,7 +60,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
ModuleDefinitionFile="libusb\libusb-1.0.def"
EmbedManagedResourceFile="libusb-1.0.rc"
@@ -93,7 +92,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -131,7 +130,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
ModuleDefinitionFile="libusb\libusb-1.0.def"
EmbedManagedResourceFile="libusb-1.0.rc"
@@ -164,7 +162,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -200,7 +198,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
ModuleDefinitionFile="libusb\libusb-1.0.def"
EmbedManagedResourceFile="libusb-1.0.rc"
@@ -232,7 +229,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\dll\libusb-1.0"
ConfigurationType="2"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -269,7 +266,6 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="setupapi.lib advapi32.lib ole32.lib"
OutputFile="$(OutDir)\libusb-1.0.dll"
ModuleDefinitionFile="libusb\libusb-1.0.def"
EmbedManagedResourceFile="libusb-1.0.rc"
diff --git a/libusb_static.vcproj b/libusb_static.vcproj index 51fdcc0..8a60ac3 100644 --- a/libusb_static.vcproj +++ b/libusb_static.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -87,7 +87,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -149,7 +149,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -214,7 +214,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
diff --git a/libusb_static_2008.vcproj b/libusb_static_2008.vcproj index cfbaba6..8541676 100644 --- a/libusb_static_2008.vcproj +++ b/libusb_static_2008.vcproj @@ -23,7 +23,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -83,7 +83,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -144,7 +144,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -203,7 +203,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib\libusb-1.0"
ConfigurationType="4"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
|