From owner-freebsd-usb@FreeBSD.ORG Sun Mar 14 15:30:14 2010 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 B35FB106566C for ; Sun, 14 Mar 2010 15:30:14 +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 A3B858FC1A for ; Sun, 14 Mar 2010 15:30:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o2EFUEXG079693 for ; Sun, 14 Mar 2010 15:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2EFUEVQ079690; Sun, 14 Mar 2010 15:30:14 GMT (envelope-from gnats) Date: Sun, 14 Mar 2010 15:30:14 GMT Message-Id: <201003141530.o2EFUEVQ079690@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Steven Noonan Cc: Subject: Re: usb/144414: Apple "Fn" key doesn't work properly X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Steven Noonan List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2010 15:30:14 -0000 The following reply was made to PR usb/144414; it has been noted by GNATS. From: Steven Noonan To: Hans Petter Selasky Cc: Kai Wang , Christoph Langguth , freebsd-gnats-submit@freebsd.org, freebsd-usb@freebsd.org Subject: Re: usb/144414: Apple "Fn" key doesn't work properly Date: Sun, 14 Mar 2010 07:28:16 -0800 On Sun, Mar 14, 2010 at 7:23 AM, Hans Petter Selasky wro= te: > On Sunday 14 March 2010 15:49:37 Steven Noonan wrote: >> On Sun, Mar 14, 2010 at 6:46 AM, Kai Wang wrote: >> > On Sun, Mar 14, 2010 at 06:37:04AM -0800, Steven Noonan wrote: >> >> On Sun, Mar 14, 2010 at 6:27 AM, Hans Petter Selasky > wrote: >> >> > On Sunday 14 March 2010 15:01:39 Steven Noonan wrote: >> >> >> On Sun, Mar 14, 2010 at 5:48 AM, Hans Petter Selasky >> >> >> >> >> > >> >> > wrote: >> >> >> > On Sunday 14 March 2010 14:22:33 Steven Noonan wrote: >> >> >> >> On Sun, Mar 14, 2010 at 3:01 AM, Hans Petter Selasky >> >> >> >> >> >> >> > >> >> >> > wrote: >> >> >> >> > On Sunday 14 March 2010 11:30:04 Steven Noonan wrote: >> >> >> >> >> The following reply was made to PR usb/144414; it has been >> >> >> >> >> noted by GNATS. >> >> >> >> >> >> >> >> >> >> From: Steven Noonan >> >> >> >> >> To: perryh@pluto.rain.com >> >> >> >> >> Cc: freebsd-usb@freebsd.org, freebsd-gnats-submit@freebsd.or= g >> >> >> >> >> Subject: Re: usb/144414: Apple "Fn" key doesn't work properl= y >> >> >> >> >> Date: Sun, 14 Mar 2010 03:26:19 -0700 >> >> >> >> >> >> >> >> >> >> =C2=A0On Thu, Mar 4, 2010 at 12:01 AM, Steven Noonan >> >> >> >> >> wrot=3D >> >> >> >> >> >> >> >> >> >> =C2=A0e: >> >> >> >> >> =C2=A0> On Wed, Mar 3, 2010 at 11:00 PM, Steven Noonan >> >> >> >> >> > wr=3D >> >> >> >> >> >> >> >> >> >> =C2=A0ote: >> >> >> >> >> =C2=A0>> On Wed, Mar 3, 2010 at 10:36 PM, >> >> >> >> >> =3DC2=3DA0 wrote: >>> Steven Noonan >> >> >> >> >> wrote: >>>> Interestingly, my tilde = key >> >> >> >> >> doesn't work either (though the key >>>> press is detected, = no >> >> >> >> >> character shows when the key is pressed). >>> >> >> >> >> >> =C2=A0>>> Any chance it is configured as a "dead" key? =3DC2= =3DA0If you >> >> >> >> >> press >>> tilde followed by n do you get an n with a tilde o= ver >> >> >> >> >> it? >> >> >> >> >> >> =C2=A0>> Nope. It simply does nothing in the console. >> >> >> >> >> =C2=A0>> >> >> >> >> >> =C2=A0>> But in X11, it does something very odd. Shift+Tilde= Key >> >> >> >> >> gives me '>', >> and Tilde Key gives me '<'. And Alt+Tilde >> >> >> >> >> gives me... What? I don't >> even know what action. It's >> >> >> >> >> grabbing some arbitrary command in my >> .bash_history. It g= ave >> >> >> >> >> me the first item in my .bash_history the first >> time I tr= ied >> >> >> >> >> it. Then I tried an arbitrary command ("echo"), and then >> >> >> >> >> >> Alt+Tilde gave me the second command in my .bash_history. Wh= aa? >> >> >> >> >> >> >> >> >> >> =C2=A0Any more ideas/news on this from anyone? >> >> >> >> >> >> >> >> >> >> =C2=A0The tilde key thing is especially irritating. >> >> >> >> > >> >> >> >> > static uint8_t >> >> >> >> > ukbd_apple_swap(uint8_t keycode) { >> >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0switch (keycode) { >> >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0case 0x35: return 0x64; >> >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0case 0x64: return 0x35; >> >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0default: return keycode; >> >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> >> >> > } >> >> >> >> > >> >> >> >> > Can you try to change the function above in ukbd.c to only >> >> >> >> > return keycode? Any difference? >> >> >> >> >> >> >> >> Yep, commenting the two case lines brought my tilde key back. A= ny >> >> >> >> idea what the ukbd_apple_swap() function was _supposed_ to be >> >> >> >> doing? >> >> >> >> >> >> >> >> Also, there's only one thing left (input-wise) that I can't get= to >> >> >> >> work, and that's the 'delete' key (Fn+Backspace). I'm pretty >> >> >> >> certain that it's not a problem with Fn+Backspace failing to ma= p >> >> >> >> to Delete, because my non-Mac i386 box has the same problem. >> >> >> >> >> >> >> >> Everything I read online keeps saying to muck with an .inputrc >> >> >> >> file (for bash, anyway), but I haven't been able to get it to >> >> >> >> work. Places I've looked have said to add this to .inputrc: >> >> >> >> >> >> >> >> "\e[3~": delete-char >> >> >> >> >> >> >> >> But this seems to have no effect (and I tried bind -f .inputrc = in >> >> >> >> case my INPUTRC environment variable wasn't working). Is there >> >> >> >> something FreeBSD-specific I'm not seeing, or what? >> >> >> >> >> >> >> >> - Steven >> >> >> > >> >> >> > Hi Steven, >> >> >> > >> >> >> > Can you talk this over with Christoph and send me a patch when y= ou >> >> >> > agreed? He's the one that made the Apple-SWAP key patch. Meanwhi= le >> >> >> > I suggest the following patch: >> >> >> > >> >> >> > =3D=3D=3D=3D //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#4= 7 - >> >> >> > src/sys/dev/usb/input/ukbd.c =3D=3D=3D=3D >> >> >> > @@ -896,8 +896,7 @@ >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0hid_input, 0, &sc->sc_loc_apple_fn, &flags, >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0&temp_id)) { >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0if (flags & HIO_VARIABLE) >> >> >> > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sc->sc_flags |=3D UKBD_FLAG_APPL= E_FN >> >> >> > | - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UKBD_FLAG_APPLE= _SWAP; >> >> >> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sc->sc_flags |=3D UKBD_FLAG_APPL= E_FN; >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0DPRINTFN(1, "Found Apple FN-key\n"); >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0apple_keys =3D 1; >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0sc->sc_kbd_id =3D temp_id; >> >> >> > >> >> >> > >> >> >> > The hardware that Christoph was using had an Eject-key, while yo= urs >> >> >> > didn't. I think the patch above will make both cases work. >> >> >> > >> >> >> > Christoph, do you have any comments? >> >> >> > >> >> >> > http://p4db.freebsd.org/fileViewer.cgi?FSPC=3D//depot/projects/u= sb/sr >> >> >> >c/sys/ dev/usb/input/ukbd.c&REV=3D47 >> >> >> >> >> >> Not quite true, my keyboard _does_ have an Eject key. The code >> >> >> doesn't detect it though. >> >> >> >> >> >> - Steven >> >> > >> >> > Could you try to figure out what key-press number corresponds to th= e >> >> > eject key? >> >> > >> >> > --HPS >> >> >> >> I'm not certain how to do so. It's somewhat of a chicken-and-the-egg >> >> problem: unless it detects that the key is there, I can't find it. >> >> Enabling 'hw.usb.ukbd.debug' doesn't print anything when Eject is >> >> pressed. >> > >> > It's very possible that your Eject key is in a separate interface and >> > is handled by uhid(4) instead of ukbd(4). >> > >> > /Kai >> >> Enabling 'hw.usb.uhid.debug' doesn't print anything on an Eject >> keypress either, but that could just mean that uhid(4) doesn't have >> necessary DPRINTFs to show it. >> >> - Steven >> > > You need to open /dev/uhidX before it will print anything. > > --HPS > Aha. Doing 'cat /dev/uhid0 > /dev/null' and then hitting eject yielded: "uhid_intr_callback: transferred!" in dmesg. - Steven