diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2011-09-06 07:50:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-07 07:25:16 -0400 |
commit | 7336b9f93a26082ecb068b5db42b2ed0dbf802bd (patch) | |
tree | e3239b7137a82fe84e9e3b00d9c5b71e287422ec /drivers/hid | |
parent | eac39e7eda47cec9de44d64661ef44c6b37dd45f (diff) |
HID: wiimote: Add missing extension DRM handlers
If an extension is connected the wiimote may report data though DRMs that
contain extension data. This adds handlers for these DRMs but discards extension
data since we do not support it, yet.
It prints a warning to kernel log if an unhandled report is catched. Since we
handle all requests now, this should never happen, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-wiimote.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c index 3a7dec0c9fe6..a99e058676fa 100644 --- a/drivers/hid/hid-wiimote.c +++ b/drivers/hid/hid-wiimote.c | |||
@@ -75,10 +75,13 @@ enum wiiproto_reqs { | |||
75 | WIIPROTO_REQ_RETURN = 0x22, | 75 | WIIPROTO_REQ_RETURN = 0x22, |
76 | WIIPROTO_REQ_DRM_K = 0x30, | 76 | WIIPROTO_REQ_DRM_K = 0x30, |
77 | WIIPROTO_REQ_DRM_KA = 0x31, | 77 | WIIPROTO_REQ_DRM_KA = 0x31, |
78 | WIIPROTO_REQ_DRM_KE = 0x32, | ||
78 | WIIPROTO_REQ_DRM_KAI = 0x33, | 79 | WIIPROTO_REQ_DRM_KAI = 0x33, |
80 | WIIPROTO_REQ_DRM_KEE = 0x34, | ||
79 | WIIPROTO_REQ_DRM_KAE = 0x35, | 81 | WIIPROTO_REQ_DRM_KAE = 0x35, |
80 | WIIPROTO_REQ_DRM_KIE = 0x36, | 82 | WIIPROTO_REQ_DRM_KIE = 0x36, |
81 | WIIPROTO_REQ_DRM_KAIE = 0x37, | 83 | WIIPROTO_REQ_DRM_KAIE = 0x37, |
84 | WIIPROTO_REQ_DRM_E = 0x3d, | ||
82 | WIIPROTO_REQ_DRM_SKAI1 = 0x3e, | 85 | WIIPROTO_REQ_DRM_SKAI1 = 0x3e, |
83 | WIIPROTO_REQ_DRM_SKAI2 = 0x3f, | 86 | WIIPROTO_REQ_DRM_SKAI2 = 0x3f, |
84 | }; | 87 | }; |
@@ -550,6 +553,11 @@ static void handler_drm_KA(struct wiimote_data *wdata, const __u8 *payload) | |||
550 | handler_accel(wdata, payload); | 553 | handler_accel(wdata, payload); |
551 | } | 554 | } |
552 | 555 | ||
556 | static void handler_drm_KE(struct wiimote_data *wdata, const __u8 *payload) | ||
557 | { | ||
558 | handler_keys(wdata, payload); | ||
559 | } | ||
560 | |||
553 | static void handler_drm_KAI(struct wiimote_data *wdata, const __u8 *payload) | 561 | static void handler_drm_KAI(struct wiimote_data *wdata, const __u8 *payload) |
554 | { | 562 | { |
555 | handler_keys(wdata, payload); | 563 | handler_keys(wdata, payload); |
@@ -561,6 +569,11 @@ static void handler_drm_KAI(struct wiimote_data *wdata, const __u8 *payload) | |||
561 | input_sync(wdata->ir); | 569 | input_sync(wdata->ir); |
562 | } | 570 | } |
563 | 571 | ||
572 | static void handler_drm_KEE(struct wiimote_data *wdata, const __u8 *payload) | ||
573 | { | ||
574 | handler_keys(wdata, payload); | ||
575 | } | ||
576 | |||
564 | static void handler_drm_KIE(struct wiimote_data *wdata, const __u8 *payload) | 577 | static void handler_drm_KIE(struct wiimote_data *wdata, const __u8 *payload) |
565 | { | 578 | { |
566 | handler_keys(wdata, payload); | 579 | handler_keys(wdata, payload); |
@@ -588,6 +601,10 @@ static void handler_drm_KAIE(struct wiimote_data *wdata, const __u8 *payload) | |||
588 | input_sync(wdata->ir); | 601 | input_sync(wdata->ir); |
589 | } | 602 | } |
590 | 603 | ||
604 | static void handler_drm_E(struct wiimote_data *wdata, const __u8 *payload) | ||
605 | { | ||
606 | } | ||
607 | |||
591 | static void handler_drm_SKAI1(struct wiimote_data *wdata, const __u8 *payload) | 608 | static void handler_drm_SKAI1(struct wiimote_data *wdata, const __u8 *payload) |
592 | { | 609 | { |
593 | handler_keys(wdata, payload); | 610 | handler_keys(wdata, payload); |
@@ -633,10 +650,13 @@ static struct wiiproto_handler handlers[] = { | |||
633 | { .id = WIIPROTO_REQ_RETURN, .size = 4, .func = handler_return }, | 650 | { .id = WIIPROTO_REQ_RETURN, .size = 4, .func = handler_return }, |
634 | { .id = WIIPROTO_REQ_DRM_K, .size = 2, .func = handler_keys }, | 651 | { .id = WIIPROTO_REQ_DRM_K, .size = 2, .func = handler_keys }, |
635 | { .id = WIIPROTO_REQ_DRM_KA, .size = 5, .func = handler_drm_KA }, | 652 | { .id = WIIPROTO_REQ_DRM_KA, .size = 5, .func = handler_drm_KA }, |
653 | { .id = WIIPROTO_REQ_DRM_KE, .size = 10, .func = handler_drm_KE }, | ||
636 | { .id = WIIPROTO_REQ_DRM_KAI, .size = 17, .func = handler_drm_KAI }, | 654 | { .id = WIIPROTO_REQ_DRM_KAI, .size = 17, .func = handler_drm_KAI }, |
655 | { .id = WIIPROTO_REQ_DRM_KEE, .size = 21, .func = handler_drm_KEE }, | ||
637 | { .id = WIIPROTO_REQ_DRM_KAE, .size = 21, .func = handler_drm_KAE }, | 656 | { .id = WIIPROTO_REQ_DRM_KAE, .size = 21, .func = handler_drm_KAE }, |
638 | { .id = WIIPROTO_REQ_DRM_KIE, .size = 21, .func = handler_drm_KIE }, | 657 | { .id = WIIPROTO_REQ_DRM_KIE, .size = 21, .func = handler_drm_KIE }, |
639 | { .id = WIIPROTO_REQ_DRM_KAIE, .size = 21, .func = handler_drm_KAIE }, | 658 | { .id = WIIPROTO_REQ_DRM_KAIE, .size = 21, .func = handler_drm_KAIE }, |
659 | { .id = WIIPROTO_REQ_DRM_E, .size = 21, .func = handler_drm_E }, | ||
640 | { .id = WIIPROTO_REQ_DRM_SKAI1, .size = 21, .func = handler_drm_SKAI1 }, | 660 | { .id = WIIPROTO_REQ_DRM_SKAI1, .size = 21, .func = handler_drm_SKAI1 }, |
641 | { .id = WIIPROTO_REQ_DRM_SKAI2, .size = 21, .func = handler_drm_SKAI2 }, | 661 | { .id = WIIPROTO_REQ_DRM_SKAI2, .size = 21, .func = handler_drm_SKAI2 }, |
642 | { .id = 0 } | 662 | { .id = 0 } |
@@ -649,6 +669,7 @@ static int wiimote_hid_event(struct hid_device *hdev, struct hid_report *report, | |||
649 | struct wiiproto_handler *h; | 669 | struct wiiproto_handler *h; |
650 | int i; | 670 | int i; |
651 | unsigned long flags; | 671 | unsigned long flags; |
672 | bool handled = false; | ||
652 | 673 | ||
653 | if (size < 1) | 674 | if (size < 1) |
654 | return -EINVAL; | 675 | return -EINVAL; |
@@ -657,10 +678,16 @@ static int wiimote_hid_event(struct hid_device *hdev, struct hid_report *report, | |||
657 | 678 | ||
658 | for (i = 0; handlers[i].id; ++i) { | 679 | for (i = 0; handlers[i].id; ++i) { |
659 | h = &handlers[i]; | 680 | h = &handlers[i]; |
660 | if (h->id == raw_data[0] && h->size < size) | 681 | if (h->id == raw_data[0] && h->size < size) { |
661 | h->func(wdata, &raw_data[1]); | 682 | h->func(wdata, &raw_data[1]); |
683 | handled = true; | ||
684 | } | ||
662 | } | 685 | } |
663 | 686 | ||
687 | if (!handled) | ||
688 | hid_warn(hdev, "Unhandled report %hhu size %d\n", raw_data[0], | ||
689 | size); | ||
690 | |||
664 | spin_unlock_irqrestore(&wdata->state.lock, flags); | 691 | spin_unlock_irqrestore(&wdata->state.lock, flags); |
665 | 692 | ||
666 | return 0; | 693 | return 0; |