From 12cd2eda1a7648833ddfa39c0d02c90693fd2d99 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 4 Jul 2016 19:21:44 +0200 Subject: [PATCH] lib: Define HCI_PRIMARY and use it instead of HCI_BREDR --- emulator/hciemu.c | 3 ++- emulator/le.c | 2 +- emulator/vhci.c | 6 +++--- lib/hci.c | 10 +++++----- lib/hci.h | 3 ++- monitor/packet.c | 2 +- tools/btinfo.c | 4 ++-- tools/btproxy.c | 4 ++-- tools/cltest.c | 2 +- tools/hciconfig.c | 6 +++--- 10 files changed, 22 insertions(+), 20 deletions(-) diff --git a/emulator/hciemu.c b/emulator/hciemu.c index 6a534990b..ea1e3cf79 100644 --- a/emulator/hciemu.c +++ b/emulator/hciemu.c @@ -243,7 +243,8 @@ static bool create_vhci(struct hciemu *hciemu) } create_req[0] = HCI_VENDOR_PKT; - create_req[1] = HCI_BREDR; + create_req[1] = HCI_PRIMARY; + written = write(fd, create_req, sizeof(create_req)); if (written < 0) { close(fd); diff --git a/emulator/le.c b/emulator/le.c index 82ae573f4..d7ee297c0 100644 --- a/emulator/le.c +++ b/emulator/le.c @@ -1881,7 +1881,7 @@ struct bt_le *bt_le_new(void) } setup_cmd[0] = HCI_VENDOR_PKT; - setup_cmd[1] = HCI_BREDR; + setup_cmd[1] = HCI_PRIMARY; if (write(hci->vhci_fd, setup_cmd, sizeof(setup_cmd)) < 0) { close(hci->vhci_fd); diff --git a/emulator/vhci.c b/emulator/vhci.c index 6bba4e2c6..8dec20a08 100644 --- a/emulator/vhci.c +++ b/emulator/vhci.c @@ -105,15 +105,15 @@ struct vhci *vhci_open(enum vhci_type type) switch (type) { case VHCI_TYPE_BREDRLE: btdev_type = BTDEV_TYPE_BREDRLE; - ctrl_type = HCI_BREDR; + ctrl_type = HCI_PRIMARY; break; case VHCI_TYPE_BREDR: btdev_type = BTDEV_TYPE_BREDR; - ctrl_type = HCI_BREDR; + ctrl_type = HCI_PRIMARY; break; case VHCI_TYPE_LE: btdev_type = BTDEV_TYPE_LE; - ctrl_type = HCI_BREDR; + ctrl_type = HCI_PRIMARY; break; case VHCI_TYPE_AMP: btdev_type = BTDEV_TYPE_AMP; diff --git a/lib/hci.c b/lib/hci.c index c339085f0..2ac09a15f 100644 --- a/lib/hci.c +++ b/lib/hci.c @@ -143,7 +143,7 @@ char *hci_bustostr(int bus) { switch (bus) { case HCI_VIRTUAL: - return "VIRTUAL"; + return "Virtual"; case HCI_USB: return "USB"; case HCI_PCCARD: @@ -161,7 +161,7 @@ char *hci_bustostr(int bus) case HCI_I2C: return "I2C"; default: - return "UNKNOWN"; + return "Unknown"; } } @@ -173,12 +173,12 @@ char *hci_dtypetostr(int type) char *hci_typetostr(int type) { switch (type) { - case HCI_BREDR: - return "BR/EDR"; + case HCI_PRIMARY: + return "Primary"; case HCI_AMP: return "AMP"; default: - return "UNKNOWN"; + return "Unknown"; } } diff --git a/lib/hci.h b/lib/hci.h index d1c7b9700..747f2a6c4 100644 --- a/lib/hci.h +++ b/lib/hci.h @@ -59,8 +59,9 @@ extern "C" { #define HCI_I2C 8 /* HCI controller types */ -#define HCI_BREDR 0x00 +#define HCI_PRIMARY 0x00 #define HCI_AMP 0x01 +#define HCI_BREDR HCI_PRIMARY /* HCI device flags */ enum { diff --git a/monitor/packet.c b/monitor/packet.c index ca824bf50..259c20bac 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -5542,7 +5542,7 @@ static void read_local_version_rsp(const void *data, uint8_t size) if (index_current < MAX_INDEX) { switch (index_list[index_current].type) { - case HCI_BREDR: + case HCI_PRIMARY: print_lmp_version(rsp->lmp_ver, rsp->lmp_subver); break; case HCI_AMP: diff --git a/tools/btinfo.c b/tools/btinfo.c index fd11ac428..8e36577d7 100644 --- a/tools/btinfo.c +++ b/tools/btinfo.c @@ -79,7 +79,7 @@ struct hci_dev_info { #define HCI_UP (1 << 0) -#define HCI_BREDR 0x00 +#define HCI_PRIMARY 0x00 #define HCI_AMP 0x01 static struct hci_dev_info hci_info; @@ -128,7 +128,7 @@ static void local_version_callback(const void *data, uint8_t size, printf("HCI revision: %u\n", le16_to_cpu(rsp->hci_rev)); switch (hci_type) { - case HCI_BREDR: + case HCI_PRIMARY: printf("LMP version: %u\n", rsp->lmp_ver); printf("LMP subversion: %u\n", le16_to_cpu(rsp->lmp_subver)); break; diff --git a/tools/btproxy.c b/tools/btproxy.c index 43de0375e..4bb7fef31 100644 --- a/tools/btproxy.c +++ b/tools/btproxy.c @@ -49,7 +49,7 @@ #include "src/shared/ecc.h" #include "monitor/bt.h" -#define HCI_BREDR 0x00 +#define HCI_PRIMARY 0x00 #define HCI_AMP 0x01 #define BTPROTO_HCI 1 @@ -758,7 +758,7 @@ int main(int argc, char *argv[]) const char *unix_path = NULL; unsigned short tcp_port = 0xb1ee; /* 45550 */ bool use_redirect = false; - uint8_t type = HCI_BREDR; + uint8_t type = HCI_PRIMARY; const char *str; sigset_t mask; diff --git a/tools/cltest.c b/tools/cltest.c index 95fa7b637..44a17a892 100644 --- a/tools/cltest.c +++ b/tools/cltest.c @@ -228,7 +228,7 @@ static bool find_controllers(void) if (ioctl(fd, HCIGETDEVINFO, (void *) &di) < 0) continue; - if (((di.type & 0x30) >> 4) != HCI_BREDR) + if (((di.type & 0x30) >> 4) != HCI_PRIMARY) continue; if (!bacmp(&bdaddr_src, BDADDR_ANY)) { diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 9029f7d9b..8a97cc4da 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -1151,7 +1151,7 @@ static void cmd_version(int ctl, int hdev, char *opt) } hciver = hci_vertostr(ver.hci_ver); - if (((di.type & 0x30) >> 4) == HCI_BREDR) + if (((di.type & 0x30) >> 4) == HCI_PRIMARY) lmpver = lmp_vertostr(ver.lmp_ver); else lmpver = pal_vertostr(ver.lmp_ver); @@ -1161,7 +1161,7 @@ static void cmd_version(int ctl, int hdev, char *opt) "\t%s Version: %s (0x%x) Subversion: 0x%x\n" "\tManufacturer: %s (%d)\n", hciver ? hciver : "n/a", ver.hci_ver, ver.hci_rev, - (((di.type & 0x30) >> 4) == HCI_BREDR) ? "LMP" : "PAL", + (((di.type & 0x30) >> 4) == HCI_PRIMARY) ? "LMP" : "PAL", lmpver ? lmpver : "n/a", ver.lmp_ver, ver.lmp_subver, bt_compidtostr(ver.manufacturer), ver.manufacturer); @@ -1902,7 +1902,7 @@ static void print_dev_info(int ctl, struct hci_dev_info *di) if (all && !hci_test_bit(HCI_RAW, &di->flags)) { print_dev_features(di, 0); - if (((di->type & 0x30) >> 4) == HCI_BREDR) { + if (((di->type & 0x30) >> 4) == HCI_PRIMARY) { print_pkt_type(di); print_link_policy(di); print_link_mode(di); -- 2.47.3