diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hciconfig.c | 6 | ||||
-rw-r--r-- | tools/hcitool.c | 29 | ||||
-rw-r--r-- | tools/l2ping.c | 9 |
3 files changed, 23 insertions, 21 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c index aa3d9ab4..c1df2815 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -875,17 +875,17 @@ static void cmd_revision(int ctl, int hdev, char *opt) void print_dev_hdr(struct hci_dev_info *di) { static int hdr = -1; - bdaddr_t bdaddr; + char addr[18]; if (hdr == di->dev_id) return; hdr = di->dev_id; - baswap(&bdaddr, &di->bdaddr); + ba2str(&di->bdaddr, addr); printf("%s:\tType: %s\n", di->name, hci_dtypetostr(di->type) ); printf("\tBD Address: %s ACL MTU: %d:%d SCO MTU: %d:%d\n", - batostr(&bdaddr), di->acl_mtu, di->acl_pkts, + addr, di->acl_mtu, di->acl_pkts, di->sco_mtu, di->sco_pkts); } diff --git a/tools/hcitool.c b/tools/hcitool.c index 88c53266..59235270 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -56,12 +56,13 @@ static void usage(void); static int dev_info(int s, int dev_id, long arg) { struct hci_dev_info di = {dev_id: dev_id}; - bdaddr_t bdaddr; + char addr[18]; + if (ioctl(s, HCIGETDEVINFO, (void*) &di)) return 0; - baswap(&bdaddr, &di.bdaddr); - printf("\t%s\t%s\n", di.name, batostr(&bdaddr)); + ba2str(&di.bdaddr, addr); + printf("\t%s\t%s\n", di.name, addr); return 0; } @@ -89,12 +90,12 @@ static int conn_list(int s, int dev_id, long arg) } for (i=0; i < cl->conn_num; i++, ci++) { - bdaddr_t bdaddr; - baswap(&bdaddr, &ci->bdaddr); + char addr[18]; + ba2str(&ci->bdaddr, addr); printf("\t%s %s %s handle %d state %d lm %s\n", ci->out ? "<" : ">", ci->type == ACL_LINK ? "ACL" : "SCO", - batostr(&bdaddr), ci->handle, ci->state, + addr, ci->handle, ci->state, hci_lmtostr(ci->link_mode)); } return 0; @@ -188,7 +189,7 @@ static void cmd_inq(int dev_id, int argc, char **argv) { int num_rsp, length, flags; inquiry_info *info = NULL; - bdaddr_t bdaddr; + char addr[18]; int i, opt; length = 8; /* ~10 seconds */ @@ -223,9 +224,9 @@ static void cmd_inq(int dev_id, int argc, char **argv) } for (i = 0; i < num_rsp; i++) { - baswap(&bdaddr, &(info+i)->bdaddr); + ba2str(&(info+i)->bdaddr, addr); printf("\t%s\tclock offset: 0x%4.4x\tclass: 0x%2.2x%2.2x%2.2x\n", - batostr(&bdaddr), (info+i)->clock_offset, + addr, (info+i)->clock_offset, (info+i)->dev_class[2], (info+i)->dev_class[1], (info+i)->dev_class[0]); @@ -251,7 +252,7 @@ static void cmd_scan(int dev_id, int argc, char **argv) { inquiry_info *info = NULL; int num_rsp, length, flags; - bdaddr_t bdaddr; + char addr[18]; char name[248]; int i, opt, dd; @@ -280,7 +281,7 @@ static void cmd_scan(int dev_id, int argc, char **argv) } if (dev_id < 0) { - dev_id = hci_get_route(&bdaddr); + dev_id = hci_get_route(NULL); if (dev_id < 0) { perror("Device is not available"); exit(1); @@ -305,8 +306,8 @@ static void cmd_scan(int dev_id, int argc, char **argv) memset(name, 0, sizeof(name)); if (hci_read_remote_name(dd, &(info+i)->bdaddr, sizeof(name), name, 100000) < 0) strcpy(name, "n/a"); - baswap(&bdaddr, &(info+i)->bdaddr); - printf("\t%s\t%s\n", batostr(&bdaddr), name); + ba2str(&(info+i)->bdaddr, addr); + printf("\t%s\t%s\n", addr, name); } close(dd); @@ -345,7 +346,7 @@ static void cmd_name(int dev_id, int argc, char **argv) return; } - baswap(&bdaddr, strtoba(argv[0])); + str2ba(argv[0], &bdaddr); if (dev_id < 0) { dev_id = hci_get_route(&bdaddr); diff --git a/tools/l2ping.c b/tools/l2ping.c index 310ba86b..d5d7748b 100644 --- a/tools/l2ping.c +++ b/tools/l2ping.c @@ -77,6 +77,7 @@ static void ping(char *svr) struct sockaddr_l2 addr; struct sigaction sa; char buf[2048]; + char str[18]; int s, i, opt, lost; uint8_t id; @@ -97,7 +98,7 @@ static void ping(char *svr) exit(1); } - baswap(&addr.l2_bdaddr, strtoba(svr)); + str2ba(svr, &addr.l2_bdaddr); if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("Can't connect."); exit(1); @@ -109,9 +110,9 @@ static void ping(char *svr) perror("Can't get local address."); exit(1); } - baswap(&bdaddr, &addr.l2_bdaddr); + ba2str(&addr.l2_bdaddr, str); - printf("Ping: %s from %s (data size %d) ...\n", svr, batostr(&bdaddr), size); + printf("Ping: %s from %s (data size %d) ...\n", svr, str, size); /* Initialize buffer */ for(i = L2CAP_CMD_HDR_SIZE; i < sizeof(buf); i++) @@ -231,7 +232,7 @@ int main(int argc, char *argv[]) break; case 'S': - baswap(&bdaddr, strtoba(optarg)); + str2ba(optarg, &bdaddr); break; default: |