From: Amos Kong <akong@redhat.com>
To: li guang <lig.fnst@cn.fujitsu.com>
Cc: aliguori@us.ibm.com, lcapitulino@redhat.com, lersek@redhat.com,
qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] ps2: add support of auto-repeat
Date: Thu, 16 May 2013 15:28:22 +0800 [thread overview]
Message-ID: <20130516072822.GD3785@t430s.nay.redhat.com> (raw)
In-Reply-To: <1368688390.5142.87.camel@liguang.fnst.cn.fujitsu.com>
On Thu, May 16, 2013 at 03:13:10PM +0800, li guang wrote:
> 在 2013-05-16四的 14:58 +0800,Amos Kong写道:
> > On Thu, May 16, 2013 at 01:30:28PM +0800, li guang wrote:
> > > 在 2013-05-16四的 12:30 +0800,Amos Kong写道:
> > > > Guest driver sets repeat rate and delay time by KBD_CMD_SET_RATE,
> > > > but ps2 backend doesn't process it and no auto-repeat implementation.
> > > > This patch adds support of auto-repeat feature.
> > > >
> > > > Guest ps2 driver sets autorepeat to fastest possible in reset,
> > > > period: 250ms, delay: 33ms
> > > >
> > > > Tested by 'sendkey' monitor command.
> > > >
> > > > referenced: http://www.computer-engineering.org/ps2keyboard/
> > > >
> > > > Signed-off-by: Amos Kong <akong@redhat.com>
> > Hi, Li guang
> >
> > > theoretically, we have to check if the typematic key is in break
> > > now, if so, we will not do repeat anymore.
> >
> > You mean key is released? I checked by '~keycode & 0x80', stop repeat
> > when key is release.
> >
> > > don't you think we have a chance that new key can come in during
> > > waiting?
> >
> > When the new key (press) comes, repeat_timer will be modified by
> > qemu_mod_timer(), original repate will be end.
> >
> > > > + if (auto_repeat) {
> > > > + qemu_mod_timer(repeat_timer, qemu_get_clock_ns(vm_clock) +
> > > > + muldiv64(get_ticks_per_sec(), s->repeat_period,
> > > > + 1000));
> > > > + ps2_queue(&s->common, s->repeat_key);
> > > > + }
> > > > +}
> > > > +
> > > > +
> > > > /*
> > > > keycode is expressed as follow:
> > > > bit 7 - 0 key pressed, 1 = key released
> > > > @@ -167,7 +186,17 @@ static void ps2_put_keycode(void *opaque, int keycode)
> > > > keycode = ps2_raw_keycode_set3[keycode & 0x7f];
> > > > }
> > > > }
> > > > +
> > > > + /* only auto-repeat press event */
> > > > + auto_repeat = ~keycode & 0x80;
> >
> > ^^^
>
> case:
>
> 1. new key pressed
> 2. enter ps2_put_keycode
> 3. previous timer timeout
I guess it's repeat_timer
> 4. enter repeat_ps2_queue
> 5. put previous keycode in queue
> 6. back to ps2_put_keycode
back? repeat_ps_queue() is called in background.
> 7. check auto_repeat
>
> so, an obsolete key comes up.
> can timer interrupt ps2_put_keycode?
no.
--
Amos.
next prev parent reply other threads:[~2013-05-16 7:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 4:30 [Qemu-devel] [PATCH] ps2: add support of auto-repeat Amos Kong
2013-05-16 5:30 ` li guang
2013-05-16 6:58 ` Amos Kong
2013-05-16 7:13 ` li guang
2013-05-16 7:28 ` Amos Kong [this message]
2013-05-16 15:04 ` Paolo Bonzini
2013-05-16 6:40 ` Jason Wang
2013-05-16 6:50 ` Peter Maydell
2013-05-16 7:17 ` Amos Kong
2013-05-16 7:23 ` Lei Li
2013-05-16 7:35 ` Amos Kong
2013-05-16 9:11 ` Lei Li
2013-05-16 20:37 ` Amos Kong
2013-05-16 15:09 ` Paolo Bonzini
2013-05-16 15:17 ` Peter Maydell
2013-05-16 15:20 ` Paolo Bonzini
2013-05-21 8:33 ` Amos Kong
2013-05-21 8:38 ` Paolo Bonzini
2013-05-21 9:04 ` Amos Kong
2013-05-21 9:51 ` Amos Kong
2013-05-21 9:54 ` Paolo Bonzini
2013-05-16 15:03 ` Paolo Bonzini
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=20130516072822.GD3785@t430s.nay.redhat.com \
--to=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=kraxel@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=lersek@redhat.com \
--cc=lig.fnst@cn.fujitsu.com \
--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).