From owner-freebsd-usb@FreeBSD.ORG Fri Oct 5 08:30:15 2007 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15FD616A46C for ; Fri, 5 Oct 2007 08:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DDCD213C494 for ; Fri, 5 Oct 2007 08:30:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l958UE8I024116 for ; Fri, 5 Oct 2007 08:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l958UEvV024115; Fri, 5 Oct 2007 08:30:14 GMT (envelope-from gnats) Resent-Date: Fri, 5 Oct 2007 08:30:14 GMT Resent-Message-Id: <200710050830.l958UEvV024115@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eygene Ryabinkin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D60416A419 for ; Fri, 5 Oct 2007 08:29:22 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from pobox.codelabs.ru (pobox.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id B871013C455 for ; Fri, 5 Oct 2007 08:29:21 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by pobox.codelabs.ru with esmtps (TLSv1:CAMELLIA256-SHA:256) id 1IdiYi-0008TL-2Z; Fri, 05 Oct 2007 12:29:20 +0400 Message-Id: <20071005082919.8FBCD1AF41E@void.codelabs.ru> Date: Fri, 5 Oct 2007 12:29:19 +0400 (MSD) From: Eygene Ryabinkin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: imp@FreeBSD.org Subject: usb/116947: [patch] enable boot protocol on the USB keyboards X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eygene Ryabinkin List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Oct 2007 08:30:15 -0000 >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@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: