aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-03-20 12:40:11 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-04-03 11:39:43 +0200
commita309ee6e0a256f690760abfba44fceaa52a7c2f3 (patch)
tree8128df78194b6c23474c8abcaabad5fcace11fa1
parentc24e4aac3bd7dd6591e26b77985e5d3915ecbe4b (diff)
usb-hub: report status changes only once
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/dev-hub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index a5f092bfee..0b71abd028 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -33,6 +33,7 @@ typedef struct USBHubPort {
USBPort port;
uint16_t wPortStatus;
uint16_t wPortChange;
+ uint16_t wPortChange_reported;
} USBHubPort;
typedef struct USBHubState {
@@ -467,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++) {