diff options
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-wiimote.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c index 35dc293db40e..66583986bcdb 100644 --- a/drivers/hid/hid-wiimote.c +++ b/drivers/hid/hid-wiimote.c | |||
@@ -668,6 +668,32 @@ static void wiimote_accel_close(struct input_dev *dev) | |||
668 | hid_hw_close(wdata->hdev); | 668 | hid_hw_close(wdata->hdev); |
669 | } | 669 | } |
670 | 670 | ||
671 | static int wiimote_ir_open(struct input_dev *dev) | ||
672 | { | ||
673 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
674 | int ret; | ||
675 | |||
676 | ret = hid_hw_open(wdata->hdev); | ||
677 | if (ret) | ||
678 | return ret; | ||
679 | |||
680 | ret = wiimote_init_ir(wdata, WIIPROTO_FLAG_IR_BASIC); | ||
681 | if (ret) { | ||
682 | hid_hw_close(wdata->hdev); | ||
683 | return ret; | ||
684 | } | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | static void wiimote_ir_close(struct input_dev *dev) | ||
690 | { | ||
691 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
692 | |||
693 | wiimote_init_ir(wdata, 0); | ||
694 | hid_hw_close(wdata->hdev); | ||
695 | } | ||
696 | |||
671 | static void handler_keys(struct wiimote_data *wdata, const __u8 *payload) | 697 | static void handler_keys(struct wiimote_data *wdata, const __u8 *payload) |
672 | { | 698 | { |
673 | input_report_key(wdata->input, wiiproto_keymap[WIIPROTO_KEY_LEFT], | 699 | input_report_key(wdata->input, wiiproto_keymap[WIIPROTO_KEY_LEFT], |
@@ -1062,6 +1088,8 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) | |||
1062 | goto err_ir; | 1088 | goto err_ir; |
1063 | 1089 | ||
1064 | input_set_drvdata(wdata->ir, wdata); | 1090 | input_set_drvdata(wdata->ir, wdata); |
1091 | wdata->ir->open = wiimote_ir_open; | ||
1092 | wdata->ir->close = wiimote_ir_close; | ||
1065 | wdata->ir->dev.parent = &wdata->hdev->dev; | 1093 | wdata->ir->dev.parent = &wdata->hdev->dev; |
1066 | wdata->ir->id.bustype = wdata->hdev->bus; | 1094 | wdata->ir->id.bustype = wdata->hdev->bus; |
1067 | wdata->ir->id.vendor = wdata->hdev->vendor; | 1095 | wdata->ir->id.vendor = wdata->hdev->vendor; |