Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externals: Update libusb to version 1.0.22 #6545

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Externals/libusb/.private/README.txt
@@ -0,0 +1,5 @@
This directory contains private internal scripts used by the libusb
project maintainers.

These scripts are not intended for general usage and will not be
exported when producing release archives.
89 changes: 89 additions & 0 deletions Externals/libusb/.private/bd.cmd
@@ -0,0 +1,89 @@
@echo off
rem produce the DDK binary files for snapshots
rem !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!

if NOT x%DDK_TARGET_OS%==xWinXP goto usage

set IWD=%~dp0
cd ..
mkdir E:\dailies\%DATE%
for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A
for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A\static
for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A\dll
for %%A in (source bin32 bin64) do mkdir E:\dailies\%DATE%\examples\%%A
copy examples\listdevs.c E:\dailies\%DATE%\examples\source
copy examples\xusb.c E:\dailies\%DATE%\examples\source
copy examples\ezusb.? E:\dailies\%DATE%\examples\source
copy examples\fxload.c E:\dailies\%DATE%\examples\source
copy msvc\stdint.h E:\dailies\%DATE%\examples\source
copy .private\wbs.txt E:\dailies\%DATE%\README.txt

set ORG_BUILD_ALT_DIR=%BUILD_ALT_DIR%
set ORG_BUILDARCH=%_BUILDARCH%
set ORG_PATH=%PATH%
set ORG_BUILD_DEFAULT_TARGETS=%BUILD_DEFAULT_TARGETS%

set 386=1
set AMD64=
set BUILD_DEFAULT_TARGETS=-386
set _AMD64bit=
set _BUILDARCH=x86
set PATH=%BASEDIR%\bin\x86;%BASEDIR%\bin\x86\x86

cd msvc
call ddk_build
cd ..

@echo off
copy Win32\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS32\static
copy Win32\Release\examples\listdevs.exe E:\dailies\%DATE%\examples\bin32
copy Win32\Release\examples\xusb.exe E:\dailies\%DATE%\examples\bin32
copy Win32\Release\examples\fxload.exe E:\dailies\%DATE%\examples\bin32

cd msvc
call ddk_build DLL
cd ..

@echo off
copy Win32\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS32\dll
copy Win32\Release\dll\libusb-1.0.dll E:\dailies\%DATE%\MS32\dll
copy Win32\Release\dll\libusb-1.0.pdb E:\dailies\%DATE%\MS32\dll

set 386=
set AMD64=1
set BUILD_DEFAULT_TARGETS=-amd64
set _AMD64bit=true
set _BUILDARCH=AMD64
set PATH=%BASEDIR%\bin\x86\amd64;%BASEDIR%\bin\x86

cd msvc
call ddk_build
cd ..

@echo off
copy x64\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS64\static
copy x64\Release\examples\listdevs.exe E:\dailies\%DATE%\examples\bin64
copy x64\Release\examples\xusb.exe E:\dailies\%DATE%\examples\bin64
copy x64\Release\examples\fxload.exe E:\dailies\%DATE%\examples\bin64

cd msvc
call ddk_build DLL
cd ..

@echo off
copy x64\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS64\dll
copy x64\Release\dll\libusb-1.0.dll E:\dailies\%DATE%\MS64\dll
copy x64\Release\dll\libusb-1.0.pdb E:\dailies\%DATE%\MS64\dll

set BUILD_ALT_DIR=%ORG_BUILD_ALT_DIR%
set _BUILDARCH=%ORG_BUILDARCH%
set PATH=%ORG_PATH%
set BUILD_DEFAULT_TARGETS=%ORG_BUILD_DEFAULT_TARGETS%

goto done

:usage
echo must be run in a WXP build environment!

:done
cd %IWD%
54 changes: 54 additions & 0 deletions Externals/libusb/.private/bm.sh
@@ -0,0 +1,54 @@
#!/bin/sh
# produce the MinGW binary files for snapshots
# !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!

PWD=`pwd`
cd ..
date=`date +%Y.%m.%d`
target=e:/dailies/$date
mkdir -p $target/include/libusb-1.0
cp -v libusb/libusb-1.0.def $target
cp -v libusb/libusb.h $target/include/libusb-1.0

