summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-12-20 10:40:46 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-12-20 10:40:46 +0000
commitf1e35f0b9edc15eebfd9b2b0b01ffa4bf0f85cdb (patch)
tree2a3bb50584bde69adaa6a1392c9fdfbbd54c5e95 /tools
parent1eac882c2722eee74b595d8e3af69f3ab10228ae (diff)
More accurate class of device decoding for hcitool and hciconfig
Diffstat (limited to 'tools')
-rw-r--r--tools/hciconfig.c77
-rw-r--r--tools/hcitool.c73
2 files changed, 139 insertions, 11 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 18601d77..0dc6d08a 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -594,16 +594,53 @@ static char *get_minor_device_name(int major, int minor)
return "Gaming/Toy";
}
break;
- case 5: /* peripheral */
- switch(minor) {
+ case 5: /* peripheral */ {
+ static char cls_str[48];
+
+ cls_str[0] = '\0';
+
+ switch(minor & 48) {
case 16:
- return "Keyboard";
+ strncpy(cls_str, "Keyboard", sizeof(cls_str));
+ break;
case 32:
- return "Pointing device";
+ strncpy(cls_str, "Pointing device", sizeof(cls_str));
+ break;
case 48:
- return "Combo keyboard/pointing device";
+ strncpy(cls_str, "Combo keyboard/pointing device", sizeof(cls_str));
+ break;
}
- break;
+ if((minor & 15) && (strlen(cls_str) > 0))
+ strcat(cls_str, "/");
+
+ switch(minor & 15) {
+ case 0:
+ break;
+ case 1:
+ strncat(cls_str, "Joystick", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 2:
+ strncat(cls_str, "Gamepad", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 3:
+ strncat(cls_str, "Remote control", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 4:
+ strncat(cls_str, "Sensing device", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 5:
+ strncat(cls_str, "Digitizer tablet", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 6:
+ strncat(cls_str, "Card reader", sizeof(cls_str) - strlen(cls_str));
+ break;
+ default:
+ strncat(cls_str, "(reserved)", sizeof(cls_str) - strlen(cls_str));
+ break;
+ }
+ if(strlen(cls_str) > 0)
+ return cls_str;
+ }
case 6: /* imaging */
if (minor & 4)
return "Display";
@@ -614,6 +651,34 @@ static char *get_minor_device_name(int major, int minor)
if (minor & 32)
return "Printer";
break;
+ case 7: /* wearable */
+ switch(minor) {
+ case 1:
+ return "Wrist Watch";
+ case 2:
+ return "Pager";
+ case 3:
+ return "Jacket";
+ case 4:
+ return "Helmet";
+ case 5:
+ return "Glasses";
+ }
+ break;
+ case 8: /* toy */
+ switch(minor) {
+ case 1:
+ return "Robot";
+ case 2:
+ return "Vehicle";
+ case 3:
+ return "Doll / Action Figure";
+ case 4:
+ return "Controller";
+ case 5:
+ return "Game";
+ }
+ break;
case 63: /* uncategorised */
return "";
}
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 9449e7c6..50abce17 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -245,16 +245,51 @@ static char *get_minor_device_name(int major, int minor)
return "Gaming/Toy";
}
break;
- case 5: /* peripheral */
- switch(minor) {
+ case 5: /* peripheral */ {
+ static char cls_str[48]; cls_str[0] = 0;
+
+ switch(minor & 48) {
case 16:
- return "Keyboard";
+ strncpy(cls_str, "Keyboard", sizeof(cls_str));
+ break;
case 32:
- return "Pointing device";
+ strncpy(cls_str, "Pointing device", sizeof(cls_str));
+ break;
case 48:
- return "Combo keyboard/pointing device";
+ strncpy(cls_str, "Combo keyboard/pointing device", sizeof(cls_str));
+ break;
}
+ if((minor & 15) && (strlen(cls_str) > 0))
+ strcat(cls_str, "/");
+
+ switch(minor & 15) {
+ case 0:
+ break;
+ case 1:
+ strncat(cls_str, "Joystick", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 2:
+ strncat(cls_str, "Gamepad", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 3:
+ strncat(cls_str, "Remote control", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 4:
+ strncat(cls_str, "Sensing device", sizeof(cls_str) - strlen(cls_str));
+ break;
+ case 5:
+ strncat(cls_str, "Digitizer tablet", sizeof(cls_str) - strlen(cls_str));
break;
+ case 6:
+ strncat(cls_str, "Card reader", sizeof(cls_str) - strlen(cls_str));
+ break;
+ default:
+ strncat(cls_str, "(reserved)", sizeof(cls_str) - strlen(cls_str));
+ break;
+ }
+ if(strlen(cls_str) > 0)
+ return cls_str;
+ }
case 6: /* imaging */
if (minor & 4)
return "Display";
@@ -265,6 +300,34 @@ static char *get_minor_device_name(int major, int minor)
if (minor & 32)
return "Printer";
break;
+ case 7: /* wearable */
+ switch(minor) {
+ case 1:
+ return "Wrist Watch";
+ case 2:
+ return "Pager";
+ case 3:
+ return "Jacket";
+ case 4:
+ return "Helmet";
+ case 5:
+ return "Glasses";
+ }
+ break;
+ case 8: /* toy */
+ switch(minor) {
+ case 1:
+ return "Robot";
+ case 2:
+ return "Vehicle";
+ case 3:
+ return "Doll / Action Figure";
+ case 4:
+ return "Controller";
+ case 5:
+ return "Game";
+ }
+ break;
case 63: /* uncategorised */
return "";
}