]> Pileus Git - ~andy/linux/commitdiff
HID: uhid: add UHID_START and UHID_STOP events
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 10 Jun 2012 13:16:21 +0000 (15:16 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 18 Jun 2012 11:42:01 +0000 (13:42 +0200)
We send UHID_START and UHID_STOP events to user-space when the HID core
starts/stops the device. This notifies user-space about driver readiness
and data-I/O can start now.

This directly forwards the callbacks from hid-core to user-space.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/uhid.c
include/linux/uhid.h

index 0d011db30a4658be89d7750c8765d473cb305abd..2e7f3a02397539aa799ff00b87eb61c82f652e5e 100644 (file)
@@ -82,11 +82,17 @@ static int uhid_queue_event(struct uhid_device *uhid, __u32 event)
 
 static int uhid_hid_start(struct hid_device *hid)
 {
-       return 0;
+       struct uhid_device *uhid = hid->driver_data;
+
+       return uhid_queue_event(uhid, UHID_START);
 }
 
 static void uhid_hid_stop(struct hid_device *hid)
 {
+       struct uhid_device *uhid = hid->driver_data;
+
+       hid->claimed = 0;
+       uhid_queue_event(uhid, UHID_STOP);
 }
 
 static int uhid_hid_open(struct hid_device *hid)
index 6eb42bea86a25b12f54d4f882d4ae67f5961f7c5..f8ce6f7571d858129d750846bdac056c1c67d2ee 100644 (file)
@@ -25,6 +25,8 @@
 enum uhid_event_type {
        UHID_CREATE,
        UHID_DESTROY,
+       UHID_START,
+       UHID_STOP,
        UHID_INPUT,
 };