Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] hcitool: Bring up device before sending commands over socket
@ 2010-11-09 18:29 Anderson Lizardo
  2010-11-11  9:26 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Anderson Lizardo @ 2010-11-09 18:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

The Texas specific initialization code sends HCI commands over the
bluetooth socket, but does not bring up the device. This gives these
errors when running "hciattach /dev/ttyUSB0 texas":

Found a Texas Instruments' chip!
Firmware file : /lib/firmware/TIInit_XX.Y.ZZ.bts
Loaded BTS script version 1
Cannot send hci command to socket: Network is down
Can't initialize device: Network is down
---
 tools/hciattach_ti.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/hciattach_ti.c b/tools/hciattach_ti.c
index 7627bc1..e107a65 100644
--- a/tools/hciattach_ti.c
+++ b/tools/hciattach_ti.c
@@ -514,6 +514,13 @@ int texas_post(int fd, struct termios *ti)
 		return -1;
 	}
 
+	if (ioctl(dd, HCIDEVUP, dev_id) < 0 && errno != EALREADY) {
+		fprintf(stderr, "Can't init device hci%d: %s (%d)", dev_id,
+							strerror(errno), errno);
+		hci_close_dev(dd);
+		return -1;
+	}
+
 	ret = brf_do_script(dd, ti, NULL);
 
 	hci_close_dev(dd);
-- 
1.7.0.4


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

end of thread, other threads:[~2010-11-11  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 18:29 [PATCH] hcitool: Bring up device before sending commands over socket Anderson Lizardo
2010-11-11  9:26 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox