render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0144-usb-redir-Get-rid-of-async-struct-get-member.patch

5544c1
From a9fd3192a956ed1bce0f945f6b35bf9b162b30c3 Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Date: Mon, 27 Aug 2012 16:33:08 +0200
5544c1
Subject: [PATCH] usb-redir: Get rid of async-struct get member
Hans de Goede c8dfc6
Hans de Goede c8dfc6
This is a preparation patch for completely getting rid of the async-packet
Hans de Goede c8dfc6
struct in usb-redir, instead relying on the (new) per ep queues in the
Hans de Goede c8dfc6
qemu usb core.
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1
(cherry picked from commit cb897117cdedd488f19985c8ec5ea05971103a27)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/usb/redirect.c | 9 +++------
Hans de Goede c8dfc6
 1 file changed, 3 insertions(+), 6 deletions(-)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
5544c1
index 5cc3334..2cae8c5 100644
Hans de Goede c8dfc6
--- a/hw/usb/redirect.c
Hans de Goede c8dfc6
+++ b/hw/usb/redirect.c
Hans de Goede c8dfc6
@@ -1,7 +1,7 @@
Hans de Goede c8dfc6
 /*
Hans de Goede c8dfc6
  * USB redirector usb-guest
Hans de Goede c8dfc6
  *
Hans de Goede c8dfc6
- * Copyright (c) 2011 Red Hat, Inc.
Hans de Goede c8dfc6
+ * Copyright (c) 2011-2012 Red Hat, Inc.
Hans de Goede c8dfc6
  *
Hans de Goede c8dfc6
  * Red Hat Authors:
Hans de Goede c8dfc6
  * Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
@@ -99,7 +99,6 @@ struct AsyncURB {
Hans de Goede c8dfc6
     USBRedirDevice *dev;
Hans de Goede c8dfc6
     USBPacket *packet;
Hans de Goede c8dfc6
     uint32_t packet_id;
Hans de Goede c8dfc6
-    int get;
Hans de Goede c8dfc6
     union {
Hans de Goede c8dfc6
         struct usb_redir_control_packet_header control_packet;
Hans de Goede c8dfc6
         struct usb_redir_bulk_packet_header bulk_packet;
5544c1
@@ -672,7 +671,6 @@ static int usbredir_get_config(USBRedirDevice *dev, USBPacket *p)
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
     DPRINTF("get config id %u\n", aurb->packet_id);
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
-    aurb->get = 1;
Hans de Goede c8dfc6
     usbredirparser_send_get_configuration(dev->parser, aurb->packet_id);
Hans de Goede c8dfc6
     usbredirparser_do_write(dev->parser);
Hans de Goede c8dfc6
     return USB_RET_ASYNC;
5544c1
@@ -721,7 +719,6 @@ static int usbredir_get_interface(USBRedirDevice *dev, USBPacket *p,
Hans de Goede c8dfc6
     DPRINTF("get interface %d id %u\n", interface, aurb->packet_id);
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
     get_alt.interface = interface;
Hans de Goede c8dfc6
-    aurb->get = 1;
Hans de Goede c8dfc6
     usbredirparser_send_get_alt_setting(dev->parser, aurb->packet_id,
Hans de Goede c8dfc6
                                         &get_alt);
Hans de Goede c8dfc6
     usbredirparser_do_write(dev->parser);
5544c1
@@ -1226,7 +1223,7 @@ static void usbredir_configuration_status(void *priv, uint32_t id,
Hans de Goede c8dfc6
         return;
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
     if (aurb->packet) {
Hans de Goede c8dfc6
-        if (aurb->get) {
Hans de Goede c8dfc6
+        if (dev->dev.setup_buf[0] & USB_DIR_IN) {
Hans de Goede c8dfc6
             dev->dev.data_buf[0] = config_status->configuration;
Hans de Goede c8dfc6
             len = 1;
Hans de Goede c8dfc6
         }
5544c1
@@ -1254,7 +1251,7 @@ static void usbredir_alt_setting_status(void *priv, uint32_t id,
Hans de Goede c8dfc6
         return;
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
     if (aurb->packet) {
Hans de Goede c8dfc6
-        if (aurb->get) {
Hans de Goede c8dfc6
+        if (dev->dev.setup_buf[0] & USB_DIR_IN) {
Hans de Goede c8dfc6
             dev->dev.data_buf[0] = alt_setting_status->alt;
Hans de Goede c8dfc6
             len = 1;
Hans de Goede c8dfc6
         }
Hans de Goede c8dfc6
-- 
5544c1
1.7.12.1
Hans de Goede c8dfc6