From 1515e135e5434ab7c334214ff10165e484536906 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 8 Feb 2023 10:12:48 +0000 Subject: [PATCH 1/4] Fix for old hidapi without version info. --- usbcontroller.cpp | 4 ++-- usbcontroller.h | 38 +++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/usbcontroller.cpp b/usbcontroller.cpp index 22b7abf..de8600e 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -42,7 +42,7 @@ void usbController::init(int sens) { 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) @@ -58,7 +58,7 @@ void usbController::init(int sens) .arg(hid_version()->minor) .arg(hid_version()->patch); } - +#endif hidStatus = hid_init(); if (hidStatus) { qInfo(logUsbControl()) << "Failed to intialize HID Devices"; diff --git a/usbcontroller.h b/usbcontroller.h index 9f1601e..0b16e85 100644 --- a/usbcontroller.h +++ b/usbcontroller.h @@ -16,28 +16,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 From 6a76efa368b9d0fa88d8ae3761229dbefcd25c87 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 8 Feb 2023 11:26:33 +0100 Subject: [PATCH 2/4] compilation fixes --- CHANGELOG | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f6310d9..b4c2067 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,21 @@ +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 From bbbfe38e0bfc5280e349049c126dcf2792c06b52 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 8 Feb 2023 08:26:36 -0800 Subject: [PATCH 3/4] Very minor thing to help compiling with older hidapi. --- usbcontroller.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usbcontroller.cpp b/usbcontroller.cpp index de8600e..d4b3466 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -65,8 +65,10 @@ void usbController::init(int sens) } 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):"; From 6e5e22a672e430d872eddb232bcc8491134dc13d Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 8 Feb 2023 19:00:44 +0100 Subject: [PATCH 4/4] another compile fix --- CHANGELOG | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b4c2067..23d55dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +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