mirror of https://github.com/encounter/SDL.git
Fixed bug 4347 - Keyboard LEDs don't work on linux console
Rainer Sabelka When using SLD2 on a Linux console with the KMS/DRM video backend and Linux evdev keyboard support, the caps lock, scroll lock, and num lock leds do not work. The attached patch adds ioctls for setting the LED state in SDL_evdev_kbd.c
This commit is contained in:
parent
6c029f127d
commit
9af581bd75
|
@ -510,17 +510,19 @@ static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
|
||||||
|
|
||||||
static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
{
|
{
|
||||||
return ((kbd->ledflagstate >> flag) & 1);
|
return (kbd->ledflagstate & flag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
{
|
{
|
||||||
kbd->ledflagstate |= 1 << flag;
|
kbd->ledflagstate |= flag;
|
||||||
|
ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
{
|
{
|
||||||
kbd->ledflagstate &= ~(1 << flag);
|
kbd->ledflagstate &= ~flag;
|
||||||
|
ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag)
|
static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
|
@ -535,7 +537,8 @@ static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
|
|
||||||
static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
|
||||||
{
|
{
|
||||||
kbd->ledflagstate ^= 1 << flag;
|
kbd->ledflagstate ^= flag;
|
||||||
|
ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue