25 lines
657 B
C++
25 lines
657 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <linux/hidraw.h>
|
|
#include <libudev.h>
|
|
#include <hidapi/hidapi.h>
|
|
|
|
class HIDHelper {
|
|
public:
|
|
HIDHelper();
|
|
~HIDHelper();
|
|
int openDevices();
|
|
int get_feature_report(unsigned char *buf, int size) const;
|
|
int send_feature_report(unsigned char *buf, int size) const;
|
|
void close_ctrl_device();
|
|
|
|
hid_device *m_ledDevice{};
|
|
int ctrl_device{};
|
|
protected:
|
|
bool ctrlDeviceWork(udev_list_entry *cur, udev_device *usb_dev, udev_device *raw_dev, udev *udev, unsigned int product_id);
|
|
bool findLED(hid_device_info *, unsigned int);
|
|
|
|
uint16_t m_products[3] = { 0x3098, 0x307a, 0x0000 };
|
|
};
|