From patchwork Fri Sep 7 10:17:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanno Zulla X-Patchwork-Id: 10591995 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 4DDEB13BB for ; Fri, 7 Sep 2018 10:17:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 368BE2ADFF for ; Fri, 7 Sep 2018 10:17:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ACD92AE10; Fri, 7 Sep 2018 10:17:37 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 6646C2ADFF for ; Fri, 7 Sep 2018 10:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728141AbeIGO5v (ORCPT ); Fri, 7 Sep 2018 10:57:51 -0400 Received: from zoot.epublica.de ([78.46.103.157]:56440 "EHLO zoot.epublica.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727716AbeIGO5v (ORCPT ); Fri, 7 Sep 2018 10:57:51 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by zoot.epublica.de (Postfix) with ESMTP id 9E91D1840492; Fri, 7 Sep 2018 12:17:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zoot.epublica.de Received: from zoot.epublica.de ([127.0.0.1]) by localhost (zoot.epublica.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DS1NiqiRNlVY; Fri, 7 Sep 2018 12:17:31 +0200 (CEST) Received: from [10.1.0.41] (ip1f103e43.dynamic.kabel-deutschland.de [31.16.62.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zoot.epublica.de (Postfix) with ESMTPSA id 949E51840060; Fri, 7 Sep 2018 12:17:31 +0200 (CEST) Subject: [PATCH v4 1/1] HID: hid-sony: Only allow four LED states From: Hanno Zulla To: Roderick Colenbrander , Jiri Kosina Cc: Frank Praznik , Benjamin Tissoires , linux-input References: <2AE476B4-2C49-479A-8C6A-E878E3E11483@gmail.com> Message-ID: <66e91a94-e214-d531-0df7-bb38c67c97b0@hanno.de> Date: Fri, 7 Sep 2018 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US 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: Hanno Zulla Date: Fri, 7 Sep 2018 11:34:03 +0200 Subject: [PATCH] HID: hid-sony: Only allow four LED states to identify controller The PS4 console only support four game controllers, while Linux supports any number of game controller connected to it. The kernel driver should mirror the original console's behaviour here and leave the use of additional LED colours to user space. Signed-off-by: Hanno Zulla --- drivers/hid/hid-sony.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 9671a4bad643..e13a9dcab964 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1777,15 +1777,12 @@ static void sixaxis_set_leds_from_id(struct sony_sc *sc) static void dualshock4_set_leds_from_id(struct sony_sc *sc) { - /* The first 4 color/index entries match what the PS4 assigns */ - static const u8 color_code[7][3] = { + /* The four color/index entries match what the PS4 assigns */ + static const u8 color_code[4][3] = { /* Blue */ { 0x00, 0x00, 0x40 }, - /* Red */ { 0x40, 0x00, 0x00 }, + /* Red */ { 0x40, 0x00, 0x00 }, /* Green */ { 0x00, 0x40, 0x00 }, - /* Pink */ { 0x20, 0x00, 0x20 }, - /* Orange */ { 0x02, 0x01, 0x00 }, - /* Teal */ { 0x00, 0x01, 0x01 }, - /* White */ { 0x01, 0x01, 0x01 } + /* Pink */ { 0x20, 0x00, 0x20 } }; int id = sc->device_id; @@ -1795,7 +1792,7 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc) if (id < 0) return; - id %= 7; + id %= 4; memcpy(sc->led_state, color_code[id], sizeof(color_code[id])); }