qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/2] ps2: add support of auto-repeat


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 1/2] ps2: add support of auto-repeat
Date: Thu, 13 Jun 2013 08:34:49 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 13/06/2013 06:19, Andreas Färber ha scritto:
> Am 31.05.2013 14:31, schrieb Amos Kong:
>> diff --git a/hw/input/ps2.c b/hw/input/ps2.c
>> index cdb18e6..fdb9912 100644
>> --- a/hw/input/ps2.c
>> +++ b/hw/input/ps2.c
>> @@ -615,7 +615,17 @@ static bool ps2_keyboard_repeatstate_needed(void
>> *opaque)
>>  {
>>      PS2KbdState *s = opaque;
>>  
>> -    return s->repeat_period || s->repeat_delay;
>> +    return s->repeat_period || s->repeat_delay || s->repeat_key ||
>> s->repeat_timer;
>> +}
>> +
>> +static int ps2_kbd_repeatstate_load(QEMUFile *f, void *opaque, int
>> version_id)
>> +{
>> +    PS2KbdState *s = opaque;
>> +    qemu_get_timer(f, s->repeat_timer);
>> +    qemu_mod_timer(s->repeat_timer, qemu_get_clock_ns(vm_clock) +
>> +                   muldiv64(get_ticks_per_sec(), s->repeat_period,
>> 1000));
>> +
>> +    return 0;
>>  }
>>  
>>  static bool ps2_keyboard_ledstate_needed(void *opaque)
>> @@ -638,9 +648,12 @@ static const VMStateDescription
>> vmstate_ps2_keyboard_repeatstate = {
>>      .version_id = 3,
>>      .minimum_version_id = 2,
>>      .minimum_version_id_old = 2,
>> +    .load_state_old = ps2_kbd_repeatstate_load,
>>      .fields      = (VMStateField[]) {
>>          VMSTATE_INT32(repeat_period, PS2KbdState),
>>          VMSTATE_INT32(repeat_delay, PS2KbdState),
>> +        VMSTATE_INT32(repeat_key, PS2KbdState),
>> +        VMSTATE_TIMER(repeat_timer, PS2KbdState),
> 
> You can't just add fields here, they'd need to be specific to a new
> version 4. Requested was to make it a subsection instead.

This is already a subsection, and this patch is just a proposal to be
squashed in this series (which adds the subsection).  But I think Amos
is right and only the period/delay need to be migrated.  Otherwise,
you'll get an endless stream of repeats on the destination.

Paolo



reply via email to

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