qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ps2: add support of auto-repeat


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] ps2: add support of auto-repeat
Date: Thu, 16 May 2013 17:09:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Il 16/05/2013 22:37, Amos Kong ha scritto:
> On Thu, May 16, 2013 at 05:11:59PM +0800, Lei Li wrote:
>> On 05/16/2013 03:35 PM, Amos Kong wrote:
>>> On Thu, May 16, 2013 at 03:23:21PM +0800, Lei Li wrote:
>>>> On 05/16/2013 12:30 PM, Amos Kong wrote:
>>>>> 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 <address@hidden>
>>>
>>>>>  /*
>>>>>     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;
>>> Hi Lei,
>>>
>>>> Does this check allow to distinguish the difference between auto-repeat and
>>>> actual repeated entry by the user?
>>> Actual repeat by user:
>>>   press event
>>>   release event
>>>   press event
>>>   release event
>>>   press event
>>>   release event
>>>
>>> Auto-repeat example:
>>>   press event
>>>   press event
>>>   press event
>>>   release event
> 
> Hi Lei,
>  
>> On what platform?
> 
> 
> Fedora 18 @ thinkpad t430s
> 
> address@hidden amos]# showkey  (hold 'a')
> akeycode  30 press
> aaaaaaaaaaakeycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> keycode  30 press
> aakeycode  30 press
> keycode  30 press
> keycode  30 release   <----(one release event in the end)
> 
> 
> Qemu VM (rhel6, using vnc/ SDL) can get same result.
>  
>> AFAIK, the Auto-repeat event is like below on some GTK-based
>> ||||||||||||environments,||||||||||||
>>
>> keydown
>> keypress
>> keyup
>> keydown
>> keypress
>> keyup|||||||||||||
>> ...
>> as reference link:
>>
>> https://developer.mozilla.org/zh-CN/docs/DOM/KeyboardEvent
> 
> ===== Auto-repeat handling  (it's also mentioned in mozilla page)
> 
> When a key is pressed and held down, it begins to auto-repeat. This
> results in a sequence of events similar to the following being
> dispatched:
> 
> keydown
> keypress
> keydown
> keypress
> <<repeating until the user releases the key>>
> keyup  <----(only one up event in the end)
>  
>> And on Xwindows:
>>
>> keypress
>> keyrelease
>> keypress
>> keyrelease
>> ...
>> as reference link:
>>
>> http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/
> 
> """Just what we’d expect, a bunch of KeyPress Events and one KeyRelease
> event. But that’s not how it works in X."""

...  In XWindows, you get a KeyRelease for every KeyPress Event. In X,
it looks something like this:

PRPRPRPRPRPRPRPR

Can you test your patch with all of VNC, SDL and GTK+?

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]