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;
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";

Wyświetl plik

@ -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 <hidapi/hidapi_darwin.h>
#endif
#if defined(__APPLE__) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
#include <hidapi/hidapi_darwin.h>
#endif
#if defined(USING_HIDAPI_LIBUSB) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
#include <hidapi_libusb.h>
#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