Index: usr.sbin/bluetooth/hccontrol/le.c =================================================================== --- usr.sbin/bluetooth/hccontrol/le.c +++ usr.sbin/bluetooth/hccontrol/le.c @@ -232,11 +232,43 @@ NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), (void *)&rp, &n); - - printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status, - (uintmax_t) rp.le_features); - - return 0; + if(e != 0){ + return ERROR; + } + if(rp.status != 0x00){ + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + printf("LOCAL Features: %jx(", (uintmax_t) rp.le_features); + if(rp.le_features & 0x1){ + printf("Encryption "); + } + if(rp.le_features & 0x2){ + printf("ConnectionParameter "); + } + if(rp.le_features & 0x4){ + printf("ExtendReject "); + } + if(rp.le_features & 0x8){ + printf("SlaveinitiatedFeature "); + } + if(rp.le_features & 0x10){ + printf("Ping "); + } + if(rp.le_features & 0x20){ + printf("PacketLengthEx "); + } + if(rp.le_features & 0x40){ + printf("LLPrivacy "); + } + if(rp.le_features & 0x80){ + printf("ExtendedScannerFilter "); + } + printf(")\n"); + + return OK; } static int @@ -250,8 +282,15 @@ NG_HCI_OGF_LE, NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), (void *)&rp, &n); - - printf("LE_STATUS: %d %d %jx\n", e, rp.status, (uintmax_t)rp.le_status); + if(e != 0){ + return ERROR; + } + if(rp.status != 0x00){ + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + printf("LE_STATUS: %jx\n", (uintmax_t)rp.le_status); return 0; } Index: usr.sbin/bluetooth/hccontrol/node.c =================================================================== --- usr.sbin/bluetooth/hccontrol/node.c +++ usr.sbin/bluetooth/hccontrol/node.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "hccontrol.h" /* Send Read_Node_State command to the node */ @@ -222,7 +223,6 @@ elemlen = *data; data++; length --; - elemlen--; if(length<=0) break; type = *data; @@ -239,6 +239,31 @@ printf("LocalName:"); for(i = 0; i < MIN(length,elemlen); i++){ putchar(data[i]); + } + printf("\n"); + break; + case 0x7: + { + uuid_t uuid; + char *uuidstr; + uint32_t ustatus; + uuid.time_low = le32dec(data+12); + uuid.time_mid = le16dec(data+10); + uuid.time_hi_and_version = le16dec(data+8); + uuid.clock_seq_hi_and_reserved = data[7]; + uuid.clock_seq_low = data[6]; + for(i = 0; i < _UUID_NODE_LEN; i++){ + uuid.node[i] = data[5 - i]; + } + uuid_to_string(&uuid, &uuidstr, &ustatus); + + printf("ServiceUUID: %s\n", uuidstr); + break; + } + case 0xff: + printf("Vendor:%04x:", data[0]|data[1]<<8); + for(i=2; i < MIN(length,elemlen); i++){ + printf("%02x ",data[i]); } printf("\n"); break;