All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix hciconfig leadv returned response.
@ 2011-01-31 18:57 Andre Dieb Martins
  2011-02-01  9:10 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Dieb Martins @ 2011-01-31 18:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andre Dieb Martins

Fixes hciconfig leadv returned response by treating both status of the command
execution and HCI error code.
---
 tools/hciconfig.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index c271d14..05a8910 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:"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix hciconfig leadv returned response.
  2011-01-31 18:57 [PATCH] Fix hciconfig leadv returned response Andre Dieb Martins
@ 2011-02-01  9:10 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-01  9:10 UTC (permalink / raw)
  To: Andre Dieb Martins; +Cc: linux-bluetooth

Hi André,

On Mon, Jan 31, 2011, Andre Dieb Martins wrote:
> Fixes hciconfig leadv returned response by treating both status of the command
> execution and HCI error code.
> ---
>  tools/hciconfig.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)

The patch has been pushed upstream. Thanks. However, I did have to fix
your commit message first: the summary line should not have a '.' at the
end and no line should be longer than 74 characters so that the message
is properly viewable with git log on a 80 character wide terminal.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-01  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-31 18:57 [PATCH] Fix hciconfig leadv returned response Andre Dieb Martins
2011-02-01  9:10 ` Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.