#
# 32 bit binaries
#
target=e:/dailies/$date/MinGW32
git clean -fdx
# Not using debug (-g) in CFLAGS DRAMATICALLY reduces the size of the binaries
export CFLAGS="-O2 -m32"
export LDFLAGS="-m32"
export RCFLAGS="--target=pe-i386"
export DLLTOOLFLAGS="-m i386 -f --32"
echo `pwd`
(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize
$LIBTOOLIZE --copy --force || exit 1
aclocal || exit 1
autoheader || exit 1
autoconf || exit 1
automake -a -c || exit 1
./configure
make -j2
mkdir -p $target/static
mkdir -p $target/dll
cp -v libusb/.libs/libusb-1.0.a $target/static
cp -v libusb/.libs/libusb-1.0.dll $target/dll
cp -v libusb/.libs/libusb-1.0.dll.a $target/dll
make clean -j2

#
# 64 bit binaries
#
target=e:/dailies/$date/MinGW64
export CFLAGS="-O2"
export LDFLAGS=""
export RCFLAGS=""
export DLLTOOLFLAGS=""
./configure
make -j2
mkdir -p $target/static
mkdir -p $target/dll
cp -v libusb/.libs/libusb-1.0.a $target/static
cp -v libusb/.libs/libusb-1.0.dll $target/dll
cp -v libusb/.libs/libusb-1.0.dll.a $target/dll
cd $PWD
57 changes: 57 additions & 0 deletions Externals/libusb/.private/bwince.cmd
@@ -0,0 +1,57 @@
@echo off
rem produce the Win CE binary files for snapshots
rem !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!

if "x%VSINSTALLDIR%"=="x" goto usage

if "x%WINCE_TARGET_DIR_BASE%"=="x" set WINCE_TARGET_DIR_BASE=E:\dailies
if "x%WINCE_TARGET_ARCHES%"=="x" set WINCE_TARGET_ARCHES=ARMV4I MIPSII MIPSII_FP MIPSIV MIPSIV_FP SH4 x86


set WINCE_TARGET_DIR=%WINCE_TARGET_DIR_BASE%\%DATE:/=-%
set MSBUILD_CMD=msbuild.exe
set MSBUILD_TARGET=Rebuild
set MSBUILD_CONFIGURATION=Release
set WINCE_SLN=msvc\libusb_wince.sln
set PLATFORM_PREFIX=STANDARDSDK_500 (
set PLATFORM_POSTFIX=)


set PWD=%~dp0
cd ..

mkdir %WINCE_TARGET_DIR%
mkdir %WINCE_TARGET_DIR%\include\libusb-1.0
copy libusb\libusb-1.0.def %WINCE_TARGET_DIR%
copy libusb\libusb.h %WINCE_TARGET_DIR%\include\libusb-1.0
for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A
for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A\static
for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A\dll
for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\examples\%%A
mkdir %WINCE_TARGET_DIR%\examples\source
copy examples\listdevs.c %WINCE_TARGET_DIR%\examples\source
copy examples\xusb.c %WINCE_TARGET_DIR%\examples\source
copy msvc\stdint.h %WINCE_TARGET_DIR%\examples\source
copy .private\wbs_wince.txt %WINCE_TARGET_DIR%\README.txt
copy COPYING %WINCE_TARGET_DIR%\COPYING

rem Perform the rebuild
for %%A in (%WINCE_TARGET_ARCHES%) do %MSBUILD_CMD% %WINCE_SLN% /property:Platform="%PLATFORM_PREFIX%%%A%PLATFORM_POSTFIX%" /property:Configuration=%MSBUILD_CONFIGURATION% /target:%MSBUILD_TARGET%"


rem Copy across the binaries
for %%A in (%WINCE_TARGET_ARCHES%) do (
copy %%A\%MSBUILD_CONFIGURATION%\lib\libusb-1.0.lib %WINCE_TARGET_DIR%\%%A\static
copy %%A\%MSBUILD_CONFIGURATION%\examples\listdevs.exe %WINCE_TARGET_DIR%\examples\%%A
copy %%A\%MSBUILD_CONFIGURATION%\examples\xusb.exe %WINCE_TARGET_DIR%\examples\%%A
copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.lib %WINCE_TARGET_DIR%\%%A\dll
copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.dll %WINCE_TARGET_DIR%\%%A\dll
copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.pdb %WINCE_TARGET_DIR%\%%A\dll )

goto done

:usage
echo must be run in a Visual Studio 2005 build environment!

:done
cd %PWD%
28 changes: 28 additions & 0 deletions Externals/libusb/.private/post-rewrite.sh
@@ -0,0 +1,28 @@
#!/bin/sh
#
# Detect amended commits and warn user if .amend is missing
#
# To have git run this script on commit, create a "post-rewrite" text file in
# .git/hooks/ with the following content:
# #!/bin/sh
# if [ -x .private/post-rewrite.sh ]; then
# source .private/post-rewrite.sh
# fi
#
# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
# libusb development team and are NOT intended to solve versioning for any
# derivative branch, such as one you would create for private development.
#

case "$1" in
amend)
# Check if a .amend exists. If none, create one and warn user to re-commit.
if [ -f .amend ]; then
rm .amend
else
echo "Amend commit detected, but no .amend file - One has now been created."
echo "Please re-commit as is (amend), so that the version number is correct."
touch .amend
fi ;;
*) ;;
esac
48 changes: 48 additions & 0 deletions Externals/libusb/.private/pre-commit.sh
@@ -0,0 +1,48 @@
#!/bin/sh
#
# Sets the nano version according to the number of commits on this branch, as
# well as the branch offset.
#
# To have git run this script on commit, first make sure you change
# BRANCH_OFFSET to 60000 or higher, then create a "pre-commit" text file in
# .git/hooks/ with the following content:
# #!/bin/sh
# if [ -x .private/pre-commit.sh ]; then
# source .private/pre-commit.sh
# fi
#
# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
# libusb development team and are NOT intended to solve versioning for any
# derivative branch, such as one you would create for private development.
#
# Should you wish to reuse these scripts for your own versioning, in your own
# private branch, we kindly ask you to first set BRANCH_OFFSET to 60000, or
# higher, as any offset below below 60000 is *RESERVED* for libusb official
# usage.

