summary refs log tree commit diff stats
path: root/hw/usb/dev-hub.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-04-08 10:36:40 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-08 10:36:40 -0500
commit2a7a239ff09aa87cc3682a976c7a57d9ea1321d7 (patch)
treee0043f932da9fac985bcd3c9ba03e700f82f04ad /hw/usb/dev-hub.c
parent9196dd411d580c27f85daa209ff9a501d719ebc0 (diff)
parentaa1c9e971e80d25b92908dce3dec7c38b49480ea (diff)
downloadfocaccia-qemu-2a7a239ff09aa87cc3682a976c7a57d9ea1321d7.tar.gz
focaccia-qemu-2a7a239ff09aa87cc3682a976c7a57d9ea1321d7.zip
Merge remote-tracking branch 'kraxel/usb.79' into staging
# By Gerd Hoffmann (7) and Hans de Goede (3)
# Via Gerd Hoffmann
* kraxel/usb.79:
  usb-tablet: Don't claim wakeup capability for USB-2 version
  usb: update docs for bus name change
  usb-hub: report status changes only once
  usb-hub: limit chain length
  xhci: zap unused name field
  xhci: remove unimplemented printfs
  xhci: remove leftover debug printf
  xhci: fix numintrs sanity checks
  usb-redir: Add flow control support
  usb-redir: Fix crash on migration with no client connected
Diffstat (limited to 'hw/usb/dev-hub.c')
-rw-r--r--hw/usb/dev-hub.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 504c98c350..0b71abd028 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -25,6 +25,7 @@
 #include "trace.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
+#include "qemu/error-report.h"
 
 #define NUM_PORTS 8
 
@@ -32,6 +33,7 @@ typedef struct USBHubPort {
     USBPort port;
     uint16_t wPortStatus;
     uint16_t wPortChange;
+    uint16_t wPortChange_reported;
 } USBHubPort;
 
 typedef struct USBHubState {
@@ -466,8 +468,11 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
             status = 0;
             for(i = 0; i < NUM_PORTS; i++) {
                 port = &s->ports[i];
-                if (port->wPortChange)
+                if (port->wPortChange &&
+                    port->wPortChange_reported != port->wPortChange) {
                     status |= (1 << (i + 1));
+                }
+                port->wPortChange_reported = port->wPortChange;
             }
             if (status != 0) {
                 for(i = 0; i < n; i++) {
@@ -514,6 +519,11 @@ static int usb_hub_initfn(USBDevice *dev)
     USBHubPort *port;
     int i;
 
+    if (dev->port->hubcount == 5) {
+        error_report("usb hub chain too deep");
+        return -1;
+    }
+
     usb_desc_create_serial(dev);
     usb_desc_init(dev);
     s->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);