From patchwork Fri Dec 28 02:26:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongye Yuan X-Patchwork-Id: 10744093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2CEE14DE for ; Fri, 28 Dec 2018 02:26:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98A0428CC0 for ; Fri, 28 Dec 2018 02:26:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BA3A28CC3; Fri, 28 Dec 2018 02:26:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36A3628CC0 for ; Fri, 28 Dec 2018 02:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727303AbeL1C02 (ORCPT ); Thu, 27 Dec 2018 21:26:28 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39386 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbeL1C02 (ORCPT ); Thu, 27 Dec 2018 21:26:28 -0500 Received: by mail-lf1-f68.google.com with SMTP id n18so13738792lfh.6; Thu, 27 Dec 2018 18:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=cn8T2QL0+FxYSIA6x4CnY8dxx2SrMelLeNXkQLlVHPg=; b=l0C6uiGEsiKAOMADqD4MPVvh+he9Wz9+IlwAfA9O7ZkcYF6GclT9Fb5tIUEV5FhoTt tZ1MMlfn051qq598AV4ok9PjKMAPZ2PA99BR+84+hXpM32j7ArMhzSxDzXCQJrEEefae 5itM6IflKH8PhFHoxzFcleFGS8FnLUEaFEinViZY0OFkaL9VJqg1paGcTh12pKs+2UqN eS7I09CpMSR7Wn97aIQ+Y3lFTapPCU0YlHxMppRCPrVMaBCdmbxIFMHJGhc6bJSg29l+ qesrhxL7gPg1pNLtkU3bGP1ba9B7KGWMlJe35gRXJYblFmMs/og8AFJhkVWTOG9Gp11p eC6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=cn8T2QL0+FxYSIA6x4CnY8dxx2SrMelLeNXkQLlVHPg=; b=UrzpEYtix9o8CxE8l+m8BgGINHen1SbqJwtdIEbo9VCEauHJJYgxnOJm+q055175HC dbr8CGxJY2nXiBjwMfpcwSnPKnRxX2iYvkXvCPBdGdXguvRwG3zKVLpvD7EQR6oPSfCT Igqo4qy5O+vY1nhlqnXO6VBtfn0tZ6xasHuEDlMmHfL1O3DyVrjCQN+FXtYmSoTAfG1J g28Txo7rwNx/KukIuFoJiOaqsCh1DAEgYZIGsqPw89OstFR6MsqGd3Uo1GtgggsQB4iw eUqSNdW0lFWTQtCI9L/QNjLeDCXlSLeV8+3HtNKJPJuhjvHvaOObGgDPDSseLp+rNVVT j3Iw== X-Gm-Message-State: AJcUukebimJmlBKu5yhlt39WPRYn1CpW7v6zW50WFW/rsnEN65aEohhQ 7W+g/61aehnL37tkByKLvA6tW6jhtM/KMqeHWVtOK5JesDY= X-Google-Smtp-Source: ALg8bN4A6yfakMmVH3AIy2Ip0J8gnhOZSd+TMbU78tPzxlYPLMYhT9Ba4gxFP80ZVlS4SH1i6htxAn0vmrJDYoNMHp4= X-Received: by 2002:a19:40cc:: with SMTP id n195mr4213232lfa.40.1545963985703; Thu, 27 Dec 2018 18:26:25 -0800 (PST) MIME-Version: 1.0 From: liquid Date: Fri, 28 Dec 2018 10:26:14 +0800 Message-ID: Subject: [PATCH] HID: sony: Fix SHANWAN PS3 GamePad rumbling on USB again To: linux-input@vger.kernel.org Cc: Greg KH , Jiri Kosina , linux-usb@vger.kernel.org Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 6323ffb83e23eab9a08208063f9dba27c6a0d228 Mon Sep 17 00:00:00 2001 From: Hongye Yuan Date: Thu, 27 Dec 2018 09:41:23 +0800 Subject: [PATCH] HID: sony: Fix SHANWAN PS3 GamePad rumbling on USB again - The SHANWAN DS3 clone joystick requires HID Output Reports via Interrupt EP. - Added a quirk for SHANWAN PS3 GamePad. Signed-off-by: Hongye Yuan --- drivers/hid/hid-sony.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) hid_info(hdev, "can't set operational mode: step 3, ignoring\n"); @@ -2097,9 +2099,13 @@ static void sixaxis_send_output_report(struct sony_sc *sc) } } - hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, - sizeof(struct sixaxis_output_report), - HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); + /* SHANWAN controllers require sending output reports via intr channel */ + if (sc->quirks & SHANWAN_GAMEPAD) + hid_hw_output_report(sc->hdev, (u8 *)report, + sizeof(struct sixaxis_output_report)); + else hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, + sizeof(struct sixaxis_output_report), + HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); } static void dualshock4_send_output_report(struct sony_sc *sc) @@ -2811,6 +2817,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!strcmp(hdev->name, "FutureMax Dance Mat")) quirks |= FUTUREMAX_DANCE_MAT; + if (!strcmp(hdev->name, "SHANWAN PS3 GamePad")) + quirks |= SHANWAN_GAMEPAD; + sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 9671a4bad643..842f370cfec2 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -58,6 +58,7 @@ #define FUTUREMAX_DANCE_MAT BIT(13) #define NSG_MR5U_REMOTE_BT BIT(14) #define NSG_MR7U_REMOTE_BT BIT(15) +#define SHANWAN_GAMEPAD BIT(16) #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT) #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT) @@ -1490,6 +1491,7 @@ static int sony_register_sensors(struct sony_sc *sc) */ static int sixaxis_set_operational_usb(struct hid_device *hdev) { + struct sony_sc *sc = hid_get_drvdata(hdev); const int buf_size = max(SIXAXIS_REPORT_0xF2_SIZE, SIXAXIS_REPORT_0xF5_SIZE); u8 *buf; @@ -1521,7 +1523,7 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev) * But the USB interrupt would cause SHANWAN controllers to * start rumbling non-stop. */ - if (strcmp(hdev->name, "SHANWAN PS3 GamePad")) { + if (sc->quirks & SHANWAN_GAMEPAD) { ret = hid_hw_output_report(hdev, buf, 1); if (ret < 0) {