################################################################################
## YOU *MUST* SET THE FOLLOWING TO 60000 OR HIGHER IF YOU REUSE THIS SCRIPT ##
################################################################################
BRANCH_OFFSET=10000
################################################################################

if [ "$BASH_VERSION" = '' ]; then
TYPE_CMD="type git >/dev/null 2>&1"
else
TYPE_CMD="type -P git &>/dev/null"
fi

eval $TYPE_CMD || { echo "git command not found. Aborting." >&2; exit 1; }

NANO=`git log --oneline | wc -l`
NANO=`expr $NANO + $BRANCH_OFFSET`
# Amended commits need to have the nano corrected. Current versions of git hooks
# only allow detection of amending post commit, so we require a .amend file,
# which will be created post commit with a user warning if none exists when an
# amend is detected.
if [ -f .amend ]; then
NANO=`expr $NANO - 1`
fi
echo "setting nano to $NANO"
echo "#define LIBUSB_NANO $NANO" > libusb/version_nano.h
git add libusb/version_nano.h
61 changes: 61 additions & 0 deletions Externals/libusb/.private/wbs.txt
@@ -0,0 +1,61 @@
libusb 1.0 Windows binary snapshot - README

*********************************************************************
* The latest version of this snapshot can always be downloaded at: *
* https://sourceforge.net/projects/libusb/files/ *
*********************************************************************

