From: Gerd Hoffmann <kraxel@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] input-keymap.c: Add keypad equal and power keys
Date: Thu, 03 Mar 2016 16:49:55 +0100 [thread overview]
Message-ID: <1457020195.3574.40.camel@redhat.com> (raw)
In-Reply-To: <4D4DDBFF-11C3-4B70-AB95-E883F4BCF8DE@gmail.com>
Hi,
> > number is modeled after pc scancodes, so you can't just pick random
> > numbers.
>
> Really? I thought the only requirement was each scancode had to be unique.
No, it's not. ps2 emulation assumes those codes are the real ones.
> > So, if there are no scancodes for the keys you want handle, you can now
> > drop the scancodes from the workflow.
>
> Are you saying not to add the power and keypad equal keys to the input-keymap.c file?
If standard scancodes exist for them we can add them. Needs some care
though, ps2 keyboards have different modes and different keymaps in each
mode.
> > Switch cocoa to generate and
> > submit qkeycodes.
>
> This is already done.
Good.
> > Switch the apple keyboard(s) to accept qkeycodes (see
> > yesterdays mail on adb keyboard).
>
> On my to-do list.
Good.
> > Then the key events from the host
> > keyboard are forwarded to the guest without ever being converted into pc
> > scancodes.
>
> How do I do this? You said to use qemu_input_event_send_key_qcode() to
> send QKeyCodes to QEMU. Is this what you still want?
Yes.
> Eventually wouldn't the qcode_to_number array in input-keymap.c try to
> translate the keypad equals to a ps/2 value?
Depends on what the emulated device is doing.
Devices which still use the old input interface to register a input
handler will get scancodes (example: current adb code).
Devices which are switched over to the new input interface will receive
InputEvent *evt. Then they can then use either
qemu_input_key_value_to_scancode() to translate the event into a
sequence of scancodes (Example: ps2 keyboard). Or they can use
qemu_input_key_value_to_qcode() to get a qkeycode.
So, with cocoa using qemu_input_event_send_key_qcode() and adb using
qemu_input_key_value_to_qcode() the keys are never translated into
scancodes, and they'll work fine even without a scancode being assigned
to them in the qcode <-> number (aka scancode) translation maps.
> If the keypad equals key isn't set in this array, the array might
> return a default value of 0 and the user will see 'a' printed whenever
> the keypad equals key is pushed.
Once the adb code is switched over to use qemu_input_key_value_to_qcode
this will stop happening.
Of course, when emulating a x86 guest with ps/2 keyboard you still run
into the problem that there might be no ps/2 scancode for certain keys.
But there is nothing we can do about that. Inventing random scancodes
wouldn't make guests interpret them as expected ...
cheers,
Gerd
next prev parent reply other threads:[~2016-03-03 15:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 15:52 [Qemu-devel] [PATCH] input-keymap.c: Add keypad equal and power keys Programmingkid
2016-03-02 16:12 ` Gerd Hoffmann
2016-03-02 16:29 ` Programmingkid
2016-03-03 10:01 ` Gerd Hoffmann
2016-03-03 15:15 ` Programmingkid
2016-03-03 15:49 ` Gerd Hoffmann [this message]
2016-03-03 17:55 ` Programmingkid
2016-03-03 18:06 ` Peter Maydell
2016-03-02 16:15 ` Eric Blake
2016-03-02 16:26 ` Programmingkid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457020195.3574.40.camel@redhat.com \
--to=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).