[PATCH v2 evdev 3/4] Add a property to toggle function key mode
Michel Dänzer
michel at daenzer.net
Thu May 19 23:43:08 PDT 2011
On Fre, 2011-05-20 at 13:42 +1000, Peter Hutterer wrote:
> On some keyboards, the multimedia function keys are overlaid with the F
> keys. This property enables clients to switch the primary mode of these F
> keys between function keys and multimedia keys.
> Some keyboards provide an Fn key to toggle between the modes. This is
> hardware-specific and may or may not work on any given keyboard device.
>
> The current implementation is only hooked up to apple keyboards.
> The kernel provides a tweak to enable/disable.
>
> /sys/module/hid_apple/parameters/fnmode
> 0 .. keyboard sends Fx keys, Fn disabled
> 1 .. keyboard sends multimedia keys, Fn toggles to function keys
> 2 .. keyboard sends function keys, Fn toggles to multimedia keys
>
> If fnmode is on 0, we force it to 2.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - device ID lookup table now squashed in (was 4/4)
> - fnmode uses 1 or 2, not 0 or 1 as values
> - add GetProperty handler to update before a client gets the property value
> - make the property itself generic, implementation is apple specific
> - use enums instead of 0/1/-1 where possible
[...]
> + if (write(fd, &mode, 1) != 1)
> + return -1;
[...]
> + if (read(fd, &retvalue, 1) != 1)
> + return FKEYMODE_UNKNOWN;
These would leak fd, wouldn't they?
Looks good to me otherwise.
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
More information about the xorg-devel
mailing list