48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// gKeyMapper daemon - per-model raw HID report tables.
|
|
//
|
|
// Ported from the byte tables of the Python reference project
|
|
// (g910_gkeys/data_mappers/supported_devices.py). Keys are matched against the
|
|
// exact bytes read from the keyboard's vendor interface.
|
|
#ifndef GKEYMAPPER_DAEMON_DEVICE_TABLES_H
|
|
#define GKEYMAPPER_DAEMON_DEVICE_TABLES_H
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace gkeymapper::daemon {
|
|
|
|
// A raw HID report from the vendor interface.
|
|
using Report = std::vector<uint8_t>;
|
|
|
|
struct DeviceProfile {
|
|
const char* name = "";
|
|
uint16_t vendor = 0;
|
|
uint16_t product = 0;
|
|
int configuration = 0; // 0-based configuration index
|
|
int interfaceNumber = 1;
|
|
int altSetting = 0;
|
|
|
|
// gKeyReports[i] is the press report for G(i+1).
|
|
std::vector<Report> gKeyReports;
|
|
Report releaseReport;
|
|
|
|
// Some models must be told to stop mapping G-keys to F-keys first.
|
|
bool disableBinding = false;
|
|
std::vector<Report> disableCommands;
|
|
};
|
|
|
|
const std::vector<DeviceProfile>& profiles();
|
|
|
|
// Matching profile for vendor/product, or nullptr.
|
|
const DeviceProfile* find_profile(uint16_t vendor, uint16_t product);
|
|
|
|
// Index of the G key (0..N-1) for a report, or -1 if it is not a known press.
|
|
int match_gkey(const DeviceProfile& profile, const uint8_t* data, int length);
|
|
|
|
// True if the report is the "all macro keys released" report.
|
|
bool is_release_report(const DeviceProfile& profile, const uint8_t* data, int length);
|
|
|
|
} // namespace gkeymapper::daemon
|
|
|
|
#endif // GKEYMAPPER_DAEMON_DEVICE_TABLES_H
|