From 181a29c5b2f5eacdc8c5fdf30bf46a04abedffde Mon Sep 17 00:00:00 2001 From: aliguori Date: Wed, 7 Jan 2009 16:41:47 +0000 Subject: fix usb-hid SET_IDLE behaviour (Stefano Stabellini) 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 Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6211 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/usb-hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: -- cgit v1.1