Retrieve hidraw file from command line

pull/7/head
nirenjan 2015-11-28 10:06:38 -08:00
parent 0a541e18ba
commit 4a1ca0badb
1 changed files with 6 additions and 1 deletions

View File

@ -48,9 +48,14 @@ int main(int argc, char **argv)
struct hidraw_report_descriptor rpt_desc;
struct hidraw_devinfo info;
if (argc != 2) {
fprintf(stderr, "usage: %s <path-to-hidraw-file>\n", argv[0]);
return 1;
}
/* Open the Device with non-blocking reads. In real life,
don't use a hard coded path; use libudev instead. */
fd = open("/dev/hidraw0", O_RDONLY);
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
perror("Unable to open device");