From: Vojtech P. <vo...@su...> - 2000-06-07 15:40:37
|
On Wed, Jun 07, 2000 at 10:46:33AM -0400, James Simmons wrote: > Vojtech while looking threw your code I noticed you have a > keybdev.c in the input directory which has code that is in keyboard.c. > Also you don't have it enabled. What I was thinking is have keybdev.c as > the raw keyboard driver. This way when a user uses /dev/input we can send > raw packets their. Otherwise it send the packets to the console system. > This way keyboard.c becomes more of a translator from raw keyboard mode to > a tty keyboard. A first move might be to move the keybaord tasklet into > keybdev.c. What do you think Vojtech? No. It works a little differently: 1) Current 2.4 way for AT keyboards: pc_keyb.c -(raw)-> keyboard.c -(raw)-> pc_keyb.c --> >--(cooked)-> keyboard.c -(chars)-> tty 2) Current 2.4 way for USB keyboards (uses keybdev): usb.c -(usb)-> hid.c -(events)-> input.c -(events)-> keybdev.c --> >--(raw)-> keyboard.c -(raw)-> pc_keyb.c -(cooked)-> keyboard.c --> >--(chars)-> tty 3) Ruby way for AT keyboards: i8042.c -(raw)-> atkbd.c -(events)-> input.c --> >--(events)-> keyboard.c -(chars)-> tty 4) Ruby way for USB keyboards: usb.c -(usb)-> hid.c -(events)-> input.c --> >--(events)-> keyboard.c -(chars)-> tty Basically keybdev.c is a module that takes input events, and emulates an AT keyboard, passing appropriate raw mode bytes to the original AT keyboard driver. This was the easiest way how to connect USB keyboards. But it's far from clean. There is no reason to converts the AT scancodes from, to and from raw again. keyboard.c, now, is a translator from events (which are compatible across all architectures and all input device types) to characters for the TTY. keyboard.c doesn't receive any raw scancodes, however, unfortunately, the tty layer has three modes - Cooked, MediumRaw, and Raw. Cooked mode is OK, it goes through a keymap. Event numbers can be used in the keymap. This has a nice effect that keymaps will be architecture independent, too. MediumRaw is seldomly used - and is event numbers again. Raw is used namely by XFree and SVGAlib - and because keyboard.c doesn't get rawmode data, it has to emulate it. The emulation has to be done somewhere, and best done closest to the app. So, what I see keyboard.c should be doing: * receiving events * generating a tty keyboard using keymaps * generating medraw/raw mode for apps that use that Perhaps I mean the same as you originally did - it's just that the rawmode driver is atkbd.c and not keybdev.c. -- Vojtech Pavlik SuSE Labs |