From patchwork Mon Jun 18 09:39:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanno Zulla X-Patchwork-Id: 10470497 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 7BD556032A for ; Mon, 18 Jun 2018 09:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69F5C289AB for ; Mon, 18 Jun 2018 09:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C029289AF; Mon, 18 Jun 2018 09:40:01 +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 EBE66289AB for ; Mon, 18 Jun 2018 09:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755176AbeFRJj6 (ORCPT ); Mon, 18 Jun 2018 05:39:58 -0400 Received: from zoot.epublica.de ([78.46.103.157]:35498 "EHLO zoot.epublica.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755259AbeFRJj5 (ORCPT ); Mon, 18 Jun 2018 05:39:57 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by zoot.epublica.de (Postfix) with ESMTP id C60BE184083C; Mon, 18 Jun 2018 11:39:55 +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 ZqhrpvB8gDSo; Mon, 18 Jun 2018 11:39:55 +0200 (CEST) Received: from [10.1.0.41] (ip1f12a024.dynamic.kabel-deutschland.de [31.18.160.36]) (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 B3F7E18406A6; Mon, 18 Jun 2018 11:39:54 +0200 (CEST) Subject: [PATCH v2] HID: hid-sony: Brighter RGB values and add 8th color. To: Roderick Colenbrander , Jiri Kosina Cc: Frank Praznik , Benjamin Tissoires , linux-input References: <2AE476B4-2C49-479A-8C6A-E878E3E11483@gmail.com> From: Hanno Zulla Message-ID: Date: Mon, 18 Jun 2018 11:39:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 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 Hi Roderick, > The official platform supports 4 controllers, so there are > no official colors passed the official 4. Honestly more than > 4 is a little academic. Though if adding other colors, I'm > not sure how bright to make them as it affects battery life. > For consistency reason I would probably have the sum of > other colors be ~0x40 to have similar battery life. Ok, the sum of the RGB values is now near 0x40, as requested. If "more than 4 is a little academic", let's at least have a list of eight colors. Having a list of values modulo 7 kicks my coding OCD in full gear. Kind regards, Hanno --- The first four RGB colors are much brighter than the remaining three colors. This also adds dark yellow as an 8th color, because a list of 2^3 is so much nicer than a list of 7 values. Signed-off-by: Hanno Zulla --- drivers/hid/hid-sony.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index e475c5073c99..12ea086df369 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1825,14 +1825,15 @@ 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] = { + static const u8 color_code[8][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 } + /* Orange */ { 0x2c, 0x16, 0x00 }, + /* Teal */ { 0x00, 0x20, 0x20 }, + /* White */ { 0x16, 0x16, 0x16 }, + /* Yellow */ { 0x20, 0x20, 0x00 } }; int id = sc->device_id; @@ -1842,7 +1843,7 @@ static void dualshock4_set_leds_from_id(struct sony_sc *sc) if (id < 0) return; - id %= 7; + id %= 8; memcpy(sc->led_state, color_code[id], sizeof(color_code[id])); }