wireless/bluetooth/btsak: Fix some errors in btsak

This commit is contained in:
Lwazi Dube 2018-11-27 08:02:43 -06:00 committed by Gregory Nutt
parent 3adf8af266
commit 6af45bdee0
3 changed files with 8 additions and 3 deletions

View File

@ -491,7 +491,7 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
} }
else else
{ {
break; // EOF break; /* EOF */
} }
} }

View File

@ -105,6 +105,7 @@ static void btsak_cmd_discover_common(FAR struct btsak_s *btsak,
} }
ret = btsak_str2addrtype(argv[2], &btreq.btr_dpeer.type); ret = btsak_str2addrtype(argv[2], &btreq.btr_dpeer.type);
if (ret < 0)
{ {
fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]); fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]);
btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE); btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE);
@ -201,6 +202,7 @@ void btsak_cmd_gatt_exchange_mtu(FAR struct btsak_s *btsak, int argc,
} }
ret = btsak_str2addrtype(argv[2], &btreq.btr_expeer.type); ret = btsak_str2addrtype(argv[2], &btreq.btr_expeer.type);
if (ret < 0)
{ {
fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]); fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]);
btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE); btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE);
@ -414,6 +416,7 @@ void btsak_cmd_gatt_read(FAR struct btsak_s *btsak, int argc,
} }
ret = btsak_str2addrtype(argv[2], &btreq.btr_rdpeer.type); ret = btsak_str2addrtype(argv[2], &btreq.btr_rdpeer.type);
if (ret < 0)
{ {
fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]); fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]);
btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE); btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE);
@ -487,6 +490,7 @@ void btsak_cmd_gatt_read_multiple(FAR struct btsak_s *btsak, int argc,
} }
ret = btsak_str2addrtype(argv[2], &btreq.btr_rdpeer.type); ret = btsak_str2addrtype(argv[2], &btreq.btr_rdpeer.type);
if (ret < 0)
{ {
fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]); fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]);
btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE); btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE);
@ -637,6 +641,7 @@ void btsak_cmd_gatt_write(FAR struct btsak_s *btsak, int argc,
} }
ret = btsak_str2addrtype(argv[2], &btreq.btr_wrpeer.type); ret = btsak_str2addrtype(argv[2], &btreq.btr_wrpeer.type);
if (ret < 0)
{ {
fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]); fprintf(stderr, "ERROR: Bad value for address type: %s\n", argv[2]);
btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE); btsak_gatt_showusage(btsak->progname, argv[0], EXIT_FAILURE);

View File

@ -572,7 +572,7 @@ int btsak_str2addr(FAR const char *str, FAR uint8_t *addr)
int btsak_str2addrtype(FAR const char *str, FAR uint8_t *addrtype) int btsak_str2addrtype(FAR const char *str, FAR uint8_t *addrtype)
{ {
if (!strcasecmp(str, "public") == 0) if (!strcasecmp(str, "public"))
{ {
*addrtype = BT_ADDR_LE_PUBLIC; *addrtype = BT_ADDR_LE_PUBLIC;
} }
@ -599,7 +599,7 @@ int btsak_str2addrtype(FAR const char *str, FAR uint8_t *addrtype)
int btsak_str2seclevel(FAR const char *str, FAR enum bt_security_e *level) int btsak_str2seclevel(FAR const char *str, FAR enum bt_security_e *level)
{ {
if (!strcasecmp(str, "low") == 0) if (!strcasecmp(str, "low"))
{ {
*level = BT_SECURITY_LOW; *level = BT_SECURITY_LOW;
} }