----- "Gerd Hoffmann" <kra...@redhat.com> 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 != NULL) {
> > +            dev = DO_UPCAST(USBDevice, qdev, qdev);
> > +            return dev;
> > +        }
> > +    }
> 
> You don't need qdev_find_recursive here.  Have a look at the
> usb_info() 
> code to see how to loop over all usb devices.  Then compare id with 
> USBDevice->qdev.id.
> 
> cheers,
>    Gerd

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?

Alon

Reply via email to