From 27895e42ac836a3553b2b21b0fd7d647ac02fb90 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 13 Jan 2013 18:03:37 -0800 Subject: [PATCH] monitor: Decode the minor class field for major class phone --- monitor/packet.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/monitor/packet.c b/monitor/packet.c index 7bf868121..b3cd2df8e 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -472,6 +472,31 @@ static const char *major_class_computer(uint8_t minor) return NULL; } +static const struct { + uint8_t val; + const char *str; +} major_class_phone_table[] = { + { 0x00, "Uncategorized, code for device not assigned" }, + { 0x01, "Cellular" }, + { 0x02, "Cordless" }, + { 0x03, "Smart phone" }, + { 0x04, "Wired modem or voice gateway" }, + { 0x05, "Common ISDN Access" }, + { } +}; + +static const char *major_class_phone(uint8_t minor) +{ + int i; + + for (i = 0; major_class_phone_table[i].str; i++) { + if (major_class_phone_table[i].val == minor) + return major_class_phone_table[i].str; + } + + return NULL; +} + static const struct { uint8_t val; const char *str; @@ -480,7 +505,8 @@ static const struct { { 0x00, "Miscellaneous" }, { 0x01, "Computer (desktop, notebook, PDA, organizers)", major_class_computer }, - { 0x02, "Phone (cellular, cordless, payphone, modem)" }, + { 0x02, "Phone (cellular, cordless, payphone, modem)", + major_class_phone }, { 0x03, "LAN /Network Access point" }, { 0x04, "Audio/Video (headset, speaker, stereo, video, vcr)" }, { 0x05, "Peripheral (mouse, joystick, keyboards)" }, -- 2.47.3