qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour
Date: Wed, 07 Jan 2009 12:45:57 +0000	[thread overview]
Message-ID: <4964A405.50801@eu.citrix.com> (raw)

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:

             reply	other threads:[~2009-01-07 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 12:45 Stefano Stabellini [this message]
2009-01-07 15:20 ` [Qemu-devel] [PATCH] fix usb-hid SET_IDLE behaviour Ian Jackson
2009-01-07 15:46   ` Alexander Graf
2009-01-07 15:53     ` Ian Jackson
2009-01-07 16:43 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4964A405.50801@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).