Пример #1
0
static struct usb_device *find_dev(int index)
{
	struct usb_bus *b;
	struct usb_device *d;
	int enumeration = 0;

	b = usb_get_busses();

	while (b) {
		d = b->devices;
		while (d) {
			if (check_known_device(d)) {
				if (enumeration == index) return d;
				else enumeration++;
			}

#ifdef DEBUG
			printf("%04x %04x\n",
				   d->descriptor.idVendor,
				   d->descriptor.idProduct);
#endif
			d = d->next;
		}
		b = b->next;
	}
	return NULL;
}
Пример #2
0
static struct usb_device *find_dev(void)
{
    struct usb_bus *b;
    struct usb_device *d;

    b = usb_get_busses();

    while(1) {
        if (b == NULL) break;

        d = b->devices;
        while(1) {
            if (!d) break;

			if (check_known_device(d))
				return d;

#ifdef DEBUG
            printf("%04x %04x\n",
                   d->descriptor.idVendor,
                   d->descriptor.idProduct);
#endif
            d = d->next;
        }
        b = b->next;
    }
    return NULL;
}