diff --git a/CHANGELOG b/CHANGELOG index f6310d9..23d55dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,33 @@ +commit bbbfe38e0bfc5280e349049c126dcf2792c06b52 +Author: Elliott Liggett +Date: Wed Feb 8 08:26:36 2023 -0800 + + Very minor thing to help compiling with older hidapi. + +commit 6a76efa368b9d0fa88d8ae3761229dbefcd25c87 +Author: Roeland Jansen +Date: Wed Feb 8 11:26:33 2023 +0100 + + compilation fixes + +commit 1515e135e5434ab7c334214ff10165e484536906 +Author: Phil Taylor +Date: Wed Feb 8 10:12:48 2023 +0000 + + Fix for old hidapi without version info. + +commit 0ff2551026c7861ab1dc2194388ea3c5cbbfdf67 +Author: Phil Taylor +Date: Tue Feb 7 23:29:50 2023 +0000 + + Fix compile if controller disabled + +commit b373685fd31f7d6cf21a117650a9bbdf17e5d107 +Author: Roeland Jansen +Date: Tue Feb 7 18:56:41 2023 +0100 + + v1.61 + commit ea1fefc219017856df6bf3c1f79b596213c97403 Merge: 6e0ebcd 3d2c162 Author: Roeland Jansen diff --git a/usbcontroller.cpp b/usbcontroller.cpp index 8e1a724..58a2706 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -43,7 +43,7 @@ void usbController::init(int sens, QMutex* mut) this->mutex = mut; this->sensitivity = sens; emit sendSensitivity(sensitivity); - +#ifdef HID_API_VERSION_MAJOR if (HID_API_VERSION == HID_API_MAKE_VERSION(hid_version()->major, hid_version()->minor, hid_version()->patch)) { qInfo(logUsbControl) << QString("Compile-time version matches runtime version of hidapi: %0.%1.%2") .arg(hid_version()->major) @@ -59,15 +59,17 @@ void usbController::init(int sens, QMutex* mut) .arg(hid_version()->minor) .arg(hid_version()->patch); } - +#endif hidStatus = hid_init(); if (hidStatus) { qInfo(logUsbControl()) << "Failed to intialize HID Devices"; } else { +#ifdef HID_API_VERSION_MAJOR #if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) hid_darwin_set_open_exclusive(0); +#endif #endif qInfo(logUsbControl()) << "Found available HID devices (not all will be suitable for use):"; diff --git a/usbcontroller.h b/usbcontroller.h index 41c7f58..bab6119 100644 --- a/usbcontroller.h +++ b/usbcontroller.h @@ -18,28 +18,28 @@ #endif #if defined(USB_CONTROLLER) -#ifndef Q_OS_WIN -#include "hidapi/hidapi.h" -#else -#include "hidapi.h" -#endif + #ifndef Q_OS_WIN + #include "hidapi/hidapi.h" + #else + #include "hidapi.h" + #endif -#ifndef HID_API_MAKE_VERSION -#define HID_API_MAKE_VERSION(mj, mn, p) (((mj) << 24) | ((mn) << 8) | (p)) -#endif -#ifndef HID_API_VERSION -#define HID_API_VERSION HID_API_MAKE_VERSION(HID_API_VERSION_MAJOR, HID_API_VERSION_MINOR, HID_API_VERSION_PATCH) -#endif + #ifdef HID_API_VERSION_MAJOR + #ifndef HID_API_MAKE_VERSION + #define HID_API_MAKE_VERSION(mj, mn, p) (((mj) << 24) | ((mn) << 8) | (p)) + #endif + #ifndef HID_API_VERSION + #define HID_API_VERSION HID_API_MAKE_VERSION(HID_API_VERSION_MAJOR, HID_API_VERSION_MINOR, HID_API_VERSION_PATCH) + #endif + #if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) + #include + #endif -#if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) -#include -#endif - -#if defined(USING_HIDAPI_LIBUSB) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) -#include -#endif - + #if defined(USING_HIDAPI_LIBUSB) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) + #include + #endif + #endif #endif #ifndef Q_OS_WIN