Commit a309ee6e authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

usb-hub: report status changes only once



Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent c24e4aac
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ typedef struct USBHubPort {
    USBPort port;
    uint16_t wPortStatus;
    uint16_t wPortChange;
    uint16_t wPortChange_reported;
} USBHubPort;

typedef struct USBHubState {
@@ -467,9 +468,12 @@ 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++) {
                    buf[i] = status >> (8 * i);