mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
don't require outgoing credits or a sent MSC Response as required to treat channel as open -> should fix RFC_BV_13
This commit is contained in:
parent
1429b2d6b9
commit
51579c0803
27
src/rfcomm.c
27
src/rfcomm.c
@ -1549,11 +1549,14 @@ void rfcomm_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
}
|
||||
|
||||
static int rfcomm_channel_ready_for_open(rfcomm_channel_t *channel){
|
||||
// note: exchanging MSC isn't neccessary to consider channel open
|
||||
// note: having outgoing credits is also not necessary to consider channel open
|
||||
// log_info("rfcomm_channel_ready_for_open state %u, flags needed %04x, current %04x, rf credits %u, l2cap credits %u \n", channel->state, RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP|RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP|RFCOMM_CHANNEL_STATE_VAR_SENT_CREDITS, channel->state_var, channel->credits_outgoing, channel->multiplexer->l2cap_credits);
|
||||
// if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP) == 0) return 0;
|
||||
// if (channel->credits_outgoing == 0) return 0;
|
||||
log_info("rfcomm_channel_ready_for_open state %u, flags needed %04x, current %04x, rf credits %u, l2cap credits %u \n", channel->state, RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP, channel->state_var, channel->credits_outgoing, channel->multiplexer->l2cap_credits);
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_RCVD_MSC_RSP) == 0) return 0;
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP) == 0) return 0;
|
||||
if ((channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SENT_CREDITS) == 0) return 0;
|
||||
if (channel->credits_outgoing == 0) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1625,6 +1628,13 @@ static void rfcomm_channel_state_machine(rfcomm_channel_t *channel, rfcomm_chann
|
||||
rfcomm_send_uih_rpn_rsp(multiplexer, channel->dlci, &channel->rpn_data);
|
||||
return;
|
||||
}
|
||||
if (channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP){
|
||||
log_info("Sending MSC RSP for #%u\n", channel->dlci);
|
||||
rfcomm_channel_state_remove(channel, RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP);
|
||||
rfcomm_channel_state_add(channel, RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP);
|
||||
rfcomm_send_uih_msc_rsp(multiplexer, channel->dlci, 0x8d); // ea=1,fc=0,rtc=1,rtr=1,ic=0,dv=1
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// emit MSC status to app
|
||||
@ -1782,13 +1792,6 @@ static void rfcomm_channel_state_machine(rfcomm_channel_t *channel, rfcomm_chann
|
||||
rfcomm_send_uih_msc_cmd(multiplexer, channel->dlci , 0x8d); // ea=1,fc=0,rtc=1,rtr=1,ic=0,dv=1
|
||||
break;
|
||||
}
|
||||
if (channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP){
|
||||
log_info("Sending MSC RSP for #%u\n", channel->dlci);
|
||||
rfcomm_channel_state_remove(channel, RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP);
|
||||
rfcomm_channel_state_add(channel, RFCOMM_CHANNEL_STATE_VAR_SENT_MSC_RSP);
|
||||
rfcomm_send_uih_msc_rsp(multiplexer, channel->dlci, 0x8d); // ea=1,fc=0,rtc=1,rtr=1,ic=0,dv=1
|
||||
break;
|
||||
}
|
||||
if (channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SEND_CREDITS){
|
||||
log_info("Providing credits for #%u\n", channel->dlci);
|
||||
rfcomm_channel_state_remove(channel, RFCOMM_CHANNEL_STATE_VAR_SEND_CREDITS);
|
||||
@ -1819,12 +1822,6 @@ static void rfcomm_channel_state_machine(rfcomm_channel_t *channel, rfcomm_chann
|
||||
rfcomm_channel_state_add(channel, RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP);
|
||||
break;
|
||||
case CH_EVT_READY_TO_SEND:
|
||||
if (channel->state_var & RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP){
|
||||
log_info("Sending MSC RSP for #%u\n", channel->dlci);
|
||||
rfcomm_channel_state_remove(channel, RFCOMM_CHANNEL_STATE_VAR_SEND_MSC_RSP);
|
||||
rfcomm_send_uih_msc_rsp(multiplexer, channel->dlci, 0x8d); // ea=1,fc=0,rtc=1,rtr=1,ic=0,dv=1
|
||||
break;
|
||||
}
|
||||
if (channel->new_credits_incoming) {
|
||||
uint8_t new_credits = channel->new_credits_incoming;
|
||||
channel->new_credits_incoming = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user