Date: Fri, 7 Nov 2008 11:38:49 +0300 From: Eygene Ryabinkin <rea-fbsd@codelabs.ru> To: Jeremy Chadwick <koitsu@FreeBSD.org> Cc: freebsd-current@freebsd.org Subject: Re: USB4BSD (USB2): Microsoft 4000 keyboard unusable Message-ID: <4bSZ78p2klKnbZ/rhiyIIUK0VNE@qm7gbYKMPO53E/nl%2BD5eD8YyL1A> In-Reply-To: <20081107075232.GA1608@icarus.home.lan> References: <20081107075232.GA1608@icarus.home.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
--bKyqfOwhbdpXa4YI Content-Type: multipart/mixed; boundary="DKU6Jbt7q3WqK7+M" Content-Disposition: inline --DKU6Jbt7q3WqK7+M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Jeremy, good day. Thu, Nov 06, 2008 at 11:52:32PM -0800, Jeremy Chadwick wrote: [...] > Everything built (csup date: 2008/11/06 ~2200 PST) fine, no issues -- > until I noticed my USB keyboard didn't function any longer. >=20 > During boot0/boot2/loader, the keyboard functions (as expected, re: USB > Legacy option is enabled in my BIOS), and the keyboard LEDs are lit as > expected. The kernel loads, some drivers initialise, and the LEDs go > off. Once the USB2 stack loads, the keyboard LEDs turn back up, but as > stated, no keypresses are registered. I was forced to hook up a PS/2 > keyboard. [...] > The keyboard in question is a Microsoft Natural Ergonomic 4000. This > keyboard is known for being a real pain in the ass, since some of the > multimedia keys, and the infamous F-Lock key, are HID-controlled, while > alphanumeric are USB keyboard class controlled. I used to have this beast. I had simular problems with it, but I had managed to overcome them by switching the keyboard to the legacy boot protocol. I am attaching two old patches, one for the stock USB stack and one for the HPS stack (the old one, more than a year ago). So, they can be worthless now, but you can give it a shot. I had quickly ported my old patch to the current usb20 ukbd2.c, this patch is attached too, but I have no such keyboard at hand just now, so I can't test the patches in question. If you will succeed with them -- please, report back. Thanks! --=20 Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual =20 )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook=20 {_.-``-' {_/ # --DKU6Jbt7q3WqK7+M Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="FBSD-ms-ergo-4000-restore-f-keys.diff" Content-Transfer-Encoding: quoted-printable --- ukbd.c.orig 2007-10-05 11:50:35.000000000 +0400 +++ ukbd.c 2007-10-05 11:59:18.000000000 +0400 @@ -1423,6 +1423,7 @@ init_keyboard(ukbd_state_t *state, int *type, int flags) { usb_endpoint_descriptor_t *ed; + usbd_status err; =20 *type =3D KB_OTHER; =20 @@ -1447,6 +1448,14 @@ printf("ukbd: unexpected endpoint\n"); return EINVAL; } +=20 + err =3D usbd_set_protocol(state->ks_iface, 0); + if (err) { + printf("ukbd: set boot protocol failed\n"); + return EIO; + } else { + DPRINTFN(5, ("boot protocol set\n")); + } =20 /* Ignore if SETIDLE fails since it is not crucial. */ usbd_set_idle(state->ks_iface, 0, 0); --DKU6Jbt7q3WqK7+M Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="HPS-ms-ergo-4000-restore-f-keys.diff" Content-Transfer-Encoding: quoted-printable --- ukbd.c.orig 2007-07-26 09:47:07.548403000 +0400 +++ ukbd.c 2007-07-26 10:21:11.000000000 +0400 @@ -659,6 +659,15 @@ */ KBD_PROBE_DONE(kbd); =20 + err =3D usbreq_set_protocol(sc->sc_udev, sc->sc_iface_index, 0); + + DPRINTF(5, "protocol set\n"); + + if (err) { + device_printf(dev, "set protocol failed\n"); + goto detach; + } + /* ignore if SETIDLE fails, hence it is not crucial */ err =3D usbreq_set_idle(sc->sc_udev, sc->sc_iface_index, 0, 0); =20 --DKU6Jbt7q3WqK7+M Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="HPS-usb20-ms-ergo-4000-restore-f-keys.diff" Content-Transfer-Encoding: quoted-printable Untested stuff, produced as the reply to Jeremy Chadwick, see http://lists.freebsd.org/pipermail/freebsd-current/2008-November/000219.h= tml This patch just sets legacy boot device protocol for the USB keyboard, so it acts as the plain old keyboard, mostly without any fancy stuff like additional controls and so on. Index: sys/dev/usb2/input/ukbd2.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /s/cvs/fbsd/src/sys/dev/usb2/input/ukbd2.c,v retrieving revision 1.1 diff -u -r1.1 ukbd2.c --- sys/dev/usb2/input/ukbd2.c 4 Nov 2008 02:31:03 -0000 1.1 +++ sys/dev/usb2/input/ukbd2.c 7 Nov 2008 08:32:41 -0000 @@ -679,6 +679,16 @@ */ KBD_PROBE_DONE(kbd); =20 + /* + * Set boot protocol. + */ + err =3D usb2_req_set_protocol(sc->sc_udev, &Giant, + sc->sc_iface_index, 0); + if (err !=3D USB_ERR_NORMAL_COMPLETION) { + device_printf(dev, "set protocol failed"); + goto detach; + } + /* ignore if SETIDLE fails, hence it is not crucial */ err =3D usb2_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0); =20 --DKU6Jbt7q3WqK7+M-- --bKyqfOwhbdpXa4YI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkT/pkACgkQthUKNsbL7Yh4EgCgjb7OgAcyKiVSwBPqbGAr2nNW ZvYAn0OrXZlc5pFrT7lm9yTXSRET+Cv3 =wjHd -----END PGP SIGNATURE----- --bKyqfOwhbdpXa4YI--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4bSZ78p2klKnbZ/rhiyIIUK0VNE>