usb/116947: [patch] enable boot protocol on the USB keyboards

Eygene Ryabinkin rea-fbsd at codelabs.ru
Fri Oct 5 01:30:15 PDT 2007


>Number:         116947
>Category:       usb
>Synopsis:       [patch] enable boot protocol on the USB keyboards
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 05 08:30:14 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
Code Labs
>Environment:

System: FreeBSD XXX 7.0-CURRENT FreeBSD 7.0-CURRENT #12: Fri Oct 5 11:59:33 MSD 2007 root at XXX:/usr/src/sys/i386/compile/XXX i386

>Description:

I have two keyboards, MS Natural Ergonomic 4000 v. 1.0 and Logitech
UltraX Premium Keyboard, whose F-keys are not recognized since the
ukbd.c, version 1.70.  And the problem is that 1.70 dropped
initialization of the USB boot protocol for the USB keyboards.  I
understand that it was done after NetBSD's move, but the ukbd.c
from NetBSD (revision 1.75) that eliminated boot protocol setting,
added report descriptor parsing, so it does not care about the
actual protocol device speaks: it just parses current report
descriptor.

FreeBSD still uses the hardcoded boot protocol descriptor, so device
should be initialized to speak the boot protocol.  And, as the
section 7.2.6 of the HID specification (v. 1.11, 27/06/2001) says,
one should not assume that the particular report protocol will be
used upon the device initialization and should set the desired
protocol explicitely.

I understand that the elimination of the usbd_set_protocol() healed
the issue in the usb/77940, but this fix contradicts with the USB
HID specification and NetBSD's change is not an argument here,
because they extensively reworked the HID parser.

>How-To-Repeat:

Plug one of the mentioned keyboards into the box with FreeBSD
7-CURRENT that was compiled after 21 Jun 2007, boot the box and
try to use keys from F1 to F12.  They would not work.

>Fix:

Essentially, the patch below just backs out the change in the 1.70,
but it drops the quirk examination, since the quirk was eliminated.
It fixes the things for both keyboards of mine and they are working
for about 3 months without problems.

--- usbd.set-boot-protocol.patch begins here ---
--- 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;
 
 	*type = KB_OTHER;
 
@@ -1447,6 +1448,14 @@
 		printf("ukbd: unexpected endpoint\n");
 		return EINVAL;
 	}
+ 
+	err = 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"));
+	}
 
 	/* Ignore if SETIDLE fails since it is not crucial. */
 	usbd_set_idle(state->ks_iface, 0, 0);
--- usbd.set-boot-protocol.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-usb mailing list