From ea3f9b2d644e2c1beeccc01591b302f5ed8a77bd Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 27 Aug 2008 14:47:31 +0200 Subject: Allow specifying of reason for the disconnect --- tools/hcitool.1 | 5 ++++- 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 " " +.BI dc " [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 " " 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 \n"; + "\tdc [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); -- cgit