summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2003-07-24 17:34:34 +0000
committerMarcel Holtmann <marcel@holtmann.org>2003-07-24 17:34:34 +0000
commit6b410af5c3e83f36ed8b5a620f1ab3029a271058 (patch)
tree24b7ec40b12997b4f13de490919e3673fc1df6eb
parent8891e1ab4d0832e12815bb94689fd0f87c06a11f (diff)
downloadbluez-6b410af5c3e83f36ed8b5a620f1ab3029a271058.tar.gz
Kill usage of strtoba() and batostr()
-rw-r--r--hcid/security.c7
-rw-r--r--tools/hciconfig.c6
-rw-r--r--tools/hcitool.c29
-rw-r--r--tools/l2ping.c9
4 files changed, 26 insertions, 25 deletions
diff --git a/hcid/security.c b/hcid/security.c
index 36fb6a712..7aa9a7a48 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -227,8 +227,7 @@ int read_pin_code(void)
static void call_pin_helper(int dev, struct hci_conn_info *ci)
{
pin_code_reply_cp pr;
- char str[255], *pin, name[20];
- bdaddr_t ba;
+ char addr[12], str[255], *pin, name[20];
FILE *pipe;
int len;
@@ -252,10 +251,10 @@ static void call_pin_helper(int dev, struct hci_conn_info *ci)
name[0] = 0;
//hci_remote_name(dev, &ci->bdaddr, sizeof(name), name, 0);
- baswap(&ba, &ci->bdaddr);
+ ba2str(&ci->bdaddr, addr);
sprintf(str, "%s %s %s \'%s\'", hcid.pin_helper,
ci->out ? "out" : "in",
- batostr(&ba), name);
+ addr, name);
setenv("PATH", "/bin:/usr/bin:/usr/local/bin", 1);
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index aa3d9ab43..c1df2815c 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 88c53266e..592352708 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 310ba86b8..d5d7748b7 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: