Subject: Re: RFC: X to use wskbd/wsmouse
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: tech-kern
Date: 02/13/2006 10:07:26
Note: CC moved to tech-kern to make it public.

Valeriy E. Ushakov wrote:
> On Mon, Feb 13, 2006 at 16:26:45 +0100, Reinoud Zandijk wrote:
>
>   
>> What is holding back X from using the wskbd interface and us to drop
>> all port custom X keyboard hacking?
>>     
>
> X has XKB which is infinitely more flexible than wskbd.  My be it's
> just that not all servers use it.  We don't need to reinvent the
> wheel, we just need to fix X servers to use XKB consistently and
> correctly.  X should be able to handle multiple input devices as well,
> so there should be no problem of adb vs usb keyboards mentioned later
> in the thread.
>
> SY, Uwe
>   

Yes, but there are other applications which might want to have a
consistent mapping table.  I don't want to reinvent XKB in every direct
console/framebuffer application I build.  (And yes, I will be building
at least a couple of these because frankly X is too heavyweight for
embedded use.  I'll be using an embedded graphics library instead.)

I understand that X wants raw key events (i.e. shift-s should be
delivered as shift-s, not S capitalized).  But we shouldn't need to have
each application know that on PS/2 the scan code for shift is value 1,
while it is a different value on USB, and yet another value with ADB, ad
nauseum.

I am proposing that the kernel keyboard drivers convert their scan codes
into USB keycodes before delivering them into wscons.  wscons can then
export either "raw" scan codes (actually already translated into USB),
or for apps that want them fully translated (chords, etc.) they can get
them that way.

For the folks on tech-kern who've not seen my earlier proposal, the
reason I suggested USB scan codes be standardized on is two fold:

    1) USB HID tables are very complete -- pretty much any key you can
imagine being on a keyboard has an entry in the HID tables.  Including
various bizarre extra keys, multimedia keys, and vendor-specific (Sun,
Apple) keys.

    2) X servers already know how to deal with USB scan codes, so we
don't have to touch any X server code

The counter-argument that some have made is that XFree is a bodge job
that relies on PS/2 scan codes.  I'm no X "expert", but it seems to me
that XFree must already know how to deal with USB keyboards, so in the
worst case it winds up performing an extra translation.  Well, so what. 
Maybe the XFree folks could be convinced to change their internal scan
code standard eventually anyway -- USB keyboards are becoming more
prevalent, and I think eventually the PS/2 keyboard standard is going to
go away.  (Yeah, I know, folks have been saying that for years now...)

-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191