From patchwork Fri Oct 7 19:39:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9367435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19F06600C8 for ; Fri, 7 Oct 2016 19:40:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08B92297EE for ; Fri, 7 Oct 2016 19:40:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F13C829832; Fri, 7 Oct 2016 19:40:17 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 9AD85297EE for ; Fri, 7 Oct 2016 19:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932561AbcJGTkR (ORCPT ); Fri, 7 Oct 2016 15:40:17 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:34722 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932554AbcJGTkQ (ORCPT ); Fri, 7 Oct 2016 15:40:16 -0400 Received: by mail-io0-f172.google.com with SMTP id r30so57355831ioi.1 for ; Fri, 07 Oct 2016 12:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaikai-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=faRiToUniey9wTavT5ieA0hLo3HCqun1VRU/HSSlsfI=; b=k7TyIAF8RA3HjazRBRDNNNcoLG6mDaZTxLILD10D88swSomDFfr533F/8jDrchHuJr mJaw2y7Xha8lTK1+3++r8Ug0y41Bri7MNiRwDxawwdkaFmdeyUC+u3zfstT9YyQiTnQg 03Fs8CO32DVR//S5J92u6V6WA/sKqFnJ4cuoe2BRrea9uJikqTpBWwKFpPWjLOt14JhJ RagA7Yv74jITZDFRvybJL/+DFN3FIXskzuJYVj/2Iox9Cg9ftMvyfhMAZg2YrqWnTRdh awldT29JC1JIAE3RwALkrj3Gw91EpSxmF+sz2gMap0gRXUYtFg5vKLoM6h79eftuPAW3 Fsrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=faRiToUniey9wTavT5ieA0hLo3HCqun1VRU/HSSlsfI=; b=Bu24r7l7eQ2es8L5Ylb0odzKeMBA00WAPYy4AUvRSbpZ15THK8c/wOqXVna2nQd81d qY2DMANzz1k+Mik46Y6gEvfLM/hU7ej39bZxjVZQl7lI8I7ijFrwyAcoVbYWV9pBmevS WcFvKCgbz/BLn9fKu0kzxNMerZpJdzidaJh4+hhJDgL2815zvPoYT9dM+gCg2u27LPrH FZYRGHLjjdl/Mk+lEoyBR7AnKBpZq8pxjlmJznJuI9RZ8sqmQmBiAgd6BgFuwEC9X4ZG ucM9Qm/p6J/RHcpzaCryTP/7EveOxRQraFBKa7Sjq4hHAvKJc+BHgpWlpC/V8Mw45JHp IsDA== X-Gm-Message-State: AA6/9RkkLbBtd66r8uyTgQbvUW1ysUjGW9DfjNrwUV2ATctknUcZAkjjo37IbJJE/6/KpPS3 X-Received: by 10.107.40.205 with SMTP id o196mr19242668ioo.137.1475869215380; Fri, 07 Oct 2016 12:40:15 -0700 (PDT) Received: from konan1.dev.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id v7sm1735481itd.6.2016.10.07.12.40.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Oct 2016 12:40:14 -0700 (PDT) From: Roderick Colenbrander To: linux-input@vger.kernel.org Cc: Benjamin Tissoires , Jiri Kosina , Tim Bird , Roderick Colenbrander Subject: [PATCH 4/7] HID: sony: Send ds4 output reports on output end-point Date: Fri, 7 Oct 2016 12:39:37 -0700 Message-Id: <1475869180-26757-5-git-send-email-roderick@gaikai.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475869180-26757-1-git-send-email-roderick@gaikai.com> References: <1475869180-26757-1-git-send-email-roderick@gaikai.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Roderick Colenbrander Add a CRC value to each output report. This removes the need for the 'no output reports on interrupt end-point' quirk. Signed-off-by: Roderick Colenbrander --- drivers/hid/hid-sony.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 34988ce..24f7d19 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1895,7 +1895,7 @@ static void dualshock4_send_output_report(struct sony_sc *sc) } else { memset(buf, 0, DS4_OUTPUT_REPORT_0x11_SIZE); buf[0] = 0x11; - buf[1] = 0x80; + buf[1] = 0xC0; /* HID + CRC */ buf[3] = 0x0F; offset = 6; } @@ -1922,9 +1922,16 @@ static void dualshock4_send_output_report(struct sony_sc *sc) if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) hid_hw_output_report(hdev, buf, DS4_OUTPUT_REPORT_0x05_SIZE); - else - hid_hw_raw_request(hdev, 0x11, buf, DS4_OUTPUT_REPORT_0x11_SIZE, - HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); + else { + /* CRC generation */ + u8 bthdr = 0xA2; + u32 crc; + + crc = crc32_le(0xFFFFFFFF, &bthdr, 1); + crc = ~crc32_le(crc, buf, DS4_OUTPUT_REPORT_0x11_SIZE-4); + put_unaligned_le32(crc, &buf[74]); + hid_hw_output_report(hdev, buf, DS4_OUTPUT_REPORT_0x11_SIZE); + } } static void motion_send_output_report(struct sony_sc *sc) @@ -2378,11 +2385,6 @@ static int sony_input_configured(struct hid_device *hdev, sony_init_output_report(sc, sixaxis_send_output_report); } else if (sc->quirks & DUALSHOCK4_CONTROLLER) { if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) { - /* - * The DualShock 4 wants output reports sent on the ctrl - * endpoint when connected via Bluetooth. - */ - hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP; ret = dualshock4_set_operational_bt(hdev); if (ret < 0) { hid_err(hdev, "failed to set the Dualshock 4 operational mode\n");