summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-06-10 15:16:22 +0200
committerJiri Kosina <jkosina@suse.cz>2012-06-18 13:42:02 +0200
commite7191474a5459e6ba7039fadca6a32f3a5731909 (patch)
tree004e573b35323ae0b92907334a4ef12e4aed4fe2
parentec4b7dea453e0f9fd0fbf1761b2d01eff64f264b (diff)
downloadblackbird-op-linux-e7191474a5459e6ba7039fadca6a32f3a5731909.tar.gz
blackbird-op-linux-e7191474a5459e6ba7039fadca6a32f3a5731909.zip
HID: uhid: forward open/close events to user-space
HID core notifies us with *_open/*_close callbacks when there is an actual user of our device. We forward these to user-space so they can react on this. This allows user-space to skip I/O unless they receive an OPEN event. When they receive a CLOSE event they can stop I/O again to save energy. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/uhid.c7
-rw-r--r--include/linux/uhid.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 2e7f3a023975..0226ba3f5307 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -97,11 +97,16 @@ static void uhid_hid_stop(struct hid_device *hid)
static int uhid_hid_open(struct hid_device *hid)
{
- return 0;
+ struct uhid_device *uhid = hid->driver_data;
+
+ return uhid_queue_event(uhid, UHID_OPEN);
}
static void uhid_hid_close(struct hid_device *hid)
{
+ struct uhid_device *uhid = hid->driver_data;
+
+ uhid_queue_event(uhid, UHID_CLOSE);
}
static int uhid_hid_input(struct input_dev *input, unsigned int type,
diff --git a/include/linux/uhid.h b/include/linux/uhid.h
index f8ce6f7571d8..351650b7a0f6 100644
--- a/include/linux/uhid.h
+++ b/include/linux/uhid.h
@@ -27,6 +27,8 @@ enum uhid_event_type {
UHID_DESTROY,
UHID_START,
UHID_STOP,
+ UHID_OPEN,
+ UHID_CLOSE,
UHID_INPUT,
};
OpenPOWER on IntegriCloud