static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port,

                              int class_id, int vendor_id, int product_id,

                              const char *product_name, int speed)

{

    struct USBAutoFilter *f;

    struct USBHostDevice *s;



    /* Ignore hubs */

    if (class_id == 9)

        return 0;



    QTAILQ_FOREACH(s, &hostdevs, next) {

        f = &s->match;



        if (f->bus_num > 0 && f->bus_num != bus_num) {

            continue;

        }

        if (f->addr > 0 && f->addr != addr) {

            continue;

        }

        if (f->port != NULL && (port == NULL || strcmp(f->port, port) != 0)) {

            continue;

        }



        if (f->vendor_id > 0 && f->vendor_id != vendor_id) {

            continue;

        }



        if (f->product_id > 0 && f->product_id != product_id) {

            continue;

        }

        /* We got a match */



        /* Already attached ? */

        if (s->fd != -1) {

            return 0;

        }

        DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr);



        usb_host_open(s, bus_num, addr, port, product_name, speed);

        break;

    }



    return 0;

}

static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port,

                              int class_id, int vendor_id, int product_id,

                              const char *product_name, int speed)

{

    struct USBAutoFilter *f;

    struct USBHostDevice *s;



    

    if (class_id == 9)

        return 0;



    QTAILQ_FOREACH(s, &hostdevs, next) {

        f = &s->match;



        if (f->bus_num > 0 && f->bus_num != bus_num) {

            continue;

        }

        if (f->addr > 0 && f->addr != addr) {

            continue;

        }

        if (f->port != NULL && (port == NULL || strcmp(f->port, port) != 0)) {

            continue;

        }



        if (f->vendor_id > 0 && f->vendor_id != vendor_id) {

            continue;

        }



        if (f->product_id > 0 && f->product_id != product_id) {

            continue;

        }

        



        

        if (s->fd != -1) {

            return 0;

        }

        DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr);



        usb_host_open(s, bus_num, addr, port, product_name, speed);

        break;

    }



    return 0;

}

static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2, char *VAR_3,

                              int VAR_4, int VAR_5, int VAR_6,

                              const char *VAR_7, int VAR_8)

{

    struct USBAutoFilter *VAR_9;

    struct USBHostDevice *VAR_10;



    

    if (VAR_4 == 9)

        return 0;



    QTAILQ_FOREACH(VAR_10, &hostdevs, next) {

        VAR_9 = &VAR_10->match;



        if (VAR_9->VAR_1 > 0 && VAR_9->VAR_1 != VAR_1) {

            continue;

        }

        if (VAR_9->VAR_2 > 0 && VAR_9->VAR_2 != VAR_2) {

            continue;

        }

        if (VAR_9->VAR_3 != NULL && (VAR_3 == NULL || strcmp(VAR_9->VAR_3, VAR_3) != 0)) {

            continue;

        }



        if (VAR_9->VAR_5 > 0 && VAR_9->VAR_5 != VAR_5) {

            continue;

        }



        if (VAR_9->VAR_6 > 0 && VAR_9->VAR_6 != VAR_6) {

            continue;

        }

        



        

        if (VAR_10->fd != -1) {

            return 0;

        }

        DPRINTF("husb: auto open: VAR_1 %d VAR_2 %d\n", VAR_1, VAR_2);



        usb_host_open(VAR_10, VAR_1, VAR_2, VAR_3, VAR_7, VAR_8);

        break;

    }



    return 0;

}

static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2, char *VAR_3,
int VAR_4, int VAR_5, int VAR_6,
const char *VAR_7, int VAR_8)
{ struct USBAutoFilter *VAR_9; struct USBHostDevice *VAR_10; if (VAR_4 == 9)
return 0; QTAILQ_FOREACH(VAR_10, &hostdevs, next) { VAR_9 = &VAR_10->match; if (VAR_9->VAR_1 > 0 && VAR_9->VAR_1 != VAR_1) { continue; } if (VAR_9->VAR_2 > 0 && VAR_9->VAR_2 != VAR_2) { continue; } if (VAR_9->VAR_3 != NULL && (VAR_3 == NULL || strcmp(VAR_9->VAR_3, VAR_3) != 0)) { continue; } if (VAR_9->VAR_5 > 0 && VAR_9->VAR_5 != VAR_5) { continue; } if (VAR_9->VAR_6 > 0 && VAR_9->VAR_6 != VAR_6) { continue; } if (VAR_10->fd != -1) { return 0; } DPRINTF("husb: auto open: VAR_1 %d VAR_2 %d\n", VAR_1, VAR_2); usb_host_open(VAR_10, VAR_1, VAR_2, VAR_3, VAR_7, VAR_8); break; } return 0; }