From 4a1ca0badbac391c6c0f76140c68f12b6c28db3a Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sat, 28 Nov 2015 10:06:38 -0800 Subject: [PATCH] Retrieve hidraw file from command line --- tools/hidraw/hidraw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/hidraw/hidraw.c b/tools/hidraw/hidraw.c index c420a4b..ac09ff7 100644 --- a/tools/hidraw/hidraw.c +++ b/tools/hidraw/hidraw.c @@ -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 \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");