From: Frank Praznik <frank.praznik@gmail.com>
To: linux-input@vger.kernel.org
Cc: Simon Wood <simon@mungewell.org>, Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] HID: hid-sony: Prevent LED overrun
Date: Tue, 17 Feb 2015 23:57:07 -0500 [thread overview]
Message-ID: <54E41BA3.7060107@gmail.com> (raw)
In-Reply-To: <1424229290-32089-1-git-send-email-simon@mungewell.org>
> 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 <si...@mungewell.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
Hi Simon,
I think this was a bug in the LED system itself fixed by this commit:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/leds/leds.h?id=56d06fdee534124f79b51ff92232373b783cddc2
In kernel 3.19 the brightness values are clamped correctly and I can't
replicate your bug.
Regards,
Frank
next prev parent reply other threads:[~2015-02-18 4:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 3:14 [PATCH] HID: hid-sony: Prevent LED overrun Simon Wood
2015-02-18 4:57 ` Frank Praznik [this message]
2015-02-18 5:32 ` simon
[not found] ` <CAH+9E3pSOb7GwGChVzSPjgq0j2B_1Ge4dcJKFRnj3WN9yTreDA@mail.gmail.com>
2015-02-18 16:24 ` simon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E41BA3.7060107@gmail.com \
--to=frank.praznik@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=simon@mungewell.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).