From: Marcel Holtmann Date: Mon, 14 Jan 2013 02:03:37 +0000 (-0800) Subject: monitor: Decode the minor class field for major class phone X-Git-Tag: android-x86-4.4-r3~8821 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=27895e42ac836a3553b2b21b0fd7d647ac02fb90;p=android-x86%2Fexternal-bluetooth-bluez.git monitor: Decode the minor class field for major class phone --- diff --git a/monitor/packet.c b/monitor/packet.c index 7bf868121..b3cd2df8e 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -475,12 +475,38 @@ static const char *major_class_computer(uint8_t minor) 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; const char *(*func)(uint8_t minor); } major_class_table[] = { { 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)" },