o Visual Studio:
- Open existing or create a new project for your application
- Copy libusb.h, from the include\libusb-1.0\ directory, into your project and
make sure that the location where the file reside appears in the 'Additional
Include Directories' section (Configuration Properties -> C/C++ -> General).
- Copy the relevant .lib file from MS32\ or MS64\ and add 'libusb-1.0.lib' to
your 'Additional Dependencies' (Configuration Properties -> Linker -> Input)
Also make sure that the directory where libusb-1.0.lib resides is added to
'Additional Library Directories' (Configuration Properties -> Linker
-> General)
- If you use the static version of the libusb library, make sure that
'Runtime Library' is set to 'Multi-threaded DLL (/MD)' (Configuration
Properties -> C/C++ -> Code Generation).
NB: If your application requires /MT (Multi-threaded/libCMT), you need to
recompile a static libusb 1.0 library from source.
- Compile and run your application. If you use the DLL version of libusb-1.0,
remember that you need to have a copy of the DLL either in the runtime
directory or in system32

o WDK/DDK:
- The following is an example of a sources files that you can use to compile
a libusb 1.0 based console application. In this sample ..\libusb\ is the
directory where you would have copied libusb.h as well as the relevant
libusb-1.0.lib

TARGETNAME=your_app
TARGETTYPE=PROGRAM
USE_MSVCRT=1
UMTYPE=console
INCLUDES=..\libusb;$(DDK_INC_PATH)
TARGETLIBS=..\libusb\libusb-1.0.lib
SOURCES=your_app.c

- Note that if you plan to use libCMT instead of MSVCRT (USE_LIBCMT=1 instead
of USE_MSVCRT=1), you will need to recompile libusb to use libCMT. This can
easily be achieved, in the DDK environment, by running 'ddk_build /MT'

o MinGW/cygwin
- Copy libusb.h, from include/libusb-1.0/ to your default include directory,
and copy the MinGW32/ or MinGW64/ .a files to your default library directory.
Or, if you don't want to use the default locations, make sure that you feed
the relevant -I and -L options to the compiler.
- Add the '-lusb-1.0' linker option when compiling.

o Additional information:
- The libusb 1.0 API documentation can be accessed at:
http://api.libusb.info
- For some libusb samples (including source), please have a look in examples/
- For additional information on the libusb 1.0 Windows backend please visit:
http://windows.libusb.info
- The MinGW and MS generated DLLs are fully interchangeable, provided that you
use the import libs provided or generate one from the .def also provided.
- If you find any issue, please visit http://libusb.info/ and check the
Support section
42 changes: 42 additions & 0 deletions Externals/libusb/.private/wbs_wince.txt
@@ -0,0 +1,42 @@
libusb 1.0 Windows CE binary snapshot - README

*********************************************************************
* The latest version of this snapshot can always be downloaded at: *
* https://sourceforge.net/projects/libusb/files/ *
*********************************************************************

The binaries contained in this snapshot are licensed under the
GNU Lesser General Public License version 2.1 or, at your option, any later
version (see COPYING for further details). The source code for these binaries
is available for download at the same location as this binary snapshot.

o Visual Studio:
- Open existing or create a new project for your application
- Copy libusb.h, from the include\libusb-1.0\ directory, into your project and
make sure that the location where the file reside appears in the 'Additional
Include Directories' section (Configuration Properties -> C/C++ -> General).
- Copy the relevant .lib file from ARMV4I, MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP,
SH4 or x86 and add 'libusb-1.0.lib' to your 'Additional Dependencies'
(Configuration Properties -> Linker -> Input). Also make sure that the
directory where libusb-1.0.lib resides is added to 'Additional Library
Directories' (Configuration Properties -> Linker -> General)
- If you use the static version of the libusb library, make sure that
'Runtime Library' is set to 'Multi-threaded DLL (/MD)' (Configuration
Properties -> C/C++ -> Code Generation).
NB: If your application requires /MT (Multi-threaded/libCMT), you need to
recompile a static libusb 1.0 library from source.
- Compile and run your application. If you use the DLL version of libusb-1.0,
remember that you need to have a copy of the DLL either in the runtime
directory or in system32

o Additional information:
- The libusb 1.0 API documentation can be accessed at:
http://api.libusb.info
- For some libusb samples (including source), please have a look in examples/
- For additional information on the libusb 1.0 Windows backend please visit:
http://windows.libusb.info
- It is necessary to install the CE USB Kernel Wrapper driver for libusb to
function on a device. This is obtainable from:
https://github.com/RealVNC/CEUSBKWrapper
- If you find any issue, please visit http://libusb.info/ and check the
Support section