提交 a309ee6e 编写于 作者: G Gerd Hoffmann

usb-hub: report status changes only once

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 c24e4aac
...@@ -33,6 +33,7 @@ typedef struct USBHubPort { ...@@ -33,6 +33,7 @@ typedef struct USBHubPort {
USBPort port; USBPort port;
uint16_t wPortStatus; uint16_t wPortStatus;
uint16_t wPortChange; uint16_t wPortChange;
uint16_t wPortChange_reported;
} USBHubPort; } USBHubPort;
typedef struct USBHubState { typedef struct USBHubState {
...@@ -467,8 +468,11 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) ...@@ -467,8 +468,11 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
status = 0; status = 0;
for(i = 0; i < NUM_PORTS; i++) { for(i = 0; i < NUM_PORTS; i++) {
port = &s->ports[i]; port = &s->ports[i];
if (port->wPortChange) if (port->wPortChange &&
port->wPortChange_reported != port->wPortChange) {
status |= (1 << (i + 1)); status |= (1 << (i + 1));
}
port->wPortChange_reported = port->wPortChange;
} }
if (status != 0) { if (status != 0) {
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册