l2cap.c (6268fbfe8d092a2ac58a34e97a7973fcc7d64fec) l2cap.c (2e4c1850fcb53a9712e3f23b407c2a67d19c9bd9)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2686 unchanged lines hidden (view full) ---

2695 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_REQ);
2696 break;
2697 }
2698 break;
2699 default:
2700 break;
2701 }
2702 if (l2cap_channel_ready_for_open(channel)){
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2686 unchanged lines hidden (view full) ---

2695 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_REQ);
2696 break;
2697 }
2698 break;
2699 default:
2700 break;
2701 }
2702 if (l2cap_channel_ready_for_open(channel)){
2703
2704#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
2705 // assert that packet can be stored in fragment buffers in ertm
2706 if (channel->mode == L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){
2707 uint16_t effective_mps = btstack_min(channel->remote_mps, channel->local_mps);
2708 uint16_t usable_mtu = channel->num_tx_buffers == 1 ? effective_mps : channel->num_tx_buffers * effective_mps - 2;
2709 if (usable_mtu < channel->remote_mtu){
2710 log_info("Remote MTU %u > max storable ERTM packet, only using MTU = %u", channel->remote_mtu, usable_mtu);
2711 channel->remote_mtu = usable_mtu;
2712 }
2713 }
2714#endif
2703 // for open:
2704 channel->state = L2CAP_STATE_OPEN;
2705 l2cap_emit_channel_opened(channel, 0);
2706 }
2707 break;
2708
2709 case L2CAP_STATE_WAIT_DISCONNECT:
2710 switch (code) {

--- 1209 unchanged lines hidden ---
2715 // for open:
2716 channel->state = L2CAP_STATE_OPEN;
2717 l2cap_emit_channel_opened(channel, 0);
2718 }
2719 break;
2720
2721 case L2CAP_STATE_WAIT_DISCONNECT:
2722 switch (code) {

--- 1209 unchanged lines hidden ---