Skip to content

Commit

Permalink
Merge pull request #3909 from uklotzde/hidapi
Browse files Browse the repository at this point in the history
Upgrade bundled hidapi from 0.10.0 to 0.10.1
  • Loading branch information
daschuer authored May 25, 2021
2 parents 53e3262 + 4b8a2ea commit 2725a5e
Show file tree
Hide file tree
Showing 30 changed files with 354 additions and 4,084 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,11 @@ lib/googletest/.github
lib/googletest/googlemock/test
lib/googletest/googletest/samples
lib/googletest/googletest/test

# Exclude unneeded files from the bundled hidapi library in the lib/
# directory for future updates
lib/hidapi/android
lib/hidapi/dist
lib/hidapi/doxygen
lib/hidapi/hidtest
lib/hidapi/testgui
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2545,7 +2545,7 @@ option(HID "USB HID controller support" ON)
if(HID)
find_package(hidapi)
# hidapi_VERSION is only available starting with 0.10.0
if(NOT hidapi_FOUND OR NOT hidapi_VERSION OR hidapi_VERSION VERSION_LESS 0.10.0)
if(NOT hidapi_FOUND OR NOT hidapi_VERSION OR hidapi_VERSION VERSION_LESS 0.10.1)
message(STATUS "Linking internal libhidapi statically")
add_library(mixxx-hidapi STATIC EXCLUDE_FROM_ALL)
target_include_directories(mixxx-hidapi SYSTEM PUBLIC lib/hidapi/hidapi)
Expand Down
2 changes: 1 addition & 1 deletion lib/hidapi/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.0
0.10.1
19 changes: 0 additions & 19 deletions lib/hidapi/android/jni/Android.mk

This file was deleted.

2,482 changes: 0 additions & 2,482 deletions lib/hidapi/doxygen/Doxyfile

This file was deleted.

12 changes: 6 additions & 6 deletions lib/hidapi/hidapi/hidapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@ingroup API
*/
#define HID_API_VERSION_PATCH 0
#define HID_API_VERSION_PATCH 1

/* Helper macros */
#define HID_API_AS_STR_IMPL(x) #x
Expand Down Expand Up @@ -96,10 +96,10 @@ extern "C" {
/** Product string */
wchar_t *product_string;
/** Usage Page for this Device/Interface
(Windows/Mac only). */
(Windows/Mac/hidraw only) */
unsigned short usage_page;
/** Usage for this Device/Interface
(Windows/Mac only).*/
(Windows/Mac/hidraw only) */
unsigned short usage;
/** The USB interface which this logical device
represents.
Expand All @@ -124,7 +124,7 @@ extern "C" {
needed. This function should be called at the beginning of
execution however, if there is a chance of HIDAPI handles
being opened by different threads simultaneously.
@ingroup API
@returns
Expand Down Expand Up @@ -478,7 +478,7 @@ extern "C" {
@returns
Pointer to statically allocated struct, that contains version.
*/
HID_API_EXPORT const struct hid_api_version* HID_API_CALL hid_version();
HID_API_EXPORT const struct hid_api_version* HID_API_CALL hid_version(void);


/** @brief Get a runtime version string of the library.
Expand All @@ -488,7 +488,7 @@ extern "C" {
@returns
Pointer to statically allocated string, that contains version string.
*/
HID_API_EXPORT const char* HID_API_CALL hid_version_str();
HID_API_EXPORT const char* HID_API_CALL hid_version_str(void);

#ifdef __cplusplus
}
Expand Down
17 changes: 0 additions & 17 deletions lib/hidapi/hidtest/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions lib/hidapi/hidtest/Makefile.am

This file was deleted.

203 changes: 0 additions & 203 deletions lib/hidapi/hidtest/test.c

This file was deleted.

8 changes: 6 additions & 2 deletions lib/hidapi/libusb/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,18 +1098,21 @@ static void cleanup_mutex(void *param)

int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
{
int bytes_read = -1;

#if 0
int transferred;
int res = libusb_interrupt_transfer(dev->device_handle, dev->input_endpoint, data, length, &transferred, 5000);
LOG("transferred: %d\n", transferred);
return transferred;
#endif
/* by initialising this variable right here, GCC gives a compilation warning/error: */
/* error: variable ‘bytes_read’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] */
int bytes_read; /* = -1; */

pthread_mutex_lock(&dev->mutex);
pthread_cleanup_push(&cleanup_mutex, dev);

bytes_read = -1;

/* There's an input report queued up. Return it. */
if (dev->input_reports) {
/* Return the first one */
Expand Down Expand Up @@ -1359,6 +1362,7 @@ int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index

HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
{
(void)dev;
return L"hid_error is not implemented yet";
}

Expand Down
Loading

0 comments on commit 2725a5e

Please sign in to comment.