diff options
author | Simon Wood <simon@mungewell.org> | 2014-02-05 12:34:18 -0700 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-02-06 09:44:39 +0100 |
commit | 7db7504a49b378529793ca9d331318567c496cfe (patch) | |
tree | 6878c5782e75c904183dba3ce78109d1a0ca6e2d /drivers/hid | |
parent | e4321c5cebbee9fc4988223af9aa1298d939d388 (diff) | |
download | linux-7db7504a49b378529793ca9d331318567c496cfe.tar.gz linux-7db7504a49b378529793ca9d331318567c496cfe.tar.bz2 linux-7db7504a49b378529793ca9d331318567c496cfe.zip |
HID: hid-sony: report actual brightness value when reading LED
The Dualshock4 controller contains a RGB LED, which is enabled via
the '/sys/class/leds' interface. At present the driver only returns
whether each of the RGB LEDs is lit (ie not off), but no indication
of it's brightness.
This patch fixes the reading of the current brightnes so that it
returns the value (rather than just off=0, on=LED_FULL).
Tested on the DS4 and SixAxis (for compatibility).
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-sony.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 2bd3f130be20..be0d38611598 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -894,7 +894,6 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led) struct sony_sc *drv_data; int n; - int on = 0; drv_data = hid_get_drvdata(hdev); if (!drv_data) { @@ -903,13 +902,11 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led) } for (n = 0; n < drv_data->led_count; n++) { - if (led == drv_data->leds[n]) { - on = !!(drv_data->led_state[n]); - break; - } + if (led == drv_data->leds[n]) + return drv_data->led_state[n]; } - return on ? LED_FULL : LED_OFF; + return LED_OFF; } static void sony_leds_remove(struct hid_device *hdev) |