Revision b373a63a
b/usb-linux.c | ||
---|---|---|
33 | 33 |
#include "qemu-common.h" |
34 | 34 |
#include "qemu-timer.h" |
35 | 35 |
#include "monitor.h" |
36 |
#include "sysemu.h" |
|
36 | 37 |
|
37 | 38 |
#include <dirent.h> |
38 | 39 |
#include <sys/ioctl.h> |
... | ... | |
132 | 133 |
int configuration; |
133 | 134 |
int ninterfaces; |
134 | 135 |
int closing; |
136 |
Notifier exit; |
|
135 | 137 |
|
136 | 138 |
struct ctrl_struct ctrl; |
137 | 139 |
struct endp_data endp_table[MAX_ENDPOINTS]; |
... | ... | |
404 | 406 |
|
405 | 407 |
usb_host_close(s); |
406 | 408 |
QTAILQ_REMOVE(&hostdevs, s, next); |
409 |
qemu_remove_exit_notifier(&s->exit); |
|
407 | 410 |
} |
408 | 411 |
|
409 | 412 |
static int usb_linux_update_endp_table(USBHostDevice *s); |
... | ... | |
997 | 1000 |
return 0; |
998 | 1001 |
} |
999 | 1002 |
|
1003 |
static void usb_host_exit_notifier(struct Notifier* n) |
|
1004 |
{ |
|
1005 |
USBHostDevice *s = container_of(n, USBHostDevice, exit); |
|
1006 |
|
|
1007 |
if (s->fd != -1) { |
|
1008 |
ioctl(s->fd, USBDEVFS_RESET); |
|
1009 |
} |
|
1010 |
} |
|
1011 |
|
|
1000 | 1012 |
static int usb_host_initfn(USBDevice *dev) |
1001 | 1013 |
{ |
1002 | 1014 |
USBHostDevice *s = DO_UPCAST(USBHostDevice, dev, dev); |
... | ... | |
1004 | 1016 |
dev->auto_attach = 0; |
1005 | 1017 |
s->fd = -1; |
1006 | 1018 |
QTAILQ_INSERT_TAIL(&hostdevs, s, next); |
1019 |
s->exit.notify = usb_host_exit_notifier; |
|
1020 |
qemu_add_exit_notifier(&s->exit); |
|
1007 | 1021 |
usb_host_auto_check(NULL); |
1008 | 1022 |
return 0; |
1009 | 1023 |
} |
Also available in: Unified diff