From 99e15d42e3c50c5c385238fea3c2b6d5a78b6246 Mon Sep 17 00:00:00 2001 From: vs7 Date: Mon, 16 Nov 2015 08:24:58 +0100 Subject: [PATCH 1/2] HID: sony: Enable Bluetooth Gasia third-party PS3 controllers --- drivers/hid/hid-sony.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 2259eaa8b9888..1a56ee442ec54 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1067,8 +1067,24 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev) static int sixaxis_set_operational_bt(struct hid_device *hdev) { unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; - return hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), - HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + unsigned char ack; + ack = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + unsigned char enable_gasia[] = { + 0xA2, + 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, // rumble values [0x00, right-timeout, right-force, left-timeout, left-force] + 0x00, 0x00, 0x00, 0x00, 0x02, // 0x02=LED1 .. 0x10=LED4 + 0xff, 0x27, 0x10, 0x00, 0x32, // LED 4 + 0xff, 0x27, 0x10, 0x00, 0x32, // LED 3 + 0xff, 0x27, 0x10, 0x00, 0x32, // LED 2 + 0xff, 0x27, 0x10, 0x00, 0x32, // LED 1 + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + }; + hid_hw_raw_request(hdev, enable_gasia[0], enable_gasia, sizeof(enable_gasia), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + return ack; } /* From b8ee68300e29e35916e2cfcbf0135a20e54db909 Mon Sep 17 00:00:00 2001 From: vs7 Date: Mon, 16 Nov 2015 17:58:34 +0100 Subject: [PATCH 2/2] code style fixes --- drivers/hid/hid-sony.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 1a56ee442ec54..a95a8b092f766 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1068,22 +1068,25 @@ static int sixaxis_set_operational_bt(struct hid_device *hdev) { unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; unsigned char ack; - ack = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); unsigned char enable_gasia[] = { - 0xA2, - 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, // rumble values [0x00, right-timeout, right-force, left-timeout, left-force] - 0x00, 0x00, 0x00, 0x00, 0x02, // 0x02=LED1 .. 0x10=LED4 - 0xff, 0x27, 0x10, 0x00, 0x32, // LED 4 - 0xff, 0x27, 0x10, 0x00, 0x32, // LED 3 - 0xff, 0x27, 0x10, 0x00, 0x32, // LED 2 - 0xff, 0x27, 0x10, 0x00, 0x32, // LED 1 - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 + 0xA2, + 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, /* rumble values [0x00, right-timeout, right-force, left-timeout, left-force] */ + 0x00, 0x00, 0x00, 0x00, 0x02, /* 0x02=LED1 .. 0x10=LED4 */ + 0xff, 0x27, 0x10, 0x00, 0x32, /* LED 4 */ + 0xff, 0x27, 0x10, 0x00, 0x32, /* LED 3 */ + 0xff, 0x27, 0x10, 0x00, 0x32, /* LED 2 */ + 0xff, 0x27, 0x10, 0x00, 0x32, /* LED 1 */ + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 }; + + ack = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + hid_hw_raw_request(hdev, enable_gasia[0], enable_gasia, sizeof(enable_gasia), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); + return ack; }