Skip to main content
16 events
when toggle format what by license comment
S Dec 3, 2013 at 11:20 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
Sync with 3.12.2 and add some direct links to Linux Cross Reference for easier navigation
S Dec 3, 2013 at 11:20 history suggested mmoya CC BY-SA 3.0
Sync with 3.12.2 and add some direct links to Linux Cross Reference for easier navigation
Dec 3, 2013 at 10:14 review Suggested edits
Dec 3, 2013 at 11:20
Feb 5, 2013 at 17:01 history edited goldilocks CC BY-SA 3.0
added 1259 characters in body
Feb 5, 2013 at 16:06 comment added goldilocks @user31765: I think see the missing link then -- I've added a few paragraphs at the end which hopefully wrap that up.
Feb 5, 2013 at 16:02 history edited goldilocks CC BY-SA 3.0
added 878 characters in body
Feb 5, 2013 at 15:42 comment added user31765 OK, thanks for the hint about console_callback(). It looks like first in the call sequence is kbd_event() in keyboard.c which calls schedule_console_callback() and then console_callback() in vt.c gets called and from there we call change_console() to change the virtual terminal. Like you said, the missing link in this chain is how we end up at kbd_event() in keyboard.c.
Feb 5, 2013 at 15:16 history edited goldilocks CC BY-SA 3.0
added 179 characters in body
Feb 5, 2013 at 15:11 comment added goldilocks There's more potentially related stuff in drivers/hid. Also notice 'console_callback()' in vt.c, which can do the switch and is registered at the top via DECLARE_WORK. This relates to the scheduler: lxr.free-electrons.com/ident?i=DECLARE_WORK (that cross-reference tool can be fed from makelinux.net/kernel_map which you might find interesting); I'd assume that makes that function kind of a "main loop" for the vt. Obviously the missing link here is exactly how keyboard events get passed around.
Feb 5, 2013 at 3:02 comment added user31765 Upon inspecting the code more closely, there are only three non-obsolete functions in keyboard.c which call set_console: fn_lastcons(), fn_dec_console(), and fn_inc_console(). One for going to the last console and one for going to the right or the left. So I still don't understand how set_console() gets called when we press Ctrl+Alt+F<num>. I assume we have to pass <num> as a parameter to set_console() somewhere. I see that set_console() crops up in vt_ioctl.c too, but isn't that just for ioctl's from user space, e.g. from chvt? There are still some holes in my understanding.
Feb 5, 2013 at 2:39 vote accept user31765
Feb 4, 2013 at 23:38 comment added goldilocks PS. Many of the kernel devs are on the on the linux kernel mail list (LKML) which is open to the public, and if you mind your P&Qs etc (tux.org/lkml) it is worthwhile inquiring there...just make sure you set up a folder for it right away, there is a LOT of mail involved.
Feb 4, 2013 at 23:27 comment added goldilocks No, I don't think so. It's all part of the tty driver, for which keyboard.c would be an event handler; the "keyboard driver" itself would be lower level -- there's bunches of them in drivers/input/keyboard/ for non-usb stuff. Usb stuff is standardized so there would only be one (probably involving drivers/hid/usbhid/usbkbd.c). I'm guessing that the keyboard driver is for producing a scancode that can be handed to vt/keyboard.c (see getkeycode() near the top of that). Documentation/input/input.txt has some (wonderfully ancient, lol) hints.
Feb 4, 2013 at 22:32 comment added user31765 Thanks, this is exactly what I was looking for. Can you elaborate on what happens earlier in the chain? How does the the code in keyboard.c get called when we press Ctrl + Alt + F1? keyboard.c is not the actual "keyboard driver", is it?
Feb 4, 2013 at 21:05 history edited goldilocks CC BY-SA 3.0
added 102 characters in body
Feb 4, 2013 at 20:59 history answered goldilocks CC BY-SA 3.0