Implement raw DeviceMonitor

Multiple things have been done in this commit; the base of the new
backend has effectively been created. This branch currently has many
vital parts commented out. Therefore, this branch is currently only
intended for debugging.
This commit is contained in:
pixl
2020-06-16 19:53:38 -04:00
parent 526ffec61a
commit ec4ae56bc4
20 changed files with 797 additions and 78 deletions

View File

@@ -0,0 +1,32 @@
#include <array>
#include <algorithm>
#include "Report.h"
using namespace logid::backend::dj;
using namespace logid::backend;
static const std::array<uint8_t, 35> DJReportDesc = {
0xA1, 0x01, // Collection (Application)
0x85, 0x20, // Report ID (32)
0x95, 0x0E, // Report Count (14)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x09, 0x41, // Usage (0x41)
0x81, 0x00, // Input (Data, Array, Absolute)
0x09, 0x41, // Usage (0x41)
0x91, 0x00, // Output (Data, Array, Absolute)
0x85, 0x21, // Report ID (33)
0x95, 0x1F, // Report Count (31)
0x09, 0x42, // Usage (0x42)
0x81, 0x00, // Input (Data, Array, Absolute)
0x09, 0x42, // Usage (0x42)
0x91, 0x00, // Output (Data, Array, Absolute)
0xC0 // End Collection
};
bool dj::supportsDjReports(std::vector<uint8_t>& rdesc)
{
auto it = std::search(rdesc.begin(), rdesc.end(), DJReportDesc.begin(), DJReportDesc.end());
return it != rdesc.end();
}

View File

@@ -0,0 +1,20 @@
#ifndef LOGID_BACKEND_DJ_REPORT_H
#define LOGID_BACKEND_DJ_REPORT_H
#include <cstdint>
#include "../raw/RawDevice.h"
namespace logid::backend::dj
{
bool supportsDjReports(std::vector<uint8_t>& rawDevice);
class Report
{
enum Type: uint8_t
{
Short = 0x20, // Short DJ reports use 12 byte parameters
Long = 0x21 // Long DJ reports use 29 byte parameters
};
};
}
#endif //LOGID_BACKEND_DJ_REPORT_H