diff options
author | Miroslav Rezanina <mrezanin@redhat.com> | 2013-09-03 11:23:08 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-09-10 11:14:41 +0200 |
commit | 644e1a8a34d2f799bfeefae94b71593a2aa662ae (patch) | |
tree | 0979c9a61023be59e703f47e888b75a8face7773 /hw/bt/hci.c | |
parent | c60174e847082ab9f70720f86509a3353f816fad (diff) | |
download | qemu-644e1a8a34d2f799bfeefae94b71593a2aa662ae.zip qemu-644e1a8a34d2f799bfeefae94b71593a2aa662ae.tar.gz qemu-644e1a8a34d2f799bfeefae94b71593a2aa662ae.tar.bz2 |
Preparation for usb-bt-dongle conditional build
To allow disable usb-bt-dongle device using CONFIG_BLUETOOTH option, some of
functions in vl.c file has to be made accessible in dev-bluetooth.c. This is
pure code moving.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/bt/hci.c')
-rw-r--r-- | hw/bt/hci.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/hw/bt/hci.c b/hw/bt/hci.c index d1c0604..7ea3dc6 100644 --- a/hw/bt/hci.c +++ b/hw/bt/hci.c @@ -429,6 +429,24 @@ static const uint8_t bt_event_reserved_mask[8] = { 0xff, 0x9f, 0xfb, 0xff, 0x07, 0x18, 0x00, 0x00, }; + +static void null_hci_send(struct HCIInfo *hci, const uint8_t *data, int len) +{ +} + +static int null_hci_addr_set(struct HCIInfo *hci, const uint8_t *bd_addr) +{ + return -ENOTSUP; +} + +struct HCIInfo null_hci = { + .cmd_send = null_hci_send, + .sco_send = null_hci_send, + .acl_send = null_hci_send, + .bdaddr_set = null_hci_addr_set, +}; + + static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci, int evt, int len) { @@ -2176,6 +2194,36 @@ struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net) return &s->info; } +struct HCIInfo *hci_init(const char *str) +{ + char *endp; + struct bt_scatternet_s *vlan = 0; + + if (!strcmp(str, "null")) + /* null */ + return &null_hci; + else if (!strncmp(str, "host", 4) && (str[4] == '\0' || str[4] == ':')) + /* host[:hciN] */ + return bt_host_hci(str[4] ? str + 5 : "hci0"); + else if (!strncmp(str, "hci", 3)) { + /* hci[,vlan=n] */ + if (str[3]) { + if (!strncmp(str + 3, ",vlan=", 6)) { + vlan = qemu_find_bt_vlan(strtol(str + 9, &endp, 0)); + if (*endp) + vlan = 0; + } + } else + vlan = qemu_find_bt_vlan(0); + if (vlan) + return bt_new_hci(vlan); + } + + fprintf(stderr, "qemu: Unknown bluetooth HCI `%s'.\n", str); + + return 0; +} + static void bt_hci_done(struct HCIInfo *info) { struct bt_hci_s *hci = hci_from_info(info); |