aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-hid.c
diff options
context:
space:
mode:
authorCésar Belley <cesar.belley@lse.epita.fr>2020-08-12 11:41:23 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-08-31 08:10:47 +0200
commit84b6c23629df888f1c11cace155704a97a239f7c (patch)
treebc291ed486754b010fe53ed4813b2b8f8d6eab62 /hw/usb/dev-hid.c
parent10b2d90c947e557a2ec5c58919d2b5ad3c400c50 (diff)
downloadqemu-84b6c23629df888f1c11cace155704a97a239f7c.zip
qemu-84b6c23629df888f1c11cace155704a97a239f7c.tar.gz
qemu-84b6c23629df888f1c11cace155704a97a239f7c.tar.bz2
hw/usb: Regroup USB HID protocol values
Group some HID values that are used pretty much everywhere when dealing with HID devices. Signed-off-by: César Belley <cesar.belley@lse.epita.fr> Message-id: 20200812094135.20550-2-cesar.belley@lse.epita.fr Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/dev-hid.c')
-rw-r--r--hw/usb/dev-hid.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 89f63b6..c73f7b2 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -32,21 +32,9 @@
#include "qemu/module.h"
#include "qemu/timer.h"
#include "hw/input/hid.h"
+#include "hw/usb/hid.h"
#include "hw/qdev-properties.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
-#define USB_DT_PHY 0x23
-
typedef struct USBHIDState {
USBDevice dev;
USBEndpoint *intr;
@@ -618,38 +606,38 @@ static void usb_hid_handle_control(USBDevice *dev, USBPacket *p,
goto fail;
}
break;
- case GET_REPORT:
+ case HID_GET_REPORT:
if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET) {
p->actual_length = hid_pointer_poll(hs, data, length);
} else if (hs->kind == HID_KEYBOARD) {
p->actual_length = hid_keyboard_poll(hs, data, length);
}
break;
- case SET_REPORT:
+ case HID_SET_REPORT:
if (hs->kind == HID_KEYBOARD) {
p->actual_length = hid_keyboard_write(hs, data, length);
} else {
goto fail;
}
break;
- case GET_PROTOCOL:
+ case HID_GET_PROTOCOL:
if (hs->kind != HID_KEYBOARD && hs->kind != HID_MOUSE) {
goto fail;
}
data[0] = hs->protocol;
p->actual_length = 1;
break;
- case SET_PROTOCOL:
+ case HID_SET_PROTOCOL:
if (hs->kind != HID_KEYBOARD && hs->kind != HID_MOUSE) {
goto fail;
}
hs->protocol = value;
break;
- case GET_IDLE:
+ case HID_GET_IDLE:
data[0] = hs->idle;
p->actual_length = 1;
break;
- case SET_IDLE:
+ case HID_SET_IDLE:
hs->idle = (uint8_t) (value >> 8);
hid_set_next_idle(hs);
if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET) {