summaryrefslogtreecommitdiff
path: root/tools/hciconfig.c
diff options
context:
space:
mode:
authorAndre Dieb Martins <andre.dieb@signove.com>2011-01-31 15:57:33 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-02-01 11:07:00 +0200
commitea6c8a871f3a9e416b63dba69cc30f2ad444ab0b (patch)
tree8e39473b26e5d9306e9531f3345ab370505701ba /tools/hciconfig.c
parentcfd434354dd23e961db6d490316adf2dd247ba8d (diff)
downloadbluez-ea6c8a871f3a9e416b63dba69cc30f2ad444ab0b.tar.gz
Fix hciconfig leadv returned response
Fixes hciconfig leadv returned response by treating both status of the command execution and HCI error code.
Diffstat (limited to 'tools/hciconfig.c')
-rw-r--r--tools/hciconfig.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index c271d14c7..05a8910dc 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -269,11 +269,20 @@ static void cmd_le_adv(int ctl, int hdev, char *opt)
rq.rlen = 1;
ret = hci_send_req(dd, &rq, 100);
- if (status || ret < 0)
+
+ hci_close_dev(dd);
+
+ if (ret < 0) {
fprintf(stderr, "Can't set advertise mode on hci%d: %s (%d)\n",
hdev, strerror(errno), errno);
+ exit(1);
+ }
- hci_close_dev(dd);
+ if (status) {
+ fprintf(stderr, "LE set advertise enable on hci%d returned status %d\n",
+ hdev, status);
+ exit(1);
+ }
}
static void cmd_le_states(int ctl, int hdev, char *opt)
@@ -302,7 +311,7 @@ static void cmd_le_states(int ctl, int hdev, char *opt)
err = hci_send_req(dd, &rq, 1000);
- close(dd);
+ hci_close_dev(dd);
if (err < 0) {
fprintf(stderr, "Can't read LE supported states on hci%d:"