apps/wireless/bluetooth/btsak: Fix numerous error that crept in with the last commits.

This commit is contained in:
Gregory Nutt 2018-04-06 11:48:19 -06:00
parent 8a2fb2f66c
commit 8a33912d5d
5 changed files with 27 additions and 27 deletions

View File

@ -91,7 +91,7 @@ static void btsak_advertise_showusage(FAR const char *progname,
static void btsak_cmd_advertisestart(FAR struct btsak_s *btsak, FAR char *cmd,
int argc, FAR char *argv[])
{
struct btreq_s start;
struct btreq_s btreq;
struct bt_eir_s ad[2]; /* Data for advertisement packets */
struct bt_eir_s sd[2]; /* Data for scan response packets */
int sockfd;
@ -138,7 +138,7 @@ static void btsak_cmd_advertisestart(FAR struct btsak_s *btsak, FAR char *cmd,
sd[1].type = BT_EIR_NAME_COMPLETE;
strcpy((FAR char *)sd[1].data, "btsak");
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
btreq.btr_advtype = BT_LE_ADV_IND;
btreq.btr_advad = ad;
@ -178,7 +178,7 @@ static void btsak_cmd_advertisestop(FAR struct btsak_s *btsak, FAR char *cmd,
/* Perform the IOCTL to stop advertising */
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
sockfd = btsak_socket(btsak);

View File

@ -139,7 +139,7 @@ void btsak_cmd_info(FAR struct btsak_s *btsak, int argc, FAR char *argv[])
/* Perform the IOCTL to stop advertising */
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
sockfd = btsak_socket(btsak);
@ -158,18 +158,18 @@ void btsak_cmd_info(FAR struct btsak_s *btsak, int argc, FAR char *argv[])
btreq.btr_bdaddr.val[0], btreq.btr_bdaddr.val[1],
btreq.btr_bdaddr.val[2], btreq.btr_bdaddr.val[3],
btreq.btr_bdaddr.val[4], btreq.btr_bdaddr.val[5]);
printf("Flags: %04x\n", btsak.btr_flags);
printf("Free: %u\n", btsak.btr_num_cmd);
printf(" ACL: %u\n", btsak.btri_num_acl);
printf(" SCO: %u\n", btsak.btri_num_sco);
printf("Flags: %04x\n", btreq.btr_flags);
printf("Free: %u\n", btreq.btr_num_cmd);
printf(" ACL: %u\n", btreq.btr_num_acl);
printf(" SCO: %u\n", btreq.btr_num_sco);
printf("Max:\n");
printf(" ACL: %u\n", btsak.btr_max_acl);
printf(" SCO: %u\n", btsak.btr_max_sco);
printf(" ACL: %u\n", btreq.btr_max_acl);
printf(" SCO: %u\n", btreq.btr_max_sco);
printf("MTU:\n");
printf(" ACL: %u\n", btsak.btr_acl_mtu);
printf(" SCO: %u\n", btsak.btr_sco_mtu);
printf("Policy: %u\n", btsak.btr_link_policy);
printf("Type: %u\n", btsak.btr_packet_type);
printf(" ACL: %u\n", btreq.btr_acl_mtu);
printf(" SCO: %u\n", btreq.btr_sco_mtu);
printf("Policy: %u\n", btreq.btr_link_policy);
printf("Type: %u\n", btreq.btr_packet_type);
}
}

View File

@ -85,14 +85,14 @@ static const struct btsak_command_s g_btsak_commands[] =
(CODE void *)btsak_cmd_help,
NULL
},
{"scan",
(CODE void *)btsak_cmd_scan,
"[-h] <start [-d]|get|stop>"
},
{"info",
(CODE void *)btsak_cmd_info,
NULL
},
{"scan",
(CODE void *)btsak_cmd_scan,
"[-h] <start [-d]|get|stop>"
},
{
"advertise",
(CODE void *)btsak_cmd_advertise,
@ -648,7 +648,7 @@ void btsak_showusage(FAR const char *progname, int exitcode)
FAR const struct btsak_command_s *cmd = &g_btsak_commands[i];
if (cmd->help != NULL)
{
fprintf(stderr, "\t%s\t%s\n", cmd->name, cmd->help);
fprintf(stderr, "\t%-10s\t%s\n", cmd->name, cmd->help);
}
else
{
@ -684,7 +684,7 @@ void btsak_gatt_showusage(FAR const char *progname, FAR const char *cmd,
FAR const struct btsak_command_s *gattcmd = &g_btsak_gatt_commands[i];
if (gattcmd->help != NULL)
{
fprintf(stderr, "\t%s\t%s\n", gattcmd->name, gattcmd->help);
fprintf(stderr, "\t%-10gdbs\t%s\n", gattcmd->name, gattcmd->help);
}
else
{

View File

@ -96,7 +96,7 @@ static void btsak_cmd_scanstart(FAR struct btsak_s *btsak, FAR char *cmd,
int sockfd;
int ret;
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
/* Check if an option was provided */
@ -153,10 +153,10 @@ static void btsak_cmd_scanget(FAR struct btsak_s *btsak, FAR char *cmd,
/* Perform the IOCTL to get the scan results so far */
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
btreq->btr_nrsp = 5;
btreq.btr_rsp = result;
btreq.btr_nrsp = 5;
btreq.btr_rsp = result;
sockfd = btsak_socket(btsak);
if (sockfd >= 0)
@ -179,7 +179,7 @@ static void btsak_cmd_scanget(FAR struct btsak_s *btsak, FAR char *cmd,
int k;
printf("Scan result:\n");
for (i = 0; i < u.result.sr_nrsp; i++)
for (i = 0; i < btreq.btr_nrsp; i++)
{
rsp = &result[i];
printf("%d.\tname: %s\n", rsp->sr_name);
@ -227,7 +227,7 @@ static void btsak_cmd_scanstop(FAR struct btsak_s *btsak, FAR char *cmd,
/* Perform the IOCTL to stop scanning and flush any buffered responses. */
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
sockfd = btsak_socket(btsak);

View File

@ -153,7 +153,7 @@ void btsak_cmd_security(FAR struct btsak_s *btsak, int argc, FAR char *argv[])
/* The first argument must be an address of the form xx:xx:xx:xx:xx:xx */
memset(&btreq, 0, sizeof(struct bt_advertisebtreq_s));
memset(&btreq, 0, sizeof(struct btreq_s));
strncpy(btreq.btr_name, btsak->ifname, HCI_DEVNAME_SIZE);
ret = btsak_str2addr(argv[1], btreq.btr_secaddr.val);