static int usb_device_add(const char *devname, int is_hotplug)

{

    const char *p;

    USBDevice *dev;



    if (!free_usb_ports)

        return -1;



    if (strstart(devname, "host:", &p)) {

        dev = usb_host_device_open(p);

    } else if (!strcmp(devname, "mouse")) {

        dev = usb_mouse_init();

    } else if (!strcmp(devname, "tablet")) {

        dev = usb_tablet_init();

    } else if (!strcmp(devname, "keyboard")) {

        dev = usb_keyboard_init();

    } else if (strstart(devname, "disk:", &p)) {

        BlockDriverState *bs;



        dev = usb_msd_init(p, &bs);

        if (!dev)

            return -1;

        if (bdrv_key_required(bs)) {

            autostart = 0;

            if (is_hotplug && monitor_read_bdrv_key(bs) < 0) {

                dev->handle_destroy(dev);

                return -1;

            }

        }

    } else if (!strcmp(devname, "wacom-tablet")) {

        dev = usb_wacom_init();

    } else if (strstart(devname, "serial:", &p)) {

        dev = usb_serial_init(p);

#ifdef CONFIG_BRLAPI

    } else if (!strcmp(devname, "braille")) {

        dev = usb_baum_init();

#endif

    } else if (strstart(devname, "net:", &p)) {

        int nic = nb_nics;



        if (net_client_init("nic", p) < 0)

            return -1;

        nd_table[nic].model = "usb";

        dev = usb_net_init(&nd_table[nic]);

    } else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {

        dev = usb_bt_init(devname[2] ? hci_init(p) :

                        bt_new_hci(qemu_find_bt_vlan(0)));

    } else {

        return -1;

    }

    if (!dev)

        return -1;



    return usb_device_add_dev(dev);

}

static int usb_device_add(const char *devname, int is_hotplug)

{

    const char *p;

    USBDevice *dev;



    if (!free_usb_ports)

        return -1;



    if (strstart(devname, "host:", &p)) {

        dev = usb_host_device_open(p);

    } else if (!strcmp(devname, "mouse")) {

        dev = usb_mouse_init();

    } else if (!strcmp(devname, "tablet")) {

        dev = usb_tablet_init();

    } else if (!strcmp(devname, "keyboard")) {

        dev = usb_keyboard_init();

    } else if (strstart(devname, "disk:", &p)) {

        BlockDriverState *bs;



        dev = usb_msd_init(p, &bs);

        if (!dev)

            return -1;

        if (bdrv_key_required(bs)) {

            autostart = 0;

            if (is_hotplug && monitor_read_bdrv_key(bs) < 0) {

                dev->handle_destroy(dev);

                return -1;

            }

        }

    } else if (!strcmp(devname, "wacom-tablet")) {

        dev = usb_wacom_init();

    } else if (strstart(devname, "serial:", &p)) {

        dev = usb_serial_init(p);

#ifdef CONFIG_BRLAPI

    } else if (!strcmp(devname, "braille")) {

        dev = usb_baum_init();

#endif

    } else if (strstart(devname, "net:", &p)) {

        int nic = nb_nics;



        if (net_client_init("nic", p) < 0)

            return -1;

        nd_table[nic].model = "usb";

        dev = usb_net_init(&nd_table[nic]);

    } else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {

        dev = usb_bt_init(devname[2] ? hci_init(p) :

                        bt_new_hci(qemu_find_bt_vlan(0)));

    } else {

        return -1;

    }

    if (!dev)

        return -1;



    return usb_device_add_dev(dev);

}

static int FUNC_0(const char *VAR_0, int VAR_1)

{

    const char *VAR_2;

    USBDevice *dev;



    if (!free_usb_ports)

        return -1;



    if (strstart(VAR_0, "host:", &VAR_2)) {

        dev = usb_host_device_open(VAR_2);

    } else if (!strcmp(VAR_0, "mouse")) {

        dev = usb_mouse_init();

    } else if (!strcmp(VAR_0, "tablet")) {

        dev = usb_tablet_init();

    } else if (!strcmp(VAR_0, "keyboard")) {

        dev = usb_keyboard_init();

    } else if (strstart(VAR_0, "disk:", &VAR_2)) {

        BlockDriverState *bs;



        dev = usb_msd_init(VAR_2, &bs);

        if (!dev)

            return -1;

        if (bdrv_key_required(bs)) {

            autostart = 0;

            if (VAR_1 && monitor_read_bdrv_key(bs) < 0) {

                dev->handle_destroy(dev);

                return -1;

            }

        }

    } else if (!strcmp(VAR_0, "wacom-tablet")) {

        dev = usb_wacom_init();

    } else if (strstart(VAR_0, "serial:", &VAR_2)) {

        dev = usb_serial_init(VAR_2);

#ifdef CONFIG_BRLAPI

    } else if (!strcmp(VAR_0, "braille")) {

        dev = usb_baum_init();

#endif

    } else if (strstart(VAR_0, "net:", &VAR_2)) {

        int VAR_3 = nb_nics;



        if (net_client_init("VAR_3", VAR_2) < 0)

            return -1;

        nd_table[VAR_3].model = "usb";

        dev = usb_net_init(&nd_table[VAR_3]);

    } else if (!strcmp(VAR_0, "bt") || strstart(VAR_0, "bt:", &VAR_2)) {

        dev = usb_bt_init(VAR_0[2] ? hci_init(VAR_2) :

                        bt_new_hci(qemu_find_bt_vlan(0)));

    } else {

        return -1;

    }

    if (!dev)

        return -1;



    return usb_device_add_dev(dev);

}

static int FUNC_0(const char *VAR_0, int VAR_1)
{ const char *VAR_2; USBDevice *dev; if (!free_usb_ports)
return -1; if (strstart(VAR_0, "host:", &VAR_2)) { dev = usb_host_device_open(VAR_2); } else if (!strcmp(VAR_0, "mouse")) { dev = usb_mouse_init(); } else if (!strcmp(VAR_0, "tablet")) { dev = usb_tablet_init(); } else if (!strcmp(VAR_0, "keyboard")) { dev = usb_keyboard_init(); } else if (strstart(VAR_0, "disk:", &VAR_2)) { BlockDriverState *bs; dev = usb_msd_init(VAR_2, &bs); if (!dev)
return -1; if (bdrv_key_required(bs)) { autostart = 0; if (VAR_1 && monitor_read_bdrv_key(bs) < 0) { dev->handle_destroy(dev); return -1; } } } else if (!strcmp(VAR_0, "wacom-tablet")) { dev = usb_wacom_init(); } else if (strstart(VAR_0, "serial:", &VAR_2)) { dev = usb_serial_init(VAR_2); #ifdef CONFIG_BRLAPI
} else if (!strcmp(VAR_0, "braille")) { dev = usb_baum_init(); #endif
} else if (strstart(VAR_0, "net:", &VAR_2)) { int VAR_3 = nb_nics; if (net_client_init("VAR_3", VAR_2) < 0)
return -1; nd_table[VAR_3].model = "usb"; dev = usb_net_init(&nd_table[VAR_3]); } else if (!strcmp(VAR_0, "bt") || strstart(VAR_0, "bt:", &VAR_2)) { dev = usb_bt_init(VAR_0[2] ? hci_init(VAR_2) :
bt_new_hci(qemu_find_bt_vlan(0))); } else { return -1; } if (!dev)
return -1; return usb_device_add_dev(dev); }