[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] PS/2 keyboard Scancode Set 3 support
From: |
Roy Tam |
Subject: |
Re: [Qemu-devel] [PATCH v2] PS/2 keyboard Scancode Set 3 support |
Date: |
Mon, 14 Feb 2011 21:22:35 +0800 |
2011/2/14 Kevin Wolf <address@hidden>:
> Am 14.02.2011 13:49, schrieb Roy Tam:
>> 2011/2/14 Kevin Wolf <address@hidden>:
>>> Am 13.02.2011 11:07, schrieb Roy Tam:
>>>> The following patch adds PS/2 keyboard Scancode Set 3 support.
>>>>
>>>> Sign-off-by: Roy Tam <address@hidden>
>>>> --
>>>> v2: checkpatch.pl style fixes
>>>>
>>>> diff --git a/hw/ps2.c b/hw/ps2.c
>>>> index 762bb00..6bea0ef 100644
>>>> --- a/hw/ps2.c
>>>> +++ b/hw/ps2.c
>>>> @@ -143,13 +143,85 @@ static void ps2_put_keycode(void *opaque, int
>>>> keycode)
>>>> {
>>>> PS2KbdState *s = opaque;
>>>>
>>>> - /* XXX: add support for scancode sets 1 and 3 */
>>>> - if (!s->translate && keycode < 0xe0 && s->scancode_set == 2)
>>>> - {
>>>> + /* XXX: add support for scancode sets 1 */
>>>> + if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) {
>>>> if (keycode & 0x80)
>>>> ps2_queue(&s->common, 0xf0);
>>>> keycode = ps2_raw_keycode[keycode & 0x7f];
>>>> - }
>>>> + if (s->scancode_set == 3) {
>>>> + switch (keycode) {
>>>> + case 0x1:
>>>> + keycode = 0x47;
>>>> + break;
>>>> + case 0x3:
>>>> + keycode = 0x27;
>>>> + break;
>>>> + case 0x4:
>>>> + keycode = 0x17;
>>>> + break;
>>>> + case 0x5:
>>>> + keycode = 0x7;
>>>> + break;
>>>> + case 0x6:
>>>> + keycode = 0xf;
>>>> + break;
>>>> + case 0x7:
>>>> + keycode = 0x5e;
>>>> + break;
>>>> + case 0x9:
>>>> + keycode = 0x4f;
>>>> + break;
>>>> + case 0xa:
>>>> + keycode = 0x3f;
>>>> + break;
>>>> + case 0xb:
>>>> + keycode = 0x2f;
>>>> + break;
>>>> + case 0xc:
>>>> + keycode = 0x1f;
>>>> + break;
>>>> + case 0x11:
>>>> + keycode = 0x19;
>>>> + break;
>>>> + case 0x14:
>>>> + keycode = 0x11;
>>>> + break;
>>>> + case 0x58:
>>>> + keycode = 0x14;
>>>> + break;
>>>> + case 0x5d:
>>>> + keycode = 0x5c;
>>>> + break;
>>>> + case 0x76:
>>>> + keycode = 0x8;
>>>> + break;
>>>> + case 0x77:
>>>> + keycode = 0x76;
>>>> + break;
>>>> + case 0x78:
>>>> + keycode = 0x56;
>>>> + break;
>>>> + case 0x79:
>>>> + keycode = 0x7c;
>>>> + break;
>>>> + case 0x7b:
>>>> + keycode = 0x84;
>>>> + break;
>>>> + case 0x7c:
>>>> + keycode = 0x7e;
>>>> + break;
>>>> + case 0x7e:
>>>> + keycode = 0x5f;
>>>> + break;
>>>> + case 0x83:
>>>> + keycode = 0x37;
>>>> + break;
>>>> + case 0x84:
>>>> + keycode = 0x57;
>>>> + break;
>>>> + }
>>>> + }
>>>> + }
>>>> ps2_queue(&s->common, keycode);
>>>> }
>>>
>>> Wouldn't a second table like ps2_raw_keycode be better than a huge
>>> switch block that translates from scancode set 2 to 3?
>>
>> Yeah, but I hate fixing old coding style to newer one. But still, I
>> will do it for this time. I just wonder why not all sources are
>> converted to new coding style when new coding style was announced.
>
> Not sure what you're referring to, how is this related to coding style?
Newly submitted patch are necessary to pass scripts/checkpatch.pl
test. scripts/checkpatch.pl check the patch if it use new coding
style. But not all original source code are converted to new coding
style, and I have to do it myself. You can have a look on patch v3, I
need to take some more time on making correct amount of spaces in the
old array to make whole patch having consistent, new coding style.
I highly suggest doing a whole coding style review on existing source
codes of QEMU.
>
> Kevin
>