From patchwork Sun Aug 23 10:54:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ring X-Patchwork-Id: 31876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id D8DF5B7B86 for ; Sun, 23 Aug 2009 20:57:28 +1000 (EST) Received: from localhost ([127.0.0.1]:60790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfAlF-0000Ml-B2 for incoming@patchwork.ozlabs.org; Sun, 23 Aug 2009 06:57:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfAkg-0000HY-1l for qemu-devel@nongnu.org; Sun, 23 Aug 2009 06:56:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfAkb-00007q-6Q for qemu-devel@nongnu.org; Sun, 23 Aug 2009 06:56:45 -0400 Received: from [199.232.76.173] (port=34360 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfAkb-00007M-0k for qemu-devel@nongnu.org; Sun, 23 Aug 2009 06:56:41 -0400 Received: from mail-fx0-f211.google.com ([209.85.220.211]:33493) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfAka-0005Ox-FZ for qemu-devel@nongnu.org; Sun, 23 Aug 2009 06:56:40 -0400 Received: by fxm7 with SMTP id 7so1237340fxm.34 for ; Sun, 23 Aug 2009 03:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :content-transfer-encoding:subject:x-mercurial-node:message-id :in-reply-to:references:date:from:to; bh=t1tAZydX2qSS4gjFAC/wgAhpQ6kSUmvZkgcKCFfFkZs=; b=Li3N25tZD5Ij7nSSdGoVtfAx0w07/KBu/vEbmyUaK75wz8qg6hDO6S8NKiUwmQlXWm IdDf9liLJ7lm2nAUQSxLU2JlrJXqE+weuHqB/EO8Lt0loVdA/RLOjUtPbHl43fG0nyj4 iDSAqHtvCMqagbAJw3NvgRZHHXQbW/GM8y5E0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:date:from:to; b=f063CsH0BDxDceEwMuzNuXbzB08p98tQfxuO998H5qHuvyFr7BqJLj5ulpW/XbxqQ/ yjmi7JSiP2v6XJuZ7VU0oZ0ToxMaAw23qPPHFkdaFdtVbjULHLgbIkiEs2xKPckEHCa9 gGA8hR/aarU+v0t+4IT2Gj1QUNNSispIMPb0M= Received: by 10.86.206.7 with SMTP id d7mr2400021fgg.25.1251024999058; Sun, 23 Aug 2009 03:56:39 -0700 (PDT) Received: from macbook-3.chello.at (chello080108206119.5.13.vie.surfer.at [80.108.206.119]) by mx.google.com with ESMTPS id 4sm573058fge.22.2009.08.23.03.56.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 23 Aug 2009 03:56:38 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: 47b0eaeb99f46127bb70f1b765113d1b21ed30c8 Message-Id: <47b0eaeb99f46127bb70.1251024894@macbook-3.chello.at> In-Reply-To: References: Date: Sun, 23 Aug 2009 12:54:54 +0200 From: Stefan Ring To: qemu-devel@nongnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 1 of 1] Fix for DOS keyboard problems X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org diff --git a/hw/pckbd.c b/hw/pckbd.c --- a/hw/pckbd.c +++ b/hw/pckbd.c @@ -120,6 +120,7 @@ uint8_t mode; /* Bitmask of devices with data available. */ uint8_t pending; + uint32_t held_kbd_val; void *kbd; void *mouse; @@ -161,9 +162,10 @@ { KBDState *s = (KBDState *)opaque; - if (level) + if (level) { s->pending |= KBD_PENDING_KBD; - else + s->held_kbd_val = (uint32_t) -1; + } else s->pending &= ~KBD_PENDING_KBD; kbd_update_irq(s); } @@ -238,6 +240,7 @@ break; case KBD_CCMD_KBD_ENABLE: s->mode &= ~KBD_MODE_DISABLE_KBD; + s->held_kbd_val = (uint32_t) -1; kbd_update_irq(s); break; case KBD_CCMD_READ_INPORT: @@ -283,8 +286,15 @@ if (s->pending == KBD_PENDING_AUX) val = ps2_read_data(s->mouse); - else - val = ps2_read_data(s->kbd); + else { + if (s->mode & KBD_MODE_DISABLE_KBD && s->held_kbd_val != (uint32_t) -1) + val = s->held_kbd_val; + else { + val = ps2_read_data(s->kbd); + if (!(s->mode & KBD_MODE_DISABLE_KBD)) + s->held_kbd_val = val; + } + } #if defined(DEBUG_KBD) printf("kbd: read data=0x%02x\n", val); @@ -339,6 +349,7 @@ s->mode = KBD_MODE_KBD_INT | KBD_MODE_MOUSE_INT; s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED; + s->held_kbd_val = (uint32_t) -1; } static void kbd_save(QEMUFile* f, void* opaque)