qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/input/hid.c Fix capslock hid code
@ 2015-01-21 22:48 dvaleev
  2015-01-22  7:20 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: dvaleev @ 2015-01-21 22:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dinar Valeev, Gerd Hoffmann

From: Dinar Valeev <dvaleev@suse.com>

When ever USB keyboard is used, e.g. '-usbdevice keyboard' pressing
caps lock key send 0x32 hid code, which is treated as backslash.
Instead it should be 0x39 code. This affects sending uppercase keys,
as they typed whith caps lock active.

While on x86 this can be workarounded by using ps/2 protocol. On
Power it is crusial as we don't have anything else than USB.

This is fixes guest automation tasts over vnc.

Signed-off-by: Dinar Valeev <dvaleev@suse.com>
---
 hw/input/hid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/input/hid.c b/hw/input/hid.c
index 148c003..58212a7 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -41,7 +41,7 @@ static const uint8_t hid_usage_keys[0x100] = {
     0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x0f, 0x33,
     0x34, 0x35, 0xe1, 0x31, 0x1d, 0x1b, 0x06, 0x19,
     0x05, 0x11, 0x10, 0x36, 0x37, 0x38, 0xe5, 0x55,
-    0xe2, 0x2c, 0x32, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
+    0xe2, 0x2c, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
     0x3f, 0x40, 0x41, 0x42, 0x43, 0x53, 0x47, 0x5f,
     0x60, 0x61, 0x56, 0x5c, 0x5d, 0x5e, 0x57, 0x59,
     0x5a, 0x5b, 0x62, 0x63, 0x00, 0x00, 0x00, 0x44,
-- 
2.1.2

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

* Re: [Qemu-devel] [PATCH] hw/input/hid.c Fix capslock hid code
  2015-01-21 22:48 [Qemu-devel] [PATCH] hw/input/hid.c Fix capslock hid code dvaleev
@ 2015-01-22  7:20 ` Gerd Hoffmann
  2015-01-22  7:59   ` Dinar Valeev
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2015-01-22  7:20 UTC (permalink / raw)
  To: dvaleev; +Cc: Dinar Valeev, qemu-devel

On Mi, 2015-01-21 at 23:48 +0100, dvaleev@suse.de wrote:
> From: Dinar Valeev <dvaleev@suse.com>
> 
> When ever USB keyboard is used, e.g. '-usbdevice keyboard' pressing
> caps lock key send 0x32 hid code, which is treated as backslash.
> Instead it should be 0x39 code. This affects sending uppercase keys,
> as they typed whith caps lock active.
> 
> While on x86 this can be workarounded by using ps/2 protocol. On
> Power it is crusial as we don't have anything else than USB.
> 
> This is fixes guest automation tasts over vnc.

That probably happens because your test automation vnc client sends
uppercase letters without also sending shift-down/up events.  The qemu
vnc server logic which is supposed to sync up capslock state between
guest and host thinks capslock is pressed on the host then and injects
some synthetic capslock key events.

Just say'ing FYI, that doesn't render the fix invalid, but you may have
wondered why you are not seeing this with a normal vnc client ;)

Added to input queue.

thanks,
  Gerd

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

* Re: [Qemu-devel] [PATCH] hw/input/hid.c Fix capslock hid code
  2015-01-22  7:20 ` Gerd Hoffmann
@ 2015-01-22  7:59   ` Dinar Valeev
  0 siblings, 0 replies; 3+ messages in thread
From: Dinar Valeev @ 2015-01-22  7:59 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Dinar Valeev, qemu-devel



On 01/22/2015 08:20 AM, Gerd Hoffmann wrote:
> On Mi, 2015-01-21 at 23:48 +0100, dvaleev@suse.de wrote:
>> From: Dinar Valeev <dvaleev@suse.com>
>>
>> When ever USB keyboard is used, e.g. '-usbdevice keyboard' pressing
>> caps lock key send 0x32 hid code, which is treated as backslash.
>> Instead it should be 0x39 code. This affects sending uppercase keys,
>> as they typed whith caps lock active.
>>
>> While on x86 this can be workarounded by using ps/2 protocol. On
>> Power it is crusial as we don't have anything else than USB.
>>
>> This is fixes guest automation tasts over vnc.
>
> That probably happens because your test automation vnc client sends
> uppercase letters without also sending shift-down/up events.  The qemu
> vnc server logic which is supposed to sync up capslock state between
> guest and host thinks capslock is pressed on the host then and injects
> some synthetic capslock key events.
>
> Just say'ing FYI, that doesn't render the fix invalid, but you may have
> wondered why you are not seeing this with a normal vnc client ;)
Yeah, I thought about sending shift+letter. It become better, but not 
really. Sending shift-b would print "|B".

I've seen this behaviour with a home grown perl vnc client, ruby-vnc as 
well as with manual vncviewer client, vnc and SDL ui.

The reproducer is simple: qemu-system-x86_64 -enable-kvm -cdrom 
SLE-12-Server-MINI-ISO-x86_64-GM-DVD.iso -usbdevice keyboard -m 1024

Pressing caps lock produces "\". showkey says backslash is pressed.

Dinar,
>
> Added to input queue.
Thanks
>
> thanks,
>    Gerd
>
>

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

end of thread, other threads:[~2015-01-22  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-21 22:48 [Qemu-devel] [PATCH] hw/input/hid.c Fix capslock hid code dvaleev
2015-01-22  7:20 ` Gerd Hoffmann
2015-01-22  7:59   ` Dinar Valeev

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).