static char *usb_get_fw_dev_path(DeviceState *qdev)

{

    USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev);

    char *fw_path, *in;

    int pos = 0;

    long nr;



    fw_path = qemu_malloc(32 + strlen(dev->port->path) * 6);

    in = dev->port->path;

    while (true) {

        nr = strtol(in, &in, 10);

        if (in[0] == '.') {

            /* some hub between root port and device */

            pos += sprintf(fw_path + pos, "hub@%ld/", nr);

            in++;

        } else {

            /* the device itself */

            pos += sprintf(fw_path + pos, "%s@%ld", qdev_fw_name(qdev), nr);

            break;

        }

    }

    return fw_path;

}

static char *usb_get_fw_dev_path(DeviceState *qdev)

{

    USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev);

    char *fw_path, *in;

    int pos = 0;

    long nr;



    fw_path = qemu_malloc(32 + strlen(dev->port->path) * 6);

    in = dev->port->path;

    while (true) {

        nr = strtol(in, &in, 10);

        if (in[0] == '.') {

            

            pos += sprintf(fw_path + pos, "hub@%ld/", nr);

            in++;

        } else {

            

            pos += sprintf(fw_path + pos, "%s@%ld", qdev_fw_name(qdev), nr);

            break;

        }

    }

    return fw_path;

}

static char *FUNC_0(DeviceState *VAR_0)

{

    USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0);

    char *VAR_1, *VAR_2;

    int VAR_3 = 0;

    long VAR_4;



    VAR_1 = qemu_malloc(32 + strlen(dev->port->path) * 6);

    VAR_2 = dev->port->path;

    while (true) {

        VAR_4 = strtol(VAR_2, &VAR_2, 10);

        if (VAR_2[0] == '.') {

            

            VAR_3 += sprintf(VAR_1 + VAR_3, "hub@%ld/", VAR_4);

            VAR_2++;

        } else {

            

            VAR_3 += sprintf(VAR_1 + VAR_3, "%s@%ld", qdev_fw_name(VAR_0), VAR_4);

            break;

        }

    }

    return VAR_1;

}

static char *FUNC_0(DeviceState *VAR_0)
{ USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0); char *VAR_1, *VAR_2; int VAR_3 = 0; long VAR_4; VAR_1 = qemu_malloc(32 + strlen(dev->port->path) * 6); VAR_2 = dev->port->path; while (true) { VAR_4 = strtol(VAR_2, &VAR_2, 10); if (VAR_2[0] == '.') { VAR_3 += sprintf(VAR_1 + VAR_3, "hub@%ld/", VAR_4); VAR_2++; } else { VAR_3 += sprintf(VAR_1 + VAR_3, "%s@%ld", qdev_fw_name(VAR_0), VAR_4); break; } } return VAR_1; }