From patchwork Wed Oct 5 02:58:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9362451 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 D9C6C608A7 for ; Wed, 5 Oct 2016 03:00:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0B2528673 for ; Wed, 5 Oct 2016 03:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C03BD287C9; Wed, 5 Oct 2016 03:00:41 +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 B00F328673 for ; Wed, 5 Oct 2016 03:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562AbcJEDAa (ORCPT ); Tue, 4 Oct 2016 23:00:30 -0400 Received: from mail-it0-f41.google.com ([209.85.214.41]:35487 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754476AbcJEDA3 (ORCPT ); Tue, 4 Oct 2016 23:00:29 -0400 Received: by mail-it0-f41.google.com with SMTP id r192so164666887ita.0 for ; Tue, 04 Oct 2016 20:00:28 -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=rAl90bzNgVnlrmEqP1qTbQgtspgGR8ePQ1iDWWVhlOrRvCi5lTTcOzS3D/A+lSCWFX YPvsXkPkoHY5cGaFHTUDSLLB2l7B9WAvqABGLOFmEu7qR/lHVjhtZFB1zlSS24SXE8fp iTAzDtobSmVxuioOVrAtimm69ZfOnhovA7DkYK8MC5pTs+E7Kz/+8VJxqjV2A8bqZw1i TqoxygJeXfv31B3QIkYDGtYTpzNCXrgSDUURIDlp7bGxYx0PtssnNh4F25U0IsHZS1ja JsjUFZyyy0BtQRljSiw2xENUD3hTlr6RUtAObw5XdBlaLQpen7bK93XdIeor3KwaKysY qLTg== 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=T/ONKZPOQuSYZnX2qcUa3gD1oymE5nxriDiNd2dTaUlL7QVFE1CxJbjYRt/y5rzZhX 4NgzafNwH6B//7cgPdLPIAYfwJtZlG4im/OZp1sNnnnJfHKZDxnMIxwEShRJaCKt6IdC Ggga8T8vgh7vvuBzM3Tk8SaLrfb+a3xqiFMxz9Yah4Eakzbt8dI7baY/4OdezcP+OHwr 0jYMTBcJo3btSl2BMNUrcnz4FfEBaZ4Nwwo4hobKltFEOdRNipdILhlFeGX7Naiso68r 7CLAcWm59BCY0GLomf2wod5BtXJ8aVcVUx2dWnXhopw1LVtDbR/5OFud+1bRNE0CQPFy SPzA== X-Gm-Message-State: AA6/9Rk1AKMqT+wRCjEkw2R3TuyeMGKcH79M3xbEuc665fCH0vL7uZ1MnmcZ0/PdyJPUeVNI X-Received: by 10.36.253.200 with SMTP id m191mr5656353ith.35.1475636427920; Tue, 04 Oct 2016 20:00:27 -0700 (PDT) Received: from konan1.dev.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id m206sm10901281ita.13.2016.10.04.20.00.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Oct 2016 20:00:27 -0700 (PDT) From: Roderick Colenbrander To: linux-input@vger.kernel.org Cc: Benjamin Tissoires , Jiri Kosina , Tim Bird , Roderick Colenbrander Subject: [PATCH 4/5] HID: sony: Send ds4 output reports on output end-point Date: Tue, 4 Oct 2016 19:58:57 -0700 Message-Id: <1475636338-3779-5-git-send-email-roderick@gaikai.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475636338-3779-1-git-send-email-roderick@gaikai.com> References: <1475636338-3779-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 acked-by: Simon Wood acked-by: Frank Praznik -- Reviewed-by: Benjamin Tissoires --- 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");