static struct bt_device_s *bt_device_add(const char *opt)

{

    struct bt_scatternet_s *vlan;

    int vlan_id = 0;

    char *endp = strstr(opt, ",vlan=");

    int len = (endp ? endp - opt : strlen(opt)) + 1;

    char devname[10];



    pstrcpy(devname, MIN(sizeof(devname), len), opt);



    if (endp) {

        vlan_id = strtol(endp + 6, &endp, 0);

        if (*endp) {

            fprintf(stderr, "qemu: unrecognised bluetooth vlan Id\n");

            return 0;

        }

    }



    vlan = qemu_find_bt_vlan(vlan_id);



    if (!vlan->slave)

        fprintf(stderr, "qemu: warning: adding a slave device to "

                        "an empty scatternet %i\n", vlan_id);



    if (!strcmp(devname, "keyboard"))

        return bt_keyboard_init(vlan);



    fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", devname);

    return 0;

}

static struct bt_device_s *bt_device_add(const char *opt)

{

    struct bt_scatternet_s *vlan;

    int vlan_id = 0;

    char *endp = strstr(opt, ",vlan=");

    int len = (endp ? endp - opt : strlen(opt)) + 1;

    char devname[10];



    pstrcpy(devname, MIN(sizeof(devname), len), opt);



    if (endp) {

        vlan_id = strtol(endp + 6, &endp, 0);

        if (*endp) {

            fprintf(stderr, "qemu: unrecognised bluetooth vlan Id\n");

            return 0;

        }

    }



    vlan = qemu_find_bt_vlan(vlan_id);



    if (!vlan->slave)

        fprintf(stderr, "qemu: warning: adding a slave device to "

                        "an empty scatternet %i\n", vlan_id);



    if (!strcmp(devname, "keyboard"))

        return bt_keyboard_init(vlan);



    fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", devname);

    return 0;

}

static struct bt_device_s *FUNC_0(const char *VAR_0)

{

    struct bt_scatternet_s *VAR_1;

    int VAR_2 = 0;

    char *VAR_3 = strstr(VAR_0, ",VAR_1=");

    int VAR_4 = (VAR_3 ? VAR_3 - VAR_0 : strlen(VAR_0)) + 1;

    char VAR_5[10];



    pstrcpy(VAR_5, MIN(sizeof(VAR_5), VAR_4), VAR_0);



    if (VAR_3) {

        VAR_2 = strtol(VAR_3 + 6, &VAR_3, 0);

        if (*VAR_3) {

            fprintf(stderr, "qemu: unrecognised bluetooth VAR_1 Id\n");

            return 0;

        }

    }



    VAR_1 = qemu_find_bt_vlan(VAR_2);



    if (!VAR_1->slave)

        fprintf(stderr, "qemu: warning: adding a slave device to "

                        "an empty scatternet %i\n", VAR_2);



    if (!strcmp(VAR_5, "keyboard"))

        return bt_keyboard_init(VAR_1);



    fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", VAR_5);

    return 0;

}

static struct bt_device_s *FUNC_0(const char *VAR_0)
{ struct bt_scatternet_s *VAR_1; int VAR_2 = 0; char *VAR_3 = strstr(VAR_0, ",VAR_1="); int VAR_4 = (VAR_3 ? VAR_3 - VAR_0 : strlen(VAR_0)) + 1; char VAR_5[10]; pstrcpy(VAR_5, MIN(sizeof(VAR_5), VAR_4), VAR_0); if (VAR_3) { VAR_2 = strtol(VAR_3 + 6, &VAR_3, 0); if (*VAR_3) { fprintf(stderr, "qemu: unrecognised bluetooth VAR_1 Id\n"); return 0; } } VAR_1 = qemu_find_bt_vlan(VAR_2); if (!VAR_1->slave)
fprintf(stderr, "qemu: warning: adding a slave device to "
"an empty scatternet %i\n", VAR_2); if (!strcmp(VAR_5, "keyboard"))
return bt_keyboard_init(VAR_1); fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", VAR_5); return 0; }