An SEID selection anomaly

25 views
Skip to first unread message

louis lee

unread,
Mar 28, 2025, 11:26:01 AMMar 28
to btstack-dev

Hi Mathias,

I've identified an SEID selection anomaly when our device initiates parallel paging procedures with mobile phones. The issue caused by overlapping AVDTP_GET_ALL_CAPABILITIES_CMD triggers.

I captured the logs using the Ellisys Bluetooth Analyzer.20250328192820.png

  1. First Trigger
    • Initiated via avdtp_signaling_emit_sep_done()
  1. Second Trigger
    • Activated by avdtp_handle_sdp_query_succeeded()

To resolve this issue, should we implement stricter conditional checks in the following function?


static void avdtp_handle_sdp_query_succeeded(avdtp_connection_t * connection){
    log_info("avdtp_handle_sdp_query_succeeded: state %d", connection->state);
    
    switch (connection->state){
        case AVDTP_SIGNALING_CONNECTION_OPENED:
            if (connection->avdtp_version < 0x0103){
                connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
            } else {
                connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES;
            }
            avdtp_request_can_send_now_initiator(connection);
            break;
        default:
            connection->state = AVDTP_SIGNALING_CONNECTION_W4_L2CAP_CONNECTED;
            l2cap_create_channel(avdtp_packet_handler, connection->remote_addr, connection->avdtp_l2cap_psm, AVDTP_L2CAP_MTU, NULL);
            break;
    }
}

Thanks for the reply.

Matthias Ringwald

unread,
Mar 28, 2025, 2:06:01 PMMar 28
to btsta...@googlegroups.com
Hi Louis

Could you explain in more detail what you see as a problem here and please also attach a HCI packet log from BTstack itself using it's hci_dump functionality.

It's ok for both devices to do a full Discovery in AVRCP, but only one side should configure a stream endpoint.
Does BTstack make a mistake in this? (again, please share a HCI packet log).

Cheers
matthias

> On 28 Mar 2025, at 12:36, louis lee <louisl...@gmail.com> wrote:
>
> Hi Mathias,
> I've identified an SEID selection anomaly when our device initiates parallel paging procedures with mobile phones. The issue caused by overlapping AVDTP_GET_ALL_CAPABILITIES_CMD triggers.
> I captured the logs using the Ellisys Bluetooth Analyzer.<20250328192820.png>
>
> • First Trigger
> •
> • Initiated via avdtp_signaling_emit_sep_done()。
> • Second Trigger
> •
> • Activated by avdtp_handle_sdp_query_succeeded()。
>
> To resolve this issue, should we implement stricter conditional checks in the following function?
>
> static void avdtp_handle_sdp_query_succeeded(avdtp_connection_t * connection){
> log_info("avdtp_handle_sdp_query_succeeded: state %d", connection->state);
> switch (connection->state){
> case AVDTP_SIGNALING_CONNECTION_OPENED:
> if (connection->avdtp_version < 0x0103){
> connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
> } else {
> connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES;
> }
> avdtp_request_can_send_now_initiator(connection);
> break;
> default:
> connection->state = AVDTP_SIGNALING_CONNECTION_W4_L2CAP_CONNECTED;
> l2cap_create_channel(avdtp_packet_handler, connection->remote_addr, connection->avdtp_l2cap_psm, AVDTP_L2CAP_MTU, NULL);
> break;
> }
> }
>
> Thanks for the reply.
>
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/9ea43910-fcaf-4451-8239-0d4bfe4d9961n%40googlegroups.com.
> <20250328192820.png>

louis lee

unread,
Mar 28, 2025, 9:18:09 PMMar 28
to btsta...@googlegroups.com
Our device sent the AVDTP_Get_All_Capabilities command twice for SEID 1 and mistakenly used the second response as SEID 2. This indicates a potential SEID assignment conflict in the AVDTP signaling process.

I suspect the possible reason might be that the phone-side initiation of AVDTP establishment coincided with the device-side SDP service search process. 

I don't have the HCI logs handy right now, I will capture  later. 

I have attached the complete protocol log captured with the Ellisys Bluetooth analyzer for your reference.  I‘ve Flagged the hot zones in logs with markers

Matthias Ringwald <matthias...@gmail.com> 于2025年3月29日周六 02:06写道:
dev_log_filtered.btt

louis lee

unread,
Mar 31, 2025, 3:27:21 AMMar 31
to btsta...@googlegroups.com
Add HCI packet log. 

louis lee <louisl...@gmail.com> 于2025年3月29日周六 09:17写道:
2025_3_31_15-12-23.pklg

Matthias Ringwald

unread,
Mar 31, 2025, 8:07:58 AMMar 31
to btsta...@googlegroups.com
Hi Louis

Thanks for the HCI dump file. BTstack shouldn't send the same reguest twice. haven't see this issue yet but we will look into this.
Is there an easy way to reproduce it?

Best regards
Matthias
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/CAN6F-wskfaFvy4USim-D8r5Q8j3c%3DiWRQcG%2Bh_bT4jbG%2BAqr_Q%40mail.gmail.com.
> <2025_3_31_15-12-23.pklg>

louisl...@gmail.com

unread,
Apr 1, 2025, 8:32:05 AMApr 1
to btstack-dev
Hi Mathias,
Here is the reproduction scenario for the issue.
When our device is powered on, it calls the function a2dp_sink_establish_stream() to connect to a mobile phone. Concurrently, the mobile phone initiates a Page operation to our device.   This issue occurs with a high probability on one specific phone. 

BR
Louis

Matthias Ringwald

unread,
Apr 3, 2025, 8:53:35 AMApr 3
to btsta...@googlegroups.com
Hi Louis

Thanks for the hci log. I think I've figured out / can confirm your hint to add more checks to avdtp_handle_sdp_query_succeeded.

Please update to the current version on the develop branch and verify the fix.
If there's still problems or others, please add ENABLE_LOG_INFO to get more insight into the stack state.

Also, in your log, it looks like you create the AVRCP connection before A2DP. And during A2DP setup, the remote phone disconnects the AVRCP connection.
I don't know if there's a rule in the Bluetooth spec, but I would recommend to connect to AVRCP after the A2DP connection has been established. I even think iOS rejects AVRCP before AVDTP/A2DP.

Cheers
Matthias
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/2025040120315804719513%40gmail.com.


louisl...@gmail.com

unread,
Apr 7, 2025, 11:21:01 PMApr 7
to btstack-dev
Hi Matthias
Thank you so much.  I've tested the latest fixes and they worked successfully.

BR
Louis

Reply all
Reply to author
Forward
0 new messages