Greetings,

I recently bought a small keyboard that doesn't have a numeric keypad. It's made
by Everex, and at this time no datasheets are publicly available.

uhidev0 at uhub0 port 1 configuration 1 interface 0 "Ever Electronics
Corp. Usb KeyBoard" rev 1.10/1.05 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0 ignoring non-standard keycodes: 8 modifier keys, 6 key codes
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub0 port 1 configuration 1 interface 1 "Ever Electronics
Corp. Usb KeyBoard" rev 1.10/1.05 addr 2
uhidev1: iclass 3/0, 2 report ids
uhid0 at uhidev1 reportid 1: input=2, output=0, feature=0
uhid1 at uhidev1 reportid 2: input=2, output=0, feature=0

According to HID specs, it has more than 7 keycodes, and therefore it fails
to attach itself.

My patch limits the keycodes to 7, and ignores the rest. It works
perfectly fine now
on my laptop running current.


Index: ukbd.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.51
diff -u -p -r1.51 ukbd.c
--- ukbd.c      22 Feb 2010 17:24:20 -0000      1.51
+++ ukbd.c      26 May 2010 16:18:58 -0000
@@ -900,14 +900,17 @@ ukbd_parse_desc(struct ukbd_softc *sc)
                        /* Array */
                        if (h.loc.size != 8)
                                return ("key code size != 8");
-                       if (h.loc.count > MAXKEYCODE)
-                               return ("too many key codes");
                        if (h.loc.pos % 8 != 0)
                                return ("key codes not on byte boundary");
                        if (sc->sc_nkeycode != 0)
                                return ("multiple key code arrays\n");
                        sc->sc_keycodeloc = h.loc;
-                       sc->sc_nkeycode = h.loc.count;
+                       if (h.loc.count > MAXKEYCODE) {
+                               printf (" ignoring non-standard keycodes");
+                               sc->sc_nkeycode = MAXKEYCODE;
+                       }
+                       else
+                               sc->sc_nkeycode = h.loc.count;
                }
        }
        sc->sc_nmod = imod;


Any idea on how I can improve it ?
Thanks in advance,

//Logan
C-x-C-c

Reply via email to