From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FvVOi-00018E-Fb for qemu-devel@nongnu.org; Wed, 28 Jun 2006 04:27:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FvVOg-000181-Fq for qemu-devel@nongnu.org; Wed, 28 Jun 2006 04:27:44 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvVOg-00017y-A2 for qemu-devel@nongnu.org; Wed, 28 Jun 2006 04:27:42 -0400 Received: from [213.25.173.251] (helo=ns.pers.pl) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FvVax-0006li-Mj for qemu-devel@nongnu.org; Wed, 28 Jun 2006 04:40:24 -0400 Received: from localhost ([127.0.0.1]) by ns.pers.pl with esmtp (Exim 4.61) (envelope-from ) id 1FvVOa-0000LW-Gf for qemu-devel@nongnu.org; Wed, 28 Jun 2006 10:27:36 +0200 Received: from ns.pers.pl ([127.0.0.1]) by localhost (ns.pers.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30995-14 for ; Wed, 28 Jun 2006 10:27:34 +0200 (CEST) Received: from aow214.internetdsl.tpnet.pl ([83.17.130.214] helo=[10.0.0.21]) by ns.pers.pl with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.61) (envelope-from ) id 1FvVOY-0000LP-Ij for qemu-devel@nongnu.org; Wed, 28 Jun 2006 10:27:34 +0200 From: =?utf-8?q?Rafa=C5=82_Cygnarowski?= Date: Wed, 28 Jun 2006 10:27:31 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200606281027.31617.zswi@pers.pl> Subject: [Qemu-devel] qemu kbd emulation Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi! I wanted to correct qemu emulation of keyboard under DOS as=20 guest OS, so I started with simple pascal program to check=20 what happen on guest DOS (and DOS) when I press up/down/left/right=20 keys. The program was: =2D- BEGIN test.pas -- program time; {$M 2048,0,0} uses crt, dos; var OldKeyInt : procedure; procedure NewKeyInt; interrupt; begin write(Port[$60]); write(' ') inline($9c); OldKeyInt; end; begin getintvec($9, addr(OldKeyInt)); setintvec($9, @NewKeyInt); keep(0); end. =2D- END test.pas -- and it look that qemu does not generate some codes before=20 pressing and after releasing arrow keys. For example pressing=20 up key on qemu looks like: 224 72 224 200 while without emulation it looks: 224 42 224 72 224 200 224 170. It's true only for single keystrokes, but good for the=20 beginning. So I tried to patch qemu for this and created following patch: =2D- BEGIN sdl.patch -- =2D-- sdl.c.old 2006-05-03 20:32:58.000000000 +0000 +++ sdl.c 2006-06-28 07:26:14.000000000 +0000 @@ -254,14 +254,34 @@ kbd_put_keycode(keycode); kbd_put_keycode(keycode | 0x80); return; + case 0xc8: /* up */ + case 0xd0: /* down */ + case 0xcd: /* right */ + case 0xcb: /* left */ + if (ev->type !=3D SDL_KEYUP) { + kbd_put_keycode(e0); + kbd_put_keycode(2a); + } + break; } =2D + /* now send the key code */ if (keycode & 0x80) kbd_put_keycode(0xe0); =2D if (ev->type =3D=3D SDL_KEYUP) =2D kbd_put_keycode(keycode | 0x80); =2D else + + if (ev->type =3D=3D SDL_KEYUP) { + kbd_put_keycode(keycode | 0x80); + + switch(keycode) { + case 0xc8: /* up */ + case 0xd0: /* down */ + case 0xcd: /* right */ + case 0xcb: /* left */ + kbd_put_keycode(0xe0); + kbd_put_keycode(0xaa); + break; + } + } else kbd_put_keycode(keycode & 0x7f); } =2D- END sdl.patch -- Unfortunatelly results of this patch completely suprised me. After this pat= ch=20 my test program produces results witch are impossible to produce in normal= =20 situation. Example output for UP key was: 224 224 72 88224 224 170. What's wrong with this patch? What I'm doing wrong? Regards, =2D-=20 Rafa=C5=82 Cygnarowski rafi@pers.pl