Deamon management

This commit is contained in:
2026-10-17 03:53:51 +02:00
parent 335a4674d1
commit b77b4a3fc6
35 changed files with 2001 additions and 172 deletions

47
daemon/device_tables.h Normal file
View File

@@ -0,0 +1,47 @@
// 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