OSDN Git Service

monitor: Add translation of Bluetooth version information
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 5 Oct 2013 13:05:17 +0000 (06:05 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 5 Oct 2013 13:05:17 +0000 (06:05 -0700)
monitor/ll.c
monitor/packet.c
monitor/packet.h

index b23de3c..e8b7a7a 100644 (file)
@@ -448,7 +448,8 @@ static void version_ind(const void *data, uint8_t size)
 {
        const struct bt_ll_version_ind *pdu = data;
 
-       packet_print_version("Version", pdu->version, btohs(pdu->subversion));
+       packet_print_version("Version", pdu->version,
+                               "Subversion", btohs(pdu->subversion));
        packet_print_company("Company", btohs(pdu->company));
 }
 
index ddd3742..849b023 100644 (file)
@@ -1495,19 +1495,55 @@ static void print_channel_map(const uint8_t *map)
        print_field("Channel map: 0x%s", str);
 }
 
-void packet_print_version(const char *label, uint8_t version, uint16_t revision)
+void packet_print_version(const char *label, uint8_t version,
+                               const char *sublabel, uint16_t subversion)
 {
-       print_field("%s: %d - 0x%4.4x", label, version, revision);
+       const char *str;
+
+       switch (version) {
+       case 0x00:
+               str = "Bluetooth 1.0b";
+               break;
+       case 0x01:
+               str = "Bluetooth 1.1";
+               break;
+       case 0x02:
+               str = "Bluetooth 1.2";
+               break;
+       case 0x03:
+               str = "Bluetooth 2.0";
+               break;
+       case 0x04:
+               str = "Bluetooth 2.1";
+               break;
+       case 0x05:
+               str = "Bluetooth 3.0";
+               break;
+       case 0x06:
+               str = "Bluetooth 4.0";
+               break;
+       case 0x07:
+               str = "Bluetooth 4.1";
+               break;
+       default:
+               str = "Reserved";
+               break;
+       }
+
+       print_field("%s: %s (0x%2.2x) - %s %d (0x%4.4x)", label, str, version,
+                                       sublabel, subversion, subversion);
 }
 
 static void print_hci_version(uint8_t hci_ver, uint16_t hci_rev)
 {
-       packet_print_version("HCI version", hci_ver, btohs(hci_rev));
+       packet_print_version("HCI version", hci_ver,
+                               "Revision", btohs(hci_rev));
 }
 
 static void print_lmp_version(uint8_t lmp_ver, uint16_t lmp_subver)
 {
-       packet_print_version("LMP version", lmp_ver, btohs(lmp_subver));
+       packet_print_version("LMP version", lmp_ver,
+                               "Subversion", btohs(lmp_subver));
 }
 
 void packet_print_company(const char *label, uint16_t company)
index 411983a..07c1ec3 100644 (file)
@@ -40,7 +40,8 @@ void packet_del_filter(unsigned long filter);
 void packet_select_index(uint16_t index);
 
 void packet_hexdump(const unsigned char *buf, uint16_t len);
-void packet_print_version(const char *label, uint8_t version, uint16_t revision);
+void packet_print_version(const char *label, uint8_t version,
+                               const char *sublabel, uint16_t subversion);
 void packet_print_company(const char *label, uint16_t company);
 void packet_print_addr(const char *label, const void *data, bool random);
 void packet_print_ad(const void *data, uint8_t size);