summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-08-27 14:47:31 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-08-27 14:47:31 +0200
commitea3f9b2d644e2c1beeccc01591b302f5ed8a77bd (patch)
tree935c4a3f17386d51af209403cc485a753963e994 /tools
parent85586b684b630334778a41c942fe8290ca07ca93 (diff)
Allow specifying of reason for the disconnect
Diffstat (limited to 'tools')
-rw-r--r--tools/hcitool.15
-rw-r--r--tools/hcitool.c6
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);