document hci_read_buffer_size result, better docuement l2cap mtu handling

This commit is contained in:
matthias.ringwald 2011-06-12 07:46:50 +00:00
parent c68bdf905b
commit 1d279b2064
2 changed files with 6 additions and 7 deletions

View File

@ -351,6 +351,7 @@ static void event_handler(uint8_t *packet, int size){
if (COMMAND_COMPLETE_EVENT(packet, hci_read_buffer_size)){
// from offset 5
// status
// "The HC_ACL_Data_Packet_Length return parameter will be used to determine the size of the L2CAP segments contained in ACL Data Packets"
hci_stack.acl_data_packet_length = READ_BT_16(packet, 6);
// ignore: SCO data packet len (8)
hci_stack.total_num_acl_packets = packet[9];

View File

@ -240,11 +240,11 @@ void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t p
// TODO: emit error event
if (!chan) return;
// validate mtu
if (hci_max_acl_data_packet_length() < mtu) {
// limit local mtu to max acl packet length
if (mtu > hci_max_acl_data_packet_length()) {
mtu = hci_max_acl_data_packet_length();
}
// fill in
BD_ADDR_COPY(chan->address, address);
chan->psm = psm;
@ -461,8 +461,8 @@ static void l2cap_handle_connection_request(hci_con_handle_t handle, uint8_t sig
channel->local_mtu = service->mtu;
channel->remote_mtu = L2CAP_DEFAULT_MTU;
// validate mtu
if (hci_max_acl_data_packet_length() < channel->local_mtu) {
// limit local mtu to max acl packet length
if (channel->local_mtu > hci_max_acl_data_packet_length()) {
channel->local_mtu = hci_max_acl_data_packet_length();
}
@ -529,8 +529,6 @@ void l2cap_signaling_handle_configure_request(l2cap_channel_t *channel, uint8_t
pos += length;
}
uint8_t identifier = command[L2CAP_SIGNALING_COMMAND_SIGID_OFFSET];
// send back received options
// l2cap_send_signaling_packet(channel->handle, CONFIGURE_RESPONSE, identifier, channel->remote_cid, 0, 0, len-4, &command[8]);
// send back OK
l2cap_send_signaling_packet(channel->handle, CONFIGURE_RESPONSE, identifier, channel->remote_cid, 0, 0, 0, NULL);
}