1
0
Fork 0

Ensure state set correctly on exit from state transform functions

This commit is contained in:
Shawn Nock 2019-07-16 13:31:27 -04:00
parent 90805d61d9
commit 0fb0118ffa
1 changed files with 8 additions and 8 deletions

View File

@ -716,19 +716,20 @@ static linkstate_t do_uninit(struct net_buf const *buf) {
} }
static linkstate_t do_init(struct net_buf const *buf) { static linkstate_t do_init(struct net_buf const *buf) {
if (packet_is_config(buf)) { if (packet_is_config_response(buf)) {
h5_send_config_response();
return INIT;
} else if (packet_is_config_response(buf)) {
h5.tx_win = conf_rsp[2] & 0x7; h5.tx_win = conf_rsp[2] & 0x7;
h5.tx_seq = 0; h5.tx_seq = 0;
h5.tx_ack = 0; h5.tx_ack = 0;
LOG_DBG("Finished H5 configuration, tx_win %u", h5.tx_win); LOG_DBG("Finished H5 configuration, tx_win %u", h5.tx_win);
return ACTIVE; return ACTIVE;
} }
if (packet_is_config(buf)) {
h5_send_config_response();
}
return INIT;
} }
static linkstate_t do_active(struct net_buf const *buf) { static linkstate_t do_active(struct net_buf *buf) {
if (packet_is_config(buf)) { if (packet_is_config(buf)) {
h5_send_config_response(); h5_send_config_response();
return ACTIVE; return ACTIVE;
@ -745,13 +746,12 @@ static linkstate_t do_active(struct net_buf const *buf) {
} }
// Presumably something from the controller // Presumably something from the controller
u8_t type = bt_buf_get_type(buf); if (bt_buf_get_type(buf) == BT_BUF_EVT) {
if (type == BT_BUF_EVT) {
//LOG_HEXDUMP_DBG(buf->data, buf->len, "CTRL -> HOST");
h5_send(buf->data, HCI_EVENT_PKT, buf->len); h5_send(buf->data, HCI_EVENT_PKT, buf->len);
} else { } else {
LOG_HEXDUMP_ERR(buf->data, buf->len, "Unexpected buffer in host_queue"); LOG_HEXDUMP_ERR(buf->data, buf->len, "Unexpected buffer in host_queue");
} }
return ACTIVE;
} }
void main(void) void main(void)