From: Marcel Holtmann Date: Mon, 26 Aug 2013 01:59:35 +0000 (-0700) Subject: monitor: Export printing functions for version and company strings X-Git-Tag: android-x86-4.4-r3~7726 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6b6d78d273091e683622513f6282bf53ac9445d6;p=android-x86%2Fexternal-bluetooth-bluez.git monitor: Export printing functions for version and company strings --- diff --git a/monitor/packet.c b/monitor/packet.c index 255cc571a..bc6861b08 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -1390,25 +1390,29 @@ static void print_name(const uint8_t *name) print_field("Name: %s", str); } -static void print_version(const char *label, uint8_t version, uint16_t revision) +void packet_print_version(const char *label, uint8_t version, uint16_t revision) { print_field("%s: %d - 0x%4.4x", label, version, revision); } static void print_hci_version(uint8_t hci_ver, uint16_t hci_rev) { - print_version("HCI version", hci_ver, hci_rev); + packet_print_version("HCI version", hci_ver, btohs(hci_rev)); } static void print_lmp_version(uint8_t lmp_ver, uint16_t lmp_subver) { - print_version("LMP version", lmp_ver, lmp_subver); + packet_print_version("LMP version", lmp_ver, btohs(lmp_subver)); +} + +void packet_print_company(const char *label, uint16_t company) +{ + print_field("%s: %s (%d)", label, bt_compidtostr(company), company); } static void print_manufacturer(uint16_t manufacturer) { - print_field("Manufacturer: %s (%d)", - bt_compidtostr(manufacturer), manufacturer); + packet_print_company("Manufacturer", btohs(manufacturer)); } static const char *get_supported_command(int bit); @@ -2138,7 +2142,7 @@ static void print_eir(const uint8_t *eir, uint8_t eir_len, bool le) case BT_EIR_MANUFACTURER_DATA: if (data_len < 2) break; - print_manufacturer(bt_get_le16(data)); + packet_print_company("Company", bt_get_le16(data)); print_hex_field(" Data", data + 2, data_len - 2); break; diff --git a/monitor/packet.h b/monitor/packet.h index 103fdf2e6..31b182a17 100644 --- a/monitor/packet.h +++ b/monitor/packet.h @@ -40,6 +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_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);