diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 66df988..7dfae60 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
Controller Index: <controller id>
Command Parameters: Address (6 Octets)
Return Parameters: Address (6 Octets)
+ Status (6 Octets)
Get Connections Command
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 10a4bd6..9eb6d2d 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
} __packed;
struct mgmt_rp_disconnect {
bdaddr_t bdaddr;
+ uint8_t status;
} __packed;
#define MGMT_ADDR_BREDR 0x00
diff --git a/mgmt/main.c b/mgmt/main.c
index 3e03028..ee1b88f 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
struct mgmt_rp_disconnect *rp = rsp;
char addr[18];
+ if (status != 0) {
+ fprintf(stderr, "Disconnect failed with status %u\n", status);
+ exit(EXIT_FAILURE);
+ }
+
if (len != sizeof(*rp)) {
fprintf(stderr, "Invalid disconnect response length (%u)\n",
len);
ba2str(&rp->bdaddr, addr);
- if (status == 0) {
+ if (rp->status == 0) {
printf("%s disconnected\n", addr);
exit(EXIT_SUCCESS);
} else {
fprintf(stderr, "Disconnecting %s failed with status %u\n",
- addr, status);
+ addr, rp->status);
exit(EXIT_FAILURE);
}
}
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 9ba7ccb..160bbd4 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
ba2str(&rp->bdaddr, addr);
+ if (rp->status != 0) {
+ error("Disconnecting %s failed with status %u",
+ addr, rp->status);
+ return;
+ }
+
DBG("hci%d %s disconnected", index, addr);
if (index > max_index) {