diff options
author | Frank Praznik <frank.praznik@oh.rr.com> | 2014-01-16 21:42:51 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-01-17 04:47:41 -0500 |
commit | 0da8ea6581d59f523880e7856bccfb35d33cffdf (patch) | |
tree | db86c2b7d7557711010e7e3c2357cc60a607c4e0 /drivers/hid | |
parent | 8ab1676b614e4ef816a83ba214523b4fac256fce (diff) |
HID: sony: Use standard output reports instead of raw reports to send data to the Dualshock 4.
Use regular HID output reports instead of raw reports in the
dualshock4_state_worker function. (Thanks Simon Mungewell)
Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-sony.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 2f992e12f6f9..e6231318cf7a 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -664,28 +664,39 @@ static void sixaxis_state_worker(struct work_struct *work) | |||
664 | static void dualshock4_state_worker(struct work_struct *work) | 664 | static void dualshock4_state_worker(struct work_struct *work) |
665 | { | 665 | { |
666 | struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); | 666 | struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); |
667 | unsigned char buf[] = { | 667 | struct hid_device *hdev = sc->hdev; |
668 | 0x05, | 668 | struct list_head *head, *list; |
669 | 0x03, 0x00, 0x00, 0x00, 0x00, | 669 | struct hid_report *report; |
670 | 0x00, 0x00, 0x00, 0x00, 0x00, | 670 | __s32 *value; |
671 | 0x00, 0x00, 0x00, 0x00, 0x00, | 671 | |
672 | 0x00, 0x00, 0x00, 0x00, 0x00, | 672 | list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list; |
673 | 0x00, 0x00, 0x00, 0x00, 0x00, | 673 | |
674 | 0x00, 0x00, 0x00, 0x00, 0x00, | 674 | list_for_each(head, list) { |
675 | 0x00, | 675 | report = list_entry(head, struct hid_report, list); |
676 | }; | 676 | |
677 | /* Report 5 is used to send data to the controller via USB */ | ||
678 | if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && report->id == 5) | ||
679 | break; | ||
680 | } | ||
681 | |||
682 | if (head == list) { | ||
683 | hid_err(hdev, "Dualshock 4 output report not found\n"); | ||
684 | return; | ||
685 | } | ||
686 | |||
687 | value = report->field[0]->value; | ||
688 | value[0] = 0x03; | ||
677 | 689 | ||
678 | #ifdef CONFIG_SONY_FF | 690 | #ifdef CONFIG_SONY_FF |
679 | buf[4] = sc->right; | 691 | value[3] = sc->right; |
680 | buf[5] = sc->left; | 692 | value[4] = sc->left; |
681 | #endif | 693 | #endif |
682 | 694 | ||
683 | buf[6] = sc->led_state[0]; | 695 | value[5] = sc->led_state[0]; |
684 | buf[7] = sc->led_state[1]; | 696 | value[6] = sc->led_state[1]; |
685 | buf[8] = sc->led_state[2]; | 697 | value[7] = sc->led_state[2]; |
686 | 698 | ||
687 | sc->hdev->hid_output_raw_report(sc->hdev, buf, sizeof(buf), | 699 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); |
688 | HID_OUTPUT_REPORT); | ||
689 | } | 700 | } |
690 | 701 | ||
691 | #ifdef CONFIG_SONY_FF | 702 | #ifdef CONFIG_SONY_FF |