Subject: Re: Sun Type6 USB keyboard & X
To: Michael <macallan18@earthlink.net>
From: Sean Davis <dive@endersgame.net>
List: current-users
Date: 10/24/2005 13:56:16
On Mon, Oct 24, 2005 at 01:01:41PM -0400, Michael wrote:
> Hello,
> 
> > > > > I've recently switched to a type6 usb keyboard on my PC. Using
> > > > > wskbd @ ukbd is working just fine for console and X, however I'm
> > > > > wondering.. where do I need to dig around if I'd like to use the
> > > > > sun buttons (the L pad on the left, and the volume
> > > > > controls/sleep button on the right)? I was looking at output
> > > > > from xev, and nothing happens when those keys are punched. I
> > > > > would like to bind them to perform useful functions (or at least
> > > > > keystrokes) but I don't see how I could do that with xmodmap if
> > > > > xev isn't even picking up keypress/release events.
> > > > > 
> > > > > Any pointers would be much appreciated.
> > > > 
> > > > Do you get any other uhid devices? (The whole probe output from
> > > > the keyboard would be good to see) Sometimes keyboards with
> > > > "extra" magic keys have them show up as non-keyboard HID input
> > > > widgets.
> > > 
> > > This is a bug ( or a misfeature ) in XFree's USB keymap and has been
> > > fixed in 3.0. In 2.x and older the Sun keys are simply mapped to
> > > nothing and there's no way to change this short of recompiling part
> > > of the Xserver. 
> > 
> > NetBSD 3.0?
> > XFree86 Version 4.5.0
> > NetBSD jane.endersgame.net 3.99.10 NetBSD 3.99.10 (JANE) #8: Sun Oct
> > 23 20:59:00 EDT 2005
> dive@jane.endersgame.net:/sys/arch/i386/compile/JANE i386
> 
> This should be recent enough, the keyboard stuff has been committed
> months ago. Which keyboard driver are you using? 
> 
> The section for the Sun keyboard in your XF86Config should look like
> this:
> 
> Section "InputDevice"
>         Identifier  "Keyboard0"
>         Driver      "kbd"
>         Option  "XkbRules" "xfree86"
>         Option  "XkbModel" "pc105"
>         Option  "XkbLayout" "us"
>         Option      "Protocol" "wskbd"
>         Option      "Device" "/dev/wskbd"
> EndSection
> 
> XkbModel is a blatant lie but right now it has to be like that. It
> definitely works for me ( on sparc64 and macppc )
> 
> > So I just need to rebuild xsrc, I guess? (also, what is this usb
> > keymap you speak of? :)
> 
> No need to rebuild I think.
> XFree translates all keyboard input to a common set of keycodes ( that's
> why the Xkb rules look so weird ), it has a bunch of compiled-in tables
> for this. The table for USB keyboards was missing the Sun extra keys so
> they are mapped to nothing which is why you don't see events in xev.
> There are two keyboard drivers - 'keyboard' which only works properly
> with PS/2 and USB keyboards and doesn't know about Sun keys and 'kbd'
> which only works properly with everything else and USB and which does
> know about the extra keys ( it doesn't properly translate multibyte PS/2
> scancodes, that's why it has problems with PS/2 keyboards )

I'm seeing the events in xev now, however, every sun key gives the exact
same thing:

KeyPress event, serial 33, synthetic NO, window 0x2800001,
    root 0x40, subw 0x2800002, time 282992, (55,29), root:(59,742),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x2800001,
    root 0x40, subw 0x2800002, time 283160, (55,29), root:(59,742),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:

KeyPress event, serial 33, synthetic NO, window 0x2800001,
    root 0x40, subw 0x2800002, time 283503, (55,29), root:(59,742),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x2800001,
    root 0x40, subw 0x2800002, time 283641, (55,29), root:(59,742),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:

Where do I go from here?

-Sean