From patchwork Mon Jul 24 16:46:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 9859807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 302E36038F for ; Mon, 24 Jul 2017 16:47:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21CB128573 for ; Mon, 24 Jul 2017 16:47:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 163832858A; Mon, 24 Jul 2017 16:47:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E6C6D28573 for ; Mon, 24 Jul 2017 16:47:00 +0000 (UTC) Received: from localhost ([::1]:55894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZgVY-0007Uv-4n for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Jul 2017 12:47:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZgUu-0007Ue-Rm for qemu-devel@nongnu.org; Mon, 24 Jul 2017 12:46:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZgUq-0000YF-U4 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 12:46:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dZgUq-0000XI-OK for qemu-devel@nongnu.org; Mon, 24 Jul 2017 12:46:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B811883C4; Mon, 24 Jul 2017 16:46:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B811883C4 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=berrange@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8B811883C4 Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B40589F1A; Mon, 24 Jul 2017 16:46:08 +0000 (UTC) From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 17:46:01 +0100 Message-Id: <20170724164601.21063-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 24 Jul 2017 16:46:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for 2.10] ps2: fix sending of PAUSE/BREAK scancodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The processing of the scancodes for PAUSE/BREAK has been broken since the conversion to qcodes in: commit 8c10e0baf0260b59a4e984744462a18016662e3e Author: Hervé Poussineau Date: Thu Sep 15 22:06:26 2016 +0200 ps2: use QEMU qcodes instead of scancodes When using a VNC client, with the raw scancode extension, the client will send a scancode of 0xc6 for both PAUSE and BREAK. There is mistakenly no entry in the qcode_to_number table for this scancode, so ps2_keyboard_event() just generates a log message and discards the scancode When using a SPICE client, it will also send 0xc6 for BREAK, but will send 0xe1 0x1d 0x45 0xe1 0x9d 0xc5 for PAUSE. There is no entry in the qcode_to_number table for the scancode 0xe1 because it is a special XT keyboard prefix not mapping to any QKeyCode. Again ps2_keyboard_event() just generates a log message and discards the scancode. The following 0x1d, 0x45, 0x9d, 0xc5 scancodes get handled correctly. Fixing this just requires special casing 0xe1 so it is directly queued for sending to the guest, skipping any conversion to QKeyCode. Signed-off-by: Daniel P. Berrange --- hw/input/ps2.c | 7 +++++++ ui/input-keymap.c | 1 + 2 files changed, 8 insertions(+) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 3ba05efd06..a132d1ba72 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -607,6 +607,13 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, assert(evt->type == INPUT_EVENT_KIND_KEY); qcode = qemu_input_key_value_to_qcode(key->key); + if (qcode == 0 && + key->key->type == KEY_VALUE_KIND_NUMBER && + key->key->u.number.data == 0x61) { + ps2_put_keycode(s, 0xe1); + return; + } + if (s->scancode_set == 1) { if (qcode == Q_KEY_CODE_PAUSE) { if (key->down) { diff --git a/ui/input-keymap.c b/ui/input-keymap.c index 8a1476fc48..9211f835be 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -98,6 +98,7 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_KP_ENTER] = 0x9c, [Q_KEY_CODE_KP_DECIMAL] = 0x53, [Q_KEY_CODE_SYSRQ] = 0x54, + [Q_KEY_CODE_PAUSE] = 0xc6, [Q_KEY_CODE_KP_0] = 0x52, [Q_KEY_CODE_KP_1] = 0x4f,