summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-02 21:11:43 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-02 21:11:43 +0100
commitb207bd38e1574cb75315a2c66e7a598c22fc55ca (patch)
tree05b3a58ac8261e1f43a944018e48c15171032052 /lib
parent8e18359de7cfc2521045671007ec6115c150dd55 (diff)
parent532b713e0e570083c8ecd5708942cacb66835838 (diff)
Merge branch '2.3' of github.com:mixxxdj/mixxx into cleanup-headers
Diffstat (limited to 'lib')
-rw-r--r--lib/fidlib/fidlib.c4
-rw-r--r--lib/fidlib/fidmkf.h3
-rw-r--r--lib/hidapi/.gitignore4
-rw-r--r--lib/hidapi/AUTHORS.txt4
-rw-r--r--lib/hidapi/HACKING.txt19
-rw-r--r--lib/hidapi/Makefile.am4
-rw-r--r--lib/hidapi/README.md34
-rw-r--r--lib/hidapi/VERSION1
-rw-r--r--lib/hidapi/configure.ac35
-rw-r--r--lib/hidapi/hidapi/hidapi.h107
-rw-r--r--lib/hidapi/hidtest/Makefile.am6
-rw-r--r--lib/hidapi/hidtest/test.c (renamed from lib/hidapi/hidtest/hidtest.cpp)13
-rw-r--r--lib/hidapi/libusb/Makefile-manual4
-rw-r--r--lib/hidapi/libusb/Makefile.am7
-rw-r--r--lib/hidapi/libusb/Makefile.freebsd13
-rw-r--r--lib/hidapi/libusb/Makefile.haiku39
-rw-r--r--lib/hidapi/libusb/Makefile.linux15
-rw-r--r--lib/hidapi/libusb/hid.c115
-rw-r--r--lib/hidapi/linux/Makefile-manual17
-rw-r--r--lib/hidapi/linux/README.txt59
-rw-r--r--lib/hidapi/linux/hid.c189
-rw-r--r--lib/hidapi/mac/Makefile-manual15
-rw-r--r--lib/hidapi/mac/hid.c443
-rwxr-xr-xlib/hidapi/testgui/copy_to_bundle.sh3
-rw-r--r--lib/hidapi/testgui/mac_support.cpp134
-rw-r--r--lib/hidapi/testgui/mac_support_cocoa.m13
-rwxr-xr-xlib/hidapi/testgui/start.sh2
-rw-r--r--lib/hidapi/windows/.gitignore2
-rw-r--r--lib/hidapi/windows/Makefile.mingw11
-rwxr-xr-xlib/hidapi/windows/hid.c195
-rw-r--r--lib/hidapi/windows/hidapi.sln26
-rw-r--r--lib/hidapi/windows/hidapi.vcxproj160
-rw-r--r--lib/hidapi/windows/hidtest.vcproj6
-rw-r--r--lib/hidapi/windows/hidtest.vcxproj156
-rw-r--r--lib/reverb/basics.h2
-rw-r--r--lib/rigtorp/SPSCQueue/include/rigtorp/SPSCQueue.h5
36 files changed, 1281 insertions, 584 deletions
diff --git a/lib/fidlib/fidlib.c b/lib/fidlib/fidlib.c
index 8dcef23b01..3f4678eef5 100644
--- a/lib/fidlib/fidlib.c
+++ b/lib/fidlib/fidlib.c
@@ -248,10 +248,6 @@
#include <math.h>
#include "fidlib.h"
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
extern FidFilter *mkfilter(char *, ...);
//
diff --git a/lib/fidlib/fidmkf.h b/lib/fidlib/fidmkf.h
index 687abb547a..5b1c846202 100644
--- a/lib/fidlib/fidmkf.h
+++ b/lib/fidlib/fidmkf.h
@@ -139,10 +139,7 @@
#endif
#endif
-//Hacks for crappy linker error in MSVC... - Albert
#ifdef T_MSVC
- #undef HUGE_VAL
- #define HUGE_VAL 1.797693134862315E+308
#define INF HUGE_VAL
#endif
diff --git a/lib/hidapi/.gitignore b/lib/hidapi/.gitignore
index b43ca58c25..9963751f30 100644
--- a/lib/hidapi/.gitignore
+++ b/lib/hidapi/.gitignore
@@ -2,9 +2,11 @@
# Autotools-added generated files
Makefile.in
aclocal.m4
+ar-lib
autom4te.cache/
config.*
configure
+compile
depcomp
install-sh
libusb/Makefile.in
@@ -18,3 +20,5 @@ windows/Makefile.in
Makefile
stamp-h1
libtool
+
+.DS_Store
diff --git a/lib/hidapi/AUTHORS.txt b/lib/hidapi/AUTHORS.txt
index 7acafd78c3..e08cb16196 100644
--- a/lib/hidapi/AUTHORS.txt
+++ b/lib/hidapi/AUTHORS.txt
@@ -10,7 +10,9 @@ Ludovic Rousseau <rousseau@debian.org>:
Bug fixes
Correctness fixes
+libusb/hidapi Team:
+ Development/maintainance since June 4th 2019
For a comprehensive list of contributions, see the commit list at github:
- http://github.com/signal11/hidapi/commits/master
+ https://github.com/libusb/hidapi/commits/master
diff --git a/lib/hidapi/HACKING.txt b/lib/hidapi/HACKING.txt
index 761d4b6550..be8c0d7612 100644
--- a/lib/hidapi/HACKING.txt
+++ b/lib/hidapi/HACKING.txt
@@ -1,15 +1,10 @@
This file is mostly for the maintainer.
-1. Build hidapi.dll
-2. Build hidtest.exe in DEBUG and RELEASE
-3. Commit all
-
-4. Run the Following
- export VERSION=0.1.0
- export TAG_NAME=hidapi-$VERSION
- git tag $TAG_NAME
- git archive --format zip --prefix $TAG_NAME/ $TAG_NAME >../$TAG_NAME.zip
-5. Test the zip file.
-6. Run the following:
- git push origin $TAG_NAME
+Updating a Version:
+1. Update VERSION file.
+2. HID_API_VERSION_MAJOR/HID_API_VERSION_MINOR/HID_API_VERSION_PATCH in hidapi.h.
+Firing a new release:
+1. Update the Version (if not yet updated).
+2. Build hidapi.dll/.lib for x86/x64.
+3. Upload Windows binaries to Github release page.
diff --git a/lib/hidapi/Makefile.am b/lib/hidapi/Makefile.am
index a6e47e8ab3..00bcb73cf4 100644
--- a/lib/hidapi/Makefile.am
+++ b/lib/hidapi/Makefile.am
@@ -31,6 +31,10 @@ if OS_KFREEBSD
SUBDIRS += libusb
endif
+if OS_HAIKU
+SUBDIRS += libusb
+endif
+
if OS_WINDOWS
SUBDIRS += windows
endif
diff --git a/lib/hidapi/README.md b/lib/hidapi/README.md
index 5243a0ba59..f5582d7a9a 100644
--- a/lib/hidapi/README.md
+++ b/lib/hidapi/README.md
@@ -1,5 +1,11 @@
## HIDAPI library for Windows, Linux, FreeBSD and macOS
+| CI instance | Status |
+|----------------------|--------|
+| `macOS master` | [![Build Status](https://travis-ci.org/libusb/hidapi.svg?branch=master)](https://travis-ci.org/libusb/hidapi) |
+| `Windows master` | [![Build status](https://ci.appveyor.com/api/projects/status/r482aevuigmi86rk/branch/master?svg=true)](https://ci.appveyor.com/project/Youw/hidapi/branch/master) |
+| `Linux/BSD, last build (branch/PR)` | [![builds.sr.ht status](https://builds.sr.ht/~qbicz/hidapi.svg)](https://builds.sr.ht/~qbicz/hidapi?) |
+
HIDAPI is a multi-platform library which allows an application to interface
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS.
HIDAPI can be either built as a shared library (`.so`, `.dll` or `.dylib`) or
@@ -43,13 +49,13 @@ tradeoffs, and the functionality supported is slightly different.
__Linux/hidraw__ (`linux/hid.c`):
-This back-end uses the hidraw interface in the Linux kernel. While this
-back-end will support both USB and Bluetooth, it has some limitations on
-kernels prior to 2.6.39, including the inability to send or receive feature
-reports. In addition, it will only communicate with devices which have
-hidraw nodes associated with them. Keyboards, mice, and some other devices
-which are blacklisted from having hidraw nodes will not work. Fortunately,
-for nearly all the uses of hidraw, this is not a problem.
+This back-end uses the hidraw interface in the Linux kernel, and supports
+both USB and Bluetooth HID devices. It requires kernel version at least 2.6.39
+to build. In addition, it will only communicate with devices which have hidraw
+nodes associated with them.
+Keyboards, mice, and some other devices which are blacklisted from having
+hidraw nodes will not work. Fortunately, for nearly all the uses of hidraw,
+this is not a problem.
__Linux/FreeBSD/libusb__ (`libusb/hid.c`):
@@ -62,12 +68,15 @@ which HIDAPI supports. Since it relies on a 3rd party library, building it
is optional but recommended because it is so useful when debugging hardware.
## What Does the API Look Like?
-The API provides the the most commonly used HID functions including sending
-and receiving of input, output, and feature reports. The sample program,
+The API provides the most commonly used HID functions including sending
+and receiving of input, output, and feature reports. The sample program,
which communicates with a heavily hacked up version of the Microchip USB
Generic HID sample looks like this (with error checking removed for
simplicity):
+**Warning: Only run the code you understand, and only when it conforms to the
+device spec. Writing data at random to your HID devices can break them.**
+
```c
#ifdef WIN32
#include <windows.h>
@@ -126,6 +135,9 @@ int main(int argc, char* argv[])
for (i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
+ // Close the device
+ hid_close(handle);
+
// Finalize the hidapi library
res = hid_exit();
@@ -133,6 +145,10 @@ int main(int argc, char* argv[])
}
```
+You can also use [hidtest/test.c](hidtest/test.c)
+as a starting point for your applications.
+
+
## License
HIDAPI may be used by one of three licenses as outlined in [LICENSE.txt](LICENSE.txt).
diff --git a/lib/hidapi/VERSION b/lib/hidapi/VERSION
new file mode 100644
index 0000000000..2774f8587f
--- /dev/null
+++ b/lib/hidapi/VERSION
@@ -0,0 +1 @@
+0.10.0 \ No newline at end of file
diff --git a/lib/hidapi/configure.ac b/lib/hidapi/configure.ac
index b9f670eb88..220909a052 100644
--- a/lib/hidapi/configure.ac
+++ b/lib/hidapi/configure.ac
@@ -1,13 +1,6 @@
AC_PREREQ(2.63)
-# Version number. This is currently the only place.
-m4_define([HIDAPI_MAJOR], 0)
-m4_define([HIDAPI_MINOR], 9)
-m4_define([HIDAPI_RELEASE], 0)
-m4_define([HIDAPI_RC], )
-m4_define([VERSION_STRING], HIDAPI_MAJOR[.]HIDAPI_MINOR[.]HIDAPI_RELEASE[]HIDAPI_RC)
-
-AC_INIT([hidapi],[VERSION_STRING],[alan@signal11.us])
+AC_INIT([hidapi],[m4_normalize(m4_builtin([include], VERSION))],[https://github.com/libusb/hidapi/issues])
# Library soname version
# Follow the following rules (particularly the ones in the second link):
@@ -79,7 +72,7 @@ case $host in
backend="mac"
os="darwin"
threads="pthreads"
- LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
+ LIBS="${LIBS} -framework IOKit -framework CoreFoundation -framework AppKit"
;;
*-freebsd*)
AC_MSG_RESULT([ (FreeBSD back-end)])
@@ -92,9 +85,10 @@ case $host in
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
LIBS="${LIBS}"
- AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb])
+ PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
+ LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
+ CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv])
- echo libs_priv: $LIBS_LIBUSB_PRIVATE
;;
*-kfreebsd*)
AC_MSG_RESULT([ (kFreeBSD back-end)])
@@ -104,8 +98,22 @@ case $host in
os="kfreebsd"
threads="pthreads"
- AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb])
- echo libs_priv: $LIBS_LIBUSB_PRIVATE
+ PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
+ LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
+ CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
+ ;;
+*-*-haiku)
+ AC_MSG_RESULT([ (Haiku back-end)])
+ AC_DEFINE(OS_HAIKU, 1, [Haiku implementation])
+ AC_SUBST(OS_HAIKU)
+ backend="libusb"
+ os="haiku"
+ threads="pthreads"
+
+ PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
+ LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
+ CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
+ AC_CHECK_LIB([iconv], [libiconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv])
;;
*-mingw*)
AC_MSG_RESULT([ (Windows back-end, using MinGW)])
@@ -213,6 +221,7 @@ AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin)
AM_CONDITIONAL(OS_FREEBSD, test "x$os" = xfreebsd)
AM_CONDITIONAL(OS_KFREEBSD, test "x$os" = xkfreebsd)
+AM_CONDITIONAL(OS_HAIKU, test "x$os" = xhaiku)
AM_CONDITIONAL(OS_WINDOWS, test "x$os" = xwindows)
AC_CONFIG_HEADERS([config.h])
diff --git a/lib/hidapi/hidapi/hidapi.h b/lib/hidapi/hidapi/hidapi.h
index 1819f8de09..c8f7bc50af 100644
--- a/lib/hidapi/hidapi/hidapi.h
+++ b/lib/hidapi/hidapi/hidapi.h
@@ -17,7 +17,7 @@
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
- http://github.com/signal11/hidapi .
+ https://github.com/libusb/hidapi .
********************************************************/
/** @file
@@ -39,9 +39,42 @@
#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/
+/** @brief Static/compile-time major version of the library.
+
+ @ingroup API
+*/
+#define HID_API_VERSION_MAJOR 0
+/** @brief Static/compile-time minor version of the library.
+
+ @ingroup API
+*/
+#define HID_API_VERSION_MINOR 10
+/** @brief Static/compile-time patch version of the library.
+
+ @ingroup API
+*/
+#define HID_API_VERSION_PATCH 0
+
+/* Helper macros */
+#define HID_API_AS_STR_IMPL(x) #x
+#define HID_API_AS_STR(x) HID_API_AS_STR_IMPL(x)
+#define HID_API_TO_VERSION_STR(v1, v2, v3) HID_API_AS_STR(v1.v2.v3)
+
+/** @brief Static/compile-time string version of the library.
+
+ @ingroup API
+*/
+#define HID_API_VERSION_STR HID_API_TO_VERSION_STR(HID_API_VERSION_MAJOR, HID_API_VERSION_MINOR, HID_API_VERSION_PATCH)
+
#ifdef __cplusplus
extern "C" {
#endif
+ struct hid_api_version {
+ int major;
+ int minor;
+ int patch;
+ };
+
struct hid_device_;
typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
@@ -151,6 +184,8 @@ extern "C" {
If @p serial_number is NULL, the first device with the
specified VID and PID is opened.
+ This function sets the return value of hid_error().
+
@ingroup API
@param vendor_id The Vendor ID (VID) of the device to open.
@param product_id The Product ID (PID) of the device to open.
@@ -169,6 +204,8 @@ extern "C" {
platform-specific path name can be used (eg: /dev/hidraw0 on
Linux).
+ This function sets the return value of hid_error().
+
@ingroup API
@param path The path name of the device to open
@@ -194,6 +231,8 @@ extern "C" {
one exists. If it does not, it will send the data through
the Control Endpoint (Endpoint 0).
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
@param data The data to send, including the report number as
@@ -212,6 +251,8 @@ extern "C" {
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
@param data A buffer to put the read data into.
@@ -233,6 +274,8 @@ extern "C" {
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
@param data A buffer to put the read data into.
@@ -282,6 +325,8 @@ extern "C" {
report data (16 bytes). In this example, the length passed
in would be 17.
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
@param data The data to send, including the report number as
@@ -303,6 +348,8 @@ extern "C" {
still contain the Report ID, and the report data will
start in data[1].
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
@param data A buffer to put the read data into, including
@@ -320,8 +367,35 @@ extern "C" {
*/
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length);
+ /** @brief Get a input report from a HID device.
+
+ Set the first byte of @p data[] to the Report ID of the
+ report to be read. Make sure to allow space for this
+ extra byte in @p data[]. Upon return, the first byte will
+ still contain the Report ID, and the report data will
+ start in data[1].
+
+ @ingroup API
+ @param device A device handle returned from hid_open().
+ @param data A buffer to put the read data into, including
+ the Report ID. Set the first byte of @p data[] to the
+ Report ID of the report to be read, or set it to zero
+ if your device does not use numbered reports.
+ @param length The number of bytes to read, including an
+ extra byte for the report ID. The buffer can be longer
+ than the actual report.
+
+ @returns
+ This function returns the number of bytes read plus
+ one for the report ID (which is still in the first
+ byte), or -1 on error.
+ */
+ int HID_API_EXPORT HID_API_CALL hid_get_input_report(hid_device *dev, unsigned char *data, size_t length);
+
/** @brief Close a HID device.
+ This function sets the return value of hid_error().
+
@ingroup API
@param dev A device handle returned from hid_open().
*/
@@ -378,8 +452,18 @@ extern "C" {
/** @brief Get a string describing the last error which occurred.
+ Whether a function sets the last error is noted in its
+ documentation. These functions will reset the last error
+ to NULL before their execution.
+
+ Strings returned from hid_error() must not be freed by the user!
+
+ This function is thread-safe, and error messages are thread-local.
+
@ingroup API
- @param dev A device handle returned from hid_open().
+ @param dev A device handle returned from hid_open(),
+ or NULL to get the last non-device-specific error
+ (e.g. for errors in hid_open() itself).
@returns
This function returns a string containing the last error
@@ -387,6 +471,25 @@ extern "C" {
*/
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
+ /** @brief Get a runtime version of the library.
+
+ @ingroup API
+
+ @returns
+ Pointer to statically allocated struct, that contains version.
+ */
+ HID_API_EXPORT const struct hid_api_version* HID_API_CALL hid_version();
+
+
+ /** @brief Get a runtime version string of the library.
+
+ @ingroup API
+
+ @returns
+ Pointer to statically allocated string, that contains version string.
+ */
+ HID_API_EXPORT const char* HID_API_CALL hid_version_str();
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/hidapi/hidtest/Makefile.am b/lib/hidapi/hidtest/Makefile.am
index d2786445a3..4fb01e1215 100644
--- a/lib/hidapi/hidtest/Makefile.am
+++ b/lib/hidapi/hidtest/Makefile.am
@@ -4,17 +4,17 @@ AM_CPPFLAGS = -I$(top_srcdir)/hidapi/
if OS_LINUX
noinst_PROGRAMS = hidtest-libusb hidtest-hidraw
-hidtest_hidraw_SOURCES = hidtest.cpp
+hidtest_hidraw_SOURCES = test.c
hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la
-hidtest_libusb_SOURCES = hidtest.cpp
+hidtest_libusb_SOURCES = test.c
hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la
else
# Other OS's
noinst_PROGRAMS = hidtest
-hidtest_SOURCES = hidtest.cpp
+hidtest_SOURCES = test.c
hidtest_LDADD = $(top_builddir)/$(backend)/libhidapi.la
endif
diff --git a/lib/hidapi/hidtest/hidtest.cpp b/lib/hidapi/hidtest/test.c
index 94f0a5c206..a694b8e644 100644
--- a/lib/hidapi/hidtest/hidtest.cpp
+++ b/lib/hidapi/hidtest/test.c
@@ -42,7 +42,15 @@ int main(int argc, char* argv[])
#endif
struct hid_device_info *devs, *cur_dev;
-
+
+ printf("hidapi test/example tool. Compiled with hidapi version %s, runtime version %s.\n", HID_API_VERSION_STR, hid_version_str());
+ if (hid_version()->major == HID_API_VERSION_MAJOR && hid_version()->minor == HID_API_VERSION_MINOR && hid_version()->patch == HID_API_VERSION_PATCH) {
+ printf("Compile-time version matches runtime version of hidapi.\n\n");
+ }
+ else {
+ printf("Compile-time version is different than runtime version of hidapi.\n]n");
+ }
+
if (hid_init())
return -1;
@@ -55,6 +63,7 @@ int main(int argc, char* argv[])
printf(" Product: %ls\n", cur_dev->product_string);
printf(" Release: %hx\n", cur_dev->release_number);
printf(" Interface: %d\n", cur_dev->interface_number);
+ printf(" Usage (page): 0x%hx (0x%hx)\n", cur_dev->usage, cur_dev->usage_page);
printf("\n");
cur_dev = cur_dev->next;
}
@@ -107,7 +116,7 @@ int main(int argc, char* argv[])
// Set the hid_read() function to be non-blocking.
hid_set_nonblocking(handle, 1);
- // Try to read from the device. There shoud be no
+ // Try to read from the device. There should be no
// data here, but execution should not block.
res = hid_read(handle, buf, 17);
diff --git a/lib/hidapi/libusb/Makefile-manual b/lib/hidapi/libusb/Makefile-manual
index c0fe86800d..0acf707a4d 100644
--- a/lib/hidapi/libusb/Makefile-manual
+++ b/lib/hidapi/libusb/Makefile-manual
@@ -10,6 +10,10 @@ ifeq ($(OS), FreeBSD)
FILE=Makefile.freebsd
endif
+ifeq ($(OS), Haiku)
+ FILE=Makefile.haiku
+endif
+
ifeq ($(FILE), )
all:
$(error Your platform ${OS} is not supported by hidapi/libusb at this time.)
diff --git a/lib/hidapi/libusb/Makefile.am b/lib/hidapi/libusb/Makefile.am
index 13c9d35517..1da06bc161 100644
--- a/lib/hidapi/libusb/Makefile.am
+++ b/lib/hidapi/libusb/Makefile.am
@@ -21,6 +21,13 @@ libhidapi_la_LDFLAGS = $(LTLDFLAGS)
libhidapi_la_LIBADD = $(LIBS_LIBUSB)
endif
+if OS_HAIKU
+lib_LTLIBRARIES = libhidapi.la
+libhidapi_la_SOURCES = hid.c
+libhidapi_la_LDFLAGS = $(LTLDFLAGS)
+libhidapi_la_LIBADD = $(LIBS_LIBUSB)
+endif
+
hdrdir = $(includedir)/hidapi
hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h
diff --git a/lib/hidapi/libusb/Makefile.freebsd b/lib/hidapi/libusb/Makefile.freebsd
index 5e69e77d4e..cb24d6a942 100644
--- a/lib/hidapi/libusb/Makefile.freebsd
+++ b/lib/hidapi/libusb/Makefile.freebsd
@@ -13,12 +13,8 @@ libs: libhidapi.so
CC ?= cc
CFLAGS ?= -Wall -g -fPIC
-CXX ?= c++
-CXXFLAGS ?= -Wall -g
-
-COBJS = hid.o
-CPPOBJS = ../hidtest/hidtest.o
-OBJS = $(COBJS) $(CPPOBJS)
+COBJS = hid.o ../hidtest/test.o
+OBJS = $(COBJS)
INCLUDES = -I../hidapi -I/usr/local/include
LDFLAGS = -L/usr/local/lib
LIBS = -lusb -liconv -pthread
@@ -26,7 +22,7 @@ LIBS = -lusb -liconv -pthread
# Console Test Program
hidtest: $(OBJS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
# Shared Libs
libhidapi.so: $(COBJS)
@@ -36,9 +32,6 @@ libhidapi.so: $(COBJS)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
-$(CPPOBJS): %.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
-
clean:
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
diff --git a/lib/hidapi/libusb/Makefile.haiku b/lib/hidapi/libusb/Makefile.haiku
new file mode 100644
index 0000000000..975e8ba674
--- /dev/null
+++ b/lib/hidapi/libusb/Makefile.haiku
@@ -0,0 +1,39 @@
+###########################################
+# Simple Makefile for HIDAPI test program
+#
+# Alan Ott
+# Signal 11 Software
+# 2010-06-01
+###########################################
+
+all: hidtest libs
+
+libs: libhidapi.so
+
+CC ?= cc
+CFLAGS ?= -Wall -g -fPIC
+
+COBJS = hid.o ../hidtest/test.o
+OBJS = $(COBJS)
+INCLUDES = -I../hidapi -I/usr/local/include
+LDFLAGS = -L/usr/local/lib
+LIBS = -lusb -liconv -pthread
+
+
+# Console Test Program
+hidtest: $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+
+# Shared Libs
+libhidapi.so: $(COBJS)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS)
+
+# Objects
+$(COBJS): %.o: %.c
+ $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
+
+
+clean:
+ rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
+
+.PHONY: clean libs
diff --git a/lib/hidapi/libusb/Makefile.linux b/lib/hidapi/libusb/Makefile.linux
index 337b556e1c..4b338ec9b2 100644
--- a/lib/hidapi/libusb/Makefile.linux
+++ b/lib/hidapi/libusb/Makefile.linux
@@ -13,23 +13,19 @@ libs: libhidapi-libusb.so
CC ?= gcc
CFLAGS ?= -Wall -g -fpic
-CXX ?= g++
-CXXFLAGS ?= -Wall -g -fpic
-
LDFLAGS ?= -Wall -g
COBJS_LIBUSB = hid.o
-COBJS = $(COBJS_LIBUSB)
-CPPOBJS = ../hidtest/hidtest.o
-OBJS = $(COBJS) $(CPPOBJS)
+COBJS = $(COBJS_LIBUSB) ../hidtest/test.o
+OBJS = $(COBJS)
LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread
LIBS = $(LIBS_USB)
INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`
# Console Test Program
-hidtest-libusb: $(COBJS_LIBUSB) $(CPPOBJS)
- $(CXX) $(LDFLAGS) $^ $(LIBS_USB) -o $@
+hidtest-libusb: $(COBJS)
+ $(CC) $(LDFLAGS) $^ $(LIBS_USB) -o $@
# Shared Libs
libhidapi-libusb.so: $(COBJS_LIBUSB)
@@ -39,9 +35,6 @@ libhidapi-libusb.so: $(COBJS_LIBUSB)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
-$(CPPOBJS): %.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
-
clean:
rm -f $(OBJS) hidtest-libusb libhidapi-libusb.so ../hidtest/hidtest.o
diff --git a/lib/hidapi/libusb/hid.c b/lib/hidapi/libusb/hid.c
index 8cd5e3dca0..a82f9cca4e 100644
--- a/lib/hidapi/libusb/hid.c
+++ b/lib/hidapi/libusb/hid.c
@@ -20,7 +20,7 @@
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
- http://github.com/signal11/hidapi .
+ https://github.com/libusb/hidapi .
********************************************************/
#define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */
@@ -45,13 +45,13 @@
/* GNU / LibUSB */
#include <libusb.h>
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(NO_ICONV)
#include <iconv.h>
#endif
#include "hidapi.h"
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && __ANDROID_API__ < __ANDROID_API_N__
/* Barrier implementation because Android/Bionic don't have pthread_barrier.
This implementation came from Brent Priddy and was posted on
@@ -168,11 +168,22 @@ struct hid_device_ {
pthread_cond_t condition;
pthread_barrier_t barrier; /* Ensures correct startup sequence */
int shutdown_thread;
- int cancelled;
+ int transfer_loop_finished;
struct libusb_transfer *transfer;
/* List of received input reports. */
struct input_report *input_reports;
+
+ /* Was kernel driver detached by libusb */
+#ifdef DETACH_KERNEL_DRIVER
+ int is_driver_detached;
+#endif
+};
+