]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
HID: sony: Print error on failure to active DS3 / Navigation controllers
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Tue, 7 Mar 2017 23:45:09 +0000 (15:45 -0800)
committerJiri Kosina <jkosina@suse.cz>
Tue, 21 Mar 2017 14:12:07 +0000 (15:12 +0100)
This patch adds printing when we failed to activate DS3 / Nagivation
controllers and checks the return value for these failures earlier
in sony_input_configured. This paves the way for other configuration
logic for these devices, which we don't want to call if for example
the activation failed.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sony.c

index b1a21ba4263ac4c606ff3732be7c686efbc98739..fa2ea085fec8bfe86f5785d33e4d1f1e69d6303b 100644 (file)
@@ -2468,7 +2468,13 @@ static int sony_input_configured(struct hid_device *hdev,
                hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
                hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID;
                sc->defer_initialization = 1;
+
                ret = sixaxis_set_operational_usb(hdev);
+               if (ret < 0) {
+                       hid_err(hdev, "Failed to set controller into operational mode\n");
+                       goto err_stop;
+               }
+
                sony_init_output_report(sc, sixaxis_send_output_report);
        } else if ((sc->quirks & SIXAXIS_CONTROLLER_BT) ||
                        (sc->quirks & NAVIGATION_CONTROLLER_BT)) {
@@ -2477,7 +2483,13 @@ static int sony_input_configured(struct hid_device *hdev,
                 * when connected via Bluetooth.
                 */
                hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
+
                ret = sixaxis_set_operational_bt(hdev);
+               if (ret < 0) {
+                       hid_err(hdev, "Failed to set controller into operational mode\n");
+                       goto err_stop;
+               }
+
                sony_init_output_report(sc, sixaxis_send_output_report);
        } else if (sc->quirks & DUALSHOCK4_CONTROLLER) {
                ret = dualshock4_get_calibration_data(sc);