Skip to contentSkip to conversation

Fix qemu mouse Set_Protocol behavior

PATCH Superseded Kevin O'Connor 3 participants 4 messages May 2, 2010 – May 3, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix qemu mouse Set_Protocol behavior

The QEMU USB mouse claims to support the "boot" protocol (bInterfaceSubClass is 1). However, the mouse rejects the Set_Protocol command.

The qemu mouse does support the "boot" protocol specification, so a simple fix is to just enable the Set_Portocol request.

-Kevin

hw/usb-hid.c +2 -2
@@ -790,13 +790,13 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
             goto fail;
         break;
     case GET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD && s->kind != USB_MOUSE)
             goto fail;
         ret = 1;
         data[0] = s->protocol;
         break;
     case SET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD && s->kind != USB_MOUSE)
             goto fail;
         ret = 0;
         s->protocol = value;
#1 lore raw
Quoted 6 lines · Kevin O'Connor

Date: Sat, 1 May 2010 22:38:51 -0400
From: Kevin O'Connor <[email protected]>
To: [email protected], [email protected]
Cc:
Subject: [Qemu-devel] [PATCH] Fix qemu mouse Set_Protocol behavior

Quoted 8 lines

The QEMU USB mouse claims to support the "boot" protocol (bInterfaceSubClass is 1). However, the mouse rejects the Set_Protocol command.

The qemu mouse does support the "boot" protocol specification, so a simple fix is to just enable the Set_Portocol request.

-Kevin

Isn't it true for the USB_TABLET as well?

Shahar.

Quoted 22 lines
hw/usb-hid.c +2 -2
@@ -790,13 +790,13 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
             goto fail;
         break;
     case GET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD && s->kind != USB_MOUSE)
             goto fail;
         ret = 1;
         data[0] = s->protocol;
         break;
     case SET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD && s->kind != USB_MOUSE)
             goto fail;
         ret = 0;
         s->protocol = value;
#2 lore raw
Quoted 9 lines · Shahar Havivi
Quoted 7 lines · Kevin O'Connor

The QEMU USB mouse claims to support the "boot" protocol (bInterfaceSubClass is 1). However, the mouse rejects the Set_Protocol command.

The qemu mouse does support the "boot" protocol specification, so a simple fix is to just enable the Set_Portocol request.

Isn't it true for the USB_TABLET as well?

The USB tablet appears to also advertise that it supports the "boot" protocol. However, its reports aren't "boot" protocol compatible. So, it really shouldn't claim that. A fix (briefly tested) is below.

-Kevin

hw/usb-hid.c +1 -1
@@ -181,7 +181,7 @@ static const uint8_t qemu_tablet_config_descriptor[] = {
        0x00,       /*  u8  if_bAlternateSetting; */
        0x01,       /*  u8  if_bNumEndpoints; */
        0x03,       /*  u8  if_bInterfaceClass; */
-       0x01,       /*  u8  if_bInterfaceSubClass; */
+       0x00,       /*  u8  if_bInterfaceSubClass; */
        0x02,       /*  u8  if_bInterfaceProtocol; [usb1.1 or single tt] */
        0x07,       /*  u8  if_iInterface; */
 
#3 lore raw
In reply to Kevin O'Connor
Quoted 9 lines · Kevin O'Connor

The QEMU USB mouse claims to support the "boot" protocol (bInterfaceSubClass is 1). However, the mouse rejects the Set_Protocol command.

The qemu mouse does support the "boot" protocol specification, so a simple fix is to just enable the Set_Portocol request.

-Kevin

Could you included a Signed-of-by: and resubmit both patches?

Thanks,

Anthony Liguori

Quoted 22 lines
hw/usb-hid.c +2 -2
@@ -790,13 +790,13 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
              goto fail;
          break;
      case GET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD&&  s->kind != USB_MOUSE)
              goto fail;
          ret = 1;
          data[0] = s->protocol;
          break;
      case SET_PROTOCOL:
-        if (s->kind != USB_KEYBOARD)
+        if (s->kind != USB_KEYBOARD&&  s->kind != USB_MOUSE)
              goto fail;
          ret = 0;
          s->protocol = value;