Merge branches 'for-4.0/upstream-fixes', 'for-4.1/genius', 'for-4.1/huion-uclogic...
[firefly-linux-kernel-4.4.55.git] / samples / hidraw / hid-example.c
index 512a7e50bcae19dd3d7dc40edb3741198f0512ac..92e6c1511910d06547a59859827d2b6b0800589e 100644 (file)
@@ -46,10 +46,14 @@ int main(int argc, char **argv)
        char buf[256];
        struct hidraw_report_descriptor rpt_desc;
        struct hidraw_devinfo info;
+       char *device = "/dev/hidraw0";
+
+       if (argc > 1)
+               device = argv[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_RDWR|O_NONBLOCK);
+       fd = open(device, O_RDWR|O_NONBLOCK);
 
        if (fd < 0) {
                perror("Unable to open device");