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>
This commit is contained in:
parent
8ab1676b61
commit
0da8ea6581
@ -664,28 +664,39 @@ static void sixaxis_state_worker(struct work_struct *work)
|
|||||||
static void dualshock4_state_worker(struct work_struct *work)
|
static void dualshock4_state_worker(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
|
struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
|
||||||
unsigned char buf[] = {
|
struct hid_device *hdev = sc->hdev;
|
||||||
0x05,
|
struct list_head *head, *list;
|
||||||
0x03, 0x00, 0x00, 0x00, 0x00,
|
struct hid_report *report;
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
__s32 *value;
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
list_for_each(head, list) {
|
||||||
0x00,
|
report = list_entry(head, struct hid_report, list);
|
||||||
};
|
|
||||||
|
/* Report 5 is used to send data to the controller via USB */
|
||||||
|
if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && report->id == 5)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (head == list) {
|
||||||
|
hid_err(hdev, "Dualshock 4 output report not found\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = report->field[0]->value;
|
||||||
|
value[0] = 0x03;
|
||||||
|
|
||||||
#ifdef CONFIG_SONY_FF
|
#ifdef CONFIG_SONY_FF
|
||||||
buf[4] = sc->right;
|
value[3] = sc->right;
|
||||||
buf[5] = sc->left;
|
value[4] = sc->left;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf[6] = sc->led_state[0];
|
value[5] = sc->led_state[0];
|
||||||
buf[7] = sc->led_state[1];
|
value[6] = sc->led_state[1];
|
||||||
buf[8] = sc->led_state[2];
|
value[7] = sc->led_state[2];
|
||||||
|
|
||||||
sc->hdev->hid_output_raw_report(sc->hdev, buf, sizeof(buf),
|
hid_hw_request(hdev, report, HID_REQ_SET_REPORT);
|
||||||
HID_OUTPUT_REPORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SONY_FF
|
#ifdef CONFIG_SONY_FF
|
||||||
|
Loading…
Reference in New Issue
Block a user