Current-Users archive

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

Improving support for Sun Type 7 USB keyboards



                        Hi everyone,

I have just managed to improve support for my Sun Type 7 keyboard
(0x00a2, 0x0430) on my amd64 box running netbsd-6:
- reporting PMF events on volume up/down/toggle
- more specifically, reporting key events for the extra keys on the
  left (Help, Stop, Again...)

I have sorted these changes as five successive patches to -current, for
which I would welcome a review before committing them myself; the last
includes them all together, so it is enough to review this one. The
successive changes are detailed below.


patch-ukbd_0_trtab_gdium_terminate.diff
----------------------------------------
Terminates the trtab_gdium_fn array, which I currently believe to not
be, with a potential out-of-bounds access in ukbd_translate_keycodes()

patch-ukbd_1_trtab_gdium_spacing.diff
-------------------------------------
Just aligns the contents of this array with the surrounding arrays of
the same type.

patch-ukbd_2_trtab_generic_pmf_volume.diff
-------------------------------------------
Converts keycodes 0x7f, 0x80 and 0x81 to PMF events VOLUME_TOGGLE,
VOLUME_UP and VOLUME_DOWN as observed on my keyboard, and also found in
the documentation mentioned in ukbd.c:
http://www.microsoft.com/whdc/archive/scancode.mspx

Unfortunately I am not exactly sure how to confirm this to be working
(powerd?).

patch-ukbd_3_compose.diff
--------------------------
Also lookup and be able to lit the LED for the Compose key. I could
confirm it to be working when plugging the keyboard (with all four LEDs
blinking), however it seems to need additional support in
xf86-input-keyboard to function properly in X. I haven't tested it in
console mode.

Moreover, this is the only USB keyboard in my disposal at the moment, so
I cannot be sure that there aren't any regressions on regular keyboards
(with the usual three LEDs).

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.

In any case, I could confirm this change to work properly on my setup.


HTH,
-- 
khorben
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.117
diff -p -u -r1.117 ukbd.c
--- sys/dev/usb/ukbd.c  11 Mar 2012 01:06:07 -0000      1.117
+++ sys/dev/usb/ukbd.c  22 Apr 2012 00:18:52 -0000
@@ -170,7 +170,8 @@ Static const struct ukbd_keycodetrans tr
 #endif
                { 76, 71 },     /* delete -> scroll lock */
                { 81, 78 },     /* down -> page down */
