qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Scott Tsai <scottt.tw@gmail.com>
To: qemu-devel@nongnu.org
Cc: Scott Tsai <scottt.tw@gmail.com>
Subject: [Qemu-devel] [PATCH V3 1/3] usb: move HID request defines to hw/usb.h
Date: Wed, 11 Nov 2009 08:24:01 +0800	[thread overview]
Message-ID: <1257899043-28415-2-git-send-email-scottt.tw@gmail.com> (raw)
In-Reply-To: <1257899043-28415-1-git-send-email-scottt.tw@gmail.com>

Move USB HID request constants from hw/usb-hid.c to hw/usb.h
to allow other modules to use them.

Signed-off-by: Scott Tsai <scottt.tw@gmail.com>
---
 hw/usb-hid.c |   20 ++++++--------------
 hw/usb.h     |    8 ++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index f4a2a48..e263fc0 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -26,14 +26,6 @@
 #include "console.h"
 #include "usb.h"
 
-/* HID interface requests */
-#define GET_REPORT   0xa101
-#define GET_IDLE     0xa102
-#define GET_PROTOCOL 0xa103
-#define SET_REPORT   0x2109
-#define SET_IDLE     0x210a
-#define SET_PROTOCOL 0x210b
-
 /* HID descriptor types */
 #define USB_DT_HID    0x21
 #define USB_DT_REPORT 0x22
@@ -763,7 +755,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
             goto fail;
         }
         break;
-    case GET_REPORT:
+    case USB_REQ_HID_GET_REPORT:
 	if (s->kind == USB_MOUSE)
             ret = usb_mouse_poll(s, data, length);
 	else if (s->kind == USB_TABLET)
@@ -771,29 +763,29 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
         else if (s->kind == USB_KEYBOARD)
             ret = usb_keyboard_poll(&s->kbd, data, length);
         break;
-    case SET_REPORT:
+    case USB_REQ_HID_SET_REPORT:
         if (s->kind == USB_KEYBOARD)
             ret = usb_keyboard_write(&s->kbd, data, length);
         else
             goto fail;
         break;
-    case GET_PROTOCOL:
+    case USB_REQ_HID_GET_PROTOCOL:
         if (s->kind != USB_KEYBOARD)
             goto fail;
         ret = 1;
         data[0] = s->protocol;
         break;
-    case SET_PROTOCOL:
+    case USB_REQ_HID_SET_PROTOCOL:
         if (s->kind != USB_KEYBOARD)
             goto fail;
         ret = 0;
         s->protocol = value;
         break;
-    case GET_IDLE:
+    case USB_REQ_HID_GET_IDLE:
         ret = 1;
         data[0] = s->idle;
         break;
-    case SET_IDLE:
+    case USB_REQ_HID_SET_IDLE:
         s->idle = (uint8_t) (value >> 8);
         ret = 0;
         break;
diff --git a/hw/usb.h b/hw/usb.h
index 351c466..7d46931 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -104,6 +104,14 @@
 #define USB_REQ_SET_INTERFACE		0x0B
 #define USB_REQ_SYNCH_FRAME		0x0C
 
+/* HID interface requests */
+#define USB_REQ_HID_GET_REPORT   0xa101
+#define USB_REQ_HID_GET_IDLE     0xa102
+#define USB_REQ_HID_GET_PROTOCOL 0xa103
+#define USB_REQ_HID_SET_REPORT   0x2109
+#define USB_REQ_HID_SET_IDLE     0x210a
+#define USB_REQ_HID_SET_PROTOCOL 0x210b
+
 #define USB_DEVICE_SELF_POWERED		0
 #define USB_DEVICE_REMOTE_WAKEUP	1
 
-- 
1.6.5.2

  reply	other threads:[~2009-11-11  0:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  0:24 [Qemu-devel] [PATCH V3 0/3] usb-gotemp: USB thermometer emulation Scott Tsai
2009-11-11  0:24 ` Scott Tsai [this message]
2009-11-11  0:24   ` [Qemu-devel] [PATCH V3 2/3] usb-gotemp: new module emulating a USB thermometer Scott Tsai
2009-11-11  0:24     ` [Qemu-devel] [PATCH V3 3/3] Documentation: -usbdevice thermometer option Scott Tsai
2009-11-11  4:25 ` [Qemu-devel] [PATCH V3 0/3] usb-gotemp: USB thermometer emulation Paul Brook

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=1257899043-28415-2-git-send-email-scottt.tw@gmail.com \
    --to=scottt.tw@gmail.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).