qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Cygnarowski" <zswi@pers.pl>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu kbd emulation
Date: Wed, 28 Jun 2006 19:27:39 +0200	[thread overview]
Message-ID: <200606281927.39125.zswi@pers.pl> (raw)
In-Reply-To: <20060628142851.GA16101@jbrown.mylinuxbox.org>

Dnia środa, 28 czerwca 2006 16:28, Jim C. Brown napisał:
> On Wed, Jun 28, 2006 at 02:16:56PM +0200, Rafa?? Cygnarowski wrote:
> > So now I have to find out:
> > - where those fake keycodes were dropped,
> > - why after loading my test program those two 8s are displayed
> >   (there is some unneeded interrupt generated - am I right?).
> >
> > Honestly, I don't know where I should start looking...
>
> Not sure if this is the cause, but I believe that ps2_read_data remembers
> the last key pressed and returns it if there is no new key to be read (to
> make it work with EMM386 it seems).

And it's ok while reading port 0x60 should return last key.
What I can say is that I found 1st REAL bug. 
Value recived from port 0x60 in interrupt function should 
always be the same. 
While I'm not sure if this is clear, here is sample code 
for testing:

-- BEGIN test.pas --
program time; {$M 2048,0,0}
uses crt, dos;
var oldkbd : procedure;
 
procedure kbd; interrupt;
begin
     Write(' 1. '); Write(Port[$60]);
     Write(' 2. '); Write(Port[$60]);
     Write(' 3. '); Writeln(Port[$60]);
     inline($9c); oldkbd;	
end;
 
begin
        getintvec($9, addr(oldkbd));
        setintvec($9, @kbd);
        keep(0);
end.
-- END test.pas --

kbd function works fine on qemu for keys which fill ps2_queue 
to q->count == 1 (like letters). It works in this case becouse 
after reading first value from queue q->count is equal 0 and
then last key is returned. 

For keys which are suppressed by 0xe0 for example this code fails.
ps2_read_data is used to recive Port[$60] value and every use of 
this function decrease q->count (and moves pointer to next value)
which is wrong in this case while this action should take place
after exiting my "kbd" function.

Any idea how to fix it? (I'm not familiar with qemu src code and
I don't know where to put the code which should move ps2_queue 
pointer to next value.)

-- 
Rafał Cygnarowski
rafi@pers.pl

  reply	other threads:[~2006-06-28 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28  8:27 [Qemu-devel] qemu kbd emulation Rafał Cygnarowski
2006-06-28  8:39 ` Oliver Gerlich
2006-06-28 12:16   ` Rafał Cygnarowski
2006-06-28 14:28     ` Jim C. Brown
2006-06-28 17:27       ` Rafał Cygnarowski [this message]
2006-06-29 20:56       ` Rafał Cygnarowski
2006-06-28 15:05     ` Stuart Brady
2006-06-28  9:39 ` Stuart Brady
2006-06-28 10:07 ` Stuart Brady
2006-06-28 11:17   ` Rafał Cygnarowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200606281927.39125.zswi@pers.pl \
    --to=zswi@pers.pl \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).