[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1424229290-32089-1-git-send-email-simon@mungewell.org>
Date: Tue, 17 Feb 2015 20:14:50 -0700
From: Simon Wood <simon@...gewell.org>
To: linux-input@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Jiri Kosina <jkosina@...e.cz>,
Simon Wood <simon@...gewell.org>
Subject: [PATCH] HID: hid-sony: Prevent LED overrun
If the value written to led1 is larger than 1 (for SixAxis or Intec controllers),
it can effect other leds on the device.
For example:
# echo 3 > /sys/class/leds/0003\:054C\:0268.0013\:\:sony1/brightness
turns on both led1 and led2, led2 does not then behave as expected through it's
own interface.
Patch limits the LEDs 'value' to the 'max brightness', thus preventing bug.
Tested with SixAxis DS3, DS4 and Intec (3rd party) controllers, via USB connection.
Signed-off-by: Simon Wood <simon@...gewell.org>
---
drivers/hid/hid-sony.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 31e9d25..385fa1f 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1296,6 +1296,9 @@ static void sony_led_set_brightness(struct led_classdev *led,
drv_data->led_delay_on[n] ||
drv_data->led_delay_off[n]))) {
+ if (value > led->max_brightness)
+ value = led->max_brightness;
+
drv_data->led_state[n] = value;
/* Setting the brightness stops the blinking */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists