diff options
author | Alan Curry <pacman@kosh.dhis.org> | 2009-02-28 00:53:10 -0500 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-01 16:20:38 +1000 |
commit | 810fe3a4afd7e77a645c312f9475e75c2f7e925c (patch) | |
tree | 7d6a9fccc236d72157e6468666ad5ad1f85ee1bc | |
parent | 0fafdc024624d27ddffdcc4ff0047dec59ef33e2 (diff) |
KDGETLED needs a char, not an int.
KDGETLED actually only stores a single byte at the address indicated by
&real_leds, which on big-endian systems means the kernel's led state is put
into the most-significant byte of real_leds. The LED_CAP LED_NUM LED_SCR
macros then extract some bits from the least-significant byte, which still
contains stack garbage since real_leds hasn't been initialized.
Don't believe what the console_ioctl(4) man page says. It's wrong. Go read
drivers/char/vt_ioctl.c in the kernel source.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/lnx_kbd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index cfe35a3..9144464 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -73,7 +73,8 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) static int GetKbdLeds(InputInfoPtr pInfo) { - int real_leds, leds = 0; + char real_leds; + int leds = 0; ioctl(pInfo->fd, KDGETLED, &real_leds); |