Received: from eggs.gnu.org ([2001:4830:134:3::10]:49401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abUyv-0001MR-EY for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:16:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abUys-0003mD-8b for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:16:01 -0500 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:35770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abUyr-0003lz-QZ for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:15:58 -0500 Received: by mail-io0-x22e.google.com with SMTP id g203so30401207iof.2 for ; Thu, 03 Mar 2016 07:15:57 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <1456999267.3574.20.camel@redhat.com> Date: Thu, 3 Mar 2016 10:15:55 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <4D4DDBFF-11C3-4B70-AB95-E883F4BCF8DE@gmail.com> References: <09EE2B64-B7B1-469B-AEE9-8250223DA109@gmail.com> <1456935179.23994.137.camel@redhat.com> <1456999267.3574.20.camel@redhat.com> Subject: Re: [Qemu-devel] [PATCH] input-keymap.c: Add keypad equal and power keys List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Peter Maydell , qemu-devel qemu-devel On Mar 3, 2016, at 5:01 AM, Gerd Hoffmann wrote: > On Mi, 2016-03-02 at 11:29 -0500, Programmingkid wrote: >> On Mar 2, 2016, at 11:12 AM, Gerd Hoffmann wrote: >>=20 >>> On Mi, 2016-03-02 at 10:52 -0500, Programmingkid wrote: >>>> Add the keypad equals and power keys to the qcode_to_number array. = These keys >>>> are used on a Macintosh keyboard. >>>>=20 >>>> Signed-off-by: John Arbuckle >>>>=20 >>>> --- >>>> ui/input-keymap.c | 3 ++- >>>> 1 files changed, 2 insertions(+), 1 deletions(-) >>>>=20 >>>> diff --git a/ui/input-keymap.c b/ui/input-keymap.c >>>> index fd2c09d..8cffe62 100644 >>>> --- a/ui/input-keymap.c >>>> +++ b/ui/input-keymap.c >>>> @@ -98,6 +98,7 @@ static const int qcode_to_number[] =3D { >>>> [Q_KEY_CODE_KP_ENTER] =3D 0x9c, >>>> [Q_KEY_CODE_KP_DECIMAL] =3D 0x53, >>>> [Q_KEY_CODE_SYSRQ] =3D 0x54, >>>> + [Q_KEY_CODE_KP_EQUALS] =3D 0x55, >>>=20 >>> Where does the 0x55 come from? >>=20 >> It is a value I picked by adding one to Q_KEY_CODE_SYSRQ's value. >=20 > Naa, that is not going to fly. >=20 > 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.=20 >=20 >>>> + [Q_KEY_CODE_POWER] =3D 0x5e, >>>=20 >>> Same question here. >>=20 >> I went to this page: = http://www.computer-engineering.org/ps2keyboard/scancodes1.html. >> Then I looked at the power button's value of 0xe05e, and just removed = the e0 part. >=20 > That is wrong too, you can't just drop the 0xe0. They value of these keys doesn't really matter to me. They both just = need to be identifiable.=20 > Traditionally qemu used pc scancodes exclusively to pass around key > presses internally. That had a number of problems: First, alot of > places in qemu had code to deal with the extended scancode (0xe0 = prefix) > logic. Second, if you need keys which don't have a pc scancode you = have > a problem. It sounds like you want the power key's value to be the actual ps/2 = value of 0xe05e.=20 > So, a while back I've switched the qemu input system over to use > qkeycodes instead. pc scancodes can still be handled and there are > helper functions to translate qkeycodes to scancodes and back. That = is > needed (a) for backward compatibility with code which isn't converted > yet to the new input api and (b) for devices such as the ps/2 keyboard > which actually need scancodes. >=20 > 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?=20 > Switch cocoa to generate and > submit qkeycodes. This is already done. > Switch the apple keyboard(s) to accept qkeycodes (see > yesterdays mail on adb keyboard). On my to-do list. > 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? Eventually wouldn't = the qcode_to_number array in input-keymap.c try to translate the keypad = equals to a ps/2 value? 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.