Fix for old hidapi without version info.

failbranch
Phil Taylor 2023-02-08 10:12:48 +00:00
rodzic 0ff2551026
commit 1515e135e5
2 zmienionych plików z 21 dodań i 21 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ void usbController::init(int sens)
{ {
sensitivity = sens; sensitivity = sens;
emit sendSensitivity(sensitivity); 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)) { 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") qInfo(logUsbControl) << QString("Compile-time version matches runtime version of hidapi: %0.%1.%2")
.arg(hid_version()->major) .arg(hid_version()->major)
@ -58,7 +58,7 @@ void usbController::init(int sens)
.arg(hid_version()->minor) .arg(hid_version()->minor)
.arg(hid_version()->patch); .arg(hid_version()->patch);
} }
#endif
hidStatus = hid_init(); hidStatus = hid_init();
if (hidStatus) { if (hidStatus) {
qInfo(logUsbControl()) << "Failed to intialize HID Devices"; qInfo(logUsbControl()) << "Failed to intialize HID Devices";

Wyświetl plik

@ -16,28 +16,28 @@
#endif #endif
#if defined(USB_CONTROLLER) #if defined(USB_CONTROLLER)
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
#include "hidapi/hidapi.h" #include "hidapi/hidapi.h"
#else #else
#include "hidapi.h" #include "hidapi.h"
#endif #endif
#ifndef HID_API_MAKE_VERSION #ifdef HID_API_VERSION_MAJOR
#define HID_API_MAKE_VERSION(mj, mn, p) (((mj) << 24) | ((mn) << 8) | (p)) #ifndef HID_API_MAKE_VERSION
#endif #define HID_API_MAKE_VERSION(mj, mn, p) (((mj) << 24) | ((mn) << 8) | (p))
#ifndef HID_API_VERSION #endif
#define HID_API_VERSION HID_API_MAKE_VERSION(HID_API_VERSION_MAJOR, HID_API_VERSION_MINOR, HID_API_VERSION_PATCH) #ifndef HID_API_VERSION
#endif #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 <hidapi/hidapi_darwin.h>
#endif
#if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) #if defined(USING_HIDAPI_LIBUSB) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
#include <hidapi/hidapi_darwin.h> #include <hidapi_libusb.h>
#endif #endif
#endif
#if defined(USING_HIDAPI_LIBUSB) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
#include <hidapi_libusb.h>
#endif
#endif #endif
#ifndef Q_OS_WIN #ifndef Q_OS_WIN