diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/hidraw/Makefile | 2 | ||||
-rw-r--r-- | samples/hidraw/hid-example.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/samples/hidraw/Makefile b/samples/hidraw/Makefile index 382eeae77bd6..a9ab96188fbe 100644 --- a/samples/hidraw/Makefile +++ b/samples/hidraw/Makefile | |||
@@ -8,3 +8,5 @@ hostprogs-y := hid-example | |||
8 | always := $(hostprogs-y) | 8 | always := $(hostprogs-y) |
9 | 9 | ||
10 | HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include | 10 | HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include |
11 | |||
12 | all: hid-example | ||
diff --git a/samples/hidraw/hid-example.c b/samples/hidraw/hid-example.c index 512a7e50bcae..92e6c1511910 100644 --- a/samples/hidraw/hid-example.c +++ b/samples/hidraw/hid-example.c | |||
@@ -46,10 +46,14 @@ int main(int argc, char **argv) | |||
46 | char buf[256]; | 46 | char buf[256]; |
47 | struct hidraw_report_descriptor rpt_desc; | 47 | struct hidraw_report_descriptor rpt_desc; |
48 | struct hidraw_devinfo info; | 48 | struct hidraw_devinfo info; |
49 | char *device = "/dev/hidraw0"; | ||
50 | |||
51 | if (argc > 1) | ||
52 | device = argv[1]; | ||
49 | 53 | ||
50 | /* Open the Device with non-blocking reads. In real life, | 54 | /* Open the Device with non-blocking reads. In real life, |
51 | don't use a hard coded path; use libudev instead. */ | 55 | don't use a hard coded path; use libudev instead. */ |
52 | fd = open("/dev/hidraw0", O_RDWR|O_NONBLOCK); | 56 | fd = open(device, O_RDWR|O_NONBLOCK); |
53 | 57 | ||
54 | if (fd < 0) { | 58 | if (fd < 0) { |
55 | perror("Unable to open device"); | 59 | perror("Unable to open device"); |