V0.1
This commit is contained in:
parent
b051b5fe52
commit
28e0cec76f
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
26
AES_KEY/CMakeLists.txt
Normal file
26
AES_KEY/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.0...4.0)
|
||||
project(AES_USB)
|
||||
|
||||
add_subdirectory(libusb)
|
||||
|
||||
add_library(AES_USB STATIC
|
||||
src/AES_USB.cpp
|
||||
)
|
||||
|
||||
target_include_directories(AES_USB PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libusb/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(AES_USB PRIVATE pthread)
|
||||
target_link_libraries(AES_USB PUBLIC
|
||||
usb-1.0
|
||||
)
|
||||
elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
|
||||
target_link_libraries(AES_USB PUBLIC
|
||||
setupapi hid
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "OHOS")
|
||||
target_link_libraries(AES_USB PUBLIC libhid.z.so libusb_ndk.z.so)
|
||||
endif ()
|
||||
110
AES_KEY/include/AES_USB.h
Normal file
110
AES_KEY/include/AES_USB.h
Normal file
@ -0,0 +1,110 @@
|
||||
#ifndef AES_USB_COMM_H
|
||||
#define AES_USB_COMM_H
|
||||
|
||||
#include <string>
|
||||
#include "vector"
|
||||
#include "stdint.h"
|
||||
|
||||
#ifdef __OHOS__
|
||||
#include <usb/usb_ddk_api.h>
|
||||
#include <usb/usb_ddk_types.h>
|
||||
#include "hid/hid_ddk_api.h"
|
||||
#include "hid/hid_ddk_types.h"
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
#define AES_BUFFER_MAX 60
|
||||
|
||||
typedef uint8_t AES_Buffer;
|
||||
|
||||
class AES_USB {
|
||||
class HIDDevice;
|
||||
HIDDevice* hidDevice;
|
||||
typedef enum {
|
||||
// 缓冲区过大或错误,缓冲区最大60字节
|
||||
BUFFER_MAX_ERROR = -2,
|
||||
// 设备不存在
|
||||
DEVICE_NOT_EXIST = -1,
|
||||
// UserPIN 错误
|
||||
DEVICE_USER_PIN_ERROR = -3,
|
||||
} HID_ERROR;
|
||||
char devicePIN[21];
|
||||
public:
|
||||
typedef struct OH_USB_Driver{
|
||||
int32_t vendor_id;
|
||||
int32_t product_id;
|
||||
int64_t deviceId;
|
||||
}OH_USB_Driver;
|
||||
/**
|
||||
* @brief 初始化USB
|
||||
* @return int 0成功 -1失败
|
||||
*/
|
||||
static int init();
|
||||
/**
|
||||
* @brief 释放USB
|
||||
*/
|
||||
static void release();
|
||||
AES_USB();
|
||||
~AES_USB();
|
||||
/**
|
||||
* @brief 打开设备
|
||||
* @param vendor_id 设备VID
|
||||
* @param product_id 设备PID
|
||||
* @param drivers USB列表(只有鸿蒙需要)
|
||||
* @return int 1成功 -1失败
|
||||
*/
|
||||
int open(uint16_t vendor_id, uint16_t product_id,const std::vector<OH_USB_Driver>& drivers = std::vector<OH_USB_Driver>()) const;
|
||||
/**
|
||||
* @brief 设置用户PIN
|
||||
* @param pin 用户PIN
|
||||
* @return 设置用户PIN结果 0: 失败 1: 成功 -1: PIN长度错误
|
||||
*/
|
||||
int setUserPIN(const std::string& pin);
|
||||
/**
|
||||
* @brief 写入指定的VID和PID
|
||||
* @param vendor_id VID
|
||||
* @param product_id PID
|
||||
* @return int 0成功 -1失败
|
||||
*/
|
||||
int set_vid_pid(uint16_t vendor_id, uint16_t product_id) const;
|
||||
/**
|
||||
* @brief 读取VID和PID值
|
||||
* @param vendor_id VID
|
||||
* @param product_id PID
|
||||
* @return int 1: 成功 -1: 失败
|
||||
*/
|
||||
int read_vid_pid(uint16_t* vendor_id, uint16_t* product_id) const;
|
||||
/**
|
||||
* @brief 写入数据
|
||||
* @param data 数据
|
||||
* @param length 数据长度
|
||||
* @param timeout 超时时间
|
||||
* @return int32_t 大于0成功 小于等于0失败 -> HID_ERROR
|
||||
*/
|
||||
int32_t write(uint8_t* data, int length, int timeout = 1000 * 1000) const;
|
||||
/**
|
||||
* @brief 读取数据
|
||||
* @param data 数据
|
||||
* @param length 数据长度
|
||||
* @param timeout 超时
|
||||
* @return int32_t 大于0成功 小于等于0失败 -> HID_ERROR
|
||||
*/
|
||||
int32_t read(uint8_t* data, int length, int timeout = 1000 * 1000) const;
|
||||
/**
|
||||
* @brief 关闭设备
|
||||
*/
|
||||
void close() const;
|
||||
//---------------厂家函数------------------------------------------------------------------------------
|
||||
static int resetAll();
|
||||
typedef struct PID_Key {
|
||||
uint16_t vendor_id;
|
||||
uint16_t product_id;
|
||||
uint8_t PIN[20];
|
||||
} PID_Key;
|
||||
static int readID_Pin(PID_Key* key);
|
||||
static int writeID_Pin(const PID_Key* key);
|
||||
//---------------厂家函数------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
AES_KEY/lib/Linux/Arm32/AES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/Arm32/AES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Linux/Arm32/libAES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/Arm32/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Linux/Arm64/AES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/Arm64/AES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Linux/Arm64/libAES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/Arm64/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Linux/x64/AES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/x64/AES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Linux/x64/libAES_USB.a
Normal file
BIN
AES_KEY/lib/Linux/x64/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/OHOS/Arm32/libAES_USB.a
Normal file
BIN
AES_KEY/lib/OHOS/Arm32/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/OHOS/Arm64/libAES_USB.a
Normal file
BIN
AES_KEY/lib/OHOS/Arm64/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/ia64/lib/AES_USB.lib
Normal file
BIN
AES_KEY/lib/Windows/ia64/lib/AES_USB.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/ia64/libusb0.dll
Normal file
BIN
AES_KEY/lib/Windows/ia64/libusb0.dll
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/ia64/libusb0.sys
Normal file
BIN
AES_KEY/lib/Windows/ia64/libusb0.sys
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/hid.dll
Normal file
BIN
AES_KEY/lib/Windows/x64/hid.dll
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/AES_USB.a
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/AES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/AES_USB.lib
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/AES_USB.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/hid.lib
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/hid.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/libAES_USB.a
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/libAES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/libAES_USB.lib
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/libAES_USB.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/setupapi.Lib
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/setupapi.Lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/lib/winusb.lib
Normal file
BIN
AES_KEY/lib/Windows/x64/lib/winusb.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/libusb0.dll
Normal file
BIN
AES_KEY/lib/Windows/x64/libusb0.dll
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/libusb0.sys
Normal file
BIN
AES_KEY/lib/Windows/x64/libusb0.sys
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x64/setupapi.dll
Normal file
BIN
AES_KEY/lib/Windows/x64/setupapi.dll
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x86/hid.dll
Normal file
BIN
AES_KEY/lib/Windows/x86/hid.dll
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x86/lib/AES_USB.a
Normal file
BIN
AES_KEY/lib/Windows/x86/lib/AES_USB.a
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x86/lib/AES_USB.lib
Normal file
BIN
AES_KEY/lib/Windows/x86/lib/AES_USB.lib
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x86/libusb0.sys
Normal file
BIN
AES_KEY/lib/Windows/x86/libusb0.sys
Normal file
Binary file not shown.
BIN
AES_KEY/lib/Windows/x86/libusb0_x86.dll
Normal file
BIN
AES_KEY/lib/Windows/x86/libusb0_x86.dll
Normal file
Binary file not shown.
257
AES_KEY/libusb/CMakeLists.txt
Normal file
257
AES_KEY/libusb/CMakeLists.txt
Normal file
@ -0,0 +1,257 @@
|
||||
cmake_minimum_required(VERSION 3.16...4.10)
|
||||
|
||||
get_filename_component(LIBUSB_ROOT "libusb/libusb" ABSOLUTE)
|
||||
|
||||
# Get the version information from version.h ignoring the nano version as it appears in version_nano.h and so we need it?
|
||||
file(READ "${LIBUSB_ROOT}/version.h" VERSIONHEADERDATA)
|
||||
string(REGEX MATCH "#define LIBUSB_MAJOR ([0-9]*)" _ ${VERSIONHEADERDATA})
|
||||
set(LIBUSB_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "#define LIBUSB_MINOR ([0-9]*)" _ ${VERSIONHEADERDATA})
|
||||
set(LIBUSB_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "#define LIBUSB_MICRO ([0-9]*)" _ ${VERSIONHEADERDATA})
|
||||
set(LIBUSB_VERSION_MICRO ${CMAKE_MATCH_1})
|
||||
set(LIBUSB_VERSION "${LIBUSB_VERSION_MAJOR}.${LIBUSB_VERSION_MINOR}.${LIBUSB_VERSION_MICRO}")
|
||||
|
||||
project(usb-1.0
|
||||
DESCRIPTION "A cross-platform library to access USB devices"
|
||||
VERSION ${LIBUSB_VERSION}
|
||||
LANGUAGES C
|
||||
)
|
||||
if(EMSCRIPTEN)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
enable_language(CXX)
|
||||
endif()
|
||||
|
||||
# This function generates all the local variables what end up getting written to config.
|
||||
# We use a function as any vars set in this context don't mess with the rest of the file.
|
||||
# e.g. Logging LIBUSB_ENABLE_LOGGING mapps to ENABLE_LOGGING in the config, keeps it clean
|
||||
function(generate_config_file)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
check_function_exists(pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
|
||||
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
|
||||
check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
|
||||
check_function_exists(eventfd HAVE_EVENTFD)
|
||||
check_function_exists(pipe2 HAVE_PIPE2)
|
||||
check_function_exists(syslog HAVE_SYSLOG)
|
||||
|
||||
check_include_files(asm/types.h HAVE_ASM_TYPES_H)
|
||||
check_include_files(sys/eventfd.h HAVE_EVENTFD)
|
||||
check_include_files(string.h HAVE_STRING_H)
|
||||
check_include_files(sys/time.h HAVE_SYS_TIME_H)
|
||||
|
||||
check_symbol_exists(timerfd_create "sys/timerfd.h" HAVE_TIMERFD)
|
||||
check_symbol_exists(nfds_t "poll.h" HAVE_NFDS_T)
|
||||
|
||||
check_struct_has_member("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
|
||||
|
||||
if(HAVE_VISIBILITY)
|
||||
set(DEFAULT_VISIBILITY "__attribute__((visibility(\"default\")))")
|
||||
else()
|
||||
set(DEFAULT_VISIBILITY "" )
|
||||
endif()
|
||||
|
||||
# Set vars that will be written into the config file.
|
||||
if(WIN32)
|
||||
set(PLATFORM_WINDOWS 1)
|
||||
else()
|
||||
set(PLATFORM_POSIX 1)
|
||||
endif()
|
||||
|
||||
if(LIBUSB_ENABLE_LOGGING)
|
||||
set(ENABLE_LOGGING ${LIBUSB_ENABLE_LOGGING})
|
||||
endif()
|
||||
if(LIBUSB_ENABLE_DEBUG_LOGGING)
|
||||
set(ENABLE_DEBUG_LOGGING ${LIBUSB_ENABLE_DEBUG_LOGGING})
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY "${LIBUSB_GEN_INCLUDES}")
|
||||
if(NOT MSVC)
|
||||
set(_GNU_SOURCE TRUE)
|
||||
endif()
|
||||
configure_file(config.h.in "${LIBUSB_GEN_INCLUDES}/config.h" @ONLY)
|
||||
endfunction()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(LIBUSB_BUILD_SHARED_LIBS_DEFAULT ON)
|
||||
else()
|
||||
set(LIBUSB_BUILD_SHARED_LIBS_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
option(LIBUSB_BUILD_SHARED_LIBS "Build Shared Libraries for libusb" ${LIBUSB_BUILD_SHARED_LIBS_DEFAULT})
|
||||
option(LIBUSB_BUILD_TESTING "Build Tests" OFF)
|
||||
if(LIBUSB_BUILD_TESTING)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
option(LIBUSB_BUILD_EXAMPLES "Build Example Applications" OFF)
|
||||
|
||||
option(LIBUSB_INSTALL_TARGETS "Install libusb targets" ON)
|
||||
option(LIBUSB_TARGETS_INCLUDE_USING_SYSTEM "Make targets include paths System" ON)
|
||||
|
||||
option(LIBUSB_ENABLE_LOGGING "Enable Logging" ON)
|
||||
option(LIBUSB_ENABLE_DEBUG_LOGGING "Enable Debug Logging" OFF)
|
||||
|
||||
#option(LIBUSB_ENABLE_UDEV "Enable udev backend for device enumeration" OFF)
|
||||
|
||||
#if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# option(LIBUSB_ENABLE_UDEV "Enable udev backend for device enumeration" ON)
|
||||
#endif()
|
||||
|
||||
set(LIBUSB_GEN_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/gen_include")
|
||||
generate_config_file()
|
||||
|
||||
if(LIBUSB_BUILD_SHARED_LIBS)
|
||||
add_library(usb-1.0 SHARED)
|
||||
else()
|
||||
add_library(usb-1.0 STATIC)
|
||||
endif()
|
||||
|
||||
set_target_properties(usb-1.0 PROPERTIES
|
||||
PREFIX lib # to be consistent with mainline libusb build system(s)
|
||||
)
|
||||
|
||||
# common sources
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_GEN_INCLUDES}/config.h"
|
||||
"${LIBUSB_ROOT}/core.c"
|
||||
"${LIBUSB_ROOT}/descriptor.c"
|
||||
"${LIBUSB_ROOT}/hotplug.c"
|
||||
"${LIBUSB_ROOT}/io.c"
|
||||
"${LIBUSB_ROOT}/libusb.h"
|
||||
"${LIBUSB_ROOT}/libusbi.h"
|
||||
"${LIBUSB_ROOT}/strerror.c"
|
||||
"${LIBUSB_ROOT}/sync.c"
|
||||
"${LIBUSB_ROOT}/version.h"
|
||||
"${LIBUSB_ROOT}/version_nano.h"
|
||||
)
|
||||
target_include_directories(usb-1.0
|
||||
PRIVATE
|
||||
"${LIBUSB_GEN_INCLUDES}"
|
||||
"${LIBUSB_ROOT}/os"
|
||||
)
|
||||
|
||||
if (LIBUSB_TARGETS_INCLUDE_USING_SYSTEM)
|
||||
target_include_directories(usb-1.0 SYSTEM PUBLIC "${LIBUSB_ROOT}")
|
||||
else()
|
||||
target_include_directories(usb-1.0 PUBLIC "${LIBUSB_ROOT}")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/libusb-1.0.def"
|
||||
"${LIBUSB_ROOT}/os/events_windows.c"
|
||||
"${LIBUSB_ROOT}/os/events_windows.h"
|
||||
"${LIBUSB_ROOT}/os/threads_windows.c"
|
||||
"${LIBUSB_ROOT}/os/threads_windows.h"
|
||||
"${LIBUSB_ROOT}/os/windows_common.c"
|
||||
"${LIBUSB_ROOT}/os/windows_common.h"
|
||||
"${LIBUSB_ROOT}/os/windows_usbdk.c"
|
||||
"${LIBUSB_ROOT}/os/windows_usbdk.h"
|
||||
"${LIBUSB_ROOT}/os/windows_winusb.c"
|
||||
"${LIBUSB_ROOT}/os/windows_winusb.h"
|
||||
$<$<C_COMPILER_ID:MSVC>:${LIBUSB_ROOT}/libusb-1.0.rc>
|
||||
)
|
||||
target_compile_definitions(usb-1.0 PRIVATE $<$<C_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS=1>)
|
||||
target_link_libraries(usb-1.0 PRIVATE windowsapp)
|
||||
set_target_properties(usb-1.0 PROPERTIES UNITY_BUILD OFF)
|
||||
else()
|
||||
# common POSIX/non-Windows sources
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/events_posix.c"
|
||||
"${LIBUSB_ROOT}/os/events_posix.h"
|
||||
"${LIBUSB_ROOT}/os/threads_posix.c"
|
||||
"${LIBUSB_ROOT}/os/threads_posix.h"
|
||||
)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.c"
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.h"
|
||||
)
|
||||
if(LIBUSB_ENABLE_UDEV)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_udev.c"
|
||||
)
|
||||
target_link_libraries(usb-1.0 PRIVATE udev)
|
||||
target_compile_definitions(usb-1.0 PRIVATE HAVE_LIBUDEV=1)
|
||||
else()
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_netlink.c"
|
||||
)
|
||||
endif()
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(usb-1.0 PRIVATE Threads::Threads)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.c"
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.h"
|
||||
)
|
||||
if(LIBUSB_ENABLE_UDEV)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_udev.c"
|
||||
)
|
||||
target_link_libraries(usb-1.0 PRIVATE udev)
|
||||
target_compile_definitions(usb-1.0 PRIVATE HAVE_LIBUDEV=1)
|
||||
else()
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_netlink.c"
|
||||
)
|
||||
endif()
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(usb-1.0 PRIVATE Threads::Threads)
|
||||
elseif(ANDROID)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/linux_netlink.c"
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.c"
|
||||
"${LIBUSB_ROOT}/os/linux_usbfs.h"
|
||||
)
|
||||
target_link_libraries(usb-1.0 PRIVATE android log)
|
||||
elseif(APPLE)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/darwin_usb.c"
|
||||
"${LIBUSB_ROOT}/os/darwin_usb.h"
|
||||
)
|
||||
target_link_libraries(usb-1.0 PRIVATE
|
||||
"-framework Foundation"
|
||||
"-framework IOKit"
|
||||
"-framework Security"
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/netbsd_usb.c"
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/openbsd_usb.c"
|
||||
)
|
||||
elseif(EMSCRIPTEN)
|
||||
target_sources(usb-1.0 PRIVATE
|
||||
"${LIBUSB_ROOT}/os/emscripten_webusb.cpp"
|
||||
)
|
||||
target_compile_options(usb-1.0 PRIVATE -pthread)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target platform: ${CMAKE_SYSTEM_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#if(LIBUSB_BUILD_TESTING)
|
||||
# add_subdirectory(tests)
|
||||
#endif()
|
||||
#
|
||||
#if(LIBUSB_BUILD_EXAMPLES)
|
||||
# add_subdirectory(examples)
|
||||
#endif()
|
||||
|
||||
if(LIBUSB_INSTALL_TARGETS)
|
||||
install(TARGETS usb-1.0)
|
||||
install(FILES "${LIBUSB_ROOT}/libusb.h" DESTINATION "include/libusb-1.0")
|
||||
endif()
|
||||
504
AES_KEY/libusb/LICENSE
Normal file
504
AES_KEY/libusb/LICENSE
Normal file
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
17
AES_KEY/libusb/README.md
Normal file
17
AES_KEY/libusb/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# libusb-cmake
|
||||
|
||||
This is the _**community**-supported_ CMake build system for [libusb] project.
|
||||
|
||||
The _officially-supported_ build system for [libusb] remains Autotools, as part of the [libusb] main repo.
|
||||
|
||||
NOTE: [libusb/](libusb/) subfolder is a git [subtree](https://www.atlassian.com/git/tutorials/git-subtree). Do not attempt to contribute to it - use an upstream [libusb] repo for that purpose.
|
||||
|
||||
## Use cases
|
||||
|
||||
The main use case as of this moment - using libusb as a [subdirectory](https://cmake.org/cmake/help/latest/command/add_subdirectory.html). Depending on the needs of the host project `libusb` may be built with different options, with or w/o installing binaries, etc.
|
||||
|
||||
---
|
||||
|
||||
More details: TBD.
|
||||
|
||||
[libusb]: https://github.com/libusb/libusb
|
||||
75
AES_KEY/libusb/config.h.in
Normal file
75
AES_KEY/libusb/config.h.in
Normal file
@ -0,0 +1,75 @@
|
||||
/* #define to the attribute for default visibility. */
|
||||
#define DEFAULT_VISIBILITY @DEFAULT_VISIBILITY@
|
||||
|
||||
/* #define to 1 to start with debug message logging enabled. */
|
||||
#cmakedefine ENABLE_DEBUG_LOGGING 1
|
||||
|
||||
/* #define to 1 to enable message logging. */
|
||||
#cmakedefine ENABLE_LOGGING 1
|
||||
|
||||
/* #define to 1 if you have the <asm/types.h> header file. */
|
||||
#cmakedefine HAVE_ASM_TYPES_H
|
||||
|
||||
/* #define to 1 if you have the `clock_gettime' function. */
|
||||
#cmakedefine HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* #define to 1 if the system has eventfd functionality. */
|
||||
#cmakedefine HAVE_EVENTFD 1
|
||||
|
||||
/* #define to 1 if the system has the type `nfds_t'. */
|
||||
#cmakedefine HAVE_NFDS_T 1
|
||||
|
||||
/* #define to 1 if you have the `pipe2' function. */
|
||||
#cmakedefine HAVE_PIPE2 1
|
||||
|
||||
/* #define to 1 if you have the `pthread_condattr_setclock' function. */
|
||||
#cmakedefine HAVE_PTHREAD_CONDATTR_SETCLOCK 1
|
||||
|
||||
/* #define to 1 if you have the `pthread_setname_np' function. */
|
||||
#cmakedefine HAVE_PTHREAD_SETNAME_NP 1
|
||||
|
||||
/* #define to 1 if you have the `pthread_threadid_np' function. */
|
||||
#cmakedefine HAVE_PTHREAD_THREADID_NP 1
|
||||
|
||||
/* #define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
|
||||
/* #define to 1 if the system has the type `struct timespec'. */
|
||||
#cmakedefine HAVE_STRUCT_TIMESPEC 1
|
||||
|
||||
/* #define to 1 if you have the `syslog' function. */
|
||||
#cmakedefine HAVE_SYSLOG 1
|
||||
|
||||
/* #define to 1 if you have the <sys/time.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TIME_H 1
|
||||
|
||||
/* #define to 1 if the system has timerfd functionality. */
|
||||
#cmakedefine HAVE_TIMERFD 1
|
||||
|
||||
/* #define to 1 if compiling for a POSIX platform. */
|
||||
#cmakedefine PLATFORM_POSIX 1
|
||||
|
||||
/* #define to 1 if compiling for a Windows platform. */
|
||||
#cmakedefine PLATFORM_WINDOWS 1
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define PRINTF_FORMAT(a, b) __attribute__ ((format (__printf__, a, b)))
|
||||
#else
|
||||
#define PRINTF_FORMAT(a, b)
|
||||
#endif
|
||||
|
||||
/* #define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
|
||||
/* #define to 1 to output logging messages to the systemwide log. */
|
||||
#cmakedefine USE_SYSTEM_LOGGING_FACILITY
|
||||
|
||||
/* Enable GNU extensions. */
|
||||
#cmakedefine _GNU_SOURCE 1
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
50
AES_KEY/libusb/examples/CMakeLists.txt
Normal file
50
AES_KEY/libusb/examples/CMakeLists.txt
Normal file
@ -0,0 +1,50 @@
|
||||
project(examples
|
||||
VERSION ${LIBUSB_VERSION}
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
get_filename_component(EXAMPLES_ROOT "${LIBUSB_ROOT}/../examples" ABSOLUTE)
|
||||
|
||||
if(MSVC)
|
||||
add_library(getoptMSVC STATIC
|
||||
"${LIBUSB_ROOT}/../msvc/getopt/getopt.c"
|
||||
"${LIBUSB_ROOT}/../msvc/getopt/getopt.h"
|
||||
"${LIBUSB_ROOT}/../msvc/getopt/getopt1.c"
|
||||
)
|
||||
# Need to pass HAVE_CONFIG_H so getopt.h can load the config header
|
||||
target_compile_definitions(getoptMSVC PRIVATE HAVE_CONFIG_H)
|
||||
target_include_directories(getoptMSVC
|
||||
PUBLIC "${LIBUSB_ROOT}/../msvc/getopt/"
|
||||
PRIVATE "${LIBUSB_GEN_INCLUDES}"
|
||||
)
|
||||
endif()
|
||||
|
||||
function(add_libusb_example TEST_NAME)
|
||||
set(SOURCES)
|
||||
foreach(SOURCE_NAME ${ARGN})
|
||||
list(APPEND SOURCES "${EXAMPLES_ROOT}/${SOURCE_NAME}")
|
||||
endforeach()
|
||||
add_executable("${TEST_NAME}" ${SOURCES})
|
||||
target_include_directories("${TEST_NAME}" PRIVATE "${LIBUSB_GEN_INCLUDES}")
|
||||
target_link_libraries("${TEST_NAME}" PRIVATE usb-1.0)
|
||||
target_compile_definitions("${TEST_NAME}" PRIVATE $<$<C_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS=1>)
|
||||
endfunction()
|
||||
|
||||
add_libusb_example(listdevs "listdevs.c")
|
||||
|
||||
add_libusb_example(dpfp "dpfp.c")
|
||||
|
||||
add_libusb_example(hotplugtest "hotplugtest.c")
|
||||
|
||||
add_libusb_example(fxload
|
||||
"ezusb.c"
|
||||
"ezusb.h"
|
||||
"fxload.c"
|
||||
)
|
||||
target_link_libraries(fxload PRIVATE $<$<C_COMPILER_ID:MSVC>:getoptMSVC>)
|
||||
|
||||
add_libusb_example(testlibusb "testlibusb.c")
|
||||
|
||||
add_libusb_example(sam3u_benchmark "sam3u_benchmark.c")
|
||||
|
||||
add_libusb_example(xusb "xusb.c")
|
||||
2453
AES_KEY/libusb/include/libusb-1.0/libusb.h
Normal file
2453
AES_KEY/libusb/include/libusb-1.0/libusb.h
Normal file
File diff suppressed because it is too large
Load Diff
34
AES_KEY/libusb/libusb/.clang-tidy
Normal file
34
AES_KEY/libusb/libusb/.clang-tidy
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
Checks: "-*,\
|
||||
boost-*,\
|
||||
bugprone-*,\
|
||||
-bugprone-easily-swappable-parameters,\
|
||||
-bugprone-narrowing-conversions,\
|
||||
-bugprone-signed-char-misuse,\
|
||||
-bugprone-switch-missing-default-case,\
|
||||
clang-analyzer-*,\
|
||||
-clang-analyzer-core.NullDereference,\
|
||||
-clang-analyzer-deadcode.DeadStores,\
|
||||
-clang-analyzer-optin.portability.UnixAPI,\
|
||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,\
|
||||
-clang-analyzer-security.insecureAPI.strcpy,\
|
||||
-clang-analyzer-unix.Malloc,\
|
||||
misc-*,\
|
||||
-misc-no-recursion,\
|
||||
-misc-include-cleaner,\
|
||||
modernize-*,\
|
||||
-modernize-macro-to-enum,\
|
||||
performance-*,\
|
||||
-performance-no-int-to-ptr,\
|
||||
-performance-type-promotion-in-math-fn,\
|
||||
portability-*,\
|
||||
readability-*,\
|
||||
-readability-braces-around-statements,\
|
||||
-readability-else-after-return,\
|
||||
-readability-identifier-length,\
|
||||
-readability-function-cognitive-complexity,\
|
||||
-readability-isolate-declaration,\
|
||||
-readability-magic-numbers,\
|
||||
"
|
||||
#WarningsAsErrors: "*"
|
||||
...
|
||||
3
AES_KEY/libusb/libusb/.codespellrc
Normal file
3
AES_KEY/libusb/libusb/.codespellrc
Normal file
@ -0,0 +1,3 @@
|
||||
[codespell]
|
||||
skip = strerror.c,AUTHORS
|
||||
ignore-words-list = numer,ser,xwindows
|
||||
7
AES_KEY/libusb/libusb/.gitattributes
vendored
Normal file
7
AES_KEY/libusb/libusb/.gitattributes
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
*.ac eol=lf
|
||||
*.am eol=lf
|
||||
*.bat eol=crlf
|
||||
*.sh eol=lf
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
INSTALL_WIN.txt eol=crlf
|
||||
26
AES_KEY/libusb/libusb/.github/cifuzz.yml
vendored
Normal file
26
AES_KEY/libusb/libusb/.github/cifuzz.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
id: build
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'libusb'
|
||||
dry-run: false
|
||||
language: c
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'libusb'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
language: c
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
50
AES_KEY/libusb/libusb/.github/workflows/linux.yml
vendored
Normal file
50
AES_KEY/libusb/libusb/.github/workflows/linux.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: linux
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on: [push, pull_request]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run
|
||||
# sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job
|
||||
# can access it
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: setup prerequisites
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install autoconf automake libtool libudev-dev m4
|
||||
|
||||
- name: bootstrap
|
||||
run: ./bootstrap.sh
|
||||
|
||||
- name: netlink
|
||||
# Disable tests for netlink as it doesn't seem to work in the CI environment.
|
||||
run: .private/ci-build.sh --build-dir build-netlink --no-test -- --disable-udev
|
||||
|
||||
- name: udev
|
||||
run: .private/ci-build.sh --build-dir build-udev -- --enable-udev
|
||||
|
||||
- name: debug-log
|
||||
run: .private/ci-build.sh --build-dir build-debug -- --enable-debug-log
|
||||
|
||||
- name: disable-log
|
||||
run: .private/ci-build.sh --build-dir build-nolog -- --disable-log
|
||||
|
||||
- uses: mymindstorm/setup-emsdk@v13
|
||||
|
||||
- run: npm ci
|
||||
working-directory: tests/webusb-test-shim
|
||||
|
||||
- name: emscripten
|
||||
run: emconfigure .private/ci-build.sh --build-dir build-emscripten -- --host=wasm32-unknown-emscripten
|
||||
|
||||
- name: umockdev test
|
||||
run: .private/ci-container-build.sh docker.io/amd64/ubuntu:rolling
|
||||
36
AES_KEY/libusb/libusb/.github/workflows/macos.yml
vendored
Normal file
36
AES_KEY/libusb/libusb/.github/workflows/macos.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
name: macOS
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on: [push, pull_request]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run
|
||||
# sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job
|
||||
# can access it
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: setup prerequisites
|
||||
shell: bash
|
||||
run: |
|
||||
brew update
|
||||
brew install autoconf automake libtool m4
|
||||
|
||||
- name: bootstrap
|
||||
shell: bash
|
||||
run: ./bootstrap.sh
|
||||
|
||||
- name: compile
|
||||
shell: bash
|
||||
run: .private/ci-build.sh --build-dir build
|
||||
|
||||
- name: Xcode
|
||||
shell: bash
|
||||
run: cd Xcode && xcodebuild -project libusb.xcodeproj
|
||||
23
AES_KEY/libusb/libusb/.github/workflows/msys2.yml
vendored
Normal file
23
AES_KEY/libusb/libusb/.github/workflows/msys2.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: MSYS2 build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-autotools
|
||||
- name: bootstrap
|
||||
run: ./bootstrap.sh
|
||||
- name: Build
|
||||
# GCC on MSYS2 doesn't have ASAN support (but Clang does).
|
||||
run: ./.private/ci-build.sh --build-dir build-msys2 --no-asan
|
||||
- name: Build with logging disabled
|
||||
run: ./.private/ci-build.sh --build-dir build-msys2-nolog --no-asan -- --disable-log
|
||||
29
AES_KEY/libusb/libusb/.github/workflows/msys2_clang64-aarch64.yml
vendored
Normal file
29
AES_KEY/libusb/libusb/.github/workflows/msys2_clang64-aarch64.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: MSYS2 aarch64 clang64
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-11-arm
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: clangarm64
|
||||
update: true
|
||||
install: git mingw-w64-clang-aarch64-cc mingw-w64-clang-aarch64-autotools
|
||||
- name: CI-Build
|
||||
run: |
|
||||
echo 'Running in MSYS2!'
|
||||
./bootstrap.sh
|
||||
./.private/ci-build.sh --no-asan --build-dir build-msys2-clang64-aarch64
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-msys2-clang64-aarch64
|
||||
path: |
|
||||
build-msys2-clang64-aarch64/libusb/.libs/libusb-1.0.dll.a
|
||||
build-msys2-clang64-aarch64/libusb/.libs/libusb-1.0.a
|
||||
build-msys2-clang64-aarch64/libusb/.libs/libusb-1.0.dll
|
||||
21
AES_KEY/libusb/libusb/.github/workflows/msys2_clang64.yml
vendored
Normal file
21
AES_KEY/libusb/libusb/.github/workflows/msys2_clang64.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: MSYS2 clang64 build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: clang64
|
||||
update: true
|
||||
install: git mingw-w64-clang-x86_64-cc mingw-w64-clang-x86_64-autotools
|
||||
- name: CI-Build
|
||||
run: |
|
||||
echo 'Running in MSYS2!'
|
||||
./bootstrap.sh
|
||||
./.private/ci-build.sh --build-dir build-msys2-clang64
|
||||
37
AES_KEY/libusb/libusb/.github/workflows/windows.yml
vendored
Normal file
37
AES_KEY/libusb/libusb/.github/workflows/windows.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Windows build and Package
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- 'windows-2022'
|
||||
- 'windows-2025'
|
||||
configuration:
|
||||
- 'Debug'
|
||||
- 'Release'
|
||||
- 'Debug-MT'
|
||||
- 'Release-MT'
|
||||
- 'Debug-Hotplug'
|
||||
- 'Release-Hotplug'
|
||||
- 'Debug-Hotplug-MT'
|
||||
- 'Release-Hotplug-MT'
|
||||
architecture:
|
||||
- 'Win32'
|
||||
- 'x64'
|
||||
- 'ARM64'
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.3
|
||||
|
||||
- name: Build solution
|
||||
run: |
|
||||
msbuild msvc/libusb.sln /m -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.architecture }}
|
||||
88
AES_KEY/libusb/libusb/.gitignore
vendored
Normal file
88
AES_KEY/libusb/libusb/.gitignore
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
!doc/Makefile.in
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
*.js
|
||||
!/tests/webusb-test-shim/*.js
|
||||
*.wasm
|
||||
*.html
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
stamp-h1
|
||||
m4/
|
||||
autom4te.cache
|
||||
INSTALL
|
||||
install-sh
|
||||
depcomp
|
||||
configure
|
||||
aclocal.m4
|
||||
compile
|
||||
test-driver
|
||||
config.guess
|
||||
config.h*
|
||||
!msvc/config.h
|
||||
!android/config.h
|
||||
!Xcode/config.h
|
||||
.vs
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
*.swp
|
||||
doxygen.cfg
|
||||
examples/listdevs
|
||||
examples/xusb
|
||||
examples/dpfp
|
||||
examples/dpfp_threaded
|
||||
examples/fxload
|
||||
examples/hotplugtest
|
||||
examples/sam3u_benchmark
|
||||
examples/testlibusb
|
||||
tests/init_context
|
||||
tests/macos
|
||||
tests/set_option
|
||||
tests/stress
|
||||
tests/stress_mt
|
||||
tests/*.log
|
||||
tests/*.trs
|
||||
android/libs
|
||||
android/obj
|
||||
*.exe
|
||||
*.pc
|
||||
doc/api-1.0
|
||||
*.plg
|
||||
*.ncb
|
||||
*.opt
|
||||
Debug
|
||||
Release
|
||||
Debug-MT
|
||||
Release-MT
|
||||
Debug-Hotplug
|
||||
Release-Hotplug
|
||||
Debug-Hotplug-MT
|
||||
Release-Hotplug-MT
|
||||
*.db
|
||||
*.user
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.patch
|
||||
*~
|
||||
*.orig
|
||||
.dirstamp
|
||||
.amend
|
||||
.DS_Store
|
||||
Xcode/build
|
||||
xcshareddata
|
||||
xcuserdata
|
||||
*.xcuserdatad
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
*.xcworkspace
|
||||
build/
|
||||
tags
|
||||
cscope.out
|
||||
5
AES_KEY/libusb/libusb/.private/README.txt
Normal file
5
AES_KEY/libusb/libusb/.private/README.txt
Normal file
@ -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.
|
||||
26
AES_KEY/libusb/libusb/.private/appveyor_build.sh
Normal file
26
AES_KEY/libusb/libusb/.private/appveyor_build.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
buildsys="${1}-${Platform}"
|
||||
|
||||
if [ "${buildsys}" == "MinGW-Win32" ]; then
|
||||
export PATH="/c/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin:${PATH}"
|
||||
elif [ "${buildsys}" == "MinGW-x64" ]; then
|
||||
export PATH="/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin:${PATH}"
|
||||
fi
|
||||
|
||||
builddir="build-${buildsys}"
|
||||
installdir="${PWD}/libusb-${buildsys}"
|
||||
|
||||
cd libusb
|
||||
|
||||
echo "Bootstrapping ..."
|
||||
./bootstrap.sh
|
||||
echo ""
|
||||
|
||||
extra_args=""
|
||||
if [ "${Configuration}" == "Release" ]; then
|
||||
extra_args="--no-asan"
|
||||
fi
|
||||
exec .private/ci-build.sh --build-dir "${builddir}" --install ${extra_args} -- "--prefix=${installdir}"
|
||||
54
AES_KEY/libusb/libusb/.private/bm.sh
Normal file
54
AES_KEY/libusb/libusb/.private/bm.sh
Normal file
@ -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
|
||||
92
AES_KEY/libusb/libusb/.private/ci-build.sh
Normal file
92
AES_KEY/libusb/libusb/.private/ci-build.sh
Normal file
@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
builddir=
|
||||
scriptdir=$(dirname $(readlink -f "$0"))
|
||||
install=no
|
||||
test=yes
|
||||
asan=yes
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--build-dir)
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "ERROR: missing argument for --build-dir option" >&2
|
||||
exit 1
|
||||
fi
|
||||
builddir=$2
|
||||
shift 2
|
||||
;;
|
||||
--install)
|
||||
install=yes
|
||||
shift
|
||||
;;
|
||||
--no-test)
|
||||
test=no
|
||||
shift
|
||||
;;
|
||||
--no-asan)
|
||||
asan=no
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break;
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unexpected argument: $1" >&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "${builddir}" ]; then
|
||||
echo "ERROR: --build-dir option not specified" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "${builddir}" ]; then
|
||||
echo "ERROR: directory entry named '${builddir}' already exists" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir "${builddir}"
|
||||
cd "${builddir}"
|
||||
|
||||
cflags="-O2"
|
||||
|
||||
# enable extra warnings
|
||||
cflags+=" -Winline"
|
||||
cflags+=" -Wmissing-include-dirs"
|
||||
cflags+=" -Wnested-externs"
|
||||
cflags+=" -Wpointer-arith"
|
||||
cflags+=" -Wredundant-decls"
|
||||
cflags+=" -Wswitch-enum"
|
||||
|
||||
# enable address sanitizer
|
||||
if [ "${asan}" = "yes" ]; then
|
||||
cflags+=" -fsanitize=address"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Configuring ..."
|
||||
CFLAGS="${cflags}" CXXFLAGS="${cflags}" ../configure --enable-examples-build --enable-tests-build "$@"
|
||||
|
||||
echo ""
|
||||
echo "Building ..."
|
||||
make -j4 -k
|
||||
|
||||
if [ "${test}" = "yes" ]; then
|
||||
# Load custom shim for WebUSB tests that simulates Web environment.
|
||||
export NODE_OPTIONS="--require ${scriptdir}/../tests/webusb-test-shim/"
|
||||
if ! make check ; then
|
||||
cat tests/test-suite.log
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${install}" = "yes" ]; then
|
||||
echo ""
|
||||
echo "Installing ..."
|
||||
make install
|
||||
fi
|
||||
67
AES_KEY/libusb/libusb/.private/ci-container-build.sh
Normal file
67
AES_KEY/libusb/libusb/.private/ci-container-build.sh
Normal file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
# keep container around if $DEBUG is set
|
||||
[ -n "${DEBUG:-}" ] || OPTS="--rm"
|
||||
|
||||
if type podman >/dev/null 2>&1; then
|
||||
RUNC=podman
|
||||
else
|
||||
RUNC="sudo docker"
|
||||
fi
|
||||
|
||||
MOUNT_MODE=":ro"
|
||||
|
||||
$RUNC run --interactive ${RUNC_OPTIONS:-} ${OPTS:-} --volume `pwd`:/source${MOUNT_MODE:-} ${1:-docker.io/amd64/ubuntu:rolling} /bin/bash << EOF
|
||||
set -ex
|
||||
|
||||
# avoid meson exit code 125; https://github.com/containers/podman/issues/11540
|
||||
trap '[ \$? -eq 0 ] || exit 1' EXIT
|
||||
|
||||
# go-faster apt
|
||||
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
|
||||
|
||||
# upgrade
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y eatmydata
|
||||
eatmydata apt-get -y --purge dist-upgrade
|
||||
|
||||
# install build and test dependencies
|
||||
eatmydata apt-get install -y make libtool libudev-dev pkg-config umockdev libumockdev-dev
|
||||
|
||||
# run build as user
|
||||
useradd build
|
||||
su -s /bin/bash - build << EOG
|
||||
set -ex
|
||||
|
||||
mkdir "/tmp/builddir"
|
||||
cd "/tmp/builddir"
|
||||
|
||||
CFLAGS="-O2"
|
||||
|
||||
# enable extra warnings
|
||||
CFLAGS+=" -Winline"
|
||||
CFLAGS+=" -Wmissing-include-dirs"
|
||||
CFLAGS+=" -Wnested-externs"
|
||||
CFLAGS+=" -Wpointer-arith"
|
||||
CFLAGS+=" -Wredundant-decls"
|
||||
CFLAGS+=" -Wswitch-enum"
|
||||
export CFLAGS
|
||||
|
||||
export CXXFLAGS="\${CFLAGS}"
|
||||
|
||||
echo ""
|
||||
echo "Configuring ..."
|
||||
/source/configure --enable-examples-build --enable-tests-build
|
||||
|
||||
echo ""
|
||||
echo "Building ..."
|
||||
make -j4 -k
|
||||
|
||||
echo ""
|
||||
echo "Running umockdev tests ..."
|
||||
tests/umockdev
|
||||
EOG
|
||||
EOF
|
||||
32
AES_KEY/libusb/libusb/.private/post-rewrite.sh
Normal file
32
AES_KEY/libusb/libusb/.private/post-rewrite.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/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
|
||||
# . .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.
|
||||
#
|
||||
|
||||
if [ -n "$LIBUSB_SKIP_NANO" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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
|
||||
52
AES_KEY/libusb/libusb/.private/pre-commit.sh
Normal file
52
AES_KEY/libusb/libusb/.private/pre-commit.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/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
|
||||
# . .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 [ -n "$LIBUSB_SKIP_NANO" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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
|
||||
43
AES_KEY/libusb/libusb/.private/wbs.txt
Normal file
43
AES_KEY/libusb/libusb/.private/wbs.txt
Normal file
@ -0,0 +1,43 @@
|
||||
libusb 1.0 Windows binary snapshot - README
|
||||
|
||||
*********************************************************************
|
||||
* The latest version of this snapshot can always be downloaded at: *
|
||||
* https://github.com/libusb/libusb/releases *
|
||||
*********************************************************************
|
||||
|
||||
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)
|
||||
- By default, static libusb statically links against the CRT and the dll build
|
||||
dynamically links against CRT. You need to rebuild libusb from source to
|
||||
change this if required by your application.
|
||||
- Compile and run your application. If you use the DLL version of libusb-1.0,
|
||||
remember that the DLL needs to be in the DLL search path of your application.
|
||||
|
||||
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
|
||||
- Using the UsbDk backend is now a run-time choice rather than a compile-time
|
||||
choice. For additional information, including example usage, please visit:
|
||||
http://windows.libusb.info/#Driver_Installation
|
||||
- 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 https://libusb.info/ and check the
|
||||
Support section
|
||||
58
AES_KEY/libusb/libusb/.travis.yml
Normal file
58
AES_KEY/libusb/libusb/.travis.yml
Normal file
@ -0,0 +1,58 @@
|
||||
language: c
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: focal
|
||||
compiler: clang
|
||||
- os: linux
|
||||
dist: focal
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
dist: bionic
|
||||
compiler: clang
|
||||
- os: linux
|
||||
dist: bionic
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
- os: linux
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
osx_image: xcode12.2
|
||||
compiler: clang
|
||||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
- os: osx
|
||||
osx_image: xcode9.4
|
||||
compiler: clang
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- libudev-dev
|
||||
- m4
|
||||
homebrew:
|
||||
packages:
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- m4
|
||||
|
||||
before_script:
|
||||
- ./bootstrap.sh
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then .private/ci-build.sh --build-dir build-netlink -- --disable-udev; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then .private/ci-build.sh --build-dir build-udev -- --enable-udev; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then .private/ci-build.sh --build-dir build; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cd Xcode && xcodebuild -project libusb.xcodeproj; fi
|
||||
231
AES_KEY/libusb/libusb/AUTHORS
Normal file
231
AES_KEY/libusb/libusb/AUTHORS
Normal file
@ -0,0 +1,231 @@
|
||||
Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
Copyright © 2010-2012 Peter Stuge <peter@stuge.se>
|
||||
Copyright © 2008-2016 Nathan Hjelm <hjelmn@users.sourceforge.net>
|
||||
Copyright © 2009-2013 Pete Batard <pete@akeo.ie>
|
||||
Copyright © 2009-2013 Ludovic Rousseau <ludovic.rousseau@gmail.com>
|
||||
Copyright © 2010-2012 Michael Plante <michael.plante@gmail.com>
|
||||
Copyright © 2011-2013 Hans de Goede <hdegoede@redhat.com>
|
||||
Copyright © 2012-2013 Martin Pieuchot <mpi@openbsd.org>
|
||||
Copyright © 2012-2013 Toby Gray <toby.gray@realvnc.com>
|
||||
Copyright © 2013-2018 Chris Dickens <christopher.a.dickens@gmail.com>
|
||||
|
||||
Other contributors:
|
||||
Aaron Luft
|
||||
Adam Korcz
|
||||
Addison Crump
|
||||
Adrian Bunk
|
||||
Adrien Destugues
|
||||
Akshay Jaggi
|
||||
Alan Ott
|
||||
Alan Stern
|
||||
Aleksandr Mezin
|
||||
Alexander Mot
|
||||
Alexander Pyhalov
|
||||
Alexander Schlarb
|
||||
Alexander Stein
|
||||
Alex Feinman
|
||||
Alex Vatchenko
|
||||
Andrew Aldridge
|
||||
Andrew Fernandes
|
||||
Andrew Goodney
|
||||
Andy Chunyu
|
||||
Andy McFadden
|
||||
Angus Gratton
|
||||
Anil Nair
|
||||
Ankur Verma
|
||||
Anthony Clay
|
||||
Antonio Ospite
|
||||
Artem Egorkine
|
||||
Aurelien Jarno
|
||||
Axel Gembe
|
||||
Aymeric Vincent
|
||||
Baruch Siach
|
||||
Bastien Nocera
|
||||
Bei Zhang
|
||||
Bence Csokas
|
||||
Benjamin Berg
|
||||
Benjamin Dobell
|
||||
Bohdan Tymkiv
|
||||
Brad Smith
|
||||
Brent Rector
|
||||
Bruno Harbulot
|
||||
Carl Karsten
|
||||
Christophe Zeitouny
|
||||
Chris Zhu
|
||||
Chunyu Xie
|
||||
Colin Walters
|
||||
Craig Hutchinson
|
||||
Dave Camarillo
|
||||
David Engraf
|
||||
Davidlohr Bueso
|
||||
David Moore
|
||||
Dmitry Fleytman
|
||||
Dmitry Kostjuchenko
|
||||
Dmitry Zakablukov
|
||||
Dominik Boehi
|
||||
Doug Johnston
|
||||
Edgar Fuß
|
||||
Evan Hunter
|
||||
Evan Miller
|
||||
Fabien Sanglard
|
||||
Fabrice Fontaine
|
||||
Federico Manzan
|
||||
Felipe Balbi
|
||||
Florian Albrechtskirchinger
|
||||
Francesco Montorsi
|
||||
Francisco Facioni
|
||||
Francis Hart
|
||||
Frank Li
|
||||
Frederik Carlier
|
||||
Freek Dijkstra
|
||||
Gaurav Gupta
|
||||
Graeme Gill
|
||||
Greg Kroah-Hartman
|
||||
Gustavo Zacarias
|
||||
Haidong Zheng
|
||||
Hans Ulrich Niedermann
|
||||
Harry Mallon
|
||||
Hector Martin
|
||||
Hoi-Ho Chan
|
||||
Ido Yariv
|
||||
Igor Anokhin
|
||||
Ihor Dutchak
|
||||
Ilya Konstantinov
|
||||
Ingvar Stepanyan
|
||||
Jakub Klama
|
||||
James Hanko
|
||||
Jeffrey Nichols
|
||||
Jesse Taube
|
||||
Jie Zhang
|
||||
Jim Chen
|
||||
Johann Richard
|
||||
John Keeping
|
||||
John Sheu
|
||||
Jon Beniston
|
||||
Jonas Malaco
|
||||
Jonathon Jongsma
|
||||
Joost Muller
|
||||
Josh Gao
|
||||
Joshua Blake
|
||||
Joshua Hou
|
||||
Joshua M. Clulow
|
||||
Juan Cruz Viotti
|
||||
Julian Scheel
|
||||
Justin Bischoff
|
||||
Karsten Koenig
|
||||
Keith Ahluwalia
|
||||
Kenjiro Tsuji
|
||||
Kimura Masaru
|
||||
Konrad Rzepecki
|
||||
Kuangye Guo
|
||||
Lars Kanis
|
||||
Lars Wirzenius
|
||||
Lei Chen
|
||||
Léo Lam
|
||||
Liang Yunwang
|
||||
Lonnie Abelbeck
|
||||
Luca Longinotti
|
||||
Luz Paz
|
||||
Mac Wang
|
||||
Marco Trevisan (Treviño)
|
||||
Marcus Meissner
|
||||
Mario Kleiner
|
||||
Mark Kuo
|
||||
Markus Heidelberg
|
||||
Martin Ettl
|
||||
Martin Koegler
|
||||
Martin Ling
|
||||
Martin Thierer
|
||||
Mathias Hjärtström
|
||||
Matthew Stapleton
|
||||
Matthias Bolte
|
||||
Matthijs Lavrijsen
|
||||
Michael Dickens
|
||||
Michel Zou
|
||||
Mike Frysinger
|
||||
Mikhail Gusarov
|
||||
Mikolaj Kucharski
|
||||
Morgan Leborgne
|
||||
Moritz Fischer
|
||||
Nancy Li
|
||||
Nia Alarie
|
||||
Nicholas Corgan
|
||||
Niklas Gürtler
|
||||
Oleksand Radovenchyk
|
||||
Omri Iluz
|
||||
Orhan aib Kavrakoglu
|
||||
Orin Eman
|
||||
Ozkan Sezer
|
||||
Pablo Prietz
|
||||
Patrick Stewart
|
||||
Paul Cercueil
|
||||
Paul Fertser
|
||||
Paul Qureshi
|
||||
Pekka Nikander
|
||||
Petr Pazourek
|
||||
Philémon Favrod
|
||||
Pino Toscano
|
||||
Radu Vele
|
||||
Rob Walker
|
||||
Romain Vimont
|
||||
Roman Kalashnikov
|
||||
Rosen Penev
|
||||
Ryan Hileman
|
||||
Ryan Metcalfe
|
||||
Ryan Schmidt
|
||||
Saleem Rashid
|
||||
Sameeh Jubran
|
||||
Sean McBride
|
||||
Sebastian Pipping
|
||||
Sebastian von Ohr
|
||||
Sergey Serb
|
||||
Shawn Hoffman
|
||||
Simon Chan
|
||||
Simon Haggett
|
||||
Simon Newton
|
||||
Slash Gordon
|
||||
Stefan Agner
|
||||
Stefan Tauner
|
||||
Steinar H. Gunderson
|
||||
Stephen Groat
|
||||
Sylvain Fasel
|
||||
Theo Buehler
|
||||
Thomas Röfer
|
||||
Tim Hutt
|
||||
Tim Roberts
|
||||
Tobias Klauser
|
||||
Toby Peterson
|
||||
Tormod Volden
|
||||
Trygve Laugstøl
|
||||
Uri Lublin
|
||||
Uwe Bonnes
|
||||
Vasily Khoruzhick
|
||||
Vegard Storheil Eriksen
|
||||
Venkatesh Shukla
|
||||
Vianney le Clément de Saint-Marcq
|
||||
Victor Toso
|
||||
Vinicius Tinti
|
||||
Vitali Lovich
|
||||
Vladimir Beloborodov
|
||||
William Orr
|
||||
William Skellenger
|
||||
Xiaofan Chen
|
||||
Yegor Yefremov
|
||||
Yiwei Lin
|
||||
Zeng Guang
|
||||
Zhiqiang Liu
|
||||
Zoltán Kovács
|
||||
Сергей Валерьевич
|
||||
Ларионов Даниил
|
||||
Роман Донченко
|
||||
jonner
|
||||
orbitcowboy
|
||||
osy
|
||||
parafin
|
||||
RipleyTom
|
||||
Seneral
|
||||
saur0n
|
||||
SomeAlphabetGuy
|
||||
winterrace
|
||||
xloem
|
||||
504
AES_KEY/libusb/libusb/COPYING
Normal file
504
AES_KEY/libusb/libusb/COPYING
Normal file
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
365
AES_KEY/libusb/libusb/ChangeLog
Normal file
365
AES_KEY/libusb/libusb/ChangeLog
Normal file
@ -0,0 +1,365 @@
|
||||
For detailed information about the changes below, please see the git log
|
||||
or visit: http://log.libusb.info
|
||||
|
||||
2025-06-01: v1.0.29
|
||||
* Fix regression on macOS leading to timeouts in enumeration
|
||||
* LIBUSB_API_VERSION bump for the new functions in 1.0.28
|
||||
* Fix xusb regression displaying wrong error on claim failure
|
||||
|
||||
2025-03-18: v1.0.28
|
||||
* New libusb_get_ssplus_usb_device_capability_descriptor API
|
||||
for query of SuperSpeed+ Capability Descriptors
|
||||
* API support for reporting USB 3.2 Gen2x2 speeds
|
||||
* macOS: Fix Zero-Length Packet for multiple packets per frame
|
||||
* Windows: Base HID device descriptor on OS-cached values
|
||||
* Build fixes for Haiku and SunOS
|
||||
* Many code correctness fixes
|
||||
|
||||
2024-01-31: v1.0.27
|
||||
* New libusb_init_context API to replace libusb_init
|
||||
* New libusb_get_max_alt_packet_size API
|
||||
* New libusb_get_platform_descriptor API (BOS)
|
||||
* Allow setting log callback with libusb_set_option/libusb_init_context
|
||||
* New WebAssembly + WebUSB backend using Emscripten
|
||||
* Fix regression in libusb_set_interface_alt_setting
|
||||
* Fix sync transfer completion race and use-after-free
|
||||
* Fix hotplug exit ordering
|
||||
* Linux: NO_DEVICE_DISCOVERY option set per context
|
||||
* macOS: Fix missing device list cleanup locking
|
||||
* macOS: Do not clear device data toggle for newer OS versions
|
||||
* macOS: Fix running binaries on older OS than build host
|
||||
* Windows: Allow claiming multiple associated interfaces
|
||||
* Windows: Ignore non-configured devices instead of waiting
|
||||
* Windows: Improved root hub detection
|
||||
|
||||
2022-04-10: v1.0.26
|
||||
* Fix regression with transfer free's after closing device
|
||||
* Fix regression with destroyed context if API is misused
|
||||
* Workaround for applications using missing default context
|
||||
* Fix hotplog enumeration regression
|
||||
* Fix Windows isochronous transfer regression since 1.0.24
|
||||
* Fix macOS exit crash in some multi-context cases
|
||||
* Build fixes for various platforms and configurations
|
||||
* Fix Windows HID multi-interface product string retrieval
|
||||
* Update isochronous OUT packet actual lengths on Windows
|
||||
* Add interface bound checking for broken devices
|
||||
* Add umockdev tests on Linux
|
||||
|
||||
2022-01-31: v1.0.25
|
||||
* Linux: Fix regression with some particular devices
|
||||
* Linux: Fix regression with libusb_handle_events_timeout_completed()
|
||||
* Linux: Fix regression with cpu usage in libusb_bulk_transfer
|
||||
* Darwin (macOS): Add support for detaching kernel drivers with authorization.
|
||||
* Darwin (macOS): Do not drop partial data on timeout.
|
||||
* Darwin (macOS): Silence pipe error in set_interface_alt_setting().
|
||||
* Windows: Fix HID backend missing byte
|
||||
* Windows: Fix segfault with libusbk driver
|
||||
* Windows: Fix regression when using libusb0 driver
|
||||
* Windows: Support LIBUSB_TRANSFER_ADD_ZERO_PACKET on winusb
|
||||
* New NO_DEVICE_DISCOVERY option replaces WEAK_AUTHORITY option
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2020-12-09: v1.0.24
|
||||
* Add new platform abstraction (#252)
|
||||
* Add Null POSIX backend
|
||||
* Add support for eventfd
|
||||
* Add support for thread IDs on Haiku, NetBSD and Solaris
|
||||
* New API libusb_hotplug_get_user_data()
|
||||
* Darwin (macOS): Fix race condition that results in segmentation fault (#701)
|
||||
* Darwin (macOS): Fix stale descriptor information post reset (#733)
|
||||
* Darwin (macOS): use IOUSBDevice as darwin_device_class explicitly (#693)
|
||||
* Linux: Drop support for kernel older than 2.6.32
|
||||
* Linux: Provide an event thread name (#689)
|
||||
* Linux: Wait until all URBs have been reaped before freeing them (#607)
|
||||
* NetBSD: Recognize device timeouts (#710)
|
||||
* OpenBSD: Allow opening ugen devices multiple times (#763)
|
||||
* OpenBSD: Support libusb_get_port_number() (#764)
|
||||
* SunOS: Fix a memory leak (#756)
|
||||
* SunOS: Various fixes (#627, #628, #629)
|
||||
* Windows: Add Visual Studio 2019 support
|
||||
* Windows: Drop support for WinCE and Visual Studio older than 2013
|
||||
* Windows: Drop support for Windows XP
|
||||
* Windows: Support building all examples using Visual Studio (#151)
|
||||
* Documentation fixes and improvements
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2019-08-28: v1.0.23
|
||||
* Add German translation (#446)
|
||||
* Add Hungarian translation (#493)
|
||||
* Android: Improved support for Android
|
||||
* BSD: Remove infinite recursion in OpenBSD backend
|
||||
* configure.ac: Fix detection of clock_gettime library (#439)
|
||||
* Core: abandon synchronous transfers when device closure is detected.
|
||||
* Core: fix error in handling the removal of file descriptors while handling
|
||||
events.
|
||||
* Darwin(macOS): Switch from using ResetDevice to USBDeviceReEnumerate (#455)
|
||||
* Darwin(macOS): Remove code that changed the device class used (#428)
|
||||
* Darwin(macOS): Reduce hotplug timeout to 1ms (from 5s)
|
||||
* New API libusb_set_log_cb() to redirect global and per context log
|
||||
messages to the provided log handling function
|
||||
* New API libusb_wrap_sys_device to allow the user to specify the
|
||||
usb device to use.
|
||||
* Solaris: Break infinite recursion in backend clock_gettime
|
||||
* Solaris: Enable timerfd on sunos when available
|
||||
* Windows: Add support for isochronous transfers with WinUSB
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2018-03-24: v1.0.22
|
||||
* New libusb_set_option() API
|
||||
* Fix transfer timeout not being cleared upon resubmission
|
||||
* Report super speed plus devices on modern Linux and macOS
|
||||
* Darwin: Improve support for macOS Sierra and High Sierra
|
||||
* Darwin: SDK fixes and improvements
|
||||
* Linux: Let initialization succeed when no devices are present
|
||||
* Linux: Mark internal file descriptors with CLOEXEC flag
|
||||
* Solaris: Add support for attach/detach kernel driver
|
||||
* Windows: Add dynamic UsbDk backend selection
|
||||
* Windows: Add isochronous transfer support via libusbK
|
||||
* Windows: Add Visual Studio 2017 support
|
||||
* Windows: Fix enumeration problems on Windows 8 and later
|
||||
* Windows: Major rework of poll() emulation
|
||||
* Windows: Numerous HID API fixes
|
||||
* Windows: Support cancellation of individual transfers (Vista and later)
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2016-10-01: v1.0.21
|
||||
* Core: Refactor code related to transfer flags and timeout handling
|
||||
* Darwin: Ignore root hub simulation devices
|
||||
* Darwin: Improved support for OS X El Capitan
|
||||
* Darwin: Work around devices with buggy endpoint descriptors
|
||||
* Darwin: Do not use objc_registerThreadWithCollector after its deprecation
|
||||
* Darwin: Use C11 atomics on 10.12+ as the OS atomics are now deprecated
|
||||
* Linux: Support preallocating kernel memory for zerocopy USB
|
||||
* Linux: Deal with receiving POLLERR before all transfers have completed
|
||||
* Solaris: Add solaris backend
|
||||
* Windows: Add Visual Studio 2015 support
|
||||
* Windows: Add usbdk backend
|
||||
* Prevent attempts to recursively handle events
|
||||
* Fix race condition in handle_timeout()
|
||||
* Allow transferred argument to be optional in bulk APIs
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2015-09-13: v1.0.20
|
||||
* Add Haiku support
|
||||
* Fix multiple memory and resource leaks (#16, #52, #76, #81)
|
||||
* Fix possible deadlock when executing transfer callback
|
||||
* New libusb_free_pollfds() API
|
||||
* Darwin: Fix devices not being detected on OS X 10.8 (#48)
|
||||
* Linux: Allow larger isochronous transfer submission (#23)
|
||||
* Windows: Fix broken builds Cygwin/MinGW builds and compiler warnings
|
||||
* Windows: Fix broken bus number lookup
|
||||
* Windows: Improve submission of control requests for composite devices
|
||||
* Examples: Add two-stage load support to fxload (#12)
|
||||
* Correctly report cancellations due to timeouts
|
||||
* Improve efficiency of event handling
|
||||
* Improve speed of transfer submission in multi-threaded environments
|
||||
* Various other bug fixes and improvements
|
||||
The (#xx) numbers are libusb issue numbers, see ie:
|
||||
https://github.com/libusb/libusb/issues/16
|
||||
|
||||
2014-05-30: v1.0.19
|
||||
* Add support for USB bulk streams on Linux and Mac OS X (#11)
|
||||
* Windows: Add AMD and Intel USB-3.0 root hub support
|
||||
* Windows: Fix USB 3.0 speed detection on Windows 8 or later (#10)
|
||||
* Added Russian translation for libusb_strerror strings
|
||||
* All: Various small fixes and cleanups
|
||||
|
||||
2014-01-25: v1.0.18
|
||||
* Fix multiple memory leaks
|
||||
* Fix a crash when HID transfers return no data on Windows
|
||||
* Ensure all pending events are consumed
|
||||
* Improve Android and ucLinux support
|
||||
* Multiple Windows improvements (error logging, VS2013, VIA xHCI support)
|
||||
* Multiple OS X improvements (broken compilation, SIGFPE, 64bit support)
|
||||
|
||||
2013-09-06: v1.0.17
|
||||
* Hotplug callbacks now always get passed a libusb_context, even if it is
|
||||
the default context. Previously NULL would be passed for the default context,
|
||||
but since the first context created is the default context, and most apps
|
||||
use only 1 context, this meant that apps explicitly creating a context would
|
||||
still get passed NULL
|
||||
* Android: Add .mk files to build with the Android NDK
|
||||
* Darwin: Add Xcode project
|
||||
* Darwin: Fix crash on unplug (#121)
|
||||
* Linux: Fix hang (deadlock) on libusb_exit
|
||||
* Linux: Fix libusb build failure with --disable-udev (#124)
|
||||
* Linux: Fix libusb_get_device_list() hang with --disable-udev (#130)
|
||||
* OpenBSD: Update OpenBSD backend with support for control transfers to
|
||||
non-ugen(4) devices and make get_configuration() no longer generate I/O.
|
||||
Note that using this libusb version on OpenBSD requires using
|
||||
OpenBSD 5.3-current or later. Users of older OpenBSD versions are advised
|
||||
to stay with the libusb shipped with OpenBSD (mpi)
|
||||
* Windows: fix libusb_dll_2010.vcxproj link errors (#129)
|
||||
* Various other bug fixes and improvements
|
||||
|
||||
2013-07-11: v1.0.16
|
||||
* Add hotplug support for Darwin and Linux (#9)
|
||||
* Add superspeed endpoint companion descriptor support (#15)
|
||||
* Add BOS descriptor support (#15)
|
||||
* Make descriptor parsing code more robust
|
||||
* New libusb_get_port_numbers API, this is libusb_get_port_path without
|
||||
the unnecessary context parameter, libusb_get_port_path is now deprecated
|
||||
* New libusb_strerror API (#14)
|
||||
* New libusb_set_auto_detach_kernel_driver API (#17)
|
||||
* Improve topology API docs (#95)
|
||||
* Logging now use a single write call per log-message, avoiding log-message
|
||||
"interlacing" when using multiple threads.
|
||||
* Android: use Android logging when building on Android (#101)
|
||||
* Darwin: make libusb_reset reenumerate device on descriptors change (#89)
|
||||
* Darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET flag (#91)
|
||||
* Darwin: add a device cache (#112, #114)
|
||||
* Examples: Add sam3u_benchmark isochronous example by Harald Welte (#109)
|
||||
* Many other bug fixes and improvements
|
||||
The (#xx) numbers are libusbx issue numbers, see ie:
|
||||
https://github.com/libusbx/libusbx/issues/9
|
||||
|
||||
2013-04-15: v1.0.15
|
||||
* Improve transfer cancellation and avoid short read failures on broken descriptors
|
||||
* Filter out 8-bit characters in libusb_get_string_descriptor_ascii()
|
||||
* Add WinCE support
|
||||
* Add library stress tests
|
||||
* Add Cypress FX3 firmware upload support for fxload sample
|
||||
* Add HID and kernel driver detach support capabilities detection
|
||||
* Add SuperSpeed detection on OS X
|
||||
* Fix bInterval value interpretation on OS X
|
||||
* Fix issues with autoclaim, composite HID devices, interface autoclaim and
|
||||
early abort in libusb_close() on Windows. Also add VS2012 solution files.
|
||||
* Improve fd event handling on Linux
|
||||
* Other bug fixes and improvements
|
||||
|
||||
2012-09-26: v1.0.14
|
||||
* Reverts the previous API change with regards to bMaxPower.
|
||||
If this doesn't matter to you, you are encouraged to keep using v1.0.13,
|
||||
as it will use the same attribute as v2.0, to be released soon.
|
||||
* Note that LIBUSB_API_VERSION is *decreased* to 0x010000FF and the previous
|
||||
guidelines with regards to concurrent use of MaxPower/bMaxPower still apply.
|
||||
|
||||
2012-09-20: v1.0.13
|
||||
* [MAJOR] Fix a typo in the API with struct libusb_config_descriptor where
|
||||
MaxPower was used instead of bMaxPower, as defined in the specs. If your
|
||||
application was accessing the MaxPower attribute, and you need to maintain
|
||||
compatibility with libusb or older versions, see APPENDIX A below.
|
||||
* Fix broken support for the 0.1 -> 1.0 libusb-compat layer
|
||||
* Fix unwanted cancellation of pending timeouts as well as major timeout related bugs
|
||||
* Fix handling of HID and composite devices on Windows
|
||||
* Introduce LIBUSB_API_VERSION macro
|
||||
* Add Cypress FX/FX2 firmware upload sample, based on fxload from
|
||||
http://linux-hotplug.sourceforge.net
|
||||
* Add libusb0 (libusb-win32) and libusbK driver support on Windows. Note that while
|
||||
the drivers allow it, isochronous transfers are not supported yet in libusb. Also
|
||||
not supported yet is the use of libusb-win32 filter drivers on composite interfaces
|
||||
* Add support for the new get_capabilities ioctl on Linux and avoid unnecessary
|
||||
splitting of bulk transfers
|
||||
* Improve support for newer Intel and Renesas USB 3.0 controllers on Windows
|
||||
* Harmonize the device number for root hubs across platforms
|
||||
* Other bug fixes and improvements
|
||||
|
||||
2012-06-15: v1.0.12
|
||||
* Fix a potential major regression with pthread on Linux
|
||||
* Fix missing thread ID from debug log output on cygwin
|
||||
* Fix possible crash when using longjmp and MinGW's gcc 4.6
|
||||
* Add topology calls: libusb_get_port_number(), libusb_get_parent() & libusb_get_port_path()
|
||||
* Add toggleable debug, using libusb_set_debug() or the LIBUSB_DEBUG environment variable
|
||||
* Define log levels in libusb.h and set timestamp origin to first libusb_init() call
|
||||
* All logging is now sent to to stderr (info was sent to stdout previously)
|
||||
* Update log messages severity and avoid polluting log output on OS-X
|
||||
* Add HID driver support on Windows
|
||||
* Enable interchangeability of MSVC and MinGW DLLs
|
||||
* Additional bug fixes and improvements
|
||||
|
||||
2012-05-08: v1.0.11
|
||||
* Revert removal of critical Windows event handling that was introduced in 1.0.10
|
||||
* Fix a possible deadlock in Windows when submitting transfers
|
||||
* Add timestamped logging
|
||||
* Add NetBSD support (experimental) and BSD libusb_get_device_speed() data
|
||||
* Add bootstrap.sh alongside autogen.sh (bootstrap.sh doesn't invoke configure)
|
||||
* Search for device nodes in /dev for Android support
|
||||
* Other bug fixes
|
||||
|
||||
2012-04-17: v1.0.10
|
||||
* Public release
|
||||
* Add libusb_get_version
|
||||
* Add Visual Studio 2010 project files
|
||||
* Some Windows code cleanup
|
||||
* Fix xusb sample warnings
|
||||
|
||||
2012-04-02: v1.0.9
|
||||
* First libusbx release
|
||||
* Add libusb_get_device_speed (all, except BSD) and libusb_error_name
|
||||
* Add Windows support (WinUSB driver only)
|
||||
* Add OpenBSD support
|
||||
* Add xusb sample
|
||||
* Tons of bug fixes
|
||||
|
||||
2010-05-07: v1.0.8
|
||||
* Bug fixes
|
||||
|
||||
2010-04-19: v1.0.7
|
||||
* Bug fixes and documentation tweaks
|
||||
* Add more interface class definitions
|
||||
|
||||
2009-11-22: v1.0.6
|
||||
* Bug fixes
|
||||
* Increase libusb_handle_events() timeout to 60s for powersaving
|
||||
|
||||
2009-11-15: v1.0.5
|
||||
* Use timerfd when available for timer management
|
||||
* Small fixes/updates
|
||||
|
||||
2009-11-06: v1.0.4 release
|
||||
* Bug fixes including transfer locking to fix some potential threading races
|
||||
* More flexibility with clock types on Linux
|
||||
* Use new bulk continuation tracking in Linux 2.6.32 for improved handling
|
||||
of short/failed transfers
|
||||
|
||||
2009-08-27: v1.0.3 release
|
||||
* Bug fixes
|
||||
* Add libusb_get_max_iso_packet_size()
|
||||
|
||||
2009-06-13: v1.0.2 release
|
||||
* Bug fixes
|
||||
|
||||
2009-05-12: v1.0.1 release
|
||||
* Bug fixes
|
||||
* Darwin backend
|
||||
|
||||
2008-12-13: v1.0.0 release
|
||||
* Bug fixes
|
||||
|
||||
2008-11-21: v0.9.4 release
|
||||
* Bug fixes
|
||||
* Add libusb_attach_kernel_driver()
|
||||
|
||||
2008-08-23: v0.9.3 release
|
||||
* Bug fixes
|
||||
|
||||
2008-07-19: v0.9.2 release
|
||||
* Bug fixes
|
||||
|
||||
2008-06-28: v0.9.1 release
|
||||
* Bug fixes
|
||||
* Introduce contexts to the API
|
||||
* Compatibility with new Linux kernel features
|
||||
|
||||
2008-05-25: v0.9.0 release
|
||||
* First libusb-1.0 beta release
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
APPENDIX A - How to maintain code compatibility with versions of libusb and
|
||||
libusb that use MaxPower:
|
||||
|
||||
If you must to maintain compatibility with versions of the library that aren't
|
||||
using the bMaxPower attribute in struct libusb_config_descriptor, the
|
||||
recommended way is to use the new LIBUSB_API_VERSION macro with an #ifdef.
|
||||
For instance, if your code was written as follows:
|
||||
|
||||
if (dev->config[0].MaxPower < 250)
|
||||
|
||||
Then you should modify it to have:
|
||||
|
||||
#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000100)
|
||||
if (dev->config[0].bMaxPower < 250)
|
||||
#else
|
||||
if (dev->config[0].MaxPower < 250)
|
||||
#endif
|
||||
25
AES_KEY/libusb/libusb/HACKING
Normal file
25
AES_KEY/libusb/libusb/HACKING
Normal file
@ -0,0 +1,25 @@
|
||||
Contributing to libusb
|
||||
**********************
|
||||
|
||||
For larger changes or API changes/extensions it may be wise to first
|
||||
discuss on the mailing list or in the issue tracker before larger
|
||||
coding efforts are initiated.
|
||||
|
||||
If you extend or change the API make sure documentation is updated.
|
||||
Please run make -C doc and check for any Doxygen warnings.
|
||||
|
||||
Commit messages should be formatted to 72 chars width and have a
|
||||
free-standing summary line. See for instance "Commit Guidelines" on
|
||||
https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
|
||||
or https://cbea.ms/git-commit/ about how to make well-formed commit
|
||||
messages.
|
||||
|
||||
Put detailed information in the commit message itself, which will end
|
||||
up in the git history. On the other hand the description that you fill
|
||||
in the GitHub pull request web page does not go anywhere.
|
||||
|
||||
For copyright reasons it is preferable to have your full name in the
|
||||
commit author field. Do not update the AUTHOR file yourself, the
|
||||
maintainers will update it as part of the release preparation.
|
||||
|
||||
Please don't touch version_nano.h in your patches or pull requests.
|
||||
52
AES_KEY/libusb/libusb/INSTALL_WIN.txt
Normal file
52
AES_KEY/libusb/libusb/INSTALL_WIN.txt
Normal file
@ -0,0 +1,52 @@
|
||||
Installation Instructions for Windows
|
||||
*************************************
|
||||
|
||||
If you are compiling for MinGW or cygwin, please refer to the INSTALL file,
|
||||
which is automatically generated by autotools (e.g. running bootstrap.sh).
|
||||
|
||||
If you are using Microsoft Visual Studio:
|
||||
- Using Visual Studio 2022, open /msvc/libusb.sln
|
||||
- If you want to debug the library, uncomment the ENABLE_DEBUG_LOGGING define
|
||||
in msvc/config.h
|
||||
- Select your configuration and compile the project.
|
||||
- To target a specific toolset (previous version of Visual Studio), either
|
||||
edit PlatformToolset in /msvc/Configuration.Base.props, or supply the value
|
||||
to msbuild on the command line.
|
||||
- For example, to build for VS2015 (from a different version):
|
||||
msbuild -p:PlatformToolset=v140,Platform=x64,Configuration=Release libusb.sln
|
||||
|
||||
Installing and building libusb via vcpkg
|
||||
****************************************
|
||||
|
||||
You can download and install libusb using the vcpkg dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.bat
|
||||
./vcpkg integrate install
|
||||
vcpkg install libusb
|
||||
|
||||
The libusb port in vcpkg is kept up to date by Microsoft team members and
|
||||
community contributors. If the version is out of date, please create an issue
|
||||
or pull request (https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
Destination directories
|
||||
***********************
|
||||
|
||||
The binaries are located at:
|
||||
/build/<PlatformToolset>/<Platform>/<Configuration>/(lib|dll)/libusb-1.0.(lib|dll)
|
||||
For example: /build/v143/x64/Release/dll/libusb-1.0.dll
|
||||
|
||||
Troubleshooting
|
||||
***************
|
||||
|
||||
If the compilation process complains about missing libraries, ensure that the
|
||||
default library paths for your project points to the relevant directories.
|
||||
If needed, these libraries can be obtained by installing the latest Windows
|
||||
SDK.
|
||||
|
||||
Links
|
||||
*****
|
||||
|
||||
Additional information related to the Windows backend:
|
||||
http://windows.libusb.info
|
||||
123
AES_KEY/libusb/libusb/KEYS
Normal file
123
AES_KEY/libusb/libusb/KEYS
Normal file
@ -0,0 +1,123 @@
|
||||
This file contains the PGP keys of libusb release managers.
|
||||
|
||||
Users:
|
||||
pgp < KEYS
|
||||
or
|
||||
gpg --import KEYS
|
||||
|
||||
Maintainers:
|
||||
pgp -kxa <your name> and append it to this file.
|
||||
or
|
||||
(pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
|
||||
or
|
||||
(gpg --list-sigs <your name> && gpg --armor --export <your name>) >> this file.
|
||||
|
||||
pub rsa4096 2020-06-23 [SC]
|
||||
C68187379B23DE9EFC46651E2C80FF56C6830A0E
|
||||
uid [ultimate] Tormod Volden <debian.tormod@gmail.com>
|
||||
sub rsa4096 2020-06-23 [E]
|
||||
sub rsa4096 2020-06-23 [S]
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBF7yPL0BEADQc/2dx8H7a7r1SGYph5hmkszs0O9V/43m8XhNnbnFraXjmbEv
|
||||
xm2wE6AuR301mjAqYSt/mphmH54z4GBbgmLBrK8TGdhlK0K11PeSudRN4jsLs+U3
|
||||
ErtkAHODmzyg7QiW3GWudP/lJQRSqNBoadeOdOsKMoJxm7T2a9fyyf8FR/FfShjv
|
||||
NB62jSWq0x0WnglI/V/ZOi/mOnqoggCoWXLzwqbKasicvfNsTPJIsjiu24US6mif
|
||||
nRllMWr/6aHyCOX6+x6PsQ35NF5C5B7b0c1fY7zU/UiM/JBF4HDf7jltzTIjHjho
|
||||
jTwcEkCVmunW+jSwjsLcr/zkOsu1re0W/VJJNXOhSnNUDpM7t9FeSfJ0LGlXYnGI
|
||||
5ZUCQ8w4RcKmkHYhepCjDVWYkCmxmTgO7LaAXZ5S0GeOoSDsvHNHYywAXNmB6A0s
|
||||
3kv/8i3wT8K1w9972eYW+NA6T7BfdbNk/EKxZQ74eezpRWDDPEl/zehoHQoPO3m1
|
||||
N2b06nnSKLv263IJAPdpLPUJowYdWnvmw/wyakeBMRJdI1FsDkEdI2KAvQxRKHfU
|
||||
/cTtMEJuGGR5qyze4jMHUuVqSvEsoXmSA2OLcWeZyn12jfd0CrGbCZ7jZ0R7Q1Ab
|
||||
cZ7hPsLKtgKHKyrmAdlmTgpOb2Kk2LP4ar0tuDa02YcFFAAWdRY9pORI+wARAQAB
|
||||
tCdUb3Jtb2QgVm9sZGVuIDx0b3Jtb2Qudm9sZGVuQGdtYWlsLmNvbT6JAlAEEwEI
|
||||
ADsCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AWIQTGgYc3myPenvxGZR4sgP9W
|
||||
xoMKDgUCXvI9hAIZAQAKCRAsgP9WxoMKDpcrD/i7ejrtzMGhDbB+IS5vvoK/Vk+s
|
||||
Oszn+Bi4kjq+S4wv93gByDQy5L8YHSecKS60Qi0XW3VP7qoMXaI10oo0+4pZjheM
|
||||
Lz38Xh7nOhnmzKzyPgB9sg/KuuSvcy6dZZ120ye035uckO3qDIvrV6rG9sx9EV8d
|
||||
rOKppgpXBhCC52bFp45S6bbWRLQrKlmWDNdMSQcknt86ntSqxNJDdbKoxL0JxSI8
|
||||
mB+XrM7TZvyP9eA0ZVy55cbm0ZwU2beJty72GB0Niz0ZiGWeoBcuotDkpAwou7/B
|
||||
Worgonw5yLMjL4NatZXRhym7YTNvKVovLwuG7krScghDCuGo1VswHyRi8xkkuvJ2
|
||||
YS51UBpvLsrDeLlBNd8JzL/FuBgFohkXzXjezx3gEUJe0+mc4gPdHULh8q9suRvF
|
||||
ewOuQshiqvRUacuKNYglqnxqM4aJxqO0BCNDofgnu8JYk+llXzKT5bKiIXHDMWwd
|
||||
eq9Y4NJzruAAilqM0tc1iI+qDmD4SabEjAmGREPeirVrASfrZFrOKBwF0PQE9fVN
|
||||
PsXdYCHhfXLjlEFVv5pmJkhw3euFoxDz3auZ6OhGo1ffCOZ62On5joiIRhhGQ57l
|
||||
qpW3W2Ph9TmWLRtOwR7DgiP/qUCrngBmk+Vl3KdwmSECDTXnFFKtOIHHomHEziEV
|
||||
wnjxNpVBwrvZZZkPiF0EExEIAB0WIQQsLnerYFFdSZykiO+jLYR2uvQdDAUCXvJG
|
||||
mgAKCRCjLYR2uvQdDNyVAJ9qmD3ioM5cVU3t7h4YSb6FuZ7CvQCggtBzoovIo6UJ
|
||||
WsMd6NvtKXSVsii0J1Rvcm1vZCBWb2xkZW4gPGRlYmlhbi50b3Jtb2RAZ21haWwu
|
||||
Y29tPokCTgQTAQgAOBYhBMaBhzebI96e/EZlHiyA/1bGgwoOBQJe8jy9AhsDBQsJ
|
||||
CAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJECyA/1bGgwoOFdQP/R3oBQ/fQTFoaRVK
|
||||
Q7KOp0MI2Bo1l9kRYnjj+CxlFUIEKTs06AER55IUpt1bjh4drldLVwaFP8rx/V5A
|
||||
62Z2yvIAhkrEKRFkTEbdnfH5S23VF9T8n2L4nZ6L0VBK8bgdZsiTKWk4aVy4YdQG
|
||||
yUC8mcXq1beZS8WiL7X/aH81uO+Bwaszmwgi2/NHEGdTuE1jUIslWyOHGhEe5Ygo
|
||||
+mEltm+PLdZJ9dJAEI3fWYl0Y+5y+eDNBBNXEsTiZ0R/7xFakcT2AWSnRPxbllJk
|
||||
4tG8FTlnSU8WY3VODec0L04UFJE64Ywupae0Xqc7ycJNk72FG3VEDgQhZC6e/L+a
|
||||
vSgCvzI9U8mdypxS9znyYblCGigR46M/CMzUp6oA78u3cHPUyL2fVYMm6FcQN1Bv
|
||||
nIlDSgHZJjFdpmAqYPvs+LR4+8dLXgwUKdIufka8yLJ2W3x5HQMtqBkgL8QqJTt1
|
||||
PdDbAaZdA1RHPJU2rE7sBI5EOOnQJu1cdFMOAXQR7BUad2au5IJ2oxy+z1fsZZeh
|
||||
1X8OjypTQuKrQA3oAgaAERu/qRC4c6SKG8bMMR+3tf6NVWlYS+gK2wGxXCM5DuEJ
|
||||
LYlHj2vQ/xeauq9MR23rgufVrmmnPEawMnsM5dD2ArR9FIq+sOAeZM/SJQC/I5Zf
|
||||
uM+khtkurI63QMKLxzJAJjeS/gmliF0EExEIAB0WIQQsLnerYFFdSZykiO+jLYR2
|
||||
uvQdDAUCXvJGowAKCRCjLYR2uvQdDIIVAKDcEF7MFwV/xjr7M5bTkSITiLfn/gCe
|
||||
OTXlJl/vmuXHcJl7GOPkxr5Lrbu5Ag0EXvI8vQEQAN4TW0AbNnnQ4ZeVJZWYsfBW
|
||||
dFkN42092q3herQuYRxzrEqqgwdVXplIQYKJKGdKmsBQGuqY4eXktz5EXSFPk6Ui
|
||||
YrDD6WffQoJOpZPYWB70clWSSvz+moSQSNyMOT+DhZ//CZ74YiOJTE4844HuzmkG
|
||||
lg+zS9cKKAYcz+KICKWxRaTfX/LtXKZBF3QSSy8qxCM9PipoO8bblQBGnY8rzneQ
|
||||
vAXuhsGgbtjR+o23owWHbFZKgvphsXgnmx6brJoY1o5x4qXpGrpG6XzNYp2zd3RJ
|
||||
0+8R6OIoukil/x3TGSFFp4cp2Nahb8XxV8neZ7Ng8O0+/P7sMJxPm0wuU8+DEnpB
|
||||
F6/bI1hvMNvF20dhWzpChOmArJQRZbCDM+EouZhAbh3T0n/5bx4EBezCMpDSO90V
|
||||
n0Uy3KAHbf6QohCt0PEmRSZkrGPFs3fSzuP4U8cWa07sUL02CW/pTn2i96fGgh+F
|
||||
+SfY1E56vN2Rzv7OSrbD+cNai9E4gwDGElX9ML/O3lTOok9cfSvbFxXr0ALnLCAT
|
||||
u1bI/f4Ohu9yQy4sYR+FSMNBaQmbb213PpoT5rNdn5XT/v067r8iWQlwi48a7IIM
|
||||
TNsTSGSNiBm3UoETipqQZVrgbk4gEwPsf/6BB9e2H0GSY7XBBcQb99UGQ9k88ieQ
|
||||
3jinfc2Mj8bIqCcRqwnNABEBAAGJAjYEGAEIACAWIQTGgYc3myPenvxGZR4sgP9W
|
||||
xoMKDgUCXvI8vQIbDAAKCRAsgP9WxoMKDuYcD/4rd2U6ca2/mQmNGoT2r315j2j0
|
||||
ej61a3BwoL42dX+0SgbjstIhpHo4Ng0b6MAvsA7Y6RX2P0FnBhxHQhkBUu0EbtfU
|
||||
Pewxn1WPn7qdXHLh/U3JBTWFgIvaRaqEoUVx1FAaShOex77rgwL+7NZyATSLNaW9
|
||||
J3NBY4LaKIHeqEbyHnIs9NAdnaDXxwXjTwvlz5rAbBG6r2uoUca95rWkAi/iT9D2
|
||||
cki5ouq7Lk6SGLOZAzeilKB81UsjryHmiJ1tzOWdpVTYw1Y0c30qDH/EgylmTscU
|
||||
+e4cFYo7ZqJeVXM8fNDMnU89UhOzArMgKNZEijfnUE/1qqLKNK3BRoaQrISZkYdF
|
||||
AILOfvE4yfoQxJ0joA5RJmGg1BoBsCxh6Bm25bwr9fckf2no42bG9E6a7Ib8Stkl
|
||||
MMkzdSL+6ei8wMZ/EJAGa7JYXu8wHR6fZ1bgpzbS3zejO1qReNrs+zyyT+tMHTT2
|
||||
Ax2HUpBokbPSjT6ZgWNj5XZJAPSF9S+f073D0Zr8051VU5cnI+TfGzK1OLiAcVNx
|
||||
cKM6cjSH40MUWFzHuRjlNnqrVWLcYHje8KhmfHRc6LzLR0yjz4RCfLhUnf/56Zz+
|
||||
kDGYEAOdx3mon/RG8q1yQZc0Uz3xr6+tV8jUJOaeTxvEVa6dwncBBma2BJIeVOFk
|
||||
fgu0j2XHDAKcyhnG97kCDQRe8j3JARAAs11IfLfybhdX3yjbVzxPiJ3RzkFZBbHy
|
||||
YcL8NJYdpxOGEK5pLu7zOe7z+TQpW4mMfQunbHreABunjCPuZwvME4ekQva/pky7
|
||||
S9ajdsm1HMVpoXNQ0cSD+WTkiJaDJC6LFH6+XDzrUK7Kp/6NGKCSwU5xXmZudSVd
|
||||
pCNuziE+KQ5qEXPT6P7H+1TLNKgZvxmksHA76+/ZahpVTCgVVMpTmlRa3jnH0MoN
|
||||
v5fwUMuC7fx09zdqb09D1bBcjrTltVcO6Ij8yUnw5DaQS8y8boIsIIK9YaJHk7uI
|
||||
o1qzilT7a71GKmz1Cs90qmLvRpN8nJGY6q28BXyM68E1Wx7x720IgXTR/JL/j3dB
|
||||
Yggil3GGdBLEwVPtAy8VeeiNGsJe1ZmYUYMc6rgOjghWZogjI5mJOqOXOs3Iilic
|
||||
sRTySCP4x7uRquWWlNNyeVE17ScGiUqsNCyzzwQ3MKbASswNrKnu0iIBfdYyWF+w
|
||||
iyB+kr8o23QMA7TIJnRj++ShOSeoPNg0wOns97Yj4VobSvWBmiX+VjFWkhOQFY9Q
|
||||
eFibQX3iBcSUBZh4eilQMWOx4vD9usBF9NsvrZKvIXrQI456BsTzoKFspqlka9y4
|
||||
YISw3fbGjfOSNXab2R5xEkHX8fF/u8Xs897kVIi/imRrVSgmzf3X4QdTLQJ2MdhH
|
||||
02lhlYdkvecAEQEAAYkEawQYAQgAIBYhBMaBhzebI96e/EZlHiyA/1bGgwoOBQJe
|
||||
8j3JAhsCAj8JECyA/1bGgwoOwXMgBBkBCAAdFiEEnH6pSTnGnE+8Pb+oqgY5B577
|
||||
YbkFAl7yPckACgkQqgY5B577YbkUig/3XOT/88S0edOfgNfFtntAYCj4w3NztXiR
|
||||
ClFQFohRupjP7h6y24VgKD1I0595fCGs9YKl9MiI9PAxNUVdKD6WOcjrRL6B8eMh
|
||||
xle4MefL4UK5kvUKTn2QqE8GgwAqgFkn0wbdOOxPVmGtJ3tuS5Hok9nn9RHUkeMK
|
||||
vOeRHx38NyozjZxoUJ+3gFngliM1BKlR3Dq1XlvXz/7fWKzl3AkneLHfca/0yzB6
|
||||
7qvs3G6q0btyZqjp0GSrGSVUnqpK670b1l6DQd6raej76RPq8OsxP1DkfwVsyNQV
|
||||
/EN0atj+MsruUPBbesZ5oP/XFrQkjjDDIGhbmg0xB9Bxp8v+y9EiFB9LC4nmLvw9
|
||||
gn2cK3j1JXdiKUVWzPMKdUrZ/Y5lksrn6a326zDOJZwT4/XYiclgM+vKQb1RWdXv
|
||||
bz3oTpSyeCdKZQ845aNM1Q8AHJ2NVlGBbiMsFTmKnM/wcU8+6saWflF0JeiNgal0
|
||||
wcGvmkossrOVQZh10959HT8Eb4Vzgf0MD4YATmM6CbGxv1tuDxhK12e8MDsI7wul
|
||||
M5ODLWpb3zwgLU/O3IeinbRlr30lhvnTzgdYx5CgYqUYUm/MSb0+vWpr67smoBbR
|
||||
pWi4j2zcTtay/iNL9pFCLFegkJtXwLehh8sgEj28c/jOH2XEfOgEEniVM57dFONm
|
||||
n5ba3xTKRSS8D/44K3JJSPi2urzO+wXtcbZ1QSWypTV8dI7zLImySMmBtU7GEKLe
|
||||
y8klXAQBnzyKTFrsS60A0JiNGbzw75kAi2677jgvEtzz0QAxvJUCianFT9QCqcxQ
|
||||
okh/W8klVaJGLucAD5CRTLc9F4TNGV1jsHf90McWWf/bKANz875PZUDqMDtQ6hqH
|
||||
Udn4AxVaLn1dAqn2ae3DQK043jViy7IivilQLLo5mmkGLs0bPQZgG4OBB0mgzS8Z
|
||||
t2/3zJUvS/ygea0vqMzleEMlBJXWMyh6S8upEJVGdJfuMfRbOpvRBXZULLKwBVLn
|
||||
/vcB6QianT31AtxpWRtXjk52DxrqP85jMZtrlXWECmOanNM41cN/hoVVcXYLYYrt
|
||||
f8ZYM4cjB744M3XqCjh8aw8p8sg/sMQ4yJMlLuS6tGR/4WS1EU+Rq3ukg5jFfAQ/
|
||||
PfXrj4iCFjUBD4CnRAQIXhPCqMl6hFMZw61BpKFpZNLlJ205R+elqGBbrLibhu3u
|
||||
RAeFxk23S035hxBZnC2CDQL7zLwnzk1DPx6ywS6ky2qENwISR9tNldehFuPHXnSf
|
||||
5/DxUzfWd2Tj35vxZDhKjJ1HiT3o++HKCRX9cP/cALsd5zvIxSVN6RRCUI2U8N+b
|
||||
k5/dfKNq8Q4FX9TZFSBnWudih+bT74v5f4LwhidPgOiYugiLoJh2ZqIVvQ==
|
||||
=5EaQ
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
50
AES_KEY/libusb/libusb/Makefile.am
Normal file
50
AES_KEY/libusb/libusb/Makefile.am
Normal file
@ -0,0 +1,50 @@
|
||||
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = INSTALL_WIN.txt PORTING doc/libusb.png \
|
||||
android msvc Xcode
|
||||
SUBDIRS = libusb
|
||||
|
||||
if BUILD_EXAMPLES
|
||||
SUBDIRS += examples
|
||||
endif
|
||||
|
||||
if BUILD_TESTS
|
||||
SUBDIRS += tests
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libusb-1.0.pc
|
||||
|
||||
# The package name is libusb-1.0, but we want the distribution
|
||||
# to be created as libusb-x.y.z instead of libusb-1.0-x.y.z
|
||||
distdir = libusb-$(VERSION)
|
||||
|
||||
# Ensure any generated docs are cleaned out
|
||||
# We need this here because make does not recurse into doc/
|
||||
clean-local:
|
||||
rm -rf doc/$(DOXYGEN_HTMLDIR)
|
||||
|
||||
# Use dist-hook to accomplish the following things for the dist recipe:
|
||||
# 1) Remove the GitHub Markdown from the README file
|
||||
# 2) Remove the .gitattributes file from the msvc directory
|
||||
dist-hook:
|
||||
chmod u+w $(distdir)/README $(distdir)/msvc
|
||||
$(SED) -i.orig -e '/Build Status/d' $(distdir)/README
|
||||
$(SED) -i.orig -e '/^$$/N;/^\n$$/D' $(distdir)/README
|
||||
$(SED) -i.orig -e 's/\[\([A-Z]*\)\](\1)/\1/' $(distdir)/README
|
||||
rm -f $(distdir)/README.orig
|
||||
rm -f $(distdir)/msvc/.gitattributes
|
||||
|
||||
reldir = .release/$(distdir)
|
||||
sfurl = frs.sourceforge.net:/home/frs/project/libusb/libusb-1.0
|
||||
.PHONY: dist-upload
|
||||
dist-upload: dist
|
||||
rm -rf $(reldir)
|
||||
mkdir -p $(reldir)
|
||||
cp $(distdir).tar.bz2 $(reldir)
|
||||
if [ -z "$$SF_USER" ]; then \
|
||||
rsync -rv $(reldir) $(sfurl); \
|
||||
else \
|
||||
rsync -rv $(reldir) $$SF_USER@$(sfurl); \
|
||||
fi
|
||||
rm -rf $(reldir)
|
||||
2
AES_KEY/libusb/libusb/NEWS
Normal file
2
AES_KEY/libusb/libusb/NEWS
Normal file
@ -0,0 +1,2 @@
|
||||
For the latest libusb news, please refer to the ChangeLog file, or visit:
|
||||
https://libusb.info
|
||||
94
AES_KEY/libusb/libusb/PORTING
Normal file
94
AES_KEY/libusb/libusb/PORTING
Normal file
@ -0,0 +1,94 @@
|
||||
PORTING LIBUSB TO OTHER PLATFORMS
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This document is aimed at developers wishing to port libusb to unsupported
|
||||
platforms. I believe the libusb API is OS-independent, so by supporting
|
||||
multiple operating systems we pave the way for cross-platform USB device
|
||||
drivers.
|
||||
|
||||
Implementation-wise, the basic idea is that you provide an interface to
|
||||
libusb's internal "backend" API, which performs the appropriate operations on
|
||||
your target platform.
|
||||
|
||||
In terms of USB I/O, your backend provides functionality to submit
|
||||
asynchronous transfers (synchronous transfers are implemented in the higher
|
||||
layers, based on the async interface). Your backend must also provide
|
||||
functionality to cancel those transfers.
|
||||
|
||||
Your backend must also provide an event handling function to "reap" ongoing
|
||||
transfers and process their results.
|
||||
|
||||
The backend must also provide standard functions for other USB operations,
|
||||
e.g. setting configuration, obtaining descriptors, etc.
|
||||
|
||||
|
||||
File descriptors for I/O polling
|
||||
================================
|
||||
|
||||
For libusb to work, your event handling function obviously needs to be called
|
||||
at various points in time. Your backend must provide a set of file descriptors
|
||||
which libusb and its users can pass to poll() or select() to determine when
|
||||
it is time to call the event handling function.
|
||||
|
||||
On Linux, this is easy: the usbfs kernel interface exposes a file descriptor
|
||||
which can be passed to poll(). If something similar is not true for your
|
||||
platform, you can emulate this using an internal library thread to reap I/O as
|
||||
necessary, and a pipe() with the main library to raise events. The file
|
||||
descriptor of the pipe can then be provided to libusb as an event source.
|
||||
|
||||
|
||||
Interface semantics and documentation
|
||||
=====================================
|
||||
|
||||
Documentation of the backend interface can be found in libusbi.h inside the
|
||||
usbi_os_backend structure definition.
|
||||
|
||||
Your implementations of these functions will need to call various internal
|
||||
libusb functions, prefixed with "usbi_". Documentation for these functions
|
||||
can be found in the .c files where they are implemented.
|
||||
|
||||
You probably want to skim over *all* the documentation before starting your
|
||||
implementation. For example, you probably need to allocate and store private
|
||||
OS-specific data for device handles, but the documentation for the mechanism
|
||||
for doing so is probably not the first thing you will see.
|
||||
|
||||
The Linux backend acts as a good example - view it as a reference
|
||||
implementation which you should try to match the behaviour of.
|
||||
|
||||
|
||||
Getting started
|
||||
===============
|
||||
|
||||
1. Modify configure.ac to detect your platform appropriately (see the OS_LINUX
|
||||
stuff for an example).
|
||||
|
||||
2. Implement your backend in the libusb/os/ directory, modifying
|
||||
libusb/os/Makefile.am appropriately.
|
||||
|
||||
3. Add preprocessor logic to the top of libusb/core.c to statically assign the
|
||||
right usbi_backend for your platform.
|
||||
|
||||
4. Produce and test your implementation.
|
||||
|
||||
5. Send your implementation to libusb-devel mailing list.
|
||||
|
||||
|
||||
Implementation difficulties? Questions?
|
||||
=======================================
|
||||
|
||||
If you encounter difficulties porting libusb to your platform, please raise
|
||||
these issues on the libusb-devel mailing list. Where possible and sensible, I
|
||||
am interested in solving problems preventing libusb from operating on other
|
||||
platforms.
|
||||
|
||||
The libusb-devel mailing list is also a good place to ask questions and
|
||||
make suggestions about the internal API. Hopefully we can produce some
|
||||
better documentation based on your questions and other input.
|
||||
|
||||
You are encouraged to get involved in the process; if the library needs
|
||||
some infrastructure additions/modifications to better support your platform,
|
||||
you are encouraged to make such changes (in cleanly distinct patch
|
||||
submissions). Even if you do not make such changes yourself, please do raise
|
||||
the issues on the mailing list at the very minimum.
|
||||
29
AES_KEY/libusb/libusb/README
Normal file
29
AES_KEY/libusb/libusb/README
Normal file
@ -0,0 +1,29 @@
|
||||
# libusb
|
||||
|
||||
libusb is a library for USB device access from Linux, macOS,
|
||||
Windows, OpenBSD/NetBSD, Haiku, Solaris userspace, and WebAssembly
|
||||
via WebUSB.
|
||||
It is written in C (Haiku backend in C++) and licensed under the GNU
|
||||
Lesser General Public License version 2.1 or, at your option, any later
|
||||
version (see [COPYING](COPYING)).
|
||||
|
||||
libusb is abstracted internally in such a way that it can hopefully
|
||||
be ported to other operating systems. Please see the [PORTING](PORTING)
|
||||
file for more information.
|
||||
|
||||
libusb homepage:
|
||||
https://libusb.info/
|
||||
|
||||
Developers will wish to consult the API documentation:
|
||||
http://api.libusb.info
|
||||
|
||||
Use the mailing list for questions, comments, etc:
|
||||
http://mailing-list.libusb.info
|
||||
|
||||
- Hans de Goede <hdegoede@redhat.com>
|
||||
- Xiaofan Chen <xiaofanc@gmail.com>
|
||||
- Ludovic Rousseau <ludovic.rousseau@gmail.com>
|
||||
- Nathan Hjelm <hjelmn@cs.unm.edu>
|
||||
- Chris Dickens <christopher.a.dickens@gmail.com>
|
||||
|
||||
(Please use the mailing list rather than mailing developers directly)
|
||||
41
AES_KEY/libusb/libusb/README.git
Normal file
41
AES_KEY/libusb/libusb/README.git
Normal file
@ -0,0 +1,41 @@
|
||||
Notes related to git compilation:
|
||||
--------------------------------
|
||||
|
||||
If you retrieved the libusb repository from git and are using a gcc based
|
||||
toolchain, be mindful that you should have the autotools installed (autoconf,
|
||||
automake) and will need to run either ./autogen.sh or ./bootstrap.sh to produce
|
||||
the configure file.
|
||||
|
||||
The difference between autogen.sh and bootstrap.sh is that the former invokes
|
||||
configure with a default set of options, and will therefore generate a Makefile,
|
||||
whereas the latter does not invoke configure at all. If using autogen.sh, note
|
||||
that you can also append options, that will be passed as is to configure.
|
||||
|
||||
macOS-specific notes:
|
||||
-------------------
|
||||
|
||||
Starting with Xcode 4.3, neither Xcode.app nor the Xcode 'command line tools'
|
||||
includes autotools and so running either autogen.sh or bootstrap.sh will result
|
||||
in the message:
|
||||
|
||||
libtoolize or glibtoolize was not found! Please install libtool.
|
||||
|
||||
To proceed, you must find and install it from somewhere.
|
||||
|
||||
Alternatively, you can use the Xcode project at Xcode/libusb.xcodeproj.
|
||||
|
||||
Notes related to submitting new developments:
|
||||
--------------------------------------------
|
||||
|
||||
If you submit a new development to libusb (eg: new backend), that is unlikely
|
||||
to fit in a couple of small patches, we would kindly suggest that you create a
|
||||
public account on github, if you don't have one already, and then fork a new
|
||||
libusb repository under this account from https://github.com/libusb/libusb.
|
||||
|
||||
Then you can create a git branch for your work, that we will be able to better
|
||||
reference and test.
|
||||
|
||||
We also suggest that, if you are planning to bring in a large development, you
|
||||
try to involve the libusb community early by letting the mailing list know, as
|
||||
you may find that other people might be eager to help you out.
|
||||
See http://mailing-list.libusb.info for details on how to join the mailing list.
|
||||
1
AES_KEY/libusb/libusb/README.md
Normal file
1
AES_KEY/libusb/libusb/README.md
Normal file
@ -0,0 +1 @@
|
||||
README
|
||||
2
AES_KEY/libusb/libusb/TODO
Normal file
2
AES_KEY/libusb/libusb/TODO
Normal file
@ -0,0 +1,2 @@
|
||||
Please see the libusb roadmap by visiting:
|
||||
https://github.com/libusb/libusb/milestones?direction=asc&sort=due_date&state=open
|
||||
92
AES_KEY/libusb/libusb/Xcode/common.xcconfig
Normal file
92
AES_KEY/libusb/libusb/Xcode/common.xcconfig
Normal file
@ -0,0 +1,92 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
// Use GNU11 dialect.
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11
|
||||
|
||||
// Don't search user paths with <> style #includes.
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
// Enable weak references for Objective-C
|
||||
CLANG_ENABLE_OBJC_WEAK = YES
|
||||
|
||||
// Allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without 'extern') in two different compilations, you will get an error when you link them.
|
||||
GCC_NO_COMMON_BLOCKS = YES
|
||||
|
||||
// Keep private symbols private. The first setting is -fvisibility=hidden, the second is -fvisibility-inlines-hidden.
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
||||
|
||||
// Compiler errors.
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
|
||||
|
||||
// Compiler warnings.
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
||||
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
||||
GCC_WARN_SHADOW = YES
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES
|
||||
GCC_WARN_UNUSED_FUNCTION = YES
|
||||
GCC_WARN_UNUSED_LABEL = YES
|
||||
GCC_WARN_UNUSED_PARAMETER = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
CLANG_WARN_ASSIGN_ENUM = YES
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
|
||||
CLANG_WARN_BOOL_CONVERSION = YES
|
||||
CLANG_WARN_COMMA = YES
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
|
||||
CLANG_WARN_EMPTY_BODY = YES
|
||||
CLANG_WARN_ENUM_CONVERSION = YES
|
||||
CLANG_WARN_FLOAT_CONVERSION = YES
|
||||
CLANG_WARN_INFINITE_RECURSION = YES
|
||||
CLANG_WARN_INT_CONVERSION = YES
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
||||
CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES
|
||||
CLANG_WARN_IMPLICIT_FALLTHROUGH = YES
|
||||
CLANG_WARN_FRAMEWORK_INCLUDE_PRIVATE_FROM_PUBLIC = YES
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
|
||||
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES
|
||||
GCC_WARN_SIGN_COMPARE = YES
|
||||
CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES
|
||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
CLANG_WARN_ATOMIC_IMPLICIT_SEQ_CST = YES
|
||||
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
|
||||
CLANG_WARN_OBJC_INTERFACE_IVARS = YES
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = YES
|
||||
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
|
||||
// Static analyzer warnings.
|
||||
CLANG_ANALYZER_NONNULL = YES
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
|
||||
31
AES_KEY/libusb/libusb/Xcode/config.h
Normal file
31
AES_KEY/libusb/libusb/Xcode/config.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* config.h. Manually generated for Xcode. */
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
/* Define to the attribute for default visibility. */
|
||||
#define DEFAULT_VISIBILITY __attribute__ ((visibility ("default")))
|
||||
|
||||
/* Define to 1 to enable message logging. */
|
||||
#define ENABLE_LOGGING 1
|
||||
|
||||
/* On 10.6 and later, use newly available pthread_threadid_np() function */
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
||||
/* Define to 1 if you have the 'pthread_threadid_np' function. */
|
||||
#define HAVE_PTHREAD_THREADID_NP 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if the system has the type `nfds_t'. */
|
||||
#define HAVE_NFDS_T 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if compiling for a POSIX platform. */
|
||||
#define PLATFORM_POSIX 1
|
||||
|
||||
/* Define to the attribute for enabling parameter checks on printf-like
|
||||
functions. */
|
||||
#define PRINTF_FORMAT(a, b) __attribute__ ((__format__ (__printf__, a, b)))
|
||||
|
||||
/* Enable GNU extensions. */
|
||||
#define _GNU_SOURCE 1
|
||||
32
AES_KEY/libusb/libusb/Xcode/debug.xcconfig
Normal file
32
AES_KEY/libusb/libusb/Xcode/debug.xcconfig
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "common.xcconfig"
|
||||
|
||||
// Embed debug symbols in binary itself.
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
|
||||
// No optimizations in debug.
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
|
||||
//
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1
|
||||
|
||||
// No need for Universal Binaries in debug.
|
||||
ONLY_ACTIVE_ARCH = YES
|
||||
21
AES_KEY/libusb/libusb/Xcode/libusb.xcconfig
Normal file
21
AES_KEY/libusb/libusb/Xcode/libusb.xcconfig
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
PRODUCT_NAME = libusb-1.0.0
|
||||
LD_DYLIB_INSTALL_NAME = @rpath/libusb-1.0.0.dylib
|
||||
1391
AES_KEY/libusb/libusb/Xcode/libusb.xcodeproj/project.pbxproj
Normal file
1391
AES_KEY/libusb/libusb/Xcode/libusb.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
21
AES_KEY/libusb/libusb/Xcode/libusb_debug.xcconfig
Normal file
21
AES_KEY/libusb/libusb/Xcode/libusb_debug.xcconfig
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "debug.xcconfig"
|
||||
#include "libusb.xcconfig"
|
||||
21
AES_KEY/libusb/libusb/Xcode/libusb_release.xcconfig
Normal file
21
AES_KEY/libusb/libusb/Xcode/libusb_release.xcconfig
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "release.xcconfig"
|
||||
#include "libusb.xcconfig"
|
||||
30
AES_KEY/libusb/libusb/Xcode/release.xcconfig
Normal file
30
AES_KEY/libusb/libusb/Xcode/release.xcconfig
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// libusb Xcode configuration file
|
||||
// Copyright © 2012 Pete Batard <pete@akeo.ie>
|
||||
// For more information, please visit: <https://libusb.info>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "common.xcconfig"
|
||||
|
||||
// Put debug symbols in separate .dym file.
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
|
||||
// Optimizations in release.
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
LLVM_LTO = YES
|
||||
|
||||
// Define NDEBUG so asserts go away in release.
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) NDEBUG=1
|
||||
152
AES_KEY/libusb/libusb/android/README
Normal file
152
AES_KEY/libusb/libusb/android/README
Normal file
@ -0,0 +1,152 @@
|
||||
libusb for Android
|
||||
==================
|
||||
|
||||
Building:
|
||||
---------
|
||||
|
||||
To build libusb for Android do the following:
|
||||
|
||||
1. Download the latest NDK from:
|
||||
http://developer.android.com/tools/sdk/ndk/index.html
|
||||
|
||||
2. Extract the NDK.
|
||||
|
||||
3. Open a shell and make sure there exist an NDK global variable
|
||||
set to the directory where you extracted the NDK.
|
||||
|
||||
4. Change directory to libusb's "android/jni"
|
||||
|
||||
5. Run "$NDK/ndk-build".
|
||||
|
||||
The libusb library, examples and tests can then be found in:
|
||||
"android/libs/$ARCH"
|
||||
|
||||
Where $ARCH is one of:
|
||||
armeabi
|
||||
armeabi-v7a
|
||||
mips
|
||||
mips64
|
||||
x86
|
||||
x86_64
|
||||
|
||||
Installing:
|
||||
-----------
|
||||
|
||||
If you wish to use libusb from native code in own Android application
|
||||
then you should add the following line to your Android.mk file:
|
||||
|
||||
include $(PATH_TO_LIBUSB_SRC)/android/jni/libusb.mk
|
||||
|
||||
You will then need to add the following lines to the build
|
||||
configuration for each native binary which uses libusb:
|
||||
|
||||
LOCAL_C_INCLUDES += $(LIBUSB_ROOT_ABS)
|
||||
LOCAL_SHARED_LIBRARIES += libusb1.0
|
||||
|
||||
The Android build system will then correctly include libusb in the
|
||||
application package (APK) file, provided ndk-build is invoked before
|
||||
the package is built.
|
||||
|
||||
|
||||
Runtime Permissions:
|
||||
--------------------
|
||||
|
||||
The Runtime Permissions on Android can be transferred from Java to Native
|
||||
over the following approach:
|
||||
|
||||
JAVA:
|
||||
|
||||
--> Obtain USB permissions over the android.hardware.usb.UsbManager class
|
||||
|
||||
usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
||||
HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
|
||||
for (UsbDevice usbDevice : deviceList.values()) {
|
||||
usbManager.requestPermission(usbDevice, mPermissionIntent);
|
||||
}
|
||||
|
||||
--> Get the native FileDescriptor of the UsbDevice and transfer it to
|
||||
Native over JNI or JNA
|
||||
|
||||
UsbDeviceConnection usbDeviceConnection = usbManager.openDevice(camDevice);
|
||||
int fileDescriptor = usbDeviceConnection.getFileDescriptor();
|
||||
|
||||
--> JNA sample method:
|
||||
|
||||
JNA.INSTANCE.set_the_native_Descriptor(fileDescriptor);
|
||||
|
||||
NATIVE:
|
||||
|
||||
--> Initialize libusb on Android
|
||||
|
||||
set_the_native_Descriptor(int fileDescriptor) {
|
||||
libusb_context *ctx;
|
||||
libusb_device_handle *devh;
|
||||
libusb_set_option(&ctx, LIBUSB_OPTION_NO_DEVICE_DISCOVERY, NULL);
|
||||
libusb_init(&ctx);
|
||||
libusb_wrap_sys_device(NULL, (intptr_t)fileDescriptor, &devh);
|
||||
}
|
||||
/* From this point you can regularly use all libusb functions as usual */
|
||||
|
||||
About LIBUSB_OPTION_NO_DEVICE_DISCOVERY:
|
||||
|
||||
The method libusb_set_option(&ctx, LIBUSB_OPTION_NO_DEVICE_DISCOVERY, NULL)
|
||||
does not affect the ctx.
|
||||
It allows initializing libusb on unrooted Android devices by skipping
|
||||
the device enumeration.
|
||||
|
||||
Rooted Devices:
|
||||
---------------
|
||||
|
||||
For rooted devices the code using libusb could be executed as root
|
||||
using the "su" command. An alternative would be to use the "su" command
|
||||
to change the permissions on the appropriate /dev/bus/usb/ files.
|
||||
|
||||
Users have reported success in using android.hardware.usb.UsbManager
|
||||
to request permission to use the UsbDevice and then opening the
|
||||
device. The difficulties in this method is that there is no guarantee
|
||||
that it will continue to work in the future Android versions, it
|
||||
requires invoking Java APIs and running code to match each
|
||||
android.hardware.usb.UsbDevice to a libusb_device.
|
||||
|
||||
For a rooted device it is possible to install libusb into the system
|
||||
image of a running device:
|
||||
|
||||
1. Enable ADB on the device.
|
||||
|
||||
2. Connect the device to a machine running ADB.
|
||||
|
||||
3. Execute the following commands on the machine
|
||||
running ADB:
|
||||
|
||||
# Make the system partition writable
|
||||
adb shell su -c "mount -o remount,rw /system"
|
||||
|
||||
# Install libusb
|
||||
adb push obj/local/armeabi/libusb1.0.so /sdcard/
|
||||
adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"
|
||||
adb shell rm /sdcard/libusb1.0.so
|
||||
|
||||
# Install the samples and tests
|
||||
for B in listdevs fxload xusb sam3u_benchmark hotplugtest stress
|
||||
do
|
||||
adb push "obj/local/armeabi/$B" /sdcard/
|
||||
adb shell su -c "cat > /system/bin/$B < /sdcard/$B"
|
||||
adb shell su -c "chmod 0755 /system/bin/$B"
|
||||
adb shell rm "/sdcard/$B"
|
||||
done
|
||||
|
||||
# Make the system partition read only again
|
||||
adb shell su -c "mount -o remount,ro /system"
|
||||
|
||||
# Run listdevs to
|
||||
adb shell su -c "listdevs"
|
||||
|
||||
4. If your device only has a single OTG port then ADB can generally
|
||||
be switched to using Wifi with the following commands when connected
|
||||
via USB:
|
||||
|
||||
adb shell netcfg
|
||||
# Note the wifi IP address of the phone
|
||||
adb tcpip 5555
|
||||
# Use the IP address from netcfg
|
||||
adb connect 192.168.1.123:5555
|
||||
55
AES_KEY/libusb/libusb/android/config.h
Normal file
55
AES_KEY/libusb/libusb/android/config.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Android build config for libusb
|
||||
* Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Define to the attribute for default visibility. */
|
||||
#define DEFAULT_VISIBILITY __attribute__ ((visibility ("default")))
|
||||
|
||||
/* Define to 1 to start with debug message logging enabled. */
|
||||
/* #undef ENABLE_DEBUG_LOGGING */
|
||||
|
||||
/* Define to 1 to enable message logging. */
|
||||
#define ENABLE_LOGGING 1
|
||||
|
||||
/* Define to 1 if you have the <asm/types.h> header file. */
|
||||
#define HAVE_ASM_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* Define to 1 if the system has the type `nfds_t'. */
|
||||
#define HAVE_NFDS_T 1
|
||||
|
||||
/* Define to 1 if you have the `pipe2' function. */
|
||||
#define HAVE_PIPE2 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if compiling for a POSIX platform. */
|
||||
#define PLATFORM_POSIX 1
|
||||
|
||||
/* Define to the attribute for enabling parameter checks on printf-like
|
||||
functions. */
|
||||
#define PRINTF_FORMAT(a, b) __attribute__ ((__format__ (__printf__, a, b)))
|
||||
|
||||
/* Define to 1 to output logging messages to the systemwide log. */
|
||||
#define USE_SYSTEM_LOGGING_FACILITY 1
|
||||
|
||||
/* Enable GNU extensions. */
|
||||
#define _GNU_SOURCE 1
|
||||
301
AES_KEY/libusb/libusb/android/examples/unrooted_android.c
Normal file
301
AES_KEY/libusb/libusb/android/examples/unrooted_android.c
Normal file
@ -0,0 +1,301 @@
|
||||
/*
|
||||
* libusb example program for reading out USB descriptors on unrooted Android
|
||||
* (based on testlibusb.c)
|
||||
*
|
||||
* Copyright 2020-2021 Peter Stoiber
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Please contact the author if you need another license.
|
||||
* This Repository is provided "as is", without warranties of any kind.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This example creates a shared object which can be accessed over JNA or JNI from Java or Kotlin in Android.
|
||||
* Hint: If you are using Android Studio, set the "Debug type" to "Java Only" to receive debug messages.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
* First, you have to connect your USB device from the Java side.
|
||||
* Use the android.hardware.usb class to find the USB device, claim the interfaces, and open the usb_device_connection
|
||||
* Obtain the native File Descriptor --> usb_device_connection.getFileDescriptor()
|
||||
* Pass the received int value to the unrooted_usb_description method of this code (over JNA)
|
||||
*/
|
||||
|
||||
/*
|
||||
* libusb can only be included in Android projects using NDK for now. (CMake is not supported at the moment)
|
||||
* Clone the libusb git repo into your Android project and include the Android.mk file in your build.gradle.
|
||||
*/
|
||||
|
||||
/*
|
||||
Example JNA Approach:
|
||||
public interface unrooted_sample extends Library {
|
||||
public static final unrooted_sample INSTANCE = Native.load("unrooted_android", unrooted_sample.class);
|
||||
public int unrooted_usb_description (int fileDescriptor);
|
||||
}
|
||||
unrooted_sample.INSTANCE.unrooted_usb_description( usbDeviceConnection.getFileDescriptor());
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include "unrooted_android.h"
|
||||
#include "libusb.h"
|
||||
#include <android/log.h>
|
||||
#define LOG_TAG "LibUsb"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
static void print_endpoint_comp(const struct libusb_ss_endpoint_companion_descriptor *ep_comp)
|
||||
{
|
||||
LOGD(" USB 3.0 Endpoint Companion:\n");
|
||||
LOGD(" bMaxBurst: %u\n", ep_comp->bMaxBurst);
|
||||
LOGD(" bmAttributes: %02xh\n", ep_comp->bmAttributes);
|
||||
LOGD(" wBytesPerInterval: %u\n", ep_comp->wBytesPerInterval);
|
||||
}
|
||||
|
||||
static void print_endpoint(const struct libusb_endpoint_descriptor *endpoint)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
LOGD(" Endpoint:\n");
|
||||
LOGD(" bEndpointAddress: %02xh\n", endpoint->bEndpointAddress);
|
||||
LOGD(" bmAttributes: %02xh\n", endpoint->bmAttributes);
|
||||
LOGD(" wMaxPacketSize: %u\n", endpoint->wMaxPacketSize);
|
||||
LOGD(" bInterval: %u\n", endpoint->bInterval);
|
||||
LOGD(" bRefresh: %u\n", endpoint->bRefresh);
|
||||
LOGD(" bSynchAddress: %u\n", endpoint->bSynchAddress);
|
||||
|
||||
for (i = 0; i < endpoint->extra_length;) {
|
||||
if (LIBUSB_DT_SS_ENDPOINT_COMPANION == endpoint->extra[i + 1]) {
|
||||
struct libusb_ss_endpoint_companion_descriptor *ep_comp;
|
||||
|
||||
ret = libusb_get_ss_endpoint_companion_descriptor(NULL, endpoint, &ep_comp);
|
||||
if (LIBUSB_SUCCESS != ret)
|
||||
continue;
|
||||
|
||||
print_endpoint_comp(ep_comp);
|
||||
|
||||
libusb_free_ss_endpoint_companion_descriptor(ep_comp);
|
||||
}
|
||||
|
||||
i += endpoint->extra[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void print_altsetting(const struct libusb_interface_descriptor *interface)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
LOGD(" Interface:\n");
|
||||
LOGD(" bInterfaceNumber: %u\n", interface->bInterfaceNumber);
|
||||
LOGD(" bAlternateSetting: %u\n", interface->bAlternateSetting);
|
||||
LOGD(" bNumEndpoints: %u\n", interface->bNumEndpoints);
|
||||
LOGD(" bInterfaceClass: %u\n", interface->bInterfaceClass);
|
||||
LOGD(" bInterfaceSubClass: %u\n", interface->bInterfaceSubClass);
|
||||
LOGD(" bInterfaceProtocol: %u\n", interface->bInterfaceProtocol);
|
||||
LOGD(" iInterface: %u\n", interface->iInterface);
|
||||
|
||||
for (i = 0; i < interface->bNumEndpoints; i++)
|
||||
print_endpoint(&interface->endpoint[i]);
|
||||
}
|
||||
|
||||
static void print_2_0_ext_cap(struct libusb_usb_2_0_extension_descriptor *usb_2_0_ext_cap)
|
||||
{
|
||||
LOGD(" USB 2.0 Extension Capabilities:\n");
|
||||
LOGD(" bDevCapabilityType: %u\n", usb_2_0_ext_cap->bDevCapabilityType);
|
||||
LOGD(" bmAttributes: %08xh\n", usb_2_0_ext_cap->bmAttributes);
|
||||
}
|
||||
|
||||
static void print_ss_usb_cap(struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap)
|
||||
{
|
||||
LOGD(" USB 3.0 Capabilities:\n");
|
||||
LOGD(" bDevCapabilityType: %u\n", ss_usb_cap->bDevCapabilityType);
|
||||
LOGD(" bmAttributes: %02xh\n", ss_usb_cap->bmAttributes);
|
||||
LOGD(" wSpeedSupported: %u\n", ss_usb_cap->wSpeedSupported);
|
||||
LOGD(" bFunctionalitySupport: %u\n", ss_usb_cap->bFunctionalitySupport);
|
||||
LOGD(" bU1devExitLat: %u\n", ss_usb_cap->bU1DevExitLat);
|
||||
LOGD(" bU2devExitLat: %u\n", ss_usb_cap->bU2DevExitLat);
|
||||
}
|
||||
|
||||
static void print_bos(libusb_device_handle *handle)
|
||||
{
|
||||
struct libusb_bos_descriptor *bos;
|
||||
uint8_t i;
|
||||
int ret;
|
||||
|
||||
ret = libusb_get_bos_descriptor(handle, &bos);
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
LOGD(" Binary Object Store (BOS):\n");
|
||||
LOGD(" wTotalLength: %u\n", bos->wTotalLength);
|
||||
LOGD(" bNumDeviceCaps: %u\n", bos->bNumDeviceCaps);
|
||||
|
||||
for (i = 0; i < bos->bNumDeviceCaps; i++) {
|
||||
struct libusb_bos_dev_capability_descriptor *dev_cap = bos->dev_capability[i];
|
||||
|
||||
if (dev_cap->bDevCapabilityType == LIBUSB_BT_USB_2_0_EXTENSION) {
|
||||
struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension;
|
||||
|
||||
ret = libusb_get_usb_2_0_extension_descriptor(NULL, dev_cap, &usb_2_0_extension);
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
print_2_0_ext_cap(usb_2_0_extension);
|
||||
libusb_free_usb_2_0_extension_descriptor(usb_2_0_extension);
|
||||
} else if (dev_cap->bDevCapabilityType == LIBUSB_BT_SS_USB_DEVICE_CAPABILITY) {
|
||||
struct libusb_ss_usb_device_capability_descriptor *ss_dev_cap;
|
||||
|
||||
ret = libusb_get_ss_usb_device_capability_descriptor(NULL, dev_cap, &ss_dev_cap);
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
print_ss_usb_cap(ss_dev_cap);
|
||||
libusb_free_ss_usb_device_capability_descriptor(ss_dev_cap);
|
||||
}
|
||||
}
|
||||
|
||||
libusb_free_bos_descriptor(bos);
|
||||
}
|
||||
|
||||
static void print_interface(const struct libusb_interface *interface)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < interface->num_altsetting; i++)
|
||||
print_altsetting(&interface->altsetting[i]);
|
||||
}
|
||||
|
||||
static void print_configuration(struct libusb_config_descriptor *config)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
LOGD(" Configuration:\n");
|
||||
LOGD(" wTotalLength: %u\n", config->wTotalLength);
|
||||
LOGD(" bNumInterfaces: %u\n", config->bNumInterfaces);
|
||||
LOGD(" bConfigurationValue: %u\n", config->bConfigurationValue);
|
||||
LOGD(" iConfiguration: %u\n", config->iConfiguration);
|
||||
LOGD(" bmAttributes: %02xh\n", config->bmAttributes);
|
||||
LOGD(" MaxPower: %u\n", config->MaxPower);
|
||||
|
||||
for (i = 0; i < config->bNumInterfaces; i++)
|
||||
print_interface(&config->interface[i]);
|
||||
}
|
||||
|
||||
static void print_device(libusb_device *dev, libusb_device_handle *handle)
|
||||
{
|
||||
struct libusb_device_descriptor desc;
|
||||
unsigned char string[256];
|
||||
const char *speed;
|
||||
int ret;
|
||||
uint8_t i;
|
||||
|
||||
switch (libusb_get_device_speed(dev)) {
|
||||
case LIBUSB_SPEED_LOW: speed = "1.5M"; break;
|
||||
case LIBUSB_SPEED_FULL: speed = "12M"; break;
|
||||
case LIBUSB_SPEED_HIGH: speed = "480M"; break;
|
||||
case LIBUSB_SPEED_SUPER: speed = "5G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS: speed = "10G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS_X2: speed = "20G"; break;
|
||||
default: speed = "Unknown";
|
||||
}
|
||||
|
||||
ret = libusb_get_device_descriptor(dev, &desc);
|
||||
if (ret < 0) {
|
||||
LOGD("failed to get device descriptor");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGD("Dev (bus %u, device %u): %04X - %04X speed: %s\n",
|
||||
libusb_get_bus_number(dev), libusb_get_device_address(dev),
|
||||
desc.idVendor, desc.idProduct, speed);
|
||||
|
||||
if (!handle)
|
||||
libusb_open(dev, &handle);
|
||||
|
||||
if (handle) {
|
||||
if (desc.iManufacturer) {
|
||||
ret = libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, string, sizeof(string));
|
||||
if (ret > 0)
|
||||
LOGD(" Manufacturer: %s\n", (char *)string);
|
||||
}
|
||||
|
||||
if (desc.iProduct) {
|
||||
ret = libusb_get_string_descriptor_ascii(handle, desc.iProduct, string, sizeof(string));
|
||||
if (ret > 0)
|
||||
LOGD(" Product: %s\n", (char *)string);
|
||||
}
|
||||
|
||||
if (desc.iSerialNumber && verbose) {
|
||||
ret = libusb_get_string_descriptor_ascii(handle, desc.iSerialNumber, string, sizeof(string));
|
||||
if (ret > 0)
|
||||
LOGD(" Serial Number: %s\n", (char *)string);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
for (i = 0; i < desc.bNumConfigurations; i++) {
|
||||
struct libusb_config_descriptor *config;
|
||||
|
||||
ret = libusb_get_config_descriptor(dev, i, &config);
|
||||
if (LIBUSB_SUCCESS != ret) {
|
||||
LOGD(" Couldn't retrieve descriptors\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
print_configuration(config);
|
||||
|
||||
libusb_free_config_descriptor(config);
|
||||
}
|
||||
|
||||
if (handle && desc.bcdUSB >= 0x0201)
|
||||
print_bos(handle);
|
||||
}
|
||||
|
||||
if (handle)
|
||||
libusb_close(handle);
|
||||
}
|
||||
|
||||
|
||||
/* fileDescriptor = the native file descriptor obtained in Java and transferred to native over JNA, for example */
|
||||
int unrooted_usb_description(int fileDescriptor)
|
||||
{
|
||||
libusb_context *ctx = NULL;
|
||||
libusb_device_handle *devh = NULL;
|
||||
int r = 0;
|
||||
verbose = 1;
|
||||
r = libusb_set_option(NULL, LIBUSB_OPTION_NO_DEVICE_DISCOVERY, NULL);
|
||||
if (r != LIBUSB_SUCCESS) {
|
||||
LOGD("libusb_set_option failed: %d\n", r);
|
||||
return -1;
|
||||
}
|
||||
r = libusb_init(&ctx);
|
||||
if (r < 0) {
|
||||
LOGD("libusb_init failed: %d\n", r);
|
||||
return r;
|
||||
}
|
||||
r = libusb_wrap_sys_device(ctx, (intptr_t)fileDescriptor, &devh);
|
||||
if (r < 0) {
|
||||
LOGD("libusb_wrap_sys_device failed: %d\n", r);
|
||||
return r;
|
||||
} else if (devh == NULL) {
|
||||
LOGD("libusb_wrap_sys_device returned invalid handle\n");
|
||||
return r;
|
||||
}
|
||||
print_device(libusb_get_device(devh), devh);
|
||||
return r;
|
||||
}
|
||||
36
AES_KEY/libusb/libusb/android/examples/unrooted_android.h
Normal file
36
AES_KEY/libusb/libusb/android/examples/unrooted_android.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2021 Peter Stoiber
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Please contact the author if you need another license.
|
||||
* This Repository is provided "as is", without warranties of any kind.
|
||||
*/
|
||||
|
||||
#ifndef unrooted_android_H
|
||||
#define unrooted_android_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int unrooted_usb_description(int fileDescriptor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
23
AES_KEY/libusb/libusb/android/jni/Android.mk
Normal file
23
AES_KEY/libusb/libusb/android/jni/Android.mk
Normal file
@ -0,0 +1,23 @@
|
||||
# Android build config for libusb, examples and tests
|
||||
# Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(LOCAL_PATH)/libusb.mk
|
||||
include $(LOCAL_PATH)/examples.mk
|
||||
include $(LOCAL_PATH)/tests.mk
|
||||
40
AES_KEY/libusb/libusb/android/jni/Application.mk
Normal file
40
AES_KEY/libusb/libusb/android/jni/Application.mk
Normal file
@ -0,0 +1,40 @@
|
||||
# Android application build config for libusb
|
||||
# Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
APP_ABI := all
|
||||
|
||||
APP_CFLAGS := \
|
||||
-std=gnu11 \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wshadow \
|
||||
-Wunused \
|
||||
-Wwrite-strings \
|
||||
-Werror=format-security \
|
||||
-Werror=implicit-function-declaration \
|
||||
-Werror=implicit-int \
|
||||
-Werror=init-self \
|
||||
-Werror=missing-prototypes \
|
||||
-Werror=strict-prototypes \
|
||||
-Werror=undef \
|
||||
-Werror=uninitialized
|
||||
|
||||
# Workaround for MIPS toolchain linker being unable to find liblog dependency
|
||||
# of shared object in NDK versions at least up to r9.
|
||||
#
|
||||
APP_LDFLAGS := -llog
|
||||
168
AES_KEY/libusb/libusb/android/jni/examples.mk
Normal file
168
AES_KEY/libusb/libusb/android/jni/examples.mk
Normal file
@ -0,0 +1,168 @@
|
||||
# Android build config for libusb examples
|
||||
# Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
LIBUSB_ROOT_REL := ../..
|
||||
LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
|
||||
|
||||
ifeq ($(USE_PC_NAME),1)
|
||||
LIBUSB_MODULE := usb-1.0
|
||||
else
|
||||
LIBUSB_MODULE := libusb1.0
|
||||
endif
|
||||
|
||||
# dpfp
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/dpfp.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := dpfp
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# dpfp_threaded
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/dpfp.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_CFLAGS := -DDPFP_THREADED -pthread
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := dpfp_threaded
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# fxload
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/ezusb.c \
|
||||
$(LIBUSB_ROOT_REL)/examples/fxload.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := fxload
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# hotplugtest
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/hotplugtest.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := hotplugtest
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# listdevs
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/listdevs.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := listdevs
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# sam3u_benchmark
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/sam3u_benchmark.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := sam3u_benchmark
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# xusb
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/examples/xusb.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := xusb
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# unrooted_android
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/android/examples/unrooted_android.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libusb1.0
|
||||
|
||||
LOCAL_LDLIBS += -llog
|
||||
|
||||
LOCAL_MODULE := unrooted_android
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
60
AES_KEY/libusb/libusb/android/jni/libusb.mk
Normal file
60
AES_KEY/libusb/libusb/android/jni/libusb.mk
Normal file
@ -0,0 +1,60 @@
|
||||
# Android build config for libusb
|
||||
# Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
LIBUSB_ROOT_REL := ../..
|
||||
LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
|
||||
|
||||
# libusb
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/libusb/core.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/descriptor.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/hotplug.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/io.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/sync.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/strerror.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/os/linux_usbfs.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/os/events_posix.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/os/threads_posix.c \
|
||||
$(LIBUSB_ROOT_REL)/libusb/os/linux_netlink.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)/libusb \
|
||||
$(LIBUSB_ROOT_ABS)/libusb/os
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := \
|
||||
$(LIBUSB_ROOT_ABS)/libusb
|
||||
|
||||
LOCAL_CFLAGS := -fvisibility=hidden -pthread
|
||||
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
ifeq ($(USE_PC_NAME),1)
|
||||
LOCAL_MODULE := usb-1.0
|
||||
else
|
||||
LOCAL_MODULE := libusb1.0
|
||||
$(warning Building to legacy library name libusb1.0, which differs from pkg-config.)
|
||||
$(warning Use ndk-build USE_PC_NAME=1 to change the module name to the compatible usb-1.0.)
|
||||
$(warning USE_PC_NAME=1 may be the default in the future.)
|
||||
endif
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
45
AES_KEY/libusb/libusb/android/jni/tests.mk
Normal file
45
AES_KEY/libusb/libusb/android/jni/tests.mk
Normal file
@ -0,0 +1,45 @@
|
||||
# Android build config for libusb tests
|
||||
# Copyright © 2012-2013 RealVNC Ltd. <toby.gray@realvnc.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
LIBUSB_ROOT_REL := ../..
|
||||
LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
|
||||
|
||||
ifeq ($(USE_PC_NAME),1)
|
||||
LIBUSB_MODULE := usb-1.0
|
||||
else
|
||||
LIBUSB_MODULE := libusb1.0
|
||||
endif
|
||||
|
||||
# stress
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(LIBUSB_ROOT_REL)/tests/stress.c \
|
||||
$(LIBUSB_ROOT_REL)/tests/testlib.c
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/.. \
|
||||
$(LIBUSB_ROOT_ABS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
|
||||
|
||||
LOCAL_MODULE := stress
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
108
AES_KEY/libusb/libusb/appveyor.yml
Normal file
108
AES_KEY/libusb/libusb/appveyor.yml
Normal file
@ -0,0 +1,108 @@
|
||||
version: 1.0.{build}
|
||||
image:
|
||||
- Visual Studio 2013
|
||||
- Visual Studio 2015
|
||||
- Visual Studio 2017
|
||||
- Visual Studio 2019
|
||||
- Visual Studio 2022
|
||||
platform:
|
||||
- Win32
|
||||
- x64
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
environment:
|
||||
toolset: UNK
|
||||
clone_depth: 1
|
||||
build:
|
||||
parallel: true
|
||||
for:
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2013
|
||||
environment:
|
||||
toolset: v120
|
||||
build:
|
||||
project: msvc\libusb.sln
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2015
|
||||
configuration: Debug
|
||||
environment:
|
||||
toolset: v140
|
||||
build:
|
||||
project: msvc\libusb.sln
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2015
|
||||
platform: Win32
|
||||
configuration: Release
|
||||
environment:
|
||||
toolset: v140
|
||||
install:
|
||||
- cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\msys64\home\appveyor\libusb
|
||||
- cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin\home\appveyor\libusb
|
||||
build_script:
|
||||
- cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
- cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" MinGW
|
||||
- cmd: C:\cygwin\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" cygwin
|
||||
after_build:
|
||||
- cmd: 7z a "libusb-build_%APPVEYOR_BUILD_WORKER_IMAGE%_%PLATFORM%_%CONFIGURATION%.7z" tag_* README-build.txt build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\dll build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\lib build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\*.exe C:\msys64\home\appveyor\libusb-MinGW-Win32 C:\cygwin\home\appveyor\libusb-cygwin-Win32
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2015
|
||||
platform: x64
|
||||
configuration: Release
|
||||
environment:
|
||||
toolset: v140
|
||||
install:
|
||||
- cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\msys64\home\appveyor\libusb
|
||||
- cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin64\home\appveyor\libusb
|
||||
build_script:
|
||||
- cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
- cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" MinGW
|
||||
- cmd: C:\cygwin64\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\.private\appveyor_build.sh" cygwin
|
||||
after_build:
|
||||
- cmd: 7z a "libusb-build_%APPVEYOR_BUILD_WORKER_IMAGE%_%PLATFORM%_%CONFIGURATION%.7z" tag_* README-build.txt build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\dll build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\lib build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\*.exe C:\msys64\home\appveyor\libusb-MinGW-x64 C:\cygwin64\home\appveyor\libusb-cygwin-x64
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2017
|
||||
environment:
|
||||
toolset: v141
|
||||
build:
|
||||
project: msvc\libusb.sln
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2019
|
||||
environment:
|
||||
toolset: v142
|
||||
build:
|
||||
project: msvc\libusb.sln
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- image: Visual Studio 2022
|
||||
environment:
|
||||
toolset: v143
|
||||
build:
|
||||
project: msvc\libusb.sln
|
||||
|
||||
after_build:
|
||||
- cmd: ECHO This was built by %APPVEYOR_BUILD_WORKER_IMAGE% from %APPVEYOR_REPO_NAME% commit %APPVEYOR_REPO_COMMIT% > README-build.txt
|
||||
- cmd: ECHO > tag_%APPVEYOR_REPO_TAG_NAME%_commit_%APPVEYOR_REPO_COMMIT%
|
||||
- cmd: 7z a "libusb-build_%APPVEYOR_BUILD_WORKER_IMAGE%_%PLATFORM%_%CONFIGURATION%.7z" tag_* README-build.txt build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\dll build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\lib build\%TOOLSET%\%PLATFORM%\%CONFIGURATION%\*.exe
|
||||
|
||||
artifacts:
|
||||
- path: "libusb-build_%APPVEYOR_BUILD_WORKER_IMAGE%_%PLATFORM%_%CONFIGURATION%.7z"
|
||||
10
AES_KEY/libusb/libusb/autogen.sh
Normal file
10
AES_KEY/libusb/libusb/autogen.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
srcdir="$(dirname "$0")"
|
||||
|
||||
"$srcdir"/bootstrap.sh
|
||||
if [ -z "$NOCONFIGURE" ]; then
|
||||
exec "$srcdir"/configure --enable-examples-build --enable-tests-build "$@"
|
||||
fi
|
||||
10
AES_KEY/libusb/libusb/bootstrap.sh
Normal file
10
AES_KEY/libusb/libusb/bootstrap.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ ! -d m4 ]; then
|
||||
mkdir m4
|
||||
fi
|
||||
exec autoreconf -ivf
|
||||
460
AES_KEY/libusb/libusb/configure.ac
Normal file
460
AES_KEY/libusb/libusb/configure.ac
Normal file
@ -0,0 +1,460 @@
|
||||
dnl These m4 macros are whitespace sensitive and break if moved around much.
|
||||
m4_define([LU_VERSION_H], m4_include([libusb/version.h]))
|
||||
m4_define([LU_DEFINE_VERSION_ATOM],
|
||||
[m4_define([$1], m4_bregexp(LU_VERSION_H,
|
||||
[^#define\s*$1\s*\([0-9]*\).*], [\1]))])
|
||||
m4_define([LU_DEFINE_VERSION_RC_ATOM],
|
||||
[m4_define([$1], m4_bregexp(LU_VERSION_H,
|
||||
[^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
|
||||
dnl The m4_bregexp() returns (only) the numbers following the #define named
|
||||
dnl in the first macro parameter. m4_define() then defines the name for use
|
||||
dnl in AC_INIT.
|
||||
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
|
||||
LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
|
||||
LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([libusb-1.0], [LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC], [libusb-devel@lists.sourceforge.net], [libusb-1.0], [https://libusb.info])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([libusb/core.c])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_C_INLINE
|
||||
AM_INIT_AUTOMAKE
|
||||
LT_INIT
|
||||
LT_LANG([Windows Resource])
|
||||
|
||||
dnl Library versioning
|
||||
dnl These numbers should be tweaked on every release. Read carefully:
|
||||
dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
dnl http://sourceware.org/autobook/autobook/autobook_91.html
|
||||
lt_current=5
|
||||
lt_revision=0
|
||||
lt_age=5
|
||||
LT_LDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age} -no-undefined"
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
EXTRA_CPPFLAGS=
|
||||
EXTRA_CFLAGS=
|
||||
|
||||
dnl check for -std=gnu11 compiler support (optional)
|
||||
dnl note that we don't just check if the compiler accepts '-std=x11'
|
||||
dnl but also that it supports the _Thread_local keyword because some compilers
|
||||
dnl (e.g. gcc 4.8) accept the command line option but do not implement TLS
|
||||
saved_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="-std=gnu11"
|
||||
AC_MSG_CHECKING([if $CC supports -std=gnu11])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
c_dialect=gnu],
|
||||
[AC_MSG_RESULT([no])
|
||||
c_dialect=])
|
||||
if test "x$c_dialect" != xgnu; then
|
||||
dnl fallback check for -std=c11 compiler support (required)
|
||||
CFLAGS="-std=c11"
|
||||
AC_MSG_CHECKING([if $CC supports -std=c11])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([compiler with C11 support is required to build libusb])])
|
||||
c_dialect=c
|
||||
fi
|
||||
CFLAGS="${saved_CFLAGS}"
|
||||
|
||||
AC_DEFINE([_GNU_SOURCE], [1], [Enable GNU extensions.])
|
||||
AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__ ((visibility ("default")))], [Define to the attribute for default visibility.])
|
||||
AC_DEFINE([PRINTF_FORMAT(a, b)], [__attribute__ ((__format__ (__printf__, a, b)))], [Define to the attribute for enabling parameter checks on printf-like functions.])
|
||||
|
||||
create_import_lib=
|
||||
is_android_linux=
|
||||
AC_MSG_CHECKING([operating system])
|
||||
case $host in
|
||||
*-darwin*)
|
||||
AC_MSG_RESULT([Darwin/Mac OS X])
|
||||
backend=darwin
|
||||
platform=posix
|
||||
;;
|
||||
*-haiku*)
|
||||
AC_MSG_RESULT([Haiku])
|
||||
backend=haiku
|
||||
platform=posix
|
||||
;;
|
||||
wasm*-emscripten)
|
||||
AC_MSG_RESULT([Emscripten])
|
||||
backend=emscripten
|
||||
platform=posix
|
||||
;;
|
||||
wasm*-unknown-none)
|
||||
AC_MSG_ERROR([
|
||||
--host=$host_alias is not accepted as it might become ambiguous in the future.
|
||||
Please use an explicit --host=$host_cpu-emscripten instead.
|
||||
])
|
||||
;;
|
||||
*-linux* | *-uclinux*)
|
||||
dnl on Android Linux, some functions are in different places
|
||||
case $host in
|
||||
*-linux-android*)
|
||||
AC_MSG_RESULT([Android Linux])
|
||||
is_android_linux=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([Linux])
|
||||
;;
|
||||
esac
|
||||
backend=linux
|
||||
platform=posix
|
||||
;;
|
||||
*-netbsd*)
|
||||
AC_MSG_RESULT([NetBSD])
|
||||
backend=netbsd
|
||||
platform=posix
|
||||
;;
|
||||
*-openbsd*)
|
||||
AC_MSG_RESULT([OpenBSD])
|
||||
backend=openbsd
|
||||
platform=posix
|
||||
;;
|
||||
*-solaris*)
|
||||
AC_MSG_RESULT([SunOS])
|
||||
backend=sunos
|
||||
platform=posix
|
||||
;;
|
||||
*-cygwin*)
|
||||
AC_MSG_RESULT([Windows (using Cygwin)])
|
||||
backend=windows
|
||||
platform=windows
|
||||
EXTRA_CFLAGS="-mwin32"
|
||||
;;
|
||||
*-mingw* | *msys*)
|
||||
AC_MSG_RESULT([Windows])
|
||||
backend=windows
|
||||
platform=windows
|
||||
test "x$enable_shared" = xyes && create_import_lib=yes
|
||||
EXTRA_CFLAGS="-fno-omit-frame-pointer"
|
||||
EXTRA_LDFLAGS="-static-libgcc"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([Null])
|
||||
AC_MSG_WARN([The host being compiled for is not supported.])
|
||||
AC_MSG_WARN([The library may compile but will not function in any useful manner.])
|
||||
backend=null
|
||||
platform=posix
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "x$platform" = xposix; then
|
||||
AC_DEFINE([PLATFORM_POSIX], [1], [Define to 1 if compiling for a POSIX platform.])
|
||||
AC_CHECK_TYPES([nfds_t], [], [], [[#include <poll.h>]])
|
||||
if test "x$backend" != xemscripten; then
|
||||
# pipe2 is detected as present on Emscripten, but it isn't actually ported and always
|
||||
# returns an error. https://github.com/emscripten-core/emscripten/issues/14824
|
||||
AC_CHECK_FUNCS([pipe2])
|
||||
fi
|
||||
dnl Some compilers do not support the '-pthread' option so check for it here
|
||||
saved_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="-Wall -Werror -pthread"
|
||||
AC_MSG_CHECKING([if $CC recognizes -pthread])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_SUBST(THREAD_CFLAGS, [-pthread])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CFLAGS="${saved_CFLAGS}"
|
||||
dnl Android Linux and Darwin provide pthread functions directly in libc
|
||||
dnl glibc also provides some pthread functions directly, so search for a thread-specific function
|
||||
AC_SEARCH_LIBS([pthread_create], [pthread],
|
||||
[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
|
||||
[], [])
|
||||
dnl Check for new-style atomic builtins. We first check without linking to -latomic.
|
||||
AC_MSG_CHECKING(whether __atomic_load_n is supported)
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdint.h>
|
||||
int main() {
|
||||
struct {
|
||||
uint64_t *v;
|
||||
} x;
|
||||
return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
|
||||
(int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
|
||||
}]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
|
||||
AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
|
||||
if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
|
||||
AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
|
||||
fi
|
||||
elif test "x$platform" = xwindows; then
|
||||
AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
|
||||
else
|
||||
AC_MSG_ERROR([Unknown platform])
|
||||
fi
|
||||
|
||||
case $backend in
|
||||
darwin)
|
||||
AC_CHECK_FUNCS([pthread_threadid_np])
|
||||
LIBS="${LIBS} -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security"
|
||||
AC_CHECK_HEADERS([IOKit/usb/IOUSBHostFamilyDefinitions.h])
|
||||
;;
|
||||
haiku)
|
||||
LIBS="${LIBS} -lbe"
|
||||
;;
|
||||
linux)
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt], [], [], [])
|
||||
AC_CHECK_FUNCS([pthread_setname_np])
|
||||
AC_ARG_ENABLE([udev],
|
||||
[AS_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
|
||||
[use_udev=$enableval], [use_udev=yes])
|
||||
if test "x$use_udev" = xyes; then
|
||||
dnl system has udev. use it or fail!
|
||||
AC_CHECK_HEADER([libudev.h], [], [AC_MSG_ERROR([udev support requested but libudev header not installed])])
|
||||
AC_CHECK_LIB([udev], [udev_new], [], [AC_MSG_ERROR([udev support requested but libudev not installed])])
|
||||
|
||||
# We can build umockdev tests (if available)
|
||||
m4_ifdef([PKG_PROG_PKG_CONFIG],[
|
||||
PKG_PROG_PKG_CONFIG
|
||||
PKG_CHECK_MODULES([UMOCKDEV], [umockdev-1.0 >= 0.16.0], [ac_have_umockdev=yes], [ac_have_umockdev=no])
|
||||
PKG_CHECK_MODULES([UMOCKDEV_HOTPLUG], [umockdev-1.0 >= 0.17.7], [ac_umockdev_hotplug=yes], [ac_umockdev_hotplug=no])
|
||||
if test $ac_umockdev_hotplug = yes; then
|
||||
AC_DEFINE([UMOCKDEV_HOTPLUG], [1], [UMockdev hotplug code is not racy])
|
||||
fi
|
||||
], [])
|
||||
else
|
||||
AC_CHECK_HEADERS([asm/types.h])
|
||||
AC_CHECK_HEADER([linux/netlink.h], [], [AC_MSG_ERROR([Linux netlink header not found])])
|
||||
AC_CHECK_HEADER([sys/socket.h], [], [AC_MSG_ERROR([Linux socket header not found])])
|
||||
fi
|
||||
;;
|
||||
sunos)
|
||||
LIBS="${LIBS} -ldevinfo"
|
||||
;;
|
||||
windows)
|
||||
AC_CHECK_TYPES([struct timespec], [], [], [[#include <time.h>]])
|
||||
AC_DEFINE([_WIN32_WINNT], [_WIN32_WINNT_VISTA], [Define to the oldest supported Windows version.])
|
||||
LT_LDFLAGS="${LT_LDFLAGS} -avoid-version"
|
||||
;;
|
||||
emscripten)
|
||||
# Note: LT_LDFLAGS is not enough here because we need link flags for executable.
|
||||
EM_LDFLAGS="--bind -s ASYNCIFY"
|
||||
AM_LDFLAGS="${AM_LDFLAGS} ${EM_LDFLAGS} -s ASSERTIONS -s ALLOW_MEMORY_GROWTH"
|
||||
LIBS="${LIBS} ${EM_LDFLAGS}"
|
||||
;;
|
||||
*)
|
||||
dnl no special handling required
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl headers not available on all platforms but required on others
|
||||
AC_CHECK_HEADERS([sys/time.h])
|
||||
|
||||
dnl check availability of clock_gettime(), except don't bother on Darwin, because the result is not used.
|
||||
if test "x$platform" = xposix && test "x$backend" != xdarwin; then
|
||||
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [AC_MSG_ERROR([clock_gettime() is required on this platform])])
|
||||
|
||||
if test "x$have_clock_gettime" = xyes; then
|
||||
dnl the clock_gettime() function needs certain clock IDs defined
|
||||
AC_CHECK_DECL([CLOCK_MONOTONIC], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_MONOTONIC])], [[#include <time.h>]])
|
||||
dnl use the monotonic clock for condition variable timed waits if possible
|
||||
AC_CHECK_FUNCS([pthread_condattr_setclock], [need_clock_realtime=], [need_clock_realtime=yes])
|
||||
if test "x$need_clock_realtime" = xyes; then
|
||||
AC_CHECK_DECL([CLOCK_REALTIME], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_REALTIME])], [[#include <time.h>]])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl eventfd support
|
||||
if test "x$backend" = xlinux || test "x$backend" = xsunos; then
|
||||
AC_ARG_ENABLE([eventfd],
|
||||
[AS_HELP_STRING([--enable-eventfd], [use eventfd for signalling [default=auto]])],
|
||||
[use_eventfd=$enableval],
|
||||
[use_eventfd=auto])
|
||||
if test "x$use_eventfd" != xno; then
|
||||
AC_CHECK_HEADER([sys/eventfd.h], [eventfd_h=yes], [eventfd_h=])
|
||||
if test "x$eventfd_h" = xyes; then
|
||||
AC_CHECK_DECLS([EFD_NONBLOCK, EFD_CLOEXEC], [eventfd_h_ok=yes], [eventfd_h_ok=], [[#include <sys/eventfd.h>]])
|
||||
if test "x$eventfd_h_ok" = xyes; then
|
||||
AC_CHECK_FUNC([eventfd], [eventfd_ok=yes], [eventfd_ok=])
|
||||
if test "x$eventfd_ok" = xyes; then
|
||||
AC_DEFINE([HAVE_EVENTFD], [1], [Define to 1 if the system has eventfd functionality.])
|
||||
elif test "x$use_eventfd" = xyes; then
|
||||
AC_MSG_ERROR([eventfd() function not found; glibc 2.9+ required])
|
||||
fi
|
||||
elif test "x$use_eventfd" = xyes; then
|
||||
AC_MSG_ERROR([eventfd header not usable; glibc 2.9+ required])
|
||||
fi
|
||||
elif test "x$use_eventfd" = xyes; then
|
||||
AC_MSG_ERROR([eventfd header not available; glibc 2.9+ required])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING([whether to use eventfd for signalling])
|
||||
if test "x$use_eventfd" = xno; then
|
||||
AC_MSG_RESULT([no (disabled by user)])
|
||||
elif test "x$eventfd_h" != xyes; then
|
||||
AC_MSG_RESULT([no (header not available)])
|
||||
elif test "x$eventfd_h_ok" != xyes; then
|
||||
AC_MSG_RESULT([no (header not usable)])
|
||||
elif test "x$eventfd_ok" != xyes; then
|
||||
AC_MSG_RESULT([no (functions not available)])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl timerfd support
|
||||
if test "x$backend" = xlinux || test "x$backend" = xsunos; then
|
||||
AC_ARG_ENABLE([timerfd],
|
||||
[AS_HELP_STRING([--enable-timerfd], [use timerfd for timing [default=auto]])],
|
||||
[use_timerfd=$enableval],
|
||||
[use_timerfd=auto])
|
||||
if test "x$use_timerfd" != xno; then
|
||||
AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=yes], [timerfd_h=])
|
||||
if test "x$timerfd_h" = xyes; then
|
||||
AC_CHECK_DECLS([TFD_NONBLOCK, TFD_CLOEXEC], [timerfd_h_ok=yes], [timerfd_h_ok=], [[#include <sys/timerfd.h>]])
|
||||
if test "x$timerfd_h_ok" = xyes; then
|
||||
AC_CHECK_FUNC([timerfd_create], [timerfd_ok=yes], [timerfd_ok=])
|
||||
if test "x$timerfd_ok" = xyes; then
|
||||
AC_DEFINE([HAVE_TIMERFD], [1], [Define to 1 if the system has timerfd functionality.])
|
||||
elif test "x$use_timerfd" = xyes; then
|
||||
AC_MSG_ERROR([timerfd_create() function not found; glibc 2.9+ required])
|
||||
fi
|
||||
elif test "x$use_timerfd" = xyes; then
|
||||
AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
|
||||
fi
|
||||
elif test "x$use_timerfd" = xyes; then
|
||||
AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING([whether to use timerfd for timing])
|
||||
if test "x$use_timerfd" = xno; then
|
||||
AC_MSG_RESULT([no (disabled by user)])
|
||||
elif test "x$timerfd_h" != xyes; then
|
||||
AC_MSG_RESULT([no (header not available)])
|
||||
elif test "x$timerfd_h_ok" != xyes; then
|
||||
AC_MSG_RESULT([no (header not usable)])
|
||||
elif test "x$timerfd_ok" != xyes; then
|
||||
AC_MSG_RESULT([no (functions not available)])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Message logging
|
||||
AC_ARG_ENABLE([log],
|
||||
[AS_HELP_STRING([--disable-log], [disable all logging])],
|
||||
[log_enabled=$enableval],
|
||||
[log_enabled=yes])
|
||||
if test "x$log_enabled" != xno; then
|
||||
AC_DEFINE([ENABLE_LOGGING], [1], [Define to 1 to enable message logging.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([debug-log],
|
||||
[AS_HELP_STRING([--enable-debug-log], [start with debug message logging enabled [default=no]])],
|
||||
[debug_log_enabled=$enableval],
|
||||
[debug_log_enabled=no])
|
||||
if test "x$debug_log_enabled" != xno; then
|
||||
AC_DEFINE([ENABLE_DEBUG_LOGGING], [1], [Define to 1 to start with debug message logging enabled.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([system-log],
|
||||
[AS_HELP_STRING([--enable-system-log], [output logging messages to the systemwide log, if supported by the OS [default=no]])],
|
||||
[system_log_enabled=$enableval],
|
||||
[system_log_enabled=no])
|
||||
if test "x$system_log_enabled" != xno; then
|
||||
AC_DEFINE([USE_SYSTEM_LOGGING_FACILITY], [1], [Define to 1 to output logging messages to the systemwide log.])
|
||||
if test "x$backend" != xwindows && test "x$is_android_linux" != xyes; then
|
||||
dnl Check if syslog is available in standard C library
|
||||
AC_CHECK_HEADER([syslog.h], [syslog_h=yes], [syslog_h=])
|
||||
if test "x$syslog_h" = xyes; then
|
||||
AC_CHECK_FUNCS([syslog])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Examples build
|
||||
AC_ARG_ENABLE([examples-build],
|
||||
[AS_HELP_STRING([--enable-examples-build], [build example applications [default=no]])],
|
||||
[build_examples=$enableval],
|
||||
[build_examples=no])
|
||||
|
||||
dnl Tests build
|
||||
AC_ARG_ENABLE([tests-build],
|
||||
[AS_HELP_STRING([--enable-tests-build], [build test applications [default=no]])],
|
||||
[build_tests=$enableval],
|
||||
[build_tests=no])
|
||||
|
||||
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != xno])
|
||||
AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != xno])
|
||||
AM_CONDITIONAL([BUILD_UMOCKDEV_TEST], [test "x$ac_have_umockdev" = xyes -a "x$log_enabled" != xno -a "x$debug_log_enabled" != xyes])
|
||||
AM_CONDITIONAL([CREATE_IMPORT_LIB], [test "x$create_import_lib" = xyes])
|
||||
AM_CONDITIONAL([OS_DARWIN], [test "x$backend" = xdarwin])
|
||||
AM_CONDITIONAL([OS_HAIKU], [test "x$backend" = xhaiku])
|
||||
AM_CONDITIONAL([OS_LINUX], [test "x$backend" = xlinux])
|
||||
AM_CONDITIONAL([OS_NETBSD], [test "x$backend" = xnetbsd])
|
||||
AM_CONDITIONAL([OS_NULL], [test "x$backend" = xnull])
|
||||
AM_CONDITIONAL([OS_OPENBSD], [test "x$backend" = xopenbsd])
|
||||
AM_CONDITIONAL([OS_SUNOS], [test "x$backend" = xsunos])
|
||||
AM_CONDITIONAL([OS_WINDOWS], [test "x$backend" = xwindows])
|
||||
AM_CONDITIONAL([OS_EMSCRIPTEN], [test "x$backend" = xemscripten])
|
||||
AM_CONDITIONAL([PLATFORM_POSIX], [test "x$platform" = xposix])
|
||||
AM_CONDITIONAL([PLATFORM_WINDOWS], [test "x$platform" = xwindows])
|
||||
AM_CONDITIONAL([USE_UDEV], [test "x$use_udev" = xyes])
|
||||
AM_CONDITIONAL([LIBUSB_WINDOWS_HOTPLUG], [test "x$enable_windows_hotplug" = xyes])
|
||||
|
||||
dnl The -Wcast-function-type warning causes a flurry of warnings when compiling
|
||||
dnl Windows with GCC 8 or later because of dynamically loaded functions
|
||||
if test "x$backend" = xwindows; then
|
||||
AC_ARG_ENABLE([windows-hotplug],
|
||||
AS_HELP_STRING([--enable-windows-hotplug], [Enable Windows hotplug support]),
|
||||
[enable_windows_hotplug="$enableval"],
|
||||
[enable_windows_hotplug=no])
|
||||
|
||||
if test "x$enable_windows_hotplug" = "xyes"; then
|
||||
AC_DEFINE([LIBUSB_WINDOWS_HOTPLUG], [1], [Define to enable Windows hotplug support])
|
||||
fi
|
||||
|
||||
saved_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="-Werror -Wcast-function-type"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-cast-function-type"],
|
||||
[])
|
||||
CFLAGS="${saved_CFLAGS}"
|
||||
fi
|
||||
|
||||
dnl Some linkers do not support the '--add-stdcall-alias' option so check for it here
|
||||
if test "x$backend" = xwindows; then
|
||||
saved_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="-Wl,--add-stdcall-alias"
|
||||
AC_MSG_CHECKING([if linker supports --add-stdcall-alias])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
LT_LDFLAGS="${LT_LDFLAGS} -Wl,--add-stdcall-alias"],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CFLAGS="${saved_CFLAGS}"
|
||||
fi
|
||||
|
||||
SHARED_CFLAGS="-Wall -Wextra -Wshadow -Wunused -Wwrite-strings -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=init-self -Werror=missing-prototypes -Werror=strict-prototypes -Werror=undef -Werror=uninitialized"
|
||||
|
||||
AM_CPPFLAGS="${EXTRA_CPPFLAGS}"
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
|
||||
AM_CFLAGS="-std=${c_dialect}11 ${EXTRA_CFLAGS} ${SHARED_CFLAGS}"
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
AM_CXXFLAGS="-std=${c_dialect}++11 ${EXTRA_CFLAGS} ${SHARED_CFLAGS} -Wmissing-declarations"
|
||||
AC_SUBST(AM_CXXFLAGS)
|
||||
|
||||
AC_SUBST(LT_LDFLAGS)
|
||||
AC_SUBST(AM_LDFLAGS)
|
||||
|
||||
AC_SUBST([EXTRA_LDFLAGS])
|
||||
|
||||
dnl set name of html output directory for doxygen
|
||||
AC_SUBST(DOXYGEN_HTMLDIR, [api-1.0])
|
||||
|
||||
AC_CONFIG_FILES([libusb-1.0.pc])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([libusb/Makefile])
|
||||
AC_CONFIG_FILES([examples/Makefile])
|
||||
AC_CONFIG_FILES([tests/Makefile])
|
||||
AC_CONFIG_FILES([doc/Makefile])
|
||||
AC_CONFIG_FILES([doc/doxygen.cfg])
|
||||
AC_OUTPUT
|
||||
22
AES_KEY/libusb/libusb/doc/Makefile.in
Normal file
22
AES_KEY/libusb/libusb/doc/Makefile.in
Normal file
@ -0,0 +1,22 @@
|
||||
LIBUSB_SRC_DIR = @top_srcdir@/libusb
|
||||
EXCLUDED_FILES = libusbi.h version.h version_nano.h
|
||||
LIBUSB_SRC = $(wildcard $(LIBUSB_SRC_DIR)/*.c) $(wildcard $(LIBUSB_SRC_DIR)/*.h)
|
||||
LIBUSB_DOC_SRC = $(filter-out $(addprefix $(LIBUSB_SRC_DIR)/,$(EXCLUDED_FILES)),$(LIBUSB_SRC))
|
||||
|
||||
docs: @DOXYGEN_HTMLDIR@
|
||||
|
||||
@DOXYGEN_HTMLDIR@: doxygen.cfg @top_srcdir@/doc/libusb.png $(LIBUSB_DOC_SRC)
|
||||
doxygen $<
|
||||
|
||||
sfurl = web.sourceforge.net:/home/project-web/libusb/htdocs
|
||||
docs-upload: @DOXYGEN_HTMLDIR@
|
||||
if [ -z "$$SF_USER" ]; then \
|
||||
rsync -rv --delete $< $(sfurl); \
|
||||
else \
|
||||
rsync -rv --delete $< $$SF_USER@$(sfurl); \
|
||||
fi
|
||||
|
||||
clean:
|
||||
rm -rf @DOXYGEN_HTMLDIR@
|
||||
|
||||
.PHONY: clean docs docs-upload
|
||||
2571
AES_KEY/libusb/libusb/doc/doxygen.cfg.in
Normal file
2571
AES_KEY/libusb/libusb/doc/doxygen.cfg.in
Normal file
File diff suppressed because it is too large
Load Diff
BIN
AES_KEY/libusb/libusb/doc/libusb.png
Normal file
BIN
AES_KEY/libusb/libusb/doc/libusb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
12
AES_KEY/libusb/libusb/examples/Makefile.am
Normal file
12
AES_KEY/libusb/libusb/examples/Makefile.am
Normal file
@ -0,0 +1,12 @@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/libusb
|
||||
LDADD = ../libusb/libusb-1.0.la
|
||||
LIBS =
|
||||
|
||||
noinst_PROGRAMS = dpfp dpfp_threaded fxload hotplugtest listdevs sam3u_benchmark testlibusb xusb
|
||||
|
||||
dpfp_threaded_CPPFLAGS = $(AM_CPPFLAGS) -DDPFP_THREADED
|
||||
dpfp_threaded_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
|
||||
dpfp_threaded_LDADD = $(LDADD) $(THREAD_LIBS)
|
||||
dpfp_threaded_SOURCES = dpfp.c
|
||||
|
||||
fxload_SOURCES = ezusb.c ezusb.h fxload.c
|
||||
711
AES_KEY/libusb/libusb/examples/dpfp.c
Normal file
711
AES_KEY/libusb/libusb/examples/dpfp.c
Normal file
@ -0,0 +1,711 @@
|
||||
/*
|
||||
* libusb example program to manipulate U.are.U 4000B fingerprint scanner.
|
||||
* Copyright © 2007 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright © 2016 Nathan Hjelm <hjelmn@mac.com>
|
||||
* Copyright © 2020 Chris Dickens <christopher.a.dickens@gmail.com>
|
||||
*
|
||||
* Basic image capture program only, does not consider the powerup quirks or
|
||||
* the fact that image encryption may be enabled. Not expected to work
|
||||
* flawlessly all of the time.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if defined(DPFP_THREADED)
|
||||
#if defined(PLATFORM_POSIX)
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define THREAD_RETURN_VALUE NULL
|
||||
typedef sem_t * semaphore_t;
|
||||
typedef pthread_t thread_t;
|
||||
|
||||
static inline semaphore_t semaphore_create(void)
|
||||
{
|
||||
sem_t *semaphore;
|
||||
char name[50];
|
||||
|
||||
snprintf(name, sizeof(name), "/org.libusb.example.dpfp_threaded:%d", (int)getpid());
|
||||
semaphore = sem_open(name, O_CREAT | O_EXCL, 0, 0);
|
||||
if (semaphore == SEM_FAILED)
|
||||
return NULL;
|
||||
/* Remove semaphore so that it does not persist after process exits */
|
||||
(void)sem_unlink(name);
|
||||
return semaphore;
|
||||
}
|
||||
|
||||
static inline void semaphore_give(semaphore_t semaphore)
|
||||
{
|
||||
(void)sem_post(semaphore);
|
||||
}
|
||||
|
||||
static inline void semaphore_take(semaphore_t semaphore)
|
||||
{
|
||||
(void)sem_wait(semaphore);
|
||||
}
|
||||
|
||||
static inline void semaphore_destroy(semaphore_t semaphore)
|
||||
{
|
||||
(void)sem_close(semaphore);
|
||||
}
|
||||
|
||||
static inline int thread_create(thread_t *thread,
|
||||
void *(*thread_entry)(void *arg), void *arg)
|
||||
{
|
||||
return pthread_create(thread, NULL, thread_entry, arg) == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static inline void thread_join(thread_t thread)
|
||||
{
|
||||
(void)pthread_join(thread, NULL);
|
||||
}
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
#define THREAD_RETURN_VALUE 0
|
||||
typedef HANDLE semaphore_t;
|
||||
typedef HANDLE thread_t;
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
typedef DWORD thread_return_t;
|
||||
#else
|
||||
#include <process.h>
|
||||
typedef unsigned thread_return_t;
|
||||
#endif
|
||||
|
||||
static inline semaphore_t semaphore_create(void)
|
||||
{
|
||||
return CreateSemaphore(NULL, 0, 1, NULL);
|
||||
}
|
||||
|
||||
static inline void semaphore_give(semaphore_t semaphore)
|
||||
{
|
||||
(void)ReleaseSemaphore(semaphore, 1, NULL);
|
||||
}
|
||||
|
||||
static inline void semaphore_take(semaphore_t semaphore)
|
||||
{
|
||||
(void)WaitForSingleObject(semaphore, INFINITE);
|
||||
}
|
||||
|
||||
static inline void semaphore_destroy(semaphore_t semaphore)
|
||||
{
|
||||
(void)CloseHandle(semaphore);
|
||||
}
|
||||
|
||||
static inline int thread_create(thread_t *thread,
|
||||
thread_return_t (__stdcall *thread_entry)(void *arg), void *arg)
|
||||
{
|
||||
#if defined(__CYGWIN__)
|
||||
*thread = CreateThread(NULL, 0, thread_entry, arg, 0, NULL);
|
||||
#else
|
||||
*thread = (HANDLE)_beginthreadex(NULL, 0, thread_entry, arg, 0, NULL);
|
||||
#endif
|
||||
return *thread != NULL ? 0 : -1;
|
||||
}
|
||||
|
||||
static inline void thread_join(thread_t thread)
|
||||
{
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
|
||||
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
|
||||
#define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN)
|
||||
#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT)
|
||||
#define USB_RQ 0x04
|
||||
#define INTR_LENGTH 64
|
||||
|
||||
enum {
|
||||
MODE_INIT = 0x00,
|
||||
MODE_AWAIT_FINGER_ON = 0x10,
|
||||
MODE_AWAIT_FINGER_OFF = 0x12,
|
||||
MODE_CAPTURE = 0x20,
|
||||
MODE_SHUT_UP = 0x30,
|
||||
MODE_READY = 0x80,
|
||||
};
|
||||
|
||||
static int next_state(void);
|
||||
|
||||
enum {
|
||||
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON = 1,
|
||||
STATE_AWAIT_IRQ_FINGER_DETECTED,
|
||||
STATE_AWAIT_MODE_CHANGE_CAPTURE,
|
||||
STATE_AWAIT_IMAGE,
|
||||
STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF,
|
||||
STATE_AWAIT_IRQ_FINGER_REMOVED,
|
||||
};
|
||||
|
||||
static int state = 0;
|
||||
static libusb_device_handle *devh = NULL;
|
||||
static unsigned char imgbuf[0x1b340];
|
||||
static unsigned char irqbuf[INTR_LENGTH];
|
||||
static struct libusb_transfer *img_transfer = NULL;
|
||||
static struct libusb_transfer *irq_transfer = NULL;
|
||||
static int img_idx = 0;
|
||||
static volatile sig_atomic_t do_exit = 0;
|
||||
|
||||
#if defined(DPFP_THREADED)
|
||||
static semaphore_t exit_semaphore;
|
||||
static thread_t poll_thread;
|
||||
#endif
|
||||
|
||||
static void request_exit(sig_atomic_t code)
|
||||
{
|
||||
do_exit = code;
|
||||
#if defined(DPFP_THREADED)
|
||||
semaphore_give(exit_semaphore);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DPFP_THREADED)
|
||||
#if defined(PLATFORM_POSIX)
|
||||
static void *poll_thread_main(void *arg)
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
static thread_return_t __stdcall poll_thread_main(void *arg)
|
||||
#endif
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
printf("poll thread running\n");
|
||||
|
||||
while (!do_exit) {
|
||||
struct timeval tv = { 1, 0 };
|
||||
int r;
|
||||
|
||||
r = libusb_handle_events_timeout(NULL, &tv);
|
||||
if (r < 0) {
|
||||
request_exit(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("poll thread shutting down\n");
|
||||
return THREAD_RETURN_VALUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int find_dpfp_device(void)
|
||||
{
|
||||
devh = libusb_open_device_with_vid_pid(NULL, 0x05ba, 0x000a);
|
||||
if (!devh) {
|
||||
errno = ENODEV;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_f0_data(void)
|
||||
{
|
||||
unsigned char data[0x10];
|
||||
size_t i;
|
||||
int r;
|
||||
|
||||
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0xf0, 0, data,
|
||||
sizeof(data), 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "F0 error %d\n", r);
|
||||
return r;
|
||||
}
|
||||
if (r < (int)sizeof(data)) {
|
||||
fprintf(stderr, "short read (%d)\n", r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("F0 data:");
|
||||
for (i = 0; i < sizeof(data); i++)
|
||||
printf(" %02x", data[i]);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_hwstat(unsigned char *status)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = libusb_control_transfer(devh, CTRL_IN, USB_RQ, 0x07, 0, status, 1, 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "read hwstat error %d\n", r);
|
||||
return r;
|
||||
}
|
||||
if (r < 1) {
|
||||
fprintf(stderr, "short read (%d)\n", r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("hwstat reads %02x\n", *status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_hwstat(unsigned char data)
|
||||
{
|
||||
int r;
|
||||
|
||||
printf("set hwstat to %02x\n", data);
|
||||
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x07, 0, &data, 1, 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "set hwstat error %d\n", r);
|
||||
return r;
|
||||
}
|
||||
if (r < 1) {
|
||||
fprintf(stderr, "short write (%d)\n", r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_mode(unsigned char data)
|
||||
{
|
||||
int r;
|
||||
|
||||
printf("set mode %02x\n", data);
|
||||
r = libusb_control_transfer(devh, CTRL_OUT, USB_RQ, 0x4e, 0, &data, 1, 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "set mode error %d\n", r);
|
||||
return r;
|
||||
}
|
||||
if (r < 1) {
|
||||
fprintf(stderr, "short write (%d)\n", r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
|
||||
{
|
||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||
fprintf(stderr, "mode change transfer not completed!\n");
|
||||
request_exit(2);
|
||||
}
|
||||
|
||||
printf("async cb_mode_changed length=%d actual_length=%d\n",
|
||||
transfer->length, transfer->actual_length);
|
||||
if (next_state() < 0)
|
||||
request_exit(2);
|
||||
}
|
||||
|
||||
static int set_mode_async(unsigned char data)
|
||||
{
|
||||
unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
||||
struct libusb_transfer *transfer;
|
||||
|
||||
if (!buf) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
transfer = libusb_alloc_transfer(0);
|
||||
if (!transfer) {
|
||||
free(buf);
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("async set mode %02x\n", data);
|
||||
libusb_fill_control_setup(buf, CTRL_OUT, USB_RQ, 0x4e, 0, 1);
|
||||
buf[LIBUSB_CONTROL_SETUP_SIZE] = data;
|
||||
libusb_fill_control_transfer(transfer, devh, buf, cb_mode_changed, NULL,
|
||||
1000);
|
||||
|
||||
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK
|
||||
| LIBUSB_TRANSFER_FREE_BUFFER | LIBUSB_TRANSFER_FREE_TRANSFER;
|
||||
return libusb_submit_transfer(transfer);
|
||||
}
|
||||
|
||||
static int do_sync_intr(unsigned char *data)
|
||||
{
|
||||
int r;
|
||||
int transferred;
|
||||
|
||||
r = libusb_interrupt_transfer(devh, EP_INTR, data, INTR_LENGTH,
|
||||
&transferred, 1000);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "intr error %d\n", r);
|
||||
return r;
|
||||
}
|
||||
if (transferred < INTR_LENGTH) {
|
||||
fprintf(stderr, "short read (%d)\n", r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("recv interrupt %04x\n", *((uint16_t *)data));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sync_intr(unsigned char type)
|
||||
{
|
||||
int r;
|
||||
unsigned char data[INTR_LENGTH];
|
||||
|
||||
while (1) {
|
||||
r = do_sync_intr(data);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (data[0] == type)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int save_to_file(unsigned char *data)
|
||||
{
|
||||
FILE *f;
|
||||
char filename[64];
|
||||
|
||||
snprintf(filename, sizeof(filename), "finger%d.pgm", img_idx++);
|
||||
f = fopen(filename, "w");
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
fputs("P5 384 289 255 ", f);
|
||||
(void)fwrite(data + 64, 1, 384L*289L, f);
|
||||
fclose(f);
|
||||
printf("saved image to %s\n", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int next_state(void)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
printf("old state: %d\n", state);
|
||||
switch (state) {
|
||||
case STATE_AWAIT_IRQ_FINGER_REMOVED:
|
||||
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON;
|
||||
r = set_mode_async(MODE_AWAIT_FINGER_ON);
|
||||
break;
|
||||
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_ON:
|
||||
state = STATE_AWAIT_IRQ_FINGER_DETECTED;
|
||||
break;
|
||||
case STATE_AWAIT_IRQ_FINGER_DETECTED:
|
||||
state = STATE_AWAIT_MODE_CHANGE_CAPTURE;
|
||||
r = set_mode_async(MODE_CAPTURE);
|
||||
break;
|
||||
case STATE_AWAIT_MODE_CHANGE_CAPTURE:
|
||||
state = STATE_AWAIT_IMAGE;
|
||||
break;
|
||||
case STATE_AWAIT_IMAGE:
|
||||
state = STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF;
|
||||
r = set_mode_async(MODE_AWAIT_FINGER_OFF);
|
||||
break;
|
||||
case STATE_AWAIT_MODE_CHANGE_AWAIT_FINGER_OFF:
|
||||
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
|
||||
break;
|
||||
default:
|
||||
printf("unrecognised state %d\n", state);
|
||||
}
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "error detected changing state\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
printf("new state: %d\n", state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void LIBUSB_CALL cb_irq(struct libusb_transfer *transfer)
|
||||
{
|
||||
unsigned char irqtype = transfer->buffer[0];
|
||||
|
||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||
fprintf(stderr, "irq transfer status %d?\n", transfer->status);
|
||||
goto err_free_transfer;
|
||||
}
|
||||
|
||||
printf("IRQ callback %02x\n", irqtype);
|
||||
switch (state) {
|
||||
case STATE_AWAIT_IRQ_FINGER_DETECTED:
|
||||
if (irqtype == 0x01) {
|
||||
if (next_state() < 0)
|
||||
goto err_free_transfer;
|
||||
} else {
|
||||
printf("finger-on-sensor detected in wrong state!\n");
|
||||
}
|
||||
break;
|
||||
case STATE_AWAIT_IRQ_FINGER_REMOVED:
|
||||
if (irqtype == 0x02) {
|
||||
if (next_state() < 0)
|
||||
goto err_free_transfer;
|
||||
} else {
|
||||
printf("finger-on-sensor detected in wrong state!\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (libusb_submit_transfer(irq_transfer) < 0)
|
||||
goto err_free_transfer;
|
||||
|
||||
return;
|
||||
|
||||
err_free_transfer:
|
||||
libusb_free_transfer(transfer);
|
||||
irq_transfer = NULL;
|
||||
request_exit(2);
|
||||
}
|
||||
|
||||
static void LIBUSB_CALL cb_img(struct libusb_transfer *transfer)
|
||||
{
|
||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||
fprintf(stderr, "img transfer status %d?\n", transfer->status);
|
||||
goto err_free_transfer;
|
||||
}
|
||||
|
||||
printf("Image callback\n");
|
||||
save_to_file(imgbuf);
|
||||
if (next_state() < 0)
|
||||
goto err_free_transfer;
|
||||
|
||||
if (libusb_submit_transfer(img_transfer) < 0)
|
||||
goto err_free_transfer;
|
||||
|
||||
return;
|
||||
|
||||
err_free_transfer:
|
||||
libusb_free_transfer(transfer);
|
||||
img_transfer = NULL;
|
||||
request_exit(2);
|
||||
}
|
||||
|
||||
static int init_capture(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = libusb_submit_transfer(irq_transfer);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = libusb_submit_transfer(img_transfer);
|
||||
if (r < 0) {
|
||||
libusb_cancel_transfer(irq_transfer);
|
||||
while (irq_transfer)
|
||||
if (libusb_handle_events(NULL) < 0)
|
||||
break;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* start state machine */
|
||||
state = STATE_AWAIT_IRQ_FINGER_REMOVED;
|
||||
return next_state();
|
||||
}
|
||||
|
||||
static int do_init(void)
|
||||
{
|
||||
unsigned char status;
|
||||
int r;
|
||||
|
||||
r = get_hwstat(&status);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!(status & 0x80)) {
|
||||
r = set_hwstat(status | 0x80);
|
||||
if (r < 0)
|
||||
return r;
|
||||
r = get_hwstat(&status);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
status &= ~0x80;
|
||||
r = set_hwstat(status);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = get_hwstat(&status);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sync_intr(0x56);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int alloc_transfers(void)
|
||||
{
|
||||
img_transfer = libusb_alloc_transfer(0);
|
||||
if (!img_transfer) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
irq_transfer = libusb_alloc_transfer(0);
|
||||
if (!irq_transfer) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
libusb_fill_bulk_transfer(img_transfer, devh, EP_DATA, imgbuf,
|
||||
sizeof(imgbuf), cb_img, NULL, 0);
|
||||
libusb_fill_interrupt_transfer(irq_transfer, devh, EP_INTR, irqbuf,
|
||||
sizeof(irqbuf), cb_irq, NULL, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
(void)signum;
|
||||
|
||||
request_exit(1);
|
||||
}
|
||||
|
||||
static void setup_signals(void)
|
||||
{
|
||||
#if defined(PLATFORM_POSIX)
|
||||
struct sigaction sigact;
|
||||
|
||||
sigact.sa_handler = sighandler;
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
sigact.sa_flags = 0;
|
||||
(void)sigaction(SIGINT, &sigact, NULL);
|
||||
(void)sigaction(SIGTERM, &sigact, NULL);
|
||||
(void)sigaction(SIGQUIT, &sigact, NULL);
|
||||
#else
|
||||
(void)signal(SIGINT, sighandler);
|
||||
(void)signal(SIGTERM, sighandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = libusb_init_context(/*ctx=*/NULL, /*options=*/NULL, /*num_options=*/0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "failed to initialise libusb %d - %s\n", r, libusb_strerror(r));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
r = find_dpfp_device();
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "Could not find/open device\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = libusb_claim_interface(devh, 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "claim interface error %d - %s\n", r, libusb_strerror(r));
|
||||
goto out;
|
||||
}
|
||||
printf("claimed interface\n");
|
||||
|
||||
r = print_f0_data();
|
||||
if (r < 0)
|
||||
goto out_release;
|
||||
|
||||
r = do_init();
|
||||
if (r < 0)
|
||||
goto out_deinit;
|
||||
|
||||
/* async from here onwards */
|
||||
setup_signals();
|
||||
|
||||
r = alloc_transfers();
|
||||
if (r < 0)
|
||||
goto out_deinit;
|
||||
|
||||
#if defined(DPFP_THREADED)
|
||||
exit_semaphore = semaphore_create();
|
||||
if (!exit_semaphore) {
|
||||
fprintf(stderr, "failed to initialise semaphore\n");
|
||||
goto out_deinit;
|
||||
}
|
||||
|
||||
r = thread_create(&poll_thread, poll_thread_main, NULL);
|
||||
if (r) {
|
||||
semaphore_destroy(exit_semaphore);
|
||||
goto out_deinit;
|
||||
}
|
||||
|
||||
r = init_capture();
|
||||
if (r < 0)
|
||||
request_exit(2);
|
||||
|
||||
while (!do_exit)
|
||||
semaphore_take(exit_semaphore);
|
||||
#else
|
||||
r = init_capture();
|
||||
if (r < 0)
|
||||
goto out_deinit;
|
||||
|
||||
while (!do_exit) {
|
||||
r = libusb_handle_events(NULL);
|
||||
if (r < 0)
|
||||
request_exit(2);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("shutting down...\n");
|
||||
|
||||
#if defined(DPFP_THREADED)
|
||||
thread_join(poll_thread);
|
||||
semaphore_destroy(exit_semaphore);
|
||||
#endif
|
||||
|
||||
if (img_transfer) {
|
||||
r = libusb_cancel_transfer(img_transfer);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "failed to cancel transfer %d - %s\n", r, libusb_strerror(r));
|
||||
}
|
||||
|
||||
if (irq_transfer) {
|
||||
r = libusb_cancel_transfer(irq_transfer);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "failed to cancel transfer %d - %s\n", r, libusb_strerror(r));
|
||||
}
|
||||
|
||||
while (img_transfer || irq_transfer) {
|
||||
if (libusb_handle_events(NULL) < 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (do_exit == 1)
|
||||
r = 0;
|
||||
else
|
||||
r = 1;
|
||||
|
||||
out_deinit:
|
||||
if (img_transfer)
|
||||
libusb_free_transfer(img_transfer);
|
||||
if (irq_transfer)
|
||||
libusb_free_transfer(irq_transfer);
|
||||
set_mode(0);
|
||||
set_hwstat(0x80);
|
||||
out_release:
|
||||
libusb_release_interface(devh, 0);
|
||||
out:
|
||||
libusb_close(devh);
|
||||
libusb_exit(NULL);
|
||||
return r >= 0 ? r : -r;
|
||||
}
|
||||
846
AES_KEY/libusb/libusb/examples/ezusb.c
Normal file
846
AES_KEY/libusb/libusb/examples/ezusb.c
Normal file
@ -0,0 +1,846 @@
|
||||
/*
|
||||
* Copyright © 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright © 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
* Copyright © 2008 Roger Williams (rawqux@users.sourceforge.net)
|
||||
* Copyright © 2012 Pete Batard (pete@akeo.ie)
|
||||
* Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "ezusb.h"
|
||||
|
||||
/*
|
||||
* This file contains functions for uploading firmware into Cypress
|
||||
* EZ-USB microcontrollers. These chips use control endpoint 0 and vendor
|
||||
* specific commands to support writing into the on-chip SRAM. They also
|
||||
* support writing into the CPUCS register, which is how we reset the
|
||||
* processor after loading firmware (including the reset vector).
|
||||
*
|
||||
* These Cypress devices are 8-bit 8051 based microcontrollers with
|
||||
* special support for USB I/O. They come in several packages, and
|
||||
* some can be set up with external memory when device costs allow.
|
||||
* Note that the design was originally by AnchorChips, so you may find
|
||||
* references to that vendor (which was later merged into Cypress).
|
||||
* The Cypress FX parts are largely compatible with the Anchorhip ones.
|
||||
*/
|
||||
|
||||
int verbose = 1;
|
||||
|
||||
/*
|
||||
* return true if [addr,addr+len] includes external RAM
|
||||
* for Anchorchips EZ-USB or Cypress EZ-USB FX
|
||||
*/
|
||||
static bool fx_is_external(uint32_t addr, size_t len)
|
||||
{
|
||||
/* with 8KB RAM, 0x0000-0x1b3f can be written
|
||||
* we can't tell if it's a 4KB device here
|
||||
*/
|
||||
if (addr <= 0x1b3f)
|
||||
return ((addr + len) > 0x1b40);
|
||||
|
||||
/* there may be more RAM; unclear if we can write it.
|
||||
* some bulk buffers may be unused, 0x1b3f-0x1f3f
|
||||
* firmware can set ISODISAB for 2KB at 0x2000-0x27ff
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* return true if [addr,addr+len] includes external RAM
|
||||
* for Cypress EZ-USB FX2
|
||||
*/
|
||||
static bool fx2_is_external(uint32_t addr, size_t len)
|
||||
{
|
||||
/* 1st 8KB for data/code, 0x0000-0x1fff */
|
||||
if (addr <= 0x1fff)
|
||||
return ((addr + len) > 0x2000);
|
||||
|
||||
/* and 512 for data, 0xe000-0xe1ff */
|
||||
else if (addr >= 0xe000 && addr <= 0xe1ff)
|
||||
return ((addr + len) > 0xe200);
|
||||
|
||||
/* otherwise, it's certainly external */
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* return true if [addr,addr+len] includes external RAM
|
||||
* for Cypress EZ-USB FX2LP
|
||||
*/
|
||||
static bool fx2lp_is_external(uint32_t addr, size_t len)
|
||||
{
|
||||
/* 1st 16KB for data/code, 0x0000-0x3fff */
|
||||
if (addr <= 0x3fff)
|
||||
return ((addr + len) > 0x4000);
|
||||
|
||||
/* and 512 for data, 0xe000-0xe1ff */
|
||||
else if (addr >= 0xe000 && addr <= 0xe1ff)
|
||||
return ((addr + len) > 0xe200);
|
||||
|
||||
/* otherwise, it's certainly external */
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* These are the requests (bRequest) that the bootstrap loader is expected
|
||||
* to recognize. The codes are reserved by Cypress, and these values match
|
||||
* what EZ-USB hardware, or "Vend_Ax" firmware (2nd stage loader) uses.
|
||||
* Cypress' "a3load" is nice because it supports both FX and FX2, although
|
||||
* it doesn't have the EEPROM support (subset of "Vend_Ax").
|
||||
*/
|
||||
#define RW_INTERNAL 0xA0 /* hardware implements this one */
|
||||
#define RW_MEMORY 0xA3
|
||||
|
||||
/*
|
||||
* Issues the specified vendor-specific write request.
|
||||
*/
|
||||
static int ezusb_write(libusb_device_handle *device, const char *label,
|
||||
uint8_t opcode, uint32_t addr, const unsigned char *data, size_t len)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (verbose > 1)
|
||||
logerror("%s, addr 0x%08x len %4u (0x%04x)\n", label, addr, (unsigned)len, (unsigned)len);
|
||||
status = libusb_control_transfer(device,
|
||||
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
opcode, addr & 0xFFFF, addr >> 16,
|
||||
(unsigned char*)data, (uint16_t)len, 1000);
|
||||
if (status != (signed)len) {
|
||||
if (status < 0)
|
||||
logerror("%s: %s\n", label, libusb_error_name(status));
|
||||
else
|
||||
logerror("%s ==> %d\n", label, status);
|
||||
}
|
||||
if (status < 0) {
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Issues the specified vendor-specific read request.
|
||||
*/
|
||||
static int ezusb_read(libusb_device_handle *device, const char *label,
|
||||
uint8_t opcode, uint32_t addr, const unsigned char *data, size_t len)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (verbose > 1)
|
||||
logerror("%s, addr 0x%08x len %4u (0x%04x)\n", label, addr, (unsigned)len, (unsigned)len);
|
||||
status = libusb_control_transfer(device,
|
||||
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
opcode, addr & 0xFFFF, addr >> 16,
|
||||
(unsigned char*)data, (uint16_t)len, 1000);
|
||||
if (status != (signed)len) {
|
||||
if (status < 0)
|
||||
logerror("%s: %s\n", label, libusb_error_name(status));
|
||||
else
|
||||
logerror("%s ==> %d\n", label, status);
|
||||
}
|
||||
if (status < 0) {
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Modifies the CPUCS register to stop or reset the CPU.
|
||||
* Returns false on error.
|
||||
*/
|
||||
static bool ezusb_cpucs(libusb_device_handle *device, uint32_t addr, bool doRun)
|
||||
{
|
||||
int status;
|
||||
uint8_t data = doRun ? 0x00 : 0x01;
|
||||
|
||||
if (verbose)
|
||||
logerror("%s\n", data ? "stop CPU" : "reset CPU");
|
||||
status = libusb_control_transfer(device,
|
||||
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
RW_INTERNAL, addr & 0xFFFF, addr >> 16,
|
||||
&data, 1, 1000);
|
||||
if ((status != 1) &&
|
||||
/* We may get an I/O error from libusb as the device disappears */
|
||||
((!doRun) || (status != LIBUSB_ERROR_IO)))
|
||||
{
|
||||
const char *mesg = "can't modify CPUCS";
|
||||
if (status < 0)
|
||||
logerror("%s: %s\n", mesg, libusb_error_name(status));
|
||||
else
|
||||
logerror("%s\n", mesg);
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send an FX3 jump to address command
|
||||
* Returns false on error.
|
||||
*/
|
||||
static bool ezusb_fx3_jump(libusb_device_handle *device, uint32_t addr)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (verbose)
|
||||
logerror("transfer execution to Program Entry at 0x%08x\n", addr);
|
||||
status = libusb_control_transfer(device,
|
||||
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
RW_INTERNAL, addr & 0xFFFF, addr >> 16,
|
||||
NULL, 0, 1000);
|
||||
/* We may get an I/O error from libusb as the device disappears */
|
||||
if ((status != 0) && (status != LIBUSB_ERROR_IO))
|
||||
{
|
||||
const char *mesg = "failed to send jump command";
|
||||
if (status < 0)
|
||||
logerror("%s: %s\n", mesg, libusb_error_name(status));
|
||||
else
|
||||
logerror("%s\n", mesg);
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Parse an Intel HEX image file and invoke the poke() function on the
|
||||
* various segments to implement policies such as writing to RAM (with
|
||||
* a one or two stage loader setup, depending on the firmware) or to
|
||||
* EEPROM (two stages required).
|
||||
*
|
||||
* image - the hex image file
|
||||
* context - for use by poke()
|
||||
* is_external - if non-null, used to check which segments go into
|
||||
* external memory (writable only by software loader)
|
||||
* poke - called with each memory segment; errors indicated
|
||||
* by returning negative values.
|
||||
*
|
||||
* Caller is responsible for halting CPU as needed, such as when
|
||||
* overwriting a second stage loader.
|
||||
*/
|
||||
static int parse_ihex(FILE *image, void *context,
|
||||
bool (*is_external)(uint32_t addr, size_t len),
|
||||
int (*poke) (void *context, uint32_t addr, bool external,
|
||||
const unsigned char *data, size_t len))
|
||||
{
|
||||
unsigned char data[1023];
|
||||
uint32_t data_addr = 0;
|
||||
size_t data_len = 0;
|
||||
int rc;
|
||||
int first_line = 1;
|
||||
bool external = false;
|
||||
|
||||
/* Read the input file as an IHEX file, and report the memory segments
|
||||
* as we go. Each line holds a max of 16 bytes, but uploading is
|
||||
* faster (and EEPROM space smaller) if we merge those lines into larger
|
||||
* chunks. Most hex files keep memory segments together, which makes
|
||||
* such merging all but free. (But it may still be worth sorting the
|
||||
* hex files to make up for undesirable behavior from tools.)
|
||||
*
|
||||
* Note that EEPROM segments max out at 1023 bytes; the upload protocol
|
||||
* allows segments of up to 64 KBytes (more than a loader could handle).
|
||||
*/
|
||||
for (;;) {
|
||||
char buf[512], *cp;
|
||||
char tmp, type;
|
||||
size_t len;
|
||||
unsigned idx, off;
|
||||
|
||||
cp = fgets(buf, sizeof(buf), image);
|
||||
if (cp == NULL) {
|
||||
logerror("EOF without EOF record!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* EXTENSION: "# comment-till-end-of-line", for copyrights etc */
|
||||
if (buf[0] == '#')
|
||||
continue;
|
||||
|
||||
if (buf[0] != ':') {
|
||||
logerror("not an ihex record: %s", buf);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* ignore any newline */
|
||||
cp = strchr(buf, '\n');
|
||||
if (cp)
|
||||
*cp = 0;
|
||||
|
||||
if (verbose >= 3)
|
||||
logerror("** LINE: %s\n", buf);
|
||||
|
||||
/* Read the length field (up to 16 bytes) */
|
||||
tmp = buf[3];
|
||||
buf[3] = 0;
|
||||
len = strtoul(buf+1, NULL, 16);
|
||||
buf[3] = tmp;
|
||||
|
||||
/* Read the target offset (address up to 64KB) */
|
||||
tmp = buf[7];
|
||||
buf[7] = 0;
|
||||
off = (unsigned int)strtoul(buf+3, NULL, 16);
|
||||
buf[7] = tmp;
|
||||
|
||||
/* Initialize data_addr */
|
||||
if (first_line) {
|
||||
data_addr = off;
|
||||
first_line = 0;
|
||||
}
|
||||
|
||||
/* Read the record type */
|
||||
tmp = buf[9];
|
||||
buf[9] = 0;
|
||||
type = (char)strtoul(buf+7, NULL, 16);
|
||||
buf[9] = tmp;
|
||||
|
||||
/* If this is an EOF record, then make it so. */
|
||||
if (type == 1) {
|
||||
if (verbose >= 2)
|
||||
logerror("EOF on hexfile\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (type != 0) {
|
||||
logerror("unsupported record type: %u\n", type);
|
||||
return -3;
|
||||
}
|
||||
|
||||
if ((len * 2) + 11 > strlen(buf)) {
|
||||
logerror("record too short?\n");
|
||||
return -4;
|
||||
}
|
||||
|
||||
/* FIXME check for _physically_ contiguous not just virtually
|
||||
* e.g. on FX2 0x1f00-0x2100 includes both on-chip and external
|
||||
* memory so it's not really contiguous */
|
||||
|
||||
/* flush the saved data if it's not contiguous,
|
||||
* or when we've buffered as much as we can.
|
||||
*/
|
||||
if (data_len != 0
|
||||
&& (off != (data_addr + data_len)
|
||||
/* || !merge */
|
||||
|| (data_len + len) > sizeof(data))) {
|
||||
if (is_external)
|
||||
external = is_external(data_addr, data_len);
|
||||
rc = poke(context, data_addr, external, data, data_len);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
data_addr = off;
|
||||
data_len = 0;
|
||||
}
|
||||
|
||||
/* append to saved data, flush later */
|
||||
for (idx = 0, cp = buf+9 ; idx < len ; idx += 1, cp += 2) {
|
||||
tmp = cp[2];
|
||||
cp[2] = 0;
|
||||
data[data_len + idx] = (uint8_t)strtoul(cp, NULL, 16);
|
||||
cp[2] = tmp;
|
||||
}
|
||||
data_len += len;
|
||||
}
|
||||
|
||||
|
||||
/* flush any data remaining */
|
||||
if (data_len != 0) {
|
||||
if (is_external)
|
||||
external = is_external(data_addr, data_len);
|
||||
rc = poke(context, data_addr, external, data, data_len);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a binary image file and write it as is to the target.
|
||||
* Applies to Cypress BIX images for RAM or Cypress IIC images
|
||||
* for EEPROM.
|
||||
*
|
||||
* image - the BIX image file
|
||||
* context - for use by poke()
|
||||
* is_external - if non-null, used to check which segments go into
|
||||
* external memory (writable only by software loader)
|
||||
* poke - called with each memory segment; errors indicated
|
||||
* by returning negative values.
|
||||
*
|
||||
* Caller is responsible for halting CPU as needed, such as when
|
||||
* overwriting a second stage loader.
|
||||
*/
|
||||
static int parse_bin(FILE *image, void *context,
|
||||
bool (*is_external)(uint32_t addr, size_t len), int (*poke)(void *context,
|
||||
uint32_t addr, bool external, const unsigned char *data, size_t len))
|
||||
{
|
||||
unsigned char data[4096];
|
||||
uint32_t data_addr = 0;
|
||||
size_t data_len = 0;
|
||||
int rc;
|
||||
bool external = false;
|
||||
|
||||
for (;;) {
|
||||
data_len = fread(data, 1, 4096, image);
|
||||
if (data_len == 0)
|
||||
break;
|
||||
if (is_external)
|
||||
external = is_external(data_addr, data_len);
|
||||
rc = poke(context, data_addr, external, data, data_len);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
data_addr += (uint32_t)data_len;
|
||||
}
|
||||
return feof(image)?0:-1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a Cypress IIC image file and invoke the poke() function on the
|
||||
* various segments for writing to RAM
|
||||
*
|
||||
* image - the IIC image file
|
||||
* context - for use by poke()
|
||||
* is_external - if non-null, used to check which segments go into
|
||||
* external memory (writable only by software loader)
|
||||
* poke - called with each memory segment; errors indicated
|
||||
* by returning negative values.
|
||||
*
|
||||
* Caller is responsible for halting CPU as needed, such as when
|
||||
* overwriting a second stage loader.
|
||||
*/
|
||||
static int parse_iic(FILE *image, void *context,
|
||||
bool (*is_external)(uint32_t addr, size_t len),
|
||||
int (*poke)(void *context, uint32_t addr, bool external, const unsigned char *data, size_t len))
|
||||
{
|
||||
unsigned char data[4096];
|
||||
uint32_t data_addr = 0;
|
||||
size_t data_len = 0, read_len;
|
||||
uint8_t block_header[4];
|
||||
int rc;
|
||||
bool external = false;
|
||||
long file_size, initial_pos;
|
||||
|
||||
initial_pos = ftell(image);
|
||||
if (initial_pos < 0)
|
||||
return -1;
|
||||
|
||||
if (fseek(image, 0L, SEEK_END) != 0)
|
||||
return -1;
|
||||
file_size = ftell(image);
|
||||
if (fseek(image, initial_pos, SEEK_SET) != 0)
|
||||
return -1;
|
||||
for (;;) {
|
||||
/* Ignore the trailing reset IIC data (5 bytes) */
|
||||
if (ftell(image) >= (file_size - 5))
|
||||
break;
|
||||
if (fread(&block_header, 1, sizeof(block_header), image) != 4) {
|
||||
logerror("unable to read IIC block header\n");
|
||||
return -1;
|
||||
}
|
||||
data_len = (block_header[0] << 8) + block_header[1];
|
||||
data_addr = (block_header[2] << 8) + block_header[3];
|
||||
if (data_len > sizeof(data)) {
|
||||
/* If this is ever reported as an error, switch to using malloc/realloc */
|
||||
logerror("IIC data block too small - please report this error to libusb.info\n");
|
||||
return -1;
|
||||
}
|
||||
read_len = fread(data, 1, data_len, image);
|
||||
if (read_len != data_len) {
|
||||
logerror("read error\n");
|
||||
return -1;
|
||||
}
|
||||
if (is_external)
|
||||
external = is_external(data_addr, data_len);
|
||||
rc = poke(context, data_addr, external, data, data_len);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the parse call will be selected according to the image type */
|
||||
static int (*parse[IMG_TYPE_MAX])(FILE *image, void *context, bool (*is_external)(uint32_t addr, size_t len),
|
||||
int (*poke)(void *context, uint32_t addr, bool external, const unsigned char *data, size_t len))
|
||||
= { parse_ihex, parse_iic, parse_bin };
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* For writing to RAM using a first (hardware) or second (software)
|
||||
* stage loader and 0xA0 or 0xA3 vendor requests
|
||||
*/
|
||||
typedef enum {
|
||||
_undef = 0,
|
||||
internal_only, /* hardware first-stage loader */
|
||||
skip_internal, /* first phase, second-stage loader */
|
||||
skip_external /* second phase, second-stage loader */
|
||||
} ram_mode;
|
||||
|
||||
struct ram_poke_context {
|
||||
libusb_device_handle *device;
|
||||
ram_mode mode;
|
||||
size_t total, count;
|
||||
};
|
||||
|
||||
#define RETRY_LIMIT 5
|
||||
|
||||
static int ram_poke(void *context, uint32_t addr, bool external,
|
||||
const unsigned char *data, size_t len)
|
||||
{
|
||||
struct ram_poke_context *ctx = (struct ram_poke_context*)context;
|
||||
int rc;
|
||||
unsigned retry = 0;
|
||||
|
||||
switch (ctx->mode) {
|
||||
case internal_only: /* CPU should be stopped */
|
||||
if (external) {
|
||||
logerror("can't write %u bytes external memory at 0x%08x\n",
|
||||
(unsigned)len, addr);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case skip_internal: /* CPU must be running */
|
||||
if (!external) {
|
||||
if (verbose >= 2) {
|
||||
logerror("SKIP on-chip RAM, %u bytes at 0x%08x\n",
|
||||
(unsigned)len, addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case skip_external: /* CPU should be stopped */
|
||||
if (external) {
|
||||
if (verbose >= 2) {
|
||||
logerror("SKIP external RAM, %u bytes at 0x%08x\n",
|
||||
(unsigned)len, addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case _undef:
|
||||
default:
|
||||
logerror("bug\n");
|
||||
errno = EDOM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->total += len;
|
||||
ctx->count++;
|
||||
|
||||
/* Retry this till we get a real error. Control messages are not
|
||||
* NAKed (just dropped) so time out means is a real problem.
|
||||
*/
|
||||
while ((rc = ezusb_write(ctx->device,
|
||||
external ? "write external" : "write on-chip",
|
||||
external ? RW_MEMORY : RW_INTERNAL,
|
||||
addr, data, len)) < 0
|
||||
&& retry < RETRY_LIMIT) {
|
||||
if (rc != LIBUSB_ERROR_TIMEOUT)
|
||||
break;
|
||||
retry += 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a Cypress Image file into target RAM.
|
||||
* See http://www.cypress.com/?docID=41351 (AN76405 PDF) for more info.
|
||||
*/
|
||||
static int fx3_load_ram(libusb_device_handle *device, const char *path)
|
||||
{
|
||||
uint32_t dCheckSum, dExpectedCheckSum, dAddress, i, dLen, dLength;
|
||||
uint32_t* dImageBuf;
|
||||
unsigned char *bBuf, hBuf[4], blBuf[4], rBuf[4096];
|
||||
FILE *image;
|
||||
int ret = 0;
|
||||
|
||||
image = fopen(path, "rb");
|
||||
if (image == NULL) {
|
||||
logerror("unable to open '%s' for input\n", path);
|
||||
return -2;
|
||||
} else if (verbose)
|
||||
logerror("open firmware image %s for RAM upload\n", path);
|
||||
|
||||
// Read header
|
||||
if (fread(hBuf, sizeof(char), sizeof(hBuf), image) != sizeof(hBuf)) {
|
||||
logerror("could not read image header");
|
||||
ret = -3;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// check "CY" signature byte and format
|
||||
if ((hBuf[0] != 'C') || (hBuf[1] != 'Y')) {
|
||||
logerror("image doesn't have a CYpress signature\n");
|
||||
ret = -3;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Check bImageType
|
||||
switch(hBuf[3]) {
|
||||
case 0xB0:
|
||||
if (verbose)
|
||||
logerror("normal FW binary %s image with checksum\n", (hBuf[2]&0x01)?"data":"executable");
|
||||
break;
|
||||
case 0xB1:
|
||||
logerror("security binary image is not currently supported\n");
|
||||
ret = -3;
|
||||
goto exit;
|
||||
case 0xB2:
|
||||
logerror("VID:PID image is not currently supported\n");
|
||||
ret = -3;
|
||||
goto exit;
|
||||
default:
|
||||
logerror("invalid image type 0x%02X\n", hBuf[3]);
|
||||
ret = -3;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Read the bootloader version
|
||||
if (verbose) {
|
||||
if ((ezusb_read(device, "read bootloader version", RW_INTERNAL, 0xFFFF0020, blBuf, 4) < 0)) {
|
||||
logerror("Could not read bootloader version\n");
|
||||
ret = -8;
|
||||
goto exit;
|
||||
}
|
||||
logerror("FX3 bootloader version: 0x%02X%02X%02X%02X\n", blBuf[3], blBuf[2], blBuf[1], blBuf[0]);
|
||||
}
|
||||
|
||||
dCheckSum = 0;
|
||||
if (verbose)
|
||||
logerror("writing image...\n");
|
||||
while (1) {
|
||||
if ((fread(&dLength, sizeof(uint32_t), 1, image) != 1) || // read dLength
|
||||
(fread(&dAddress, sizeof(uint32_t), 1, image) != 1)) { // read dAddress
|
||||
logerror("could not read image");
|
||||
ret = -3;
|
||||
goto exit;
|
||||
}
|
||||
if (dLength == 0)
|
||||
break; // done
|
||||
|
||||
// coverity[tainted_data]
|
||||
dImageBuf = (uint32_t*)calloc(dLength, sizeof(uint32_t));
|
||||
if (dImageBuf == NULL) {
|
||||
logerror("could not allocate buffer for image chunk\n");
|
||||
ret = -4;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// read sections
|
||||
if (fread(dImageBuf, sizeof(uint32_t), dLength, image) != dLength) {
|
||||
logerror("could not read image");
|
||||
free(dImageBuf);
|
||||
ret = -3;
|
||||
goto exit;
|
||||
}
|
||||
for (i = 0; i < dLength; i++)
|
||||
dCheckSum += dImageBuf[i];
|
||||
dLength <<= 2; // convert to Byte length
|
||||
bBuf = (unsigned char*) dImageBuf;
|
||||
|
||||
while (dLength > 0) {
|
||||
dLen = 4096; // 4K max
|
||||
if (dLen > dLength)
|
||||
dLen = dLength;
|
||||
if ((ezusb_write(device, "write firmware", RW_INTERNAL, dAddress, bBuf, dLen) < 0) ||
|
||||
(ezusb_read(device, "read firmware", RW_INTERNAL, dAddress, rBuf, dLen) < 0)) {
|
||||
logerror("R/W error\n");
|
||||
free(dImageBuf);
|
||||
ret = -5;
|
||||
goto exit;
|
||||
}
|
||||
// Verify data: rBuf with bBuf
|
||||
for (i = 0; i < dLen; i++) {
|
||||
if (rBuf[i] != bBuf[i]) {
|
||||
logerror("verify error");
|
||||
free(dImageBuf);
|
||||
ret = -6;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
dLength -= dLen;
|
||||
bBuf += dLen;
|
||||
dAddress += dLen;
|
||||
}
|
||||
free(dImageBuf);
|
||||
}
|
||||
|
||||
// read pre-computed checksum data
|
||||
if ((fread(&dExpectedCheckSum, sizeof(uint32_t), 1, image) != 1) ||
|
||||
(dCheckSum != dExpectedCheckSum)) {
|
||||
logerror("checksum error\n");
|
||||
ret = -7;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// transfer execution to Program Entry
|
||||
if (!ezusb_fx3_jump(device, dAddress)) {
|
||||
ret = -6;
|
||||
}
|
||||
|
||||
exit:
|
||||
fclose(image);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a firmware file into target RAM. device is the open libusb
|
||||
* device, and the path is the name of the source file. Open the file,
|
||||
* parse the bytes, and write them in one or two phases.
|
||||
*
|
||||
* If stage == 0, this uses the first stage loader, built into EZ-USB
|
||||
* hardware but limited to writing on-chip memory or CPUCS. Everything
|
||||
* is written during one stage, unless there's an error such as the image
|
||||
* holding data that needs to be written to external memory.
|
||||
*
|
||||
* Otherwise, things are written in two stages. First the external
|
||||
* memory is written, expecting a second stage loader to have already
|
||||
* been loaded. Then file is re-parsed and on-chip memory is written.
|
||||
*/
|
||||
int ezusb_load_ram(libusb_device_handle *device, const char *path, int fx_type, int img_type, int stage)
|
||||
{
|
||||
FILE *image;
|
||||
uint32_t cpucs_addr;
|
||||
bool (*is_external)(uint32_t off, size_t len);
|
||||
struct ram_poke_context ctx;
|
||||
int status;
|
||||
uint8_t iic_header[8] = { 0 };
|
||||
int ret = 0;
|
||||
|
||||
if (fx_type == FX_TYPE_FX3)
|
||||
return fx3_load_ram(device, path);
|
||||
|
||||
image = fopen(path, "rb");
|
||||
if (image == NULL) {
|
||||
logerror("%s: unable to open for input.\n", path);
|
||||
return -2;
|
||||
} else if (verbose > 1)
|
||||
logerror("open firmware image %s for RAM upload\n", path);
|
||||
|
||||
if (img_type == IMG_TYPE_IIC) {
|
||||
if ( (fread(iic_header, 1, sizeof(iic_header), image) != sizeof(iic_header))
|
||||
|| (((fx_type == FX_TYPE_FX2LP) || (fx_type == FX_TYPE_FX2)) && (iic_header[0] != 0xC2))
|
||||
|| ((fx_type == FX_TYPE_AN21) && (iic_header[0] != 0xB2))
|
||||
|| ((fx_type == FX_TYPE_FX1) && (iic_header[0] != 0xB6)) ) {
|
||||
logerror("IIC image does not contain executable code - cannot load to RAM.\n");
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* EZ-USB original/FX and FX2 devices differ, apart from the 8051 core */
|
||||
switch(fx_type) {
|
||||
case FX_TYPE_FX2LP:
|
||||
cpucs_addr = 0xe600;
|
||||
is_external = fx2lp_is_external;
|
||||
break;
|
||||
case FX_TYPE_FX2:
|
||||
cpucs_addr = 0xe600;
|
||||
is_external = fx2_is_external;
|
||||
break;
|
||||
default:
|
||||
cpucs_addr = 0x7f92;
|
||||
is_external = fx_is_external;
|
||||
break;
|
||||
}
|
||||
|
||||
/* use only first stage loader? */
|
||||
if (stage == 0) {
|
||||
ctx.mode = internal_only;
|
||||
|
||||
/* if required, halt the CPU while we overwrite its code/data */
|
||||
if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, false))
|
||||
{
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* 2nd stage, first part? loader was already uploaded */
|
||||
} else {
|
||||
ctx.mode = skip_internal;
|
||||
|
||||
/* let CPU run; overwrite the 2nd stage loader later */
|
||||
if (verbose)
|
||||
logerror("2nd stage: write external memory\n");
|
||||
}
|
||||
|
||||
/* scan the image, first (maybe only) time */
|
||||
ctx.device = device;
|
||||
ctx.total = ctx.count = 0;
|
||||
status = parse[img_type](image, &ctx, is_external, ram_poke);
|
||||
if (status < 0) {
|
||||
logerror("unable to upload %s\n", path);
|
||||
ret = status;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* second part of 2nd stage: rescan */
|
||||
// TODO: what should we do for non HEX images there?
|
||||
if (stage) {
|
||||
ctx.mode = skip_external;
|
||||
|
||||
/* if needed, halt the CPU while we overwrite the 1st stage loader */
|
||||
if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, false))
|
||||
{
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* at least write the interrupt vectors (at 0x0000) for reset! */
|
||||
status = fseek(image, 0L, SEEK_SET);
|
||||
if (status < 0) {
|
||||
logerror("unable to rewind file %s\n", path);
|
||||
ret = status;
|
||||
goto exit;
|
||||
}
|
||||
if (verbose)
|
||||
logerror("2nd stage: write on-chip memory\n");
|
||||
status = parse_ihex(image, &ctx, is_external, ram_poke);
|
||||
if (status < 0) {
|
||||
logerror("unable to completely upload %s\n", path);
|
||||
ret = status;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose && (ctx.count != 0)) {
|
||||
logerror("... WROTE: %d bytes, %d segments, avg %d\n",
|
||||
(int)ctx.total, (int)ctx.count, (int)(ctx.total/ctx.count));
|
||||
}
|
||||
|
||||
/* if required, reset the CPU so it runs what we just uploaded */
|
||||
if (cpucs_addr && !ezusb_cpucs(device, cpucs_addr, true))
|
||||
ret = -1;
|
||||
|
||||
exit:
|
||||
fclose(image);
|
||||
return ret;
|
||||
}
|
||||
109
AES_KEY/libusb/libusb/examples/ezusb.h
Normal file
109
AES_KEY/libusb/libusb/examples/ezusb.h
Normal file
@ -0,0 +1,109 @@
|
||||
#ifndef ezusb_H
|
||||
#define ezusb_H
|
||||
/*
|
||||
* Copyright © 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright © 2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
* Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define FX_TYPE_UNDEFINED -1
|
||||
#define FX_TYPE_AN21 0 /* Original AnchorChips parts */
|
||||
#define FX_TYPE_FX1 1 /* Updated Cypress versions */
|
||||
#define FX_TYPE_FX2 2 /* USB 2.0 versions */
|
||||
#define FX_TYPE_FX2LP 3 /* Updated FX2 */
|
||||
#define FX_TYPE_FX3 4 /* USB 3.0 versions */
|
||||
#define FX_TYPE_MAX 5
|
||||
#define FX_TYPE_NAMES { "an21", "fx", "fx2", "fx2lp", "fx3" }
|
||||
|
||||
#define IMG_TYPE_UNDEFINED -1
|
||||
#define IMG_TYPE_HEX 0 /* Intel HEX */
|
||||
#define IMG_TYPE_IIC 1 /* Cypress 8051 IIC */
|
||||
#define IMG_TYPE_BIX 2 /* Cypress 8051 BIX */
|
||||
#define IMG_TYPE_IMG 3 /* Cypress IMG format */
|
||||
#define IMG_TYPE_MAX 4
|
||||
#define IMG_TYPE_NAMES { "Intel HEX", "Cypress 8051 IIC", "Cypress 8051 BIX", "Cypress IMG format" }
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Automatically identified devices (VID, PID, type, designation).
|
||||
* TODO: Could use some validation. Also where's the FX2?
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
int type;
|
||||
const char* designation;
|
||||
} fx_known_device;
|
||||
|
||||
#define FX_KNOWN_DEVICES { \
|
||||
{ 0x0547, 0x2122, FX_TYPE_AN21, "Cypress EZ-USB (2122S)" },\
|
||||
{ 0x0547, 0x2125, FX_TYPE_AN21, "Cypress EZ-USB (2121S/2125S)" },\
|
||||
{ 0x0547, 0x2126, FX_TYPE_AN21, "Cypress EZ-USB (2126S)" },\
|
||||
{ 0x0547, 0x2131, FX_TYPE_AN21, "Cypress EZ-USB (2131Q/2131S/2135S)" },\
|
||||
{ 0x0547, 0x2136, FX_TYPE_AN21, "Cypress EZ-USB (2136S)" },\
|
||||
{ 0x0547, 0x2225, FX_TYPE_AN21, "Cypress EZ-USB (2225)" },\
|
||||
{ 0x0547, 0x2226, FX_TYPE_AN21, "Cypress EZ-USB (2226)" },\
|
||||
{ 0x0547, 0x2235, FX_TYPE_AN21, "Cypress EZ-USB (2235)" },\
|
||||
{ 0x0547, 0x2236, FX_TYPE_AN21, "Cypress EZ-USB (2236)" },\
|
||||
{ 0x04b4, 0x6473, FX_TYPE_FX1, "Cypress EZ-USB FX1" },\
|
||||
{ 0x04b4, 0x8613, FX_TYPE_FX2LP, "Cypress EZ-USB FX2LP (68013A/68014A/68015A/68016A)" }, \
|
||||
{ 0x04b4, 0x00f3, FX_TYPE_FX3, "Cypress FX3" },\
|
||||
}
|
||||
|
||||
/*
|
||||
* This function uploads the firmware from the given file into RAM.
|
||||
* Stage == 0 means this is a single stage load (or the first of
|
||||
* two stages). Otherwise it's the second of two stages; the
|
||||
* caller having preloaded the second stage loader.
|
||||
*
|
||||
* The target processor is reset at the end of this upload.
|
||||
*/
|
||||
extern int ezusb_load_ram(libusb_device_handle *device,
|
||||
const char *path, int fx_type, int img_type, int stage);
|
||||
|
||||
/*
|
||||
* This function uploads the firmware from the given file into EEPROM.
|
||||
* This uses the right CPUCS address to terminate the EEPROM load with
|
||||
* a reset command where FX parts behave differently than FX2 ones.
|
||||
* The configuration byte is as provided here (zero for an21xx parts)
|
||||
* and the EEPROM type is set so that the microcontroller will boot
|
||||
* from it.
|
||||
*
|
||||
* The caller must have preloaded a second stage loader that knows
|
||||
* how to respond to the EEPROM write request.
|
||||
*/
|
||||
extern int ezusb_load_eeprom(libusb_device_handle *device,
|
||||
const char *path, int fx_type, int img_type, int config);
|
||||
|
||||
/* Verbosity level (default 1). Can be increased or decreased with options v/q */
|
||||
extern int verbose;
|
||||
|
||||
extern void logerror(const char *format, ...) PRINTF_FORMAT(1, 2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
310
AES_KEY/libusb/libusb/examples/fxload.c
Normal file
310
AES_KEY/libusb/libusb/examples/fxload.c
Normal file
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Copyright © 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright © 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
|
||||
* Copyright © 2008 Roger Williams (rawqux@users.sourceforge.net)
|
||||
* Copyright © 2012 Pete Batard (pete@akeo.ie)
|
||||
* Copyright © 2013 Federico Manzan (f.manzan@gmail.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "ezusb.h"
|
||||
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <syslog.h>
|
||||
static bool dosyslog = false;
|
||||
#include <strings.h>
|
||||
#define libusb_strcasecmp strcasecmp
|
||||
#else
|
||||
#define libusb_strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#ifndef FXLOAD_VERSION
|
||||
#define FXLOAD_VERSION (__DATE__ " (libusb)")
|
||||
#endif
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
#endif
|
||||
|
||||
void logerror(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
if (dosyslog)
|
||||
vsyslog(LOG_ERR, format, ap);
|
||||
else
|
||||
#endif
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static int print_usage(int error_code) {
|
||||
fprintf(stderr, "\nUsage: fxload [-v] [-V] [-t type] [-d vid:pid] [-p bus,addr] [-s loader] -i firmware\n");
|
||||
fprintf(stderr, " -i <path> -- Firmware to upload\n");
|
||||
fprintf(stderr, " -s <path> -- Second stage loader\n");
|
||||
fprintf(stderr, " -t <type> -- Target type: an21, fx, fx2, fx2lp, fx3\n");
|
||||
fprintf(stderr, " -d <vid:pid> -- Target device, as an USB VID:PID\n");
|
||||
fprintf(stderr, " -p <bus,addr> -- Target device, as a libusb bus number and device address path\n");
|
||||
fprintf(stderr, " -v -- Increase verbosity\n");
|
||||
fprintf(stderr, " -q -- Decrease verbosity (silent mode)\n");
|
||||
fprintf(stderr, " -V -- Print program version\n");
|
||||
return error_code;
|
||||
}
|
||||
|
||||
#define FIRMWARE 0
|
||||
#define LOADER 1
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
fx_known_device known_device[] = FX_KNOWN_DEVICES;
|
||||
const char *path[] = { NULL, NULL };
|
||||
const char *device_id = NULL;
|
||||
const char *device_path = getenv("DEVICE");
|
||||
const char *type = NULL;
|
||||
const char *fx_name[FX_TYPE_MAX] = FX_TYPE_NAMES;
|
||||
const char *ext, *img_name[] = IMG_TYPE_NAMES;
|
||||
int fx_type = FX_TYPE_UNDEFINED, img_type[ARRAYSIZE(path)];
|
||||
int opt, status;
|
||||
unsigned int i, j;
|
||||
unsigned vid = 0, pid = 0;
|
||||
unsigned busnum = 0, devaddr = 0, _busnum, _devaddr;
|
||||
libusb_device *dev, **devs;
|
||||
libusb_device_handle *device = NULL;
|
||||
struct libusb_device_descriptor desc;
|
||||
|
||||
while ((opt = getopt(argc, argv, "qvV?hd:p:i:I:s:S:t:")) != EOF)
|
||||
switch (opt) {
|
||||
|
||||
case 'd':
|
||||
device_id = optarg;
|
||||
if (sscanf(device_id, "%x:%x" , &vid, &pid) != 2 ) {
|
||||
fputs ("please specify VID & PID as \"vid:pid\" in hexadecimal format\n", stderr);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
device_path = optarg;
|
||||
if (sscanf(device_path, "%u,%u", &busnum, &devaddr) != 2 ) {
|
||||
fputs ("please specify bus number & device number as \"bus,dev\" in decimal format\n", stderr);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
path[FIRMWARE] = optarg;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
case 'S':
|
||||
path[LOADER] = optarg;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
puts(FXLOAD_VERSION);
|
||||
return 0;
|
||||
|
||||
case 't':
|
||||
type = optarg;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
verbose--;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
return print_usage(-1);
|
||||
|
||||
}
|
||||
|
||||
if (path[FIRMWARE] == NULL) {
|
||||
logerror("no firmware specified!\n");
|
||||
return print_usage(-1);
|
||||
}
|
||||
if ((device_id != NULL) && (device_path != NULL)) {
|
||||
logerror("only one of -d or -p can be specified\n");
|
||||
return print_usage(-1);
|
||||
}
|
||||
|
||||
/* determine the target type */
|
||||
if (type != NULL) {
|
||||
for (i=0; i<FX_TYPE_MAX; i++) {
|
||||
if (strcmp(type, fx_name[i]) == 0) {
|
||||
fx_type = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= FX_TYPE_MAX) {
|
||||
logerror("illegal microcontroller type: %s\n", type);
|
||||
return print_usage(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* open the device using libusb */
|
||||
status = libusb_init_context(/*ctx=*/NULL, /*options=*/NULL, /*num_options=*/0);
|
||||
if (status < 0) {
|
||||
logerror("libusb_init_context() failed: %s\n", libusb_error_name(status));
|
||||
return -1;
|
||||
}
|
||||
libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, verbose);
|
||||
|
||||
/* try to pick up missing parameters from known devices */
|
||||
if ((type == NULL) || (device_id == NULL) || (device_path != NULL)) {
|
||||
if (libusb_get_device_list(NULL, &devs) < 0) {
|
||||
logerror("libusb_get_device_list() failed: %s\n", libusb_error_name(status));
|
||||
goto err;
|
||||
}
|
||||
for (i=0; (dev=devs[i]) != NULL; i++) {
|
||||
_busnum = libusb_get_bus_number(dev);
|
||||
_devaddr = libusb_get_device_address(dev);
|
||||
if ((type != NULL) && (device_path != NULL)) {
|
||||
// if both a type and bus,addr were specified, we just need to find our match
|
||||
if ((libusb_get_bus_number(dev) == busnum) && (libusb_get_device_address(dev) == devaddr))
|
||||
break;
|
||||
} else {
|
||||
status = libusb_get_device_descriptor(dev, &desc);
|
||||
if (status >= 0) {
|
||||
if (verbose >= 3) {
|
||||
logerror("examining %04x:%04x (%d,%d)\n",
|
||||
desc.idVendor, desc.idProduct, _busnum, _devaddr);
|
||||
}
|
||||
for (j=0; j<ARRAYSIZE(known_device); j++) {
|
||||
if ((desc.idVendor == known_device[j].vid)
|
||||
&& (desc.idProduct == known_device[j].pid)) {
|
||||
if (// nothing was specified
|
||||
((type == NULL) && (device_id == NULL) && (device_path == NULL)) ||
|
||||
// vid:pid was specified and we have a match
|
||||
((type == NULL) && (device_id != NULL) && (vid == desc.idVendor) && (pid == desc.idProduct)) ||
|
||||
// bus,addr was specified and we have a match
|
||||
((type == NULL) && (device_path != NULL) && (busnum == _busnum) && (devaddr == _devaddr)) ||
|
||||
// type was specified and we have a match
|
||||
((type != NULL) && (device_id == NULL) && (device_path == NULL) && (fx_type == known_device[j].type)) ) {
|
||||
fx_type = known_device[j].type;
|
||||
vid = desc.idVendor;
|
||||
pid = desc.idProduct;
|
||||
busnum = _busnum;
|
||||
devaddr = _devaddr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j < ARRAYSIZE(known_device)) {
|
||||
if (verbose)
|
||||
logerror("found device '%s' [%04x:%04x] (%d,%d)\n",
|
||||
known_device[j].designation, vid, pid, busnum, devaddr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dev == NULL) {
|
||||
libusb_free_device_list(devs, 1);
|
||||
libusb_exit(NULL);
|
||||
logerror("could not find a known device - please specify type and/or vid:pid and/or bus,dev\n");
|
||||
return print_usage(-1);
|
||||
}
|
||||
status = libusb_open(dev, &device);
|
||||
libusb_free_device_list(devs, 1);
|
||||
if (status < 0) {
|
||||
logerror("libusb_open() failed: %s\n", libusb_error_name(status));
|
||||
goto err;
|
||||
}
|
||||
} else if (device_id != NULL) {
|
||||
device = libusb_open_device_with_vid_pid(NULL, (uint16_t)vid, (uint16_t)pid);
|
||||
if (device == NULL) {
|
||||
logerror("libusb_open() failed\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to claim the first interface */
|
||||
libusb_set_auto_detach_kernel_driver(device, 1);
|
||||
status = libusb_claim_interface(device, 0);
|
||||
if (status != LIBUSB_SUCCESS) {
|
||||
libusb_close(device);
|
||||
logerror("libusb_claim_interface failed: %s\n", libusb_error_name(status));
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
logerror("microcontroller type: %s\n", fx_name[fx_type]);
|
||||
|
||||
for (i=0; i<ARRAYSIZE(path); i++) {
|
||||
if (path[i] != NULL) {
|
||||
ext = path[i] + strlen(path[i]) - 4;
|
||||
if ((libusb_strcasecmp(ext, ".hex") == 0) || (libusb_strcasecmp(ext, ".ihx") == 0))
|
||||
img_type[i] = IMG_TYPE_HEX;
|
||||
else if (libusb_strcasecmp(ext, ".iic") == 0)
|
||||
img_type[i] = IMG_TYPE_IIC;
|
||||
else if (libusb_strcasecmp(ext, ".bix") == 0)
|
||||
img_type[i] = IMG_TYPE_BIX;
|
||||
else if (libusb_strcasecmp(ext, ".img") == 0)
|
||||
img_type[i] = IMG_TYPE_IMG;
|
||||
else {
|
||||
logerror("%s is not a recognized image type\n", path[i]);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (verbose && path[i] != NULL)
|
||||
logerror("%s: type %s\n", path[i], img_name[img_type[i]]);
|
||||
}
|
||||
|
||||
if (path[LOADER] == NULL) {
|
||||
/* single stage, put into internal memory */
|
||||
if (verbose > 1)
|
||||
logerror("single stage: load on-chip memory\n");
|
||||
status = ezusb_load_ram(device, path[FIRMWARE], fx_type, img_type[FIRMWARE], 0);
|
||||
} else {
|
||||
/* two-stage, put loader into internal memory */
|
||||
if (verbose > 1)
|
||||
logerror("1st stage: load 2nd stage loader\n");
|
||||
status = ezusb_load_ram(device, path[LOADER], fx_type, img_type[LOADER], 0);
|
||||
if (status == 0) {
|
||||
/* two-stage, put firmware into internal memory */
|
||||
if (verbose > 1)
|
||||
logerror("2nd state: load on-chip memory\n");
|
||||
status = ezusb_load_ram(device, path[FIRMWARE], fx_type, img_type[FIRMWARE], 1);
|
||||
}
|
||||
}
|
||||
|
||||
libusb_release_interface(device, 0);
|
||||
libusb_close(device);
|
||||
libusb_exit(NULL);
|
||||
return status;
|
||||
err:
|
||||
libusb_exit(NULL);
|
||||
return -1;
|
||||
}
|
||||
155
AES_KEY/libusb/libusb/examples/hotplugtest.c
Normal file
155
AES_KEY/libusb/libusb/examples/hotplugtest.c
Normal file
@ -0,0 +1,155 @@
|
||||
/* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
|
||||
/*
|
||||
* libusb example program for hotplug API
|
||||
* Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
int done_attach = 0;
|
||||
int done_detach = 0;
|
||||
libusb_device_handle *handle = NULL;
|
||||
|
||||
static int LIBUSB_CALL hotplug_callback(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
|
||||
{
|
||||
struct libusb_device_descriptor desc;
|
||||
libusb_device_handle *new_handle;
|
||||
int rc;
|
||||
|
||||
(void)ctx;
|
||||
(void)dev;
|
||||
(void)event;
|
||||
(void)user_data;
|
||||
|
||||
rc = libusb_get_device_descriptor(dev, &desc);
|
||||
if (LIBUSB_SUCCESS == rc) {
|
||||
printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct);
|
||||
} else {
|
||||
printf ("Device attached\n");
|
||||
fprintf (stderr, "Error getting device descriptor: %s\n",
|
||||
libusb_strerror((enum libusb_error)rc));
|
||||
}
|
||||
|
||||
rc = libusb_open (dev, &new_handle);
|
||||
if (LIBUSB_SUCCESS == rc) {
|
||||
if (handle) {
|
||||
libusb_close (handle);
|
||||
}
|
||||
handle = new_handle;
|
||||
} else if (LIBUSB_ERROR_ACCESS != rc
|
||||
#if defined(PLATFORM_WINDOWS)
|
||||
&& LIBUSB_ERROR_NOT_SUPPORTED != rc
|
||||
&& LIBUSB_ERROR_NOT_FOUND != rc
|
||||
#endif
|
||||
) {
|
||||
fprintf (stderr, "No access to device: %s\n",
|
||||
libusb_strerror((enum libusb_error)rc));
|
||||
}
|
||||
|
||||
done_attach++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int LIBUSB_CALL hotplug_callback_detach(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data)
|
||||
{
|
||||
struct libusb_device_descriptor desc;
|
||||
int rc;
|
||||
|
||||
(void)ctx;
|
||||
(void)dev;
|
||||
(void)event;
|
||||
(void)user_data;
|
||||
|
||||
rc = libusb_get_device_descriptor(dev, &desc);
|
||||
if (LIBUSB_SUCCESS == rc) {
|
||||
printf ("Device detached: %04x:%04x\n", desc.idVendor, desc.idProduct);
|
||||
} else {
|
||||
printf ("Device detached\n");
|
||||
fprintf (stderr, "Error getting device descriptor: %s\n",
|
||||
libusb_strerror((enum libusb_error)rc));
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
libusb_close (handle);
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
done_detach++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
libusb_hotplug_callback_handle hp[2];
|
||||
int product_id, vendor_id, class_id;
|
||||
int rc;
|
||||
|
||||
vendor_id = (argc > 1) ? (int)strtol (argv[1], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
|
||||
product_id = (argc > 2) ? (int)strtol (argv[2], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
|
||||
class_id = (argc > 3) ? (int)strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
|
||||
|
||||
rc = libusb_init_context(/*ctx=*/NULL, /*options=*/NULL, /*num_options=*/0);
|
||||
if (LIBUSB_SUCCESS != rc)
|
||||
{
|
||||
printf ("failed to initialise libusb: %s\n",
|
||||
libusb_strerror((enum libusb_error)rc));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) {
|
||||
printf ("Hotplug capabilities are not supported on this platform\n");
|
||||
libusb_exit (NULL);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, vendor_id,
|
||||
product_id, class_id, hotplug_callback, NULL, &hp[0]);
|
||||
if (LIBUSB_SUCCESS != rc) {
|
||||
fprintf (stderr, "Error registering callback 0\n");
|
||||
libusb_exit (NULL);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, vendor_id,
|
||||
product_id,class_id, hotplug_callback_detach, NULL, &hp[1]);
|
||||
if (LIBUSB_SUCCESS != rc) {
|
||||
fprintf (stderr, "Error registering callback 1\n");
|
||||
libusb_exit (NULL);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while (done_detach < done_attach || done_attach == 0) {
|
||||
rc = libusb_handle_events (NULL);
|
||||
if (LIBUSB_SUCCESS != rc)
|
||||
printf ("libusb_handle_events() failed: %s\n",
|
||||
libusb_strerror((enum libusb_error)rc));
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
printf ("Warning: Closing left-over open handle\n");
|
||||
libusb_close (handle);
|
||||
}
|
||||
|
||||
libusb_exit (NULL);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
73
AES_KEY/libusb/libusb/examples/listdevs.c
Normal file
73
AES_KEY/libusb/libusb/examples/listdevs.c
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* libusb example program to list devices on the bus
|
||||
* Copyright © 2007 Daniel Drake <dsd@gentoo.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libusb.h"
|
||||
|
||||
static void print_devs(libusb_device **devs)
|
||||
{
|
||||
libusb_device *dev;
|
||||
int i = 0, j = 0;
|
||||
uint8_t path[8];
|
||||
|
||||
while ((dev = devs[i++]) != NULL) {
|
||||
struct libusb_device_descriptor desc;
|
||||
int r = libusb_get_device_descriptor(dev, &desc);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "failed to get device descriptor");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%04x:%04x (bus %d, device %d)",
|
||||
desc.idVendor, desc.idProduct,
|
||||
libusb_get_bus_number(dev), libusb_get_device_address(dev));
|
||||
|
||||
r = libusb_get_port_numbers(dev, path, sizeof(path));
|
||||
if (r > 0) {
|
||||
printf(" path: %d", path[0]);
|
||||
for (j = 1; j < r; j++)
|
||||
printf(".%d", path[j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
libusb_device **devs;
|
||||
int r;
|
||||
ssize_t cnt;
|
||||
|
||||
r = libusb_init_context(/*ctx=*/NULL, /*options=*/NULL, /*num_options=*/0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
cnt = libusb_get_device_list(NULL, &devs);
|
||||
if (cnt < 0){
|
||||
libusb_exit(NULL);
|
||||
return (int) cnt;
|
||||
}
|
||||
|
||||
print_devs(devs);
|
||||
libusb_free_device_list(devs, 1);
|
||||
|
||||
libusb_exit(NULL);
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user