提交 7db7504a 编写于 作者: S Simon Wood 提交者: Jiri Kosina

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: NSimon Wood <simon@mungewell.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 e4321c5c
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册