rebinding keys to functions

Mel Flynn mel.flynn+fbsd.questions at mailing.thruhere.net
Tue Sep 15 01:14:36 UTC 2009


On Tuesday 15 September 2009 00:40:38 Roland Smith wrote:
> On Mon, Sep 14, 2009 at 11:06:20PM +0200, Polytropon wrote:
> > On Mon, 14 Sep 2009 14:34:29 -0400, Robert Huff <roberthuff at rcn.com> 
wrote:
> > > Roland Smith writes:
> > > >  > My laptop has a bunch of volume-up/down/mute internet/mail/etc
> > > >  > keys.  How do I map each of them to run a specific shell
> > > >  > command when pressed?
> > > >
> > > >  That depends on a couple of things (assuming you're running the X
> > > >  window system, I don't know if it is even possible on the
> > > >  console).
> > > >
> > > >  First you have to make sure that you actually can see the key
> > > >  signals. In X you can test that with xev(1).
> > >
> > > 	If this is what I think it is, he probably can't.
> >
> > For most laptop keyboards, there was (as already explained) a
> > specific system that handled Fn+PFx outside the OS so it worked
> > always. Even my old Toshiba T1600 can do that.
> >
> > "Modern" laptops do it differently: Fn+PFx key combinations
> > have to be picked up by a specific driver that "listens" to
> > stange and custom keycodes outside the standard range, and then
> > communicate the selected purpose to the OS in order to perform
> > the action, e. g. raise the volume.
> 
> Not all of them. My laptop is based on a quite modern cantiga (aka
>  centrino2) PM45 chipset (from 2008, according to Wikipedia). The function
>  keys for changing the creen brightness and sound volume work OK with
>  FreeBSD, even though xev doesn't see them. So that signal seems to go
>  directly to the hardware.

Most likely not entirely. Having acpidump(8)ed a few laptops, I have seen 
references to multimedia keys in there. However I know not nearly enough about 
ACPI to know if the OS can intercept/reroute the bindings. A gamble I would 
take is to let FreeBSD post itself as a windows variant to acpi, by setting 
hw.acpi.osname="Windows 2001" in /boot/loader.conf. Then recheck xev.
-- 
Mel


More information about the freebsd-questions mailing list