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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux