9 |
|
|
10 |
|
#include <err.h> |
11 |
|
#include <fcntl.h> |
12 |
< |
#include <usbhid.h> |
12 |
> |
#include <sys/ioctl.h> |
13 |
|
|
14 |
|
#include <common.hpp> |
15 |
+ |
#include <fdstream.hpp> |
16 |
|
#include <foreach.hpp> |
17 |
|
#include <posix.hpp> |
18 |
|
#include <regex.hpp> |
50 |
|
if (device.empty()) |
51 |
|
return Usage(argv[0]); |
52 |
|
|
53 |
< |
std::cerr << device << std::endl; |
53 |
> |
// if (!debug) |
54 |
> |
// Posix::CheckError(::daemon(0, 0)); |
55 |
> |
|
56 |
> |
ext::ifdstream uhid(Posix::CheckError(::open(device.c_str(), O_RDONLY))); |
57 |
> |
char buffer[8]; |
58 |
> |
|
59 |
> |
while (uhid.read(buffer, sizeof (buffer))) |
60 |
> |
_forall (int, index, 0, 8) |
61 |
> |
std::printf("0x%08x 0x%08x\n", buffer[3], ~buffer[4] - 0x4); |
62 |
|
|
63 |
|
return 0; |
64 |
|
} |