* [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour
@ 2009-01-07 12:45 Stefano Stabellini
2009-01-07 15:20 ` Ian Jackson
2009-01-07 16:43 ` Anthony Liguori
0 siblings, 2 replies; 5+ messages in thread
From: Stefano Stabellini @ 2009-01-07 12:45 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
Hi all,
the usb-hid spec states that the SET_IDLE request has a 16bit value,
where the upper byte specifies the idle rate (currently unimplemented,
we handle only the 0 case, meaning infinite duration) and the lower
byte specifies the report id (0 means all reports).
In our code we do idle = value, while it should be idle = "upper byte",
especially if the guest issues a GET_IDLE, we should return only the
idle rate while we are returning only the report id.
In practice it doesn't make much difference because I have only seen
SET_VALUE with both bytes set to 0 so far, but still it is wrong.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 972543f..76fdce6 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -65,7 +65,7 @@ typedef struct USBHIDState {
};
int kind;
int protocol;
- int idle;
+ uint8_t idle;
int changed;
void *datain_opaque;
void (*datain)(void *);
@@ -794,7 +794,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
data[0] = s->idle;
break;
case SET_IDLE:
- s->idle = value;
+ s->idle = (uint8_t) (value >> 8);
ret = 0;
break;
default:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour
2009-01-07 12:45 [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour Stefano Stabellini
@ 2009-01-07 15:20 ` Ian Jackson
2009-01-07 15:46 ` Alexander Graf
2009-01-07 16:43 ` Anthony Liguori
1 sibling, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2009-01-07 15:20 UTC (permalink / raw)
To: qemu-devel
Stefano Stabellini writes ("[Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour"):
> the usb-hid spec states that the SET_IDLE request has a 16bit value,
> where the upper byte specifies the idle rate (currently unimplemented,
> we handle only the 0 case, meaning infinite duration) and the lower
> byte specifies the report id (0 means all reports).
> In our code we do idle = value, while it should be idle = "upper byte",
> especially if the guest issues a GET_IDLE, we should return only the
> idle rate while we are returning only the report id.
> In practice it doesn't make much difference because I have only seen
> SET_VALUE with both bytes set to 0 so far, but still it is wrong.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Stefano's patch looks good to me.
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour
2009-01-07 15:20 ` Ian Jackson
@ 2009-01-07 15:46 ` Alexander Graf
2009-01-07 15:53 ` Ian Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2009-01-07 15:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian.Jackson
Ian Jackson wrote:
> Stefano Stabellini writes ("[Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour"):
>
>> the usb-hid spec states that the SET_IDLE request has a 16bit value,
>> where the upper byte specifies the idle rate (currently unimplemented,
>> we handle only the 0 case, meaning infinite duration) and the lower
>> byte specifies the report id (0 means all reports).
>> In our code we do idle = value, while it should be idle = "upper byte",
>> especially if the guest issues a GET_IDLE, we should return only the
>> idle rate while we are returning only the report id.
>> In practice it doesn't make much difference because I have only seen
>> SET_VALUE with both bytes set to 0 so far, but still it is wrong.
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>
>
> Stefano's patch looks good to me.
>
> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
Shouldn't that be Ian rather than Stefano? :-)
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour
2009-01-07 12:45 [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour Stefano Stabellini
2009-01-07 15:20 ` Ian Jackson
@ 2009-01-07 16:43 ` Anthony Liguori
1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-01-07 16:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
Stefano Stabellini wrote:
> Hi all,
> the usb-hid spec states that the SET_IDLE request has a 16bit value,
> where the upper byte specifies the idle rate (currently unimplemented,
> we handle only the 0 case, meaning infinite duration) and the lower
> byte specifies the report id (0 means all reports).
> In our code we do idle = value, while it should be idle = "upper byte",
> especially if the guest issues a GET_IDLE, we should return only the
> idle rate while we are returning only the report id.
> In practice it doesn't make much difference because I have only seen
> SET_VALUE with both bytes set to 0 so far, but still it is wrong.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-07 16:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 12:45 [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour Stefano Stabellini
2009-01-07 15:20 ` Ian Jackson
2009-01-07 15:46 ` Alexander Graf
2009-01-07 15:53 ` Ian Jackson
2009-01-07 16:43 ` Anthony Liguori
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).