* [PATCH] samples/hidraw: make it possible to select device
@ 2015-03-14 20:57 Pavel Machek
2015-03-15 14:12 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2015-03-14 20:57 UTC (permalink / raw)
To: trivial, jkosina, kernel list
Makefile that can actually build the example, and allow selecting
device to work on.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/samples/hidraw/Makefile b/samples/hidraw/Makefile
index 382eeae..a9ab961 100644
--- a/samples/hidraw/Makefile
+++ b/samples/hidraw/Makefile
@@ -8,3 +8,5 @@ hostprogs-y := hid-example
always := $(hostprogs-y)
HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include
+
+all: hid-example
diff --git a/samples/hidraw/hid-example.c b/samples/hidraw/hid-example.c
index 512a7e5..92e6c15 100644
--- a/samples/hidraw/hid-example.c
+++ b/samples/hidraw/hid-example.c
@@ -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");
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] samples/hidraw: make it possible to select device
2015-03-14 20:57 [PATCH] samples/hidraw: make it possible to select device Pavel Machek
@ 2015-03-15 14:12 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2015-03-15 14:12 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list
On Sat, 14 Mar 2015, Pavel Machek wrote:
> Makefile that can actually build the example, and allow selecting
> device to work on.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Applied to for-4.1/upstream. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-15 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 20:57 [PATCH] samples/hidraw: make it possible to select device Pavel Machek
2015-03-15 14:12 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox