All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released through noVNC connection
@ 2016-03-29 10:20 Xulei (Stone)
  2016-03-29 10:36 ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Xulei (Stone) @ 2016-03-29 10:20 UTC (permalink / raw)
  To: qemu-devel, kraxel; +Cc: Gonglei (Arei), Wulizhen (Pss)

Is there anyone can give me some information? I would be very grateful.

I have met several times that the right ctrl key or right alt key is in a pressed status and 
never released until I inject a sendkey qmp command.
I use noVNC, a web-based vnc, as my vnc client. What confused me is that, noVNC client
seems automatically convert the right ctrl/alt to the left ctrl/alt which means noVNC will
not be possible to send right ctrl/alt key to Qemu vnc sever. What's more, I have never 
pressed any ctrl or alt key. This may happen even as soon as I use vnc to connect my VM
which is now in the login interface. So I'm not sure it is a Qemu bug or noVNC bug.

The phenomenon is described as below:
1. When I press 'a', the vnc client outputs '^A', and 'b' is '^B'... Then I try
virsh qemu-monitor-command --hmp VM1 sendkey 0x9d    ---> 0x9d is left ctrl up scancode
it does not work.
but if I try
virsh qemu-monitor-command --hmp VM1 sendkey 0xe0-0x9d  ---->0xe0-0x9d is Ctrl_R up scancode
keyboard works right!
So I'm sure this phenomenon is caused because right ctrl key is in a pressed status.

2. Other several times, when I press '1', vnc outputs noting, '2' is '@', '7' is '{', '8' is '['...
It is obviously that my third function key (right alt/altgr) is in pressed. Then I try
virsh qemu-monitor-command --hmp VM1 sendkey 0xe0-0xb8  ---->0xe0-0xb8 is Alt_R up scancode
keyboard works again. The keymap of vnc, qemu and guestOS are all en-us.

Does qemu, in some cases, cannot right handle Ctrl_R or Ctrl_R key? Any patches can fix this?
Or, it is definitely a bug of noVNC?

noVNC version: 0.4
qemu version: 2.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released through noVNC connection
  2016-03-29 10:20 [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released through noVNC connection Xulei (Stone)
@ 2016-03-29 10:36 ` Daniel P. Berrange
  2016-03-30  1:44   ` Xulei (Stone)
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2016-03-29 10:36 UTC (permalink / raw)
  To: Xulei (Stone); +Cc: Wulizhen (Pss), Gonglei (Arei), qemu-devel, kraxel

On Tue, Mar 29, 2016 at 10:20:46AM +0000, Xulei (Stone) wrote:
> Is there anyone can give me some information? I would be very grateful.
> 
> I have met several times that the right ctrl key or right alt key is in a pressed status and 
> never released until I inject a sendkey qmp command.
> I use noVNC, a web-based vnc, as my vnc client. What confused me is that, noVNC client
> seems automatically convert the right ctrl/alt to the left ctrl/alt which means noVNC will
> not be possible to send right ctrl/alt key to Qemu vnc sever. What's more, I have never 
> pressed any ctrl or alt key. This may happen even as soon as I use vnc to connect my VM
> which is now in the login interface. So I'm not sure it is a Qemu bug or noVNC bug.

The VNC protocol doesn't handle modifier keys explicitly, so clients have to
do extra hacks to deal with it. The problem typically arises when the VNC
client sends a Ctrl-press event, then the user switches focus to another
application before releasing the Ctrl key. The VNC client thus never sends
a Ctrl-release event and so the server thinks the Ctrl key is forever pressed.
Clients have to hack around this by tracking the state of all modifier keys
and explicitly sending fake release events when loosing keyboard focus. So
in summary I would expect the problem to be in the noVNC client


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released through noVNC connection
  2016-03-29 10:36 ` Daniel P. Berrange
@ 2016-03-30  1:44   ` Xulei (Stone)
  0 siblings, 0 replies; 3+ messages in thread
From: Xulei (Stone) @ 2016-03-30  1:44 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: Wulizhen (Pss), Gonglei (Arei), qemu-devel, kraxel

> -----Original Message-----
> From: Daniel P. Berrange [mailto:berrange@redhat.com]
> Sent: Tuesday, March 29, 2016 6:37 PM
> To: Xulei (Stone)
> Cc: qemu-devel@nongnu.org; kraxel@redhat.com; Gonglei (Arei); Wulizhen
> (Pss)
> Subject: Re: [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released
> through noVNC connection
> 
> On Tue, Mar 29, 2016 at 10:20:46AM +0000, Xulei (Stone) wrote:
> > Is there anyone can give me some information? I would be very grateful.
> >
> > I have met several times that the right ctrl key or right alt key is in a pressed
> status and
> > never released until I inject a sendkey qmp command.
> > I use noVNC, a web-based vnc, as my vnc client. What confused me is that,
> noVNC client
> > seems automatically convert the right ctrl/alt to the left ctrl/alt which means
> noVNC will
> > not be possible to send right ctrl/alt key to Qemu vnc sever. What's more, I
> have never
> > pressed any ctrl or alt key. This may happen even as soon as I use vnc to
> connect my VM
> > which is now in the login interface. So I'm not sure it is a Qemu bug or noVNC
> bug.
> 
> The VNC protocol doesn't handle modifier keys explicitly, so clients have to
> do extra hacks to deal with it. The problem typically arises when the VNC
> client sends a Ctrl-press event, then the user switches focus to another
> application before releasing the Ctrl key. The VNC client thus never sends
> a Ctrl-release event and so the server thinks the Ctrl key is forever pressed.
> Clients have to hack around this by tracking the state of all modifier keys
> and explicitly sending fake release events when loosing keyboard focus. So
> in summary I would expect the problem to be in the noVNC client

Appreciate your reply, Daniel. 
The problem you mentioned has already drew my attention. But it is not the 
reason for my problem:
1. The problems I met all focus on Right Ctrl or Right Alt, rather than other
common modifier keys. Seems very strange...

2. noVNC client already has a function to reset all pressed key when the client
loses focus. Unfortunately, this function will not reset right-ctrl or right-alt key,
because noVNC client does not support these modifier keys, it doesn't think he 
has ever pressed the keys.

3. I'm very sure, I have never pressed any modifier keys when this problem 
happens. So the big question is where is the Ctrl_R- press event or Alt_R-press
event from?

> Regards,
> Daniel
> --
> |: http://berrange.com      -o-
> http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-
> http://virt-manager.org :|
> |: http://autobuild.org       -o-
> http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-
> http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-30  1:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 10:20 [Qemu-devel] [Question]Ctrl_R or Alt_R Key Can Not Be Released through noVNC connection Xulei (Stone)
2016-03-29 10:36 ` Daniel P. Berrange
2016-03-30  1:44   ` Xulei (Stone)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.