---
hw/usb-bus.c | 16
hw/usb.h |1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index b692503..d732bd3 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -189,6 +189,22 @@ int usb_device_detach(USBDevice *dev)
return 0;
Hi,
There is no problem to loop over all usb devices. But first of all I
don't want to loop on used, since then I miss any detached devices,
so I actually do want the same behavior of qdev_find_recursive, and
since it's already available, why rewrite it in a different
compilation unit?
Point
+USBDevice *usb_device_by_id(const char* id)
+{
+USBBus *bus;
+DeviceState *qdev;
+USBDevice *dev;
+
+QTAILQ_FOREACH(bus,&busses, next) {
+qdev = qdev_find_recursive(&bus->qbus, id);
+if (qdev != NULL) {
+dev = DO_UPCAST(USBDevice, qdev, qdev);
+
- "Gerd Hoffmann" wrote:
> > +USBDevice *usb_device_by_id(const char* id)
> > +{
> > +USBBus *bus;
> > +DeviceState *qdev;
> > +USBDevice *dev;
> > +
> > +QTAILQ_FOREACH(bus,&busses, next) {
> > +qdev = qdev_find_recursive(&bus->qbus, id);
> > +if (qdev != NUL
---
hw/usb-bus.c | 16
hw/usb.h |1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index b692503..d732bd3 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -189,6 +189,22 @@ int usb_device_detach(USBDevice *dev)
return 0;