Bluetooth: shell: Fix requiring UUID for gatt-discover
This enables using these commands to perform discover all procedure: > gatt-discover-primary Discover pending Service 1800 found: start handle 1, end_handle 5 Service 1801 found: start handle 6, end_handle 9 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
e2362e1d00
commit
f67d45609e
2 changed files with 7 additions and 14 deletions
|
@ -2234,9 +2234,9 @@ static const struct shell_cmd bt_commands[] = {
|
|||
#if defined(CONFIG_BT_GATT_CLIENT)
|
||||
{ "gatt-exchange-mtu", cmd_gatt_exchange_mtu, HELP_NONE },
|
||||
{ "gatt-discover-primary", cmd_gatt_discover,
|
||||
"<UUID> [start handle] [end handle]" },
|
||||
"[UUID] [start handle] [end handle]" },
|
||||
{ "gatt-discover-secondary", cmd_gatt_discover,
|
||||
"<UUID> [start handle] [end handle]" },
|
||||
"[UUID] [start handle] [end handle]" },
|
||||
{ "gatt-discover-include", cmd_gatt_discover,
|
||||
"[UUID] [start handle] [end handle]" },
|
||||
{ "gatt-discover-characteristic", cmd_gatt_discover,
|
||||
|
|
|
@ -158,18 +158,12 @@ int cmd_gatt_discover(int argc, char *argv[])
|
|||
discover_params.start_handle = 0x0001;
|
||||
discover_params.end_handle = 0xffff;
|
||||
|
||||
if (argc < 2) {
|
||||
if (!strcmp(argv[0], "gatt-discover-primary") ||
|
||||
!strcmp(argv[0], "gatt-discover-secondary")) {
|
||||
return -EINVAL;
|
||||
if (argc > 1) {
|
||||
/* Only set the UUID if the value is valid (non zero) */
|
||||
uuid.val = strtoul(argv[1], NULL, 16);
|
||||
if (uuid.val) {
|
||||
discover_params.uuid = &uuid.uuid;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Only set the UUID if the value is valid (non zero) */
|
||||
uuid.val = strtoul(argv[1], NULL, 16);
|
||||
if (uuid.val) {
|
||||
discover_params.uuid = &uuid.uuid;
|
||||
}
|
||||
|
||||
if (argc > 2) {
|
||||
|
@ -179,7 +173,6 @@ int cmd_gatt_discover(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (!strcmp(argv[0], "gatt-discover-secondary")) {
|
||||
discover_params.type = BT_GATT_DISCOVER_SECONDARY;
|
||||
} else if (!strcmp(argv[0], "gatt-discover-include")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue