[PATCH kdrive/evdev] kdrive/evdev: update keyboard LEDs (#22302)

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Mon Feb 15 13:32:01 UTC 2016


Implement missing parts in kdrive evdev driver for
correct update of evdev keyboard LEDs.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=22302

Signed-off-by: Laércio de Sousa <laerciosousa at sme-mogidascruzes.sp.gov.br>
---
 hw/kdrive/linux/evdev.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index cdd45e7..32350a6 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -442,10 +442,18 @@ EvdevKbdEnable(KdKeyboardInfo * ki)
 static void
 EvdevKbdLeds(KdKeyboardInfo * ki, int leds)
 {
-/*    struct input_event event;
+    struct input_event event;
     Kevdev             *ke;
 
-    ki->driverPrivate = ke;
+    if (!ki)
+        return;
+
+    ke = ki->driverPrivate;
+
+    if (!ke) {
+        ErrorF("Can't update LEDs of disabled evdev keyboard %s.\n", ki->path);
+        return;
+    }
 
     memset(&event, 0, sizeof(event));
 
@@ -468,7 +476,6 @@ EvdevKbdLeds(KdKeyboardInfo * ki, int leds)
     event.code = LED_COMPOSE;
     event.value = leds & (1 << 3) ? 1 : 0;
     write(ke->fd, (char *) &event, sizeof(event));
-*/
 }
 
 static void
-- 
2.7.1



More information about the xorg-devel mailing list