Diff between 85d21c3ea5d57baa7075c0aac3c948eef592eb58 and 2f440ad7b5e069056c692b3d1bacffb414d015cd

Changed Files

File Additions Deletions Status
tools/hciattach.c +1 -1 modified
tools/hciattach.h +1 -1 modified
tools/hciattach_ti.c +11 -8 modified

Full Patch

diff --git a/tools/hciattach.c b/tools/hciattach.c
index 1b577ec..d7d9069 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -296,7 +296,7 @@ static int digi(int fd, struct uart_t *u, struct termios *ti)
 
 static int texas(int fd, struct uart_t *u, struct termios *ti)
 {
-	return texas_init(fd, ti);
+	return texas_init(fd, &u->speed, ti);
 }
 
 static int texas2(int fd, struct uart_t *u, struct termios *ti)
diff --git a/tools/hciattach.h b/tools/hciattach.h
index fed0d11..29fee33 100644
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -45,7 +45,7 @@
 int read_hci_event(int fd, unsigned char* buf, int size);
 int set_speed(int fd, struct termios *ti, int speed);
 
-int texas_init(int fd, struct termios *ti);
+int texas_init(int fd, int *speed, struct termios *ti);
 int texas_post(int fd, struct termios *ti);
 int texasalt_init(int fd, int speed, struct termios *ti);
 int stlc2500_init(int fd, bdaddr_t *bdaddr);
diff --git a/tools/hciattach_ti.c b/tools/hciattach_ti.c
index 6269181..fe6a894 100644
--- a/tools/hciattach_ti.c
+++ b/tools/hciattach_ti.c
@@ -210,7 +210,7 @@ static void brf_delay(struct bts_action_delay *delay)
 }
 
 static int brf_set_serial_params(struct bts_action_serial *serial_action,
-						int fd, struct termios *ti)
+						int fd, int *speed, struct termios *ti)
 {
 	fprintf(stderr, "texas: changing baud rate to %u, flow control to %u\n",
 				serial_action->baud, serial_action->flow_control );
@@ -233,6 +233,9 @@ static int brf_set_serial_params(struct bts_action_serial *serial_action,
 		return -1;
 	}
 
+	if (speed)
+		*speed = serial_action->baud;
+
 	return 0;
 }
 
@@ -312,7 +315,7 @@ static int brf_send_command(int fd, struct bts_action_send* send_action, long si
 }
 
 static int brf_do_action(uint16_t brf_type, uint8_t *brf_action, long brf_size,
-				int fd, struct termios *ti, int hcill_installed)
+				int fd, int *speed, struct termios *ti, int hcill_installed)
 {
 	int ret = 0;
 
@@ -326,7 +329,7 @@ static int brf_do_action(uint16_t brf_type, uint8_t *brf_action, long brf_size,
 		break;
 	case ACTION_SERIAL:
 		DPRINTF("S");
-		ret = brf_set_serial_params((struct bts_action_serial *) brf_action, fd, ti);
+		ret = brf_set_serial_params((struct bts_action_serial *) brf_action, fd, speed, ti);
 		break;
 	case ACTION_DELAY:
 		DPRINTF("D");
@@ -377,7 +380,7 @@ static int brf_action_is_deep_sleep(uint8_t *brf_action, long brf_size,
  * The second time it is called, it assumes HCILL protocol is set up,
  * and sends rest of brf script via the supplied socket.
  */
-static int brf_do_script(int fd, struct termios *ti, const char *bts_file)
+static int brf_do_script(int fd, int *speed, struct termios *ti, const char *bts_file)
 {
 	int ret = 0,  hcill_installed = bts_file ? 0 : 1;
 	uint32_t vers;
@@ -412,7 +415,7 @@ static int brf_do_script(int fd, struct termios *ti, const char *bts_file)
 	/* execute current action and continue to parse brf script file */
 	while (brf_size != 0) {
 		ret = brf_do_action(brf_type, brf_action, brf_size,
-						fd, ti, hcill_installed);
+						fd, speed, ti, hcill_installed);
 		if (ret == -1)
 			break;
 
@@ -435,7 +438,7 @@ static int brf_do_script(int fd, struct termios *ti, const char *bts_file)
 	return ret;
 }
 
-int texas_init(int fd, struct termios *ti)
+int texas_init(int fd, int *speed, struct termios *ti)
 {
 	struct timespec tm = {0, 50000};
 	char cmd[4];
@@ -486,7 +489,7 @@ int texas_init(int fd, struct termios *ti)
 	bts_file = get_firmware_name(resp);
 	fprintf(stderr, "Firmware file : %s\n", bts_file);
 
-	n = brf_do_script(fd, ti, bts_file);
+	n = brf_do_script(fd, speed, ti, bts_file);
 
 	nanosleep(&tm, NULL);
 
@@ -520,7 +523,7 @@ int texas_post(int fd, struct termios *ti)
 		return -1;
 	}
 
-	ret = brf_do_script(dd, ti, NULL);
+	ret = brf_do_script(dd, NULL, ti, NULL);
 
 	hci_close_dev(dd);