Commit 26af1748 authored by David Herrmann's avatar David Herrmann Committed by Jiri Kosina

HID: wiimote: Correctly call HID open/close callbacks

Even though the bluetooth hid backend does not react on open/close callbacks, we
should call them to be consistent with other hid drivers.

Also the new input open/close handlers will be used in future to prepare the
wiimote device for IR/extension input.
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 3989ef6c
...@@ -239,6 +239,20 @@ static int wiimote_input_event(struct input_dev *dev, unsigned int type, ...@@ -239,6 +239,20 @@ static int wiimote_input_event(struct input_dev *dev, unsigned int type,
return 0; return 0;
} }
static int wiimote_input_open(struct input_dev *dev)
{
struct wiimote_data *wdata = input_get_drvdata(dev);
return hid_hw_open(wdata->hdev);
}
static void wiimote_input_close(struct input_dev *dev)
{
struct wiimote_data *wdata = input_get_drvdata(dev);
hid_hw_close(wdata->hdev);
}
static void handler_keys(struct wiimote_data *wdata, const __u8 *payload) static void handler_keys(struct wiimote_data *wdata, const __u8 *payload)
{ {
input_report_key(wdata->input, wiiproto_keymap[WIIPROTO_KEY_LEFT], input_report_key(wdata->input, wiiproto_keymap[WIIPROTO_KEY_LEFT],
...@@ -321,6 +335,8 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) ...@@ -321,6 +335,8 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev)
input_set_drvdata(wdata->input, wdata); input_set_drvdata(wdata->input, wdata);
wdata->input->event = wiimote_input_event; wdata->input->event = wiimote_input_event;
wdata->input->open = wiimote_input_open;
wdata->input->close = wiimote_input_close;
wdata->input->dev.parent = &wdata->hdev->dev; wdata->input->dev.parent = &wdata->hdev->dev;
wdata->input->id.bustype = wdata->hdev->bus; wdata->input->id.bustype = wdata->hdev->bus;
wdata->input->id.vendor = wdata->hdev->vendor; wdata->input->id.vendor = wdata->hdev->vendor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment