diff mbox series

[v4,1/1] HID: hid-sony: Only allow four LED states

Message ID 66e91a94-e214-d531-0df7-bb38c67c97b0@hanno.de (mailing list archive)
State New, archived
Headers show
Series [v4,1/1] HID: hid-sony: Only allow four LED states | expand

Commit Message

Hanno Zulla Sept. 7, 2018, 10:17 a.m. UTC
From: Hanno Zulla <kontakt@hanno.de>
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 <kontakt@hanno.de>
---
 drivers/hid/hid-sony.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
diff mbox series

Patch

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