mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: KDSKBLED
@ 2001-06-23 20:34 Andries.Brouwer
  0 siblings, 0 replies; only message in thread
From: Andries.Brouwer @ 2001-06-23 20:34 UTC (permalink / raw)
  To: Andries.Brouwer, rld2h; +Cc: linux-kernel

    Why does the console ioctl, KDSKBLED, work with
    caps and num lock, but not scroll lock.
    ...
    But "setleds +scroll" changes the scroll lock led without
    changing the behavior of the keyboard.  I then have to press
    the scoll lock key twice to get the scroll lock light to turn off,
    because kbd->ledflagstate is out of sync with ledstate in the kernel.

The KDSKBLED in vt.c sets ledflagstate, which is tested directly
in the keyboard driver when the status of CapsLock or NumLock is needed.
(See kbd_kern.h, vc_kbd_led().)
However, the function of the ScrollLock key is to stop output,
and the "stopped" bit lives in the tty driver, not in the kbd driver.

You can trace what happens as follows:
1. What code is generated by the ScrollLock key? Ask showkey.
2. What keysym is bound to that code? Ask dumpkeys.
3. What is the hex value of that keysym? Ask dumpkeys -l.
In step 2 you found ScrollLock, in step 3 0x0209.
Now look at keyboard.c. The 02 part of 0209 is the index in the
array key_handler[], so we are going to call do_spec().
The 09 part of 0209 is the index in spec_fn_table[], so we
are going to call hold(). Now all is clear:

static void hold(void) {
        if (tty->stopped)
                start_tty(tty);
        else
                stop_tty(tty);
}

You see what happens. The setleds command sets the led, but does
not do stop_tty(). The next press on ScrollLock does stop_tty()
(and sets the led that was on already). The next press on ScrollLock
does start_tty() and clears the led again.

Is this a bug? I don't know. Slightly confusing perhaps,
but now that it has been like this for over seven years
I don't think there is reason to change, except possibly
as part of a global change of these drivers.

    > I noticed that the setleds program does not work with
    > scroll lock either.  In fact, it looks like it passes a
    > value of zero to the KDSKBLED ioctl when I do ./setleds +num,
    > which clears the num lock instead of setting it.

Works for me. Maybe you are using console-tools instead of kbd?

Andries


[cc to linux-kernel]


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-23 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-23 20:34 KDSKBLED Andries.Brouwer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®