提交 e7191474 编写于 作者: D David Herrmann 提交者: Jiri Kosina

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: NDavid Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 ec4b7dea
...@@ -97,11 +97,16 @@ static void uhid_hid_stop(struct hid_device *hid) ...@@ -97,11 +97,16 @@ static void uhid_hid_stop(struct hid_device *hid)
static int uhid_hid_open(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) 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, static int uhid_hid_input(struct input_dev *input, unsigned int type,
......
...@@ -27,6 +27,8 @@ enum uhid_event_type { ...@@ -27,6 +27,8 @@ enum uhid_event_type {
UHID_DESTROY, UHID_DESTROY,
UHID_START, UHID_START,
UHID_STOP, UHID_STOP,
UHID_OPEN,
UHID_CLOSE,
UHID_INPUT, UHID_INPUT,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册