diff mbox

[v2] HID: hid-sony: Brighter RGB values and add 8th color.

Message ID d379c448-e6b2-f858-bffa-5c3256c8030a@hanno.de (mailing list archive)
State New, archived
Headers show

Commit Message

Hanno Zulla June 18, 2018, 9:39 a.m. UTC
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 <kontakt@hanno.de>
---
 drivers/hid/hid-sony.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Benjamin Tissoires July 4, 2018, 12:20 p.m. UTC | #1
On Mon, Jun 18, 2018 at 11:39 AM, Hanno Zulla <abos@hanno.de> wrote:
> 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.

I definitively have no strong opinion against or for having more colors.
Bastien, Roderick, what's your take with this?

Cheers,
Benjamin

>
> 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 <kontakt@hanno.de>
> ---
>  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]));
>  }
>
> --
> 2.17.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hanno Zulla July 24, 2018, 10:30 a.m. UTC | #2
Hi Jiri,

after some internal discussions with Roderick,
I'm withdrawing this patch submission and ask
you to ignore it.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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]));
 }