OSDN Git Service

lib: Define HCI_PRIMARY and use it instead of HCI_BREDR
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 4 Jul 2016 17:21:44 +0000 (19:21 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 4 Jul 2016 17:21:44 +0000 (19:21 +0200)
emulator/hciemu.c
emulator/le.c
emulator/vhci.c
lib/hci.c
lib/hci.h
monitor/packet.c
tools/btinfo.c
tools/btproxy.c
tools/cltest.c
tools/hciconfig.c

index 6a53499..ea1e3cf 100644 (file)
@@ -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);
index 82ae573..d7ee297 100644 (file)
@@ -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);
index 6bba4e2..8dec20a 100644 (file)
@@ -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;
index c339085..2ac09a1 100644 (file)
--- 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";
        }
 }
 
index d1c7b97..747f2a6 100644 (file)
--- 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 {
index ca824bf..259c20b 100644 (file)
@@ -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:
index fd11ac4..8e36577 100644 (file)
@@ -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;
index 43de037..4bb7fef 100644 (file)
@@ -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;
 
index 95fa7b6..44a17a8 100644 (file)
@@ -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)) {
index 9029f7d..8a97cc4 100644 (file)
@@ -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);