diff --git a/tools/hciattach.c b/tools/hciattach.c
index 1b577ec..d7d9069 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
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
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
}
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 );
return -1;
}
+ if (speed)
+ *speed = serial_action->baud;
+
return 0;
}
}
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;
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");
* 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;
/* 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;
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];
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);
return -1;
}
- ret = brf_do_script(dd, ti, NULL);
+ ret = brf_do_script(dd, NULL, ti, NULL);
hci_close_dev(dd);