qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Adding more function keys support


From: Programmingkid
Subject: Re: [Qemu-devel] Adding more function keys support
Date: Wed, 13 Dec 2017 14:18:49 -0500

> On Dec 13, 2017, at 1:22 PM, BALATON Zoltan <address@hidden> wrote:
> 
> On Wed, 13 Dec 2017, Programmingkid wrote:
>>> On Dec 13, 2017, at 4:14 AM, Daniel P. Berrange <address@hidden> wrote:
>>> 
>>> On Tue, Dec 12, 2017 at 12:49:34PM -0500, Programmingkid wrote:
>>>> 
>>>>> On Dec 12, 2017, at 9:34 AM, Daniel P. Berrange <address@hidden> wrote:
>>>>> 
>>>>> On Sun, Dec 10, 2017 at 02:10:41AM -0500, Programmingkid wrote:
>>>>>> On Macintosh keyboards there is a key called fn that is used to give the
>>>>>> function keys more functionality. Does this key exist in the keyboard 
>>>>>> keys
>>>>>> database?
>>>>> 
>>>>> When you say "Macintosh keyboards" are you talking about the old style
>>>>> keyboards with Apple's custom ADB connector, or simply Apple branded
>>>>> USB keyboards ?
>>>> 
>>>> USB keyboards.
>>>> 
>>>>> 
>>>>> If its the latter (USB), then please plug it into a Linux machine, and
>>>>> in a text console (ie not X11) run 'showkey' and press this 'fn' key on
>>>>> its own and tell me what (if any) hex code gets printed.
>>>> 
>>>> There was no response to the fn key.
>>> 
>>> Doh, I made a mistake - you need to run   'showkey -s'  to get raw 
>>> scancodes.
>>> Can you try this again, pressing 'fn' on its own, and also press 'fn' in
>>> combination with some function keys.
>> 
>> Sorry but showkey still did not register the fn key being pushed.
> 
> I don't know how the fn key is handled but the Linux driver knows about it so 
> maybe it could help to understand:
> 
> https://github.com/torvalds/linux/blob/master/drivers/hid/hid-apple.c
> 
> Regards,
> BALATON Zoltan

Thank you BALATON for the file. One thing that caught my eye in this file is 
this:

static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
                struct hid_usage *usage, __s32 value)
{
        struct apple_sc *asc = hid_get_drvdata(hid);
        const struct apple_key_translation *trans, *table;

        if (usage->code == KEY_FN) {
                asc->fn_on = !!value;

Why would they need the double !? 

I think the input_event() function is what sends key input to the applications. 
It appears that the function key is not sent to input_event().

This key is usable with QEMU on Mac OS X. The NSEventTypeFlagsChanged event is 
what detects it in the cocoa.m file. Currently the code does not account for 
this key. I will make a patch to add support for the function key soon.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]