--- qemu/vl.c 2006-07-17 03:16:38.191157512 -0500 +++ qemu/vl.c 2006-07-17 03:18:13.402683160 -0500 @@ -3781,6 +3781,7 @@ { USBPort *port; USBPort **lastp; + USBDevice *dev; int bus_num, addr; const char *p; @@ -3805,8 +3806,10 @@ if (!port) return -1; + dev = port->dev; *lastp = port->next; usb_attach(port, NULL); + dev->handle_reset(dev, 1); port->next = free_usb_ports; free_usb_ports = port; return 0; --- qemu/usb-linux.c 2006-06-26 16:00:51.000000000 -0500 +++ qemu/usb-linux.c 2006-07-17 03:32:28.427699600 -0500 @@ -59,6 +59,14 @@ static void usb_host_handle_reset(USBDevice *dev, int destroy) { + USBHostDevice *s = (USBHostDevice *)dev; + + if (destroy) { + if (s->fd >= 0) + close(s->fd); + qemu_free(s); + return; + } #if 0 USBHostDevice *s = (USBHostDevice *)dev; /* USBDEVFS_RESET, but not the first time as it has already be