-               { 82, 75 }      /* up -> page up */
+               { 82, 75 },     /* up -> page up */
+               {  0, 0 }
 };
 #endif
 
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.117
diff -p -u -r1.117 ukbd.c
--- sys/dev/usb/ukbd.c  11 Mar 2012 01:06:07 -0000      1.117
+++ sys/dev/usb/ukbd.c  22 Apr 2012 00:22:16 -0000
@@ -150,27 +150,28 @@ Static const struct ukbd_keycodetrans tr
 #ifdef GDIUM_KEYBOARD_HACK
 Static const struct ukbd_keycodetrans trtab_gdium_fn[] = {     
 #ifdef notyet
-               { 58, 0 },      /* F1 -> toggle camera */
-               { 59, 0 },      /* F2 -> toggle wireless */
+       { 58, 0 },      /* F1 -> toggle camera */
+       { 59, 0 },      /* F2 -> toggle wireless */
 #endif
-               { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
-               { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
-               { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 #ifdef notyet
-               { 63, 0 },      /* F6 -> toggle ext. video */
-               { 64, 0 },      /* F7 -> toggle mouse */
+       { 63, 0 },      /* F6 -> toggle ext. video */
+       { 64, 0 },      /* F7 -> toggle mouse */
 #endif
-               { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
-               { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
+       { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
+       { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
 #ifdef notyet
-               { 67, 0 },      /* F10 -> suspend */
-               { 68, 0 },      /* F11 -> user1 */
-               { 69, 0 },      /* F12 -> user2 */
-               { 70, 0 },      /* print screen -> sysrq */
-#endif
-               { 76, 71 },     /* delete -> scroll lock */
-               { 81, 78 },     /* down -> page down */
-               { 82, 75 }      /* up -> page up */
+       { 67, 0 },      /* F10 -> suspend */
+       { 68, 0 },      /* F11 -> user1 */
+       { 69, 0 },      /* F12 -> user2 */
+       { 70, 0 },      /* print screen -> sysrq */
+#endif
+       { 76, 71 },     /* delete -> scroll lock */
+       { 81, 78 },     /* down -> page down */
+       { 82, 75 },     /* up -> page up */
+       {  0, 0 }
 };
 #endif
 
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.117
diff -p -u -r1.117 ukbd.c
--- sys/dev/usb/ukbd.c  11 Mar 2012 01:06:07 -0000      1.117
+++ sys/dev/usb/ukbd.c  22 Apr 2012 00:25:29 -0000
@@ -150,30 +150,38 @@ Static const struct ukbd_keycodetrans tr
 #ifdef GDIUM_KEYBOARD_HACK
 Static const struct ukbd_keycodetrans trtab_gdium_fn[] = {     
 #ifdef notyet
-               { 58, 0 },      /* F1 -> toggle camera */
-               { 59, 0 },      /* F2 -> toggle wireless */
+       { 58, 0 },      /* F1 -> toggle camera */
+       { 59, 0 },      /* F2 -> toggle wireless */
 #endif
-               { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
-               { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
-               { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 #ifdef notyet
-               { 63, 0 },      /* F6 -> toggle ext. video */
-               { 64, 0 },      /* F7 -> toggle mouse */
+       { 63, 0 },      /* F6 -> toggle ext. video */
+       { 64, 0 },      /* F7 -> toggle mouse */
 #endif
-               { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
-               { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
+       { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
+       { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
 #ifdef notyet
-               { 67, 0 },      /* F10 -> suspend */
-               { 68, 0 },      /* F11 -> user1 */
-               { 69, 0 },      /* F12 -> user2 */
-               { 70, 0 },      /* print screen -> sysrq */
-#endif
-               { 76, 71 },     /* delete -> scroll lock */
-               { 81, 78 },     /* down -> page down */
-               { 82, 75 }      /* up -> page up */
+       { 67, 0 },      /* F10 -> suspend */
+       { 68, 0 },      /* F11 -> user1 */
+       { 69, 0 },      /* F12 -> user2 */
+       { 70, 0 },      /* print screen -> sysrq */
+#endif
+       { 76, 71 },     /* delete -> scroll lock */
+       { 81, 78 },     /* down -> page down */
+       { 82, 75 },     /* up -> page up */
+       {  0, 0 }
 };
 #endif
 
+Static const struct ukbd_keycodetrans trtab_generic[] = {
+       { 0x7f, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 0x80, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 0x81, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 0x00, 0x00 }
+};
+
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
 #define NN 0                   /* no translation */
 /*
@@ -659,6 +667,8 @@ ukbd_intr(struct uhidev *addr, void *ibu
        }
 #endif
 
+       ukbd_translate_keycodes(sc, ud, trtab_generic);
+
        if ((sc->sc_flags & FLAG_DEBOUNCE) && !(sc->sc_flags & FLAG_POLLING)) {
                /*
                 * Some keyboards have a peculiar quirk.  They sometimes
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.117
diff -p -u -r1.117 ukbd.c
--- sys/dev/usb/ukbd.c  11 Mar 2012 01:06:07 -0000      1.117
+++ sys/dev/usb/ukbd.c  22 Apr 2012 00:32:11 -0000
@@ -150,30 +150,38 @@ Static const struct ukbd_keycodetrans tr
 #ifdef GDIUM_KEYBOARD_HACK
 Static const struct ukbd_keycodetrans trtab_gdium_fn[] = {     
 #ifdef notyet
-               { 58, 0 },      /* F1 -> toggle camera */
-               { 59, 0 },      /* F2 -> toggle wireless */
+       { 58, 0 },      /* F1 -> toggle camera */
+       { 59, 0 },      /* F2 -> toggle wireless */
 #endif
-               { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
-               { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
-               { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 #ifdef notyet
-               { 63, 0 },      /* F6 -> toggle ext. video */
-               { 64, 0 },      /* F7 -> toggle mouse */
+       { 63, 0 },      /* F6 -> toggle ext. video */
+       { 64, 0 },      /* F7 -> toggle mouse */
 #endif
-               { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
-               { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
+       { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
+       { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
 #ifdef notyet
-               { 67, 0 },      /* F10 -> suspend */
-               { 68, 0 },      /* F11 -> user1 */
-               { 69, 0 },      /* F12 -> user2 */
-               { 70, 0 },      /* print screen -> sysrq */
-#endif
-               { 76, 71 },     /* delete -> scroll lock */
-               { 81, 78 },     /* down -> page down */
-               { 82, 75 }      /* up -> page up */
+       { 67, 0 },      /* F10 -> suspend */
+       { 68, 0 },      /* F11 -> user1 */
+       { 69, 0 },      /* F12 -> user2 */
+       { 70, 0 },      /* print screen -> sysrq */
+#endif
+       { 76, 71 },     /* delete -> scroll lock */
+       { 81, 78 },     /* down -> page down */
+       { 82, 75 },     /* up -> page up */
+       {  0, 0 }
 };
 #endif
 
+Static const struct ukbd_keycodetrans trtab_generic[] = {
+       { 0x7f, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 0x80, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 0x81, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 0x00, 0x00 }
+};
+
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
 #define NN 0                   /* no translation */
 /*
@@ -261,6 +269,7 @@ struct ukbd_softc {
        struct hid_location sc_numloc;
        struct hid_location sc_capsloc;
        struct hid_location sc_scroloc;
+       struct hid_location sc_compose;
        int sc_leds;
        device_t sc_wskbddev;
 
@@ -466,7 +475,8 @@ ukbd_attach(device_t parent, device_t se
        callout_init(&sc->sc_delay, 0);
 
        /* Flash the leds; no real purpose, just shows we're alive. */
-       ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS);
+       ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS
+                       | WSKBD_LED_COMPOSE);
        usbd_delay_ms(uha->parent->sc_udev, 400);
        ukbd_set_leds(sc, 0);
 
@@ -659,6 +669,8 @@ ukbd_intr(struct uhidev *addr, void *ibu
        }
 #endif
 
+       ukbd_translate_keycodes(sc, ud, trtab_generic);
+
        if ((sc->sc_flags & FLAG_DEBOUNCE) && !(sc->sc_flags & FLAG_POLLING)) {
                /*
                 * Some keyboards have a peculiar quirk.  They sometimes
@@ -881,6 +893,8 @@ ukbd_set_leds(void *v, int leds)
        sc->sc_leds = leds;
        res = 0;
        /* XXX not really right */
+       if ((leds & WSKBD_LED_COMPOSE) && sc->sc_compose.size == 1)
+               res |= 1 << sc->sc_compose.pos;
        if ((leds & WSKBD_LED_SCROLL) && sc->sc_scroloc.size == 1)
                res |= 1 << sc->sc_scroloc.pos;
        if ((leds & WSKBD_LED_NUM) && sc->sc_numloc.size == 1)
@@ -1074,6 +1088,8 @@ ukbd_parse_desc(struct ukbd_softc *sc)
                   sc->sc_hdev.sc_report_id, hid_output, &sc->sc_capsloc, NULL);
        hid_locate(desc, size, HID_USAGE2(HUP_LEDS, HUD_LED_SCROLL_LOCK),
                   sc->sc_hdev.sc_report_id, hid_output, &sc->sc_scroloc, NULL);
+       hid_locate(desc, size, HID_USAGE2(HUP_LEDS, HUD_LED_COMPOSE),
+                  sc->sc_hdev.sc_report_id, hid_output, &sc->sc_compose, NULL);
 
        return (NULL);
 }
Index: sys/dev/usb/ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.117
diff -p -u -r1.117 ukbd.c
--- sys/dev/usb/ukbd.c  11 Mar 2012 01:06:07 -0000      1.117
+++ sys/dev/usb/ukbd.c  22 Apr 2012 00:37:17 -0000
@@ -150,30 +150,38 @@ Static const struct ukbd_keycodetrans tr
 #ifdef GDIUM_KEYBOARD_HACK
 Static const struct ukbd_keycodetrans trtab_gdium_fn[] = {     
 #ifdef notyet
-               { 58, 0 },      /* F1 -> toggle camera */
-               { 59, 0 },      /* F2 -> toggle wireless */
+       { 58, 0 },      /* F1 -> toggle camera */
+       { 59, 0 },      /* F2 -> toggle wireless */
 #endif
-               { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
-               { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
-               { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 #ifdef notyet
-               { 63, 0 },      /* F6 -> toggle ext. video */
-               { 64, 0 },      /* F7 -> toggle mouse */
+       { 63, 0 },      /* F6 -> toggle ext. video */
+       { 64, 0 },      /* F7 -> toggle mouse */
 #endif
-               { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
-               { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
+       { 65, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
+       { 66, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
 #ifdef notyet
-               { 67, 0 },      /* F10 -> suspend */
-               { 68, 0 },      /* F11 -> user1 */
-               { 69, 0 },      /* F12 -> user2 */
-               { 70, 0 },      /* print screen -> sysrq */
-#endif
-               { 76, 71 },     /* delete -> scroll lock */
-               { 81, 78 },     /* down -> page down */
-               { 82, 75 }      /* up -> page up */
+       { 67, 0 },      /* F10 -> suspend */
+       { 68, 0 },      /* F11 -> user1 */
+       { 69, 0 },      /* F12 -> user2 */
+       { 70, 0 },      /* print screen -> sysrq */
+#endif
+       { 76, 71 },     /* delete -> scroll lock */
+       { 81, 78 },     /* down -> page down */
+       { 82, 75 },     /* up -> page up */
+       {  0, 0 }
 };
 #endif
 
+Static const struct ukbd_keycodetrans trtab_generic[] = {
+       { 0x7f, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+       { 0x80, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+       { 0x81, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+       { 0x00, 0x00 }
+};
+
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
 #define NN 0                   /* no translation */
 /*
@@ -187,39 +195,39 @@ Static const struct ukbd_keycodetrans tr
  * For example, some keys generate Fake ShiftL events (e0 2a)
  * before the actual key sequence.
  */
-Static const u_int8_t ukbd_trtab[256] = {
-      NN,   NN,   NN,   NN, 0x1e, 0x30, 0x2e, 0x20, /* 00 - 07 */
-    0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, /* 08 - 0f */
-    0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1f, 0x14, /* 10 - 17 */
-    0x16, 0x2f, 0x11, 0x2d, 0x15, 0x2c, 0x02, 0x03, /* 18 - 1f */
-    0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, /* 20 - 27 */
-    0x1c, 0x01, 0x0e, 0x0f, 0x39, 0x0c, 0x0d, 0x1a, /* 28 - 2f */
-    0x1b, 0x2b, 0x2b, 0x27, 0x28, 0x29, 0x33, 0x34, /* 30 - 37 */
-    0x35, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, /* 38 - 3f */
-    0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xb7, 0x46, /* 40 - 47 */
-    0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */
-    0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */
-    0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */
-    0x48, 0x49, 0x52, 0x53, 0x56, 0xdd,   NN, 0x59, /* 60 - 67 */
-    0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,   NN, /* 68 - 6f */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 70 - 77 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 78 - 7f */
-      NN,   NN,   NN,   NN,   NN, 0x7e,   NN, 0x73, /* 80 - 87 */
-    0x70, 0x7d, 0x79, 0x7b, 0x5c,   NN,   NN,   NN, /* 88 - 8f */
-      NN,   NN, 0x78, 0x77, 0x76,   NN,   NN,   NN, /* 90 - 97 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 98 - 9f */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* a0 - a7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* a8 - af */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* b0 - b7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* b8 - bf */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* c0 - c7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* c8 - cf */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* d0 - d7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* d8 - df */
-    0x1d, 0x2a, 0x38, 0xdb, 0x9d, 0x36, 0xb8, 0xdc, /* e0 - e7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* e8 - ef */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* f0 - f7 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* f8 - ff */
+Static const u_int16_t ukbd_trtab[256] = {
+      NN,    NN,    NN,    NN,  0x1e,  0x30,  0x2e,  0x20, /* 00 - 07 */
+    0x12,  0x21,  0x22,  0x23,  0x17,  0x24,  0x25,  0x26, /* 08 - 0f */
+    0x32,  0x31,  0x18,  0x19,  0x10,  0x13,  0x1f,  0x14, /* 10 - 17 */
+    0x16,  0x2f,  0x11,  0x2d,  0x15,  0x2c,  0x02,  0x03, /* 18 - 1f */
+    0x04,  0x05,  0x06,  0x07,  0x08,  0x09,  0x0a,  0x0b, /* 20 - 27 */
+    0x1c,  0x01,  0x0e,  0x0f,  0x39,  0x0c,  0x0d,  0x1a, /* 28 - 2f */
+    0x1b,  0x2b,  0x2b,  0x27,  0x28,  0x29,  0x33,  0x34, /* 30 - 37 */
+    0x35,  0x3a,  0x3b,  0x3c,  0x3d,  0x3e,  0x3f,  0x40, /* 38 - 3f */
+    0x41,  0x42,  0x43,  0x44,  0x57,  0x58,  0xb7,  0x46, /* 40 - 47 */
+    0x7f,  0xd2,  0xc7,  0xc9,  0xd3,  0xcf,  0xd1,  0xcd, /* 48 - 4f */
+    0xcb,  0xd0,  0xc8,  0x45,  0xb5,  0x37,  0x4a,  0x4e, /* 50 - 57 */
+    0x9c,  0x4f,  0x50,  0x51,  0x4b,  0x4c,  0x4d,  0x47, /* 58 - 5f */
+    0x48,  0x49,  0x52,  0x53,  0x56,  0xdd,0xe05f,  0x59, /* 60 - 67 */
+    0x64,  0x65,  0x66,  0x67,  0x68,  0x69,  0x6a,    NN, /* 68 - 6f */
+      NN,    NN,    NN,    NN,0xf38b,0xf38a,0xf38f,0xf38d, /* 70 - 77 */
+  0xf396,0xf38e,0xf390,0xf395,0xf392,0xf394,0xf38c,    NN, /* 78 - 7f */
+      NN,    NN,    NN,    NN,    NN,  0x7e,    NN,  0x73, /* 80 - 87 */
+    0x70,  0x7d,  0x79,  0x7b,  0x5c,    NN,    NN,    NN, /* 88 - 8f */
+      NN,    NN,  0x78,  0x77,  0x76,    NN,    NN,    NN, /* 90 - 97 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* 98 - 9f */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* a0 - a7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* a8 - af */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* b0 - b7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* b8 - bf */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* c0 - c7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* c8 - cf */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* d0 - d7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* d8 - df */
+    0x1d,  0x2a,  0x38,  0xdb,  0x9d,  0x36,  0xb8,  0xdc, /* e0 - e7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* e8 - ef */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* f0 - f7 */
+      NN,    NN,    NN,    NN,    NN,    NN,    NN,    NN, /* f8 - ff */
 };
 #endif /* defined(WSDISPLAY_COMPAT_RAWKBD) */
 
@@ -261,6 +269,7 @@ struct ukbd_softc {
        struct hid_location sc_numloc;
        struct hid_location sc_capsloc;
        struct hid_location sc_scroloc;
+       struct hid_location sc_compose;
        int sc_leds;
        device_t sc_wskbddev;
 
@@ -466,7 +475,8 @@ ukbd_attach(device_t parent, device_t se
        callout_init(&sc->sc_delay, 0);
 
        /* Flash the leds; no real purpose, just shows we're alive. */
-       ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS);
+       ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS
+                       | WSKBD_LED_COMPOSE);
        usbd_delay_ms(uha->parent->sc_udev, 400);
        ukbd_set_leds(sc, 0);
 
@@ -659,6 +669,8 @@ ukbd_intr(struct uhidev *addr, void *ibu
        }
 #endif
 
+       ukbd_translate_keycodes(sc, ud, trtab_generic);
+
        if ((sc->sc_flags & FLAG_DEBOUNCE) && !(sc->sc_flags & FLAG_POLLING)) {
                /*
                 * Some keyboards have a peculiar quirk.  They sometimes
@@ -881,6 +893,8 @@ ukbd_set_leds(void *v, int leds)
        sc->sc_leds = leds;
        res = 0;
        /* XXX not really right */
+       if ((leds & WSKBD_LED_COMPOSE) && sc->sc_compose.size == 1)
+               res |= 1 << sc->sc_compose.pos;
        if ((leds & WSKBD_LED_SCROLL) && sc->sc_scroloc.size == 1)
                res |= 1 << sc->sc_scroloc.pos;
        if ((leds & WSKBD_LED_NUM) && sc->sc_numloc.size == 1)
@@ -1074,6 +1088,8 @@ ukbd_parse_desc(struct ukbd_softc *sc)
                   sc->sc_hdev.sc_report_id, hid_output, &sc->sc_capsloc, NULL);
        hid_locate(desc, size, HID_USAGE2(HUP_LEDS, HUD_LED_SCROLL_LOCK),
                   sc->sc_hdev.sc_report_id, hid_output, &sc->sc_scroloc, NULL);
+       hid_locate(desc, size, HID_USAGE2(HUP_LEDS, HUD_LED_COMPOSE),
+                  sc->sc_hdev.sc_report_id, hid_output, &sc->sc_compose, NULL);
 
        return (NULL);
 }
Index: sys/dev/wscons/wsksymdef.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsksymdef.h,v
retrieving revision 1.65
diff -p -u -r1.65 wsksymdef.h
--- sys/dev/wscons/wsksymdef.h  22 Jul 2011 18:17:12 -0000      1.65
+++ sys/dev/wscons/wsksymdef.h  22 Apr 2012 00:37:17 -0000
@@ -544,6 +544,7 @@
 #define KS_Open                 0xf393
 #define KS_Paste                0xf394
 #define KS_Cut                  0xf395
+#define KS_Stop                 0xf396
 
 #define KS_Menu                        0xf3c0
 #define KS_Pause               0xf3c1


Home | Main Index | Thread Index | Old Index