Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Improving support for Sun Type 7 USB keyboards

                        Hi current-users,

On 22/04/2012 03:04, Pierre Pronchery wrote:
> I have just managed to improve support for my Sun Type 7 keyboard
> (0x00a2, 0x0430) on my amd64 box running netbsd-6: [...]

I have partly reverted the following patch, which was wrong:

> patch-ukbd_4_16_bit_translations.diff
> -------------------------------------
> Here, I have extended the size of the members of the ukbd_trtab array
> from 8 to 16 bits. This has allowed me to substitute key events to PS/2
> equivalents with "Fake ShiftL" events, which wouldn't have fit
> otherwise. After reading code from sys/dev/wscons/wskbd.c and
> sys/dev/pckbdport/pckbd.c this seems to be a valid change to me, but I
> would welcome more opinions.

Reading all of this more carefully, I have figured that the translation
to "Fake ShiftL" events is already handled in ukbd.c (while emulating
raw XT input). Raw keyboard keystrokes are limited in size, and are
basically assumed to be part of the KS_GROUP_Plain group of keysymbols.

This is also the case in X, as the xf86-input-keyboard driver explicitly
requests raw events (at least 1.3.2nb3 does). Therefore, reporting keys
not in the range allowed is impossible (such as the ones found on my Sun
Type 7 USB keyboard) except when (re-)using unassigned values. I have
chosen the ones here according to the "USB HID to PS/2 Scan Code
Translation Table" PDF, and to the contents of the wsUsbMap variable in
the src/bsd_KbdMap.c file of xf86-input-keyboard.

The sleep button is in the valid range already, and therefore reported
automatically as XF86Standby. This sample ~/.xmodmaprc file allows me to
report the rest:

keycode 117 = SunCompose
keycode 132 = SunOpen
keycode 133 = osfHelp
keycode 135 = SunProps
keycode 136 = SunFront
keycode 137 = SunStop
keycode 138 = SunAgain
keycode 139 = SunUndo
keycode 140 = SunCut
keycode 141 = SunCopy
keycode 142 = SunPaste
keycode 143 = SunFind

Finally, I am attaching a new patch that I would like to apply if worth
committing (patch-ukbd_5_no_useless_spltty.diff).

Next, I guess it would be nice to report a sysmon/pmf event when
pressing the sleep button, and ultimately to support wscons in regular
mode in xf86-input-xorg (at least in pkgsrc).

HTH and sorry for the slight mistake,
Index: ukbd.c
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.123
diff -p -u -r1.123 ukbd.c
--- ukbd.c      24 Apr 2012 01:02:12 -0000      1.123
+++ ukbd.c      24 Apr 2012 01:23:47 -0000
@@ -851,9 +851,11 @@ ukbd_decode(struct ukbd_softc *sc, struc
-               s = spltty();
-               wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
-               splx(s);
+               if (j > 0) {
+                       s = spltty();
+                       wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
+                       splx(s);
+               }
                if (npress != 0) {

Home | Main Index | Thread Index | Old Index