From owner-freebsd-usb@FreeBSD.ORG Sat May 16 15:56:58 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B86CB106564A for ; Sat, 16 May 2009 15:56:58 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.swip.net [212.247.155.1]) by mx1.freebsd.org (Postfix) with ESMTP id 4C71A8FC1A for ; Sat, 16 May 2009 15:56:57 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=TUa3oeW83E4A:10 a=ABjp9MRm-CUA:10 a=2f3zQJoPAAAA:8 a=6I5d2MoRAAAA:8 a=ymlldahGdxh8x7UdgO4A:9 a=ez1AB1fMYXe2-tQjiPQA:7 a=pYwcS46yllL4hCvpx69nYXREBKoA:4 Received: from [193.217.167.6] (account mc467741@c2i.net HELO [10.0.0.229]) by mailfe09.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 901035699; Sat, 16 May 2009 17:56:56 +0200 From: Hans Petter Selasky To: Christoph Langguth Date: Sat, 16 May 2009 17:59:30 +0200 User-Agent: KMail/1.9.7 References: <4A0DC89C.6010708@rosenkeller.org> <200905160829.18377.hselasky@c2i.net> <4A0EDB45.8020903@rosenkeller.org> In-Reply-To: <4A0EDB45.8020903@rosenkeller.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905161759.31109.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: How to add support for Macbook Pro (USB) keyboard? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 15:56:59 -0000 Hi, It's not required to add a quirk for apple's I think. All the keys should be described in the HID descriptor. Can you dump the HID descriptor of your device? usbconfig -u 0 -a 2 do_request 0x81 0x06 0x2200 0 0x1000 Numbers after "-u" and "-a" must match those after "ugen" when your device is plugged. The command above assume the keyboard resides at interface zero. --HPS On Saturday 16 May 2009, Christoph Langguth wrote: > Hi Hans Petter, > > thanks for the quick reply! > I tried your patch but it doesn't work, all I get is: > > May 16 14:00:01 marvin kernel: ukbd0: on usbus5 > May 16 14:00:01 marvin kernel: device_attach: ukbd0 attach returned 6 > > I don't know why this happens... I tried, but unfortunately I didn't > quite understand what the patch is supposed to do :-) > > > In the meantime, I had continued writing up a slightly cleaner patch, > that also allows to fully utilize the keyboard. Some considerations first: > > - Quite a few apple keyboards (mine included) have an additional quirk > in that they switch two keys. (On [1], that's all the ones having the > APPLE_ISO_KEYBOARD flag). But of course, it's not all of them :-( > > - To fully make use of the keyboard, one also needs to consider the Fn > key ("part of" the 10th (9th payload) byte), so as to be able to be able > to type "vital" keys like DEL, INS, PGUP etc. Judging from [1], > everything from Apple that actually is a keyboard also has this FN key, > so I would expect all of these keyboards to send that 9th byte > > - It seems that some, but not all, of those keyboards, send this first > byte (the one you called hid_id) > > > In light of the above, would it make sense to > - try to detect the HID ID byte in the manner that you suggested in your > patch (assuming that I can figure out the logic, and what's going wrong > there, I think it's the cleanest and vendor-independent solution) > - add an additional UKBD-specific quirk for the ISO_KEYBOARD problem > (into usb/quirks/...) > - assume that any available 9th byte contains the Fn key information -- > or would yet another quirk, listing all affected products, be more > reliable? > > [1]: https://www.linuxhq.com/kernel/v2.6/28-rc8/drivers/hid/hid-apple.c > > In any case, I have attached the "full" patch that works for me -- as > stated above, it's not as clean as it should be because it only works > for my specific piece of hardware and doesn't consider the latest > questions/proposed solution... but it already contains all the required > logic so that you can see what I meant. > > Again, thanks for your help! > Cheers > Chris > > Hans Petter Selasky wrote: > > On Friday 15 May 2009, Christoph Langguth wrote: > >> Christoph Langguth > > > > Hi, > > > > Can you try the following patch on 8-current? > > > > http://perforce.freebsd.org/chv.cgi?CH=162145 > > > > --HPS