Signed-off-by: Shahar Havivi
---
usb-linux.c | 14 ++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 22a85e3..c3c38ec 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -33,6 +33,7 @@
#include "qemu-common.h"
#include "qemu-timer.h"
#i
On Wed, Jun 16, 2010 at 10:48:23AM +0200, Gerd Hoffmann wrote:
> Date: Wed, 16 Jun 2010 10:48:23 +0200
> From: Gerd Hoffmann
> To: Shahar Havivi
> Cc: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH 2/2] Return usb device to host on exit
>
> >+static void
+static void usb_host_cleanup(struct Notifier* n)
+{
+struct USBHostDevice *s;
+
+QTAILQ_FOREACH(s,&hostdevs, next) {
+if (s->fd != -1) {
+ioctl(s->fd, USBDEVFS_RESET);
+}
+}
+}
Well. The point of exit notifiers is that you don't need global
variables fo
Signed-off-by: Shahar Havivi
---
usb-linux.c | 19 +++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 22a85e3..4b5aeb6 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -33,6 +33,7 @@
#include "qemu-common.h"
#include "qemu-timer.h
@@ -1066,6 +1077,7 @@ USBDevice *usb_host_device_open(const char *devname)
qdev_prop_set_uint32(&dev->qdev, "vendorid", filter.vendor_id);
qdev_prop_set_uint32(&dev->qdev, "productid", filter.product_id);
qdev_init_nofail(&dev->qdev);
+atexit(usb_host_cleanup);
return
Signed-off-by: Shahar Havivi
---
usb-linux.c | 12
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 22a85e3..2a595f0 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -286,6 +286,17 @@ static void async_cancel(USBPacket *unused, void *opa