35 lines
737 B
C++
35 lines
737 B
C++
#include "hiddev.h"
|
|
#include <iostream>
|
|
#include <csignal>
|
|
|
|
bool running = true;
|
|
|
|
void signalHandler(int signal) {
|
|
running = false;
|
|
}
|
|
|
|
int main() {
|
|
signal(SIGINT, signalHandler);
|
|
|
|
HIDDev device;
|
|
if (!device.openDevice(0x2833, 0x0002)) {
|
|
std::cerr << "Unable to open device initially.\n";
|
|
}
|
|
|
|
while (running) {
|
|
|
|
unsigned char data[64];
|
|
int len = device.read(data, sizeof(data));
|
|
if (len > 0) {
|
|
std::cout << "Data read: ";
|
|
for (int i = 0; i < 5; i++) {
|
|
std::cout << std::hex << static_cast<int>(data[i]) << " ";
|
|
}
|
|
std::cout << std::dec << "\n";
|
|
}
|
|
|
|
}
|
|
|
|
device.closeDevice();
|
|
return 0;
|
|
} |