1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2026-01-06 12:56:58 +00:00

Switch to hidapi

This commit is contained in:
2017-01-21 22:45:48 +01:00
parent cdaae30aa2
commit bcdcee88f1
6 changed files with 273 additions and 148 deletions

View File

@@ -4,7 +4,11 @@
#include <iostream>
#include <vector>
#include "libusb-1.0/libusb.h"
#if defined(hidapi)
#include "hidapi/hidapi.h"
#elif defined(libusb)
#include "libusb-1.0/libusb.h"
#endif
class LedKeyboard {
@@ -180,15 +184,20 @@ class LedKeyboard {
};
bool m_isOpen = false;
bool m_isKernellDetached = false;
uint16_t m_vendorID = 0;
uint16_t m_productID = 0;
KeyboardModel m_keyboardModel = KeyboardModel::unknown;
libusb_device_handle *m_hidHandle;
libusb_context *m_ctx = NULL;
#if defined(hidapi)
hid_device *m_hidHandle;
#elif defined(libusb)
bool m_isKernellDetached = false;
libusb_device_handle *m_hidHandle;
libusb_context *m_ctx = NULL;
#endif
bool sendDataInternal(const byte_buffer_t &data);
bool sendDataInternal(byte_buffer_t &data);
byte_buffer_t getKeyGroupAddress(KeyAddressGroup keyAddressGroup);
};