diff options
-rw-r--r-- | tools/hcitool.1 | 5 | ||||
-rw-r--r-- | tools/hcitool.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tools/hcitool.1 b/tools/hcitool.1 index 8a7131d2..85498dc6 100644 --- a/tools/hcitool.1 +++ b/tools/hcitool.1 @@ -101,9 +101,12 @@ s (allow role switch, become slave if the peer asks to become master). Default is .IR m . .TP -.BI dc " <bdaddr>" +.BI dc " <bdaddr> [reason]" Delete baseband connection from remote device with Bluetooth address .IR bdaddr . +The reason can be one of the Bluetooth HCI error codes. Default is +.IR 19 +for user ended connections. The value must be given in decimal. .TP .BI sr " <bdaddr> <role>" Switch role for the baseband connection from the remote device to diff --git a/tools/hcitool.c b/tools/hcitool.c index 7ce3af38..896328c6 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -1238,12 +1238,13 @@ static struct option dc_options[] = { static const char *dc_help = "Usage:\n" - "\tdc <bdaddr>\n"; + "\tdc <bdaddr> [reason]\n"; static void cmd_dc(int dev_id, int argc, char **argv) { struct hci_conn_info_req *cr; bdaddr_t bdaddr; + uint8_t reason; int opt, dd; for_each_opt(opt, dc_options, NULL) { @@ -1262,6 +1263,7 @@ static void cmd_dc(int dev_id, int argc, char **argv) } str2ba(argv[0], &bdaddr); + reason = (argc > 1) ? atoi(argv[1]) : HCI_OE_USER_ENDED_CONNECTION; if (dev_id < 0) { dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr); @@ -1291,7 +1293,7 @@ static void cmd_dc(int dev_id, int argc, char **argv) } if (hci_disconnect(dd, htobs(cr->conn_info->handle), - HCI_OE_USER_ENDED_CONNECTION, 10000) < 0) + reason, 10000) < 0) perror("Disconnect failed"); free(cr); |