From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abVVs-0000Kd-Mc for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:50:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abVVm-0005W4-R7 for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:50:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abVVm-0005Vz-Ls for qemu-devel@nongnu.org; Thu, 03 Mar 2016 10:49:58 -0500 Message-ID: <1457020195.3574.40.camel@redhat.com> From: Gerd Hoffmann Date: Thu, 03 Mar 2016 16:49:55 +0100 In-Reply-To: <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> <4D4DDBFF-11C3-4B70-AB95-E883F4BCF8DE@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 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: Programmingkid Cc: Peter Maydell , qemu-devel qemu-devel Hi, > > number is modeled after pc scancodes, so you can't just pick random > > numbers. >=20 > Really? I thought the only requirement was each scancode had to be unique= .=20 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. >=20 > Are you saying not to add the power and keypad equal keys to the input-ke= ymap.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. >=20 > This is already done. Good. > > Switch the apple keyboard(s) to accept qkeycodes (see > > yesterdays mail on adb keyboard). >=20 > On my to-do list. Good. > > Then the key events from the host > > keyboard are forwarded to the guest without ever being converted into p= c > > scancodes. >=20 > 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