[PATCH 09/16] HID: uhid: add UHID_START and UHID_STOP events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/hid/uhid.c   |    8 +++++++-
 include/linux/uhid.h |    2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 0d011db..2e7f3a0 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -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)
diff --git a/include/linux/uhid.h b/include/linux/uhid.h
index 6eb42be..f8ce6f7 100644
--- a/include/linux/uhid.h
+++ b/include/linux/uhid.h
@@ -25,6 +25,8 @@
 enum uhid_event_type {
 	UHID_CREATE,
 	UHID_DESTROY,
+	UHID_START,
+	UHID_STOP,
 	UHID_INPUT,
 };
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux