aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Praznik <frank.praznik@oh.rr.com>2014-02-18 17:22:01 -0500
committerJiri Kosina <jkosina@suse.cz>2014-02-20 08:10:22 -0500
commitfee4e2d526c08946f481a27fd40090edce005080 (patch)
tree74ecbf5bee57f532f30cd8fdeada96320e5083b6
parenta43e94a38b91e30f36e8c9ef91bf7bd93061a3a1 (diff)
HID: sony: Enable LED controls and rumble for the Sixaxis on Bluetooth.
Add a SIXAXIS_CONTROLLER macro to simplify conditionals where the connection type is irrelevant. Enable the LED and force feedback controls for Sixaxis controllers connected via Bluetooth. Send Sixaxis Bluetooth output reports on the control channel. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-sony.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 0111d3028c4b..526705fac82c 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -44,12 +44,12 @@
44#define DUALSHOCK4_CONTROLLER_USB BIT(5) 44#define DUALSHOCK4_CONTROLLER_USB BIT(5)
45#define DUALSHOCK4_CONTROLLER_BT BIT(6) 45#define DUALSHOCK4_CONTROLLER_BT BIT(6)
46 46
47#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
47#define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |\ 48#define DUALSHOCK4_CONTROLLER (DUALSHOCK4_CONTROLLER_USB |\
48 DUALSHOCK4_CONTROLLER_BT) 49 DUALSHOCK4_CONTROLLER_BT)
49#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER |\ 50#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\
50 DUALSHOCK4_CONTROLLER)
51#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT |\
52 DUALSHOCK4_CONTROLLER) 51 DUALSHOCK4_CONTROLLER)
52#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
53 53
54#define MAX_LEDS 4 54#define MAX_LEDS 4
55 55
@@ -935,8 +935,7 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
935 /* Sixaxis HID report has acclerometers/gyro with MSByte first, this 935 /* Sixaxis HID report has acclerometers/gyro with MSByte first, this
936 * has to be BYTE_SWAPPED before passing up to joystick interface 936 * has to be BYTE_SWAPPED before passing up to joystick interface
937 */ 937 */
938 if ((sc->quirks & (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)) && 938 if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) {
939 rd[0] == 0x01 && size == 49) {
940 swap(rd[41], rd[42]); 939 swap(rd[41], rd[42]);
941 swap(rd[43], rd[44]); 940 swap(rd[43], rd[44]);
942 swap(rd[45], rd[46]); 941 swap(rd[45], rd[46]);
@@ -1096,8 +1095,7 @@ static void sony_set_leds(struct hid_device *hdev, const __u8 *leds, int count)
1096 1095
1097 if (drv_data->quirks & BUZZ_CONTROLLER && count == 4) { 1096 if (drv_data->quirks & BUZZ_CONTROLLER && count == 4) {
1098 buzz_set_leds(hdev, leds); 1097 buzz_set_leds(hdev, leds);
1099 } else if ((drv_data->quirks & SIXAXIS_CONTROLLER_USB) || 1098 } else {
1100 (drv_data->quirks & DUALSHOCK4_CONTROLLER)) {
1101 for (n = 0; n < count; n++) 1099 for (n = 0; n < count; n++)
1102 drv_data->led_state[n] = leds[n]; 1100 drv_data->led_state[n] = leds[n];
1103 schedule_work(&drv_data->state_worker); 1101 schedule_work(&drv_data->state_worker);
@@ -1285,7 +1283,11 @@ static void sixaxis_state_worker(struct work_struct *work)
1285 buf[10] |= sc->led_state[2] << 3; 1283 buf[10] |= sc->led_state[2] << 3;
1286 buf[10] |= sc->led_state[3] << 4; 1284 buf[10] |= sc->led_state[3] << 4;
1287 1285
1288 hid_output_raw_report(sc->hdev, buf, sizeof(buf), HID_OUTPUT_REPORT); 1286 if (sc->quirks & SIXAXIS_CONTROLLER_USB)
1287 hid_output_raw_report(sc->hdev, buf, sizeof(buf), HID_OUTPUT_REPORT);
1288 else
1289 hid_hw_raw_request(sc->hdev, 0x01, buf, sizeof(buf),
1290 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
1289} 1291}
1290 1292
1291static void dualshock4_state_worker(struct work_struct *work) 1293static void dualshock4_state_worker(struct work_struct *work)
@@ -1520,10 +1522,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
1520 hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; 1522 hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
1521 ret = sixaxis_set_operational_usb(hdev); 1523 ret = sixaxis_set_operational_usb(hdev);
1522 INIT_WORK(&sc->state_worker, sixaxis_state_worker); 1524 INIT_WORK(&sc->state_worker, sixaxis_state_worker);
1523 } 1525 } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) {
1524 else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
1525 ret = sixaxis_set_operational_bt(hdev); 1526 ret = sixaxis_set_operational_bt(hdev);
1526 else if (sc->quirks & DUALSHOCK4_CONTROLLER) { 1527 INIT_WORK(&sc->state_worker, sixaxis_state_worker);
1528 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) {
1527 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) { 1529 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) {
1528 ret = dualshock4_set_operational_bt(hdev); 1530 ret = dualshock4_set_operational_bt(hdev);
1529 if (ret < 0) { 1531 if (ret < 0) {