espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.31k stars 7.2k forks source link

Bluetooth reconnection still requires pairing (IDFGH-12388) #13416

Open jjj19950710 opened 5 months ago

jjj19950710 commented 5 months ago

Answers checklist.

IDF version.

v5.0.1

Espressif SoC revision.

ESP32

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

CMD

Development Kit.

ESP32

Power Supply used.

USB

What is the expected behavior?

Bluetooth reconnection does not require pairing。

What is the actual behavior?

When I reset the board using the esp_restart() function, and then start Bluetooth to reconnect the phone, I need to re-pair. However, after resetting the board and enabling Bluetooth, the phone does not need to be re-paired to reconnect to the development board.

Steps to reproduce.

  1. Modified a2dp_sink examples。

    
    void start_run(void)
    {
    /* initialize NVS — it is used to store PHY calibration data */
    // esp_err_t err = nvs_flash_init();
    // if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
    //     ESP_ERROR_CHECK(nvs_flash_erase());
    //     err = nvs_flash_init();
    // }
    // ESP_ERROR_CHECK(err);
    esp_err_t err;
    /*
     * This example only uses the functions of Classical Bluetooth.
     * So release the controller memory for Bluetooth Low Energy.
     */
    ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_BLE));
    
    esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
        ESP_LOGE(BT_AV_TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err));
        return;
    }
    if ((err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) {
        ESP_LOGE(BT_AV_TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err));
        return;
    }
    if ((err = esp_bluedroid_init()) != ESP_OK) {
        ESP_LOGE(BT_AV_TAG, "%s initialize bluedroid failed: %s\n", __func__, esp_err_to_name(err));
        return;
    }
    if ((err = esp_bluedroid_enable()) != ESP_OK) {
        ESP_LOGE(BT_AV_TAG, "%s enable bluedroid failed: %s\n", __func__, esp_err_to_name(err));
        return;
    }

if (CONFIG_BT_SSP_ENABLED == true)

/* set default parameters for Secure Simple Pairing */
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
esp_bt_io_cap_t iocap = ESP_BT_IO_CAP_IO;
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));

endif

/* set default parameters for Legacy Pairing (use fixed pin code 1234) */
esp_bt_pin_type_t pin_type = ESP_BT_PIN_TYPE_FIXED;
esp_bt_pin_code_t pin_code;
pin_code[0] = '1';
pin_code[1] = '2';
pin_code[2] = '3';
pin_code[3] = '4';
esp_bt_gap_set_pin(pin_type, 4, pin_code);

bt_app_task_start_up();
/* bluetooth device name, connection mode and profile set up */
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);

}

void app_main(void) { esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } ESP_ERROR_CHECK(ret); while (1) { int opcode = 0;

    char input[128] = "\0";

    gets(input);

    if(memcmp("con", input, 3) == 0){
        opcode = 1; //start pair
    }
    else if(memcmp("reset", input, 5) == 0){//2  avdtp 
        opcode = 2; //reset
    }
    switch (opcode)
     {
            case 1:
                if(input[3] == 48){
                    scan_flag = 0;//wait connect
                }
                else if(input[3] == 49){
                    scan_flag = 1;//active connect
                }
                vTaskDelay(100/portTICK_PERIOD_MS);
                memcpy(remote_device_name,input + 4 , sizeof(input)-4);
                start_run();
                break;
            case 2:
                esp_restart();
                break;
            default:
                 break;
     }
    vTaskDelay(4);
}

}

static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)

case ESP_BT_GAP_DISC_STATE_CHANGED_EVT: { if (param->disc_st_chg.state == ESP_BT_GAP_DISCOVERY_STOPPED) { if (s_a2d_state == APP_AV_STATE_DISCOVERED) { s_a2d_state = APP_AV_STATE_CONNECTING; ESP_LOGI(BT_AV_TAG, "Device discovery stopped."); ESP_LOGI(BT_AV_TAG, "a2dp connecting to peer: %s", s_peer_bdname); / connect source to peer device specificed by Bluetooth Device Address / esp_a2d_sink_connect(s_peer_bda); //add sink_connect } else { / not discovered, continue to discover / ESP_LOGI(BT_AV_TAG, "Device discovery failed, continue to discover..."); //esp_bt_gap_start_discovery(ESP_BT_INQ_MODE_GENERAL_INQUIRY, 10, 0); } } else if (param->disc_st_chg.state == ESP_BT_GAP_DISCOVERY_STARTED) { ESP_LOGI(BT_AV_TAG, "Discovery started."); } break; }

3. idf.py -p COM3 flash monitor
4. run:   

con1HONOR //active connect reset //Reset ESP32 con1HONOR //active connect

The second connection requires pairing

con0HONOR //wait connect reset //Reset ESP32 con0HONOR //wait connect


The second connection does not require pairing

Why is this happening?

### Debug Logs.

_No response_

### More Information.

_No response_
jjj19950710 commented 5 months ago

the main.c is main.zip

shangke1112 commented 5 months ago

@jjj19950710 Please upload the two different logs.

jjj19950710 commented 5 months ago

con1HONOR log:

I (4505) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4505) BT_BTM: BTM_SEC_REG[0]: id 0, is_orig 0, psm 0x0001, proto_id 0, chan_id 0

I (4505) BT_BTM:                : sec: 0x80, service name [Service Discovery] (up to 21 chars saved)

I (4515) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4525) BT_BTM: BTM_SEC_REG[0]: id 0, is_orig 1, psm 0x0001, proto_id 0, chan_id 0

I (4535) BT_BTM:                : sec: 0x80, service name [Service Discovery] (up to 21 chars saved)

I (4545) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4545) BT_BTM: BTM_SEC_REG[1]: id 50, is_orig 1, psm 0x001f, proto_id 0, chan_id 0

I (4555) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (4565) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4575) BT_BTM: BTM_SEC_REG[1]: id 50, is_orig 0, psm 0x001f, proto_id 0, chan_id 0

I (4585) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (4725) BT_BTM: BTM_SetPinType: pin type 0 [variable-0, fixed-1], code , length 0

I (4725) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4735) BT_BTM: BTM_SEC_REG[2]: id 42, is_orig 0, psm 0x0003, proto_id 3, chan_id 0

I (4735) BT_BTM:                : sec: 0x80, service name [RFC_MUX
] (up to 21 chars saved)

I (4745) BT_BTM: BTM_SetInquiryMode

I (4755) BT_BTM: BTM_SetPageScanType

I (4755) BT_BTM: BTM_SetInquiryScanType

I (4775) BT_BTM: BTM_SecAddDevice, link key type:5

I (4775) BT_BTM: BTM_SecAddDevice, link key type:5

I (4775) BT_BTM: BTM_SecAddDevice, link key type:4

I (4785) BT_BTM: BTM_InqDbRead: bd addr [6eb43ada69be]

I (4795) BT_BTM: BTM_InqDbRead: bd addr [4bd4a6cb1f9f]

I (4795) BT_BTM: BTM_InqDbRead: bd addr [65346099b949]

I (4805) BT_BTM: BTM_InqDbRead: bd addr [42f62300294f]

I (4805) BT_BTM: BTM_InqDbRead: bd addr [410b2ac2c4b4]

I (4815) BT_BTM: BTM_InqDbRead: bd addr [68963bb24608]

I (4825) BT_BTM: BTM_InqDbRead: bd addr [6854f7e891f4]

I (4825) BT_BTM: BTM_InqDbRead: bd addr [7fa4c7232dd6]

I (4835) BT_BTM: BTM_InqDbRead: bd addr [65907e7be46c]

I (4835) BT_BTM: BTM_InqDbRead: bd addr [4645fe2509b7]

I (4845) BT_BTM: BTM_InqDbRead: bd addr [650d658f18d3]

I (4855) BT_BTM: BTM_InqDbRead: bd addr [504218c9b55d]

I (4855) BT_BTM: BTM_InqDbRead: bd addr [768116eca9d9]

I (4865) BT_BTM: BTM_InqDbRead: bd addr [6a81fb560b97]

I (4865) BT_BTM: BTM_InqDbRead: bd addr [7d8473059743]

I (4875) BT_BTM: Write Extended Inquiry Response to controller

I (4885) BT_BTM: BTM_SetPinType: pin type 1 [variable-0, fixed-1], code 1234��l��?l��?X��?, length 4

I (4895) BT_AV: Starting device discovery...
I (4895) BT_BTM: Write Extended Inquiry Response to controller

W (4905) BT_BTC: A2DP Enable with AVRC
I (4905) BT_BTM: btm_sec_set_security_level : sec: 0x12

I (4915) BT_BTM: BTM_SEC_REG[3]: id 37, is_orig 1, psm 0x0019, proto_id 7, chan_id 0

I (4915) BT_BTM:                : sec: 0x2090, service name [] (up to 21 chars saved)

I (4925) BT_BTM: btm_sec_set_security_level : sec: 0x12

I (4935) BT_BTM: BTM_SEC_REG[3]: id 37, is_orig 0, psm 0x0019, proto_id 7, chan_id 0

I (4945) BT_BTM:                : sec: 0x3092, service name [] (up to 21 chars saved)

I (4955) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4955) BT_BTM: BTM_SEC_REG[4]: id 38, is_orig 1, psm 0x0019, proto_id 7, chan_id 1

I (4965) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (4975) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (4985) BT_BTM: BTM_SEC_REG[4]: id 38, is_orig 0, psm 0x0019, proto_id 7, chan_id 1

I (4985) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (4995) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (5005) BT_BTM: BTM_SEC_REG[4]: id 38, is_orig 1, psm 0x0019, proto_id 7, chan_id 2

I (5015) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (5025) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (5025) BT_BTM: BTM_SEC_REG[4]: id 38, is_orig 0, psm 0x0019, proto_id 7, chan_id 2

I (5035) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (5045) BT_BTM: btm_sec_set_security_level : sec: 0x12

I (5055) BT_BTM: BTM_SEC_REG[5]: id 39, is_orig 1, psm 0x0017, proto_id 0, chan_id 0

I (5055) BT_BTM:                : sec: 0x2090, service name [] (up to 21 chars saved)

I (5065) BT_BTM: btm_sec_set_security_level : sec: 0x12

I (5075) BT_BTM: BTM_SEC_REG[5]: id 39, is_orig 0, psm 0x0017, proto_id 0, chan_id 0

I (5085) BT_BTM:                : sec: 0x3092, service name [] (up to 21 chars saved)

I (5095) BT_AVRC: AVRC_AddRecord uuid: 110c
I (5095) BT_BTM: Write Extended Inquiry Response to controller

I (5105) BT_A2D: A2D_AddRecord uuid: 110b
I (5105) BT_BTM: Write Extended Inquiry Response to controller

I (5115) BT_AVCT: AVCT_CreateConn: 1, control:3
I (5115) BT_AVRC: AVRC_AddRecord uuid: 110e
I (5125) BT_BTM: Write Extended Inquiry Response to controller

I (5135) BT_AV: A2DP PROF STATE: Init Complete
I (5135) BT_BTM: BTM_ReadDiscoverability

I (5145) BT_BTM: BTM_ReadConnectability

I (5145) BT_BTM: BTM_BleReadDiscoverability

I (5155) BT_BTM: BTM_BleReadConnectability

I (5155) BT_BTM: BTM_SetDiscoverability

I (5155) BT_BTM: BTM_SetDiscoverability: mode 2 [NonDisc-0, Lim-1, Gen-2], window 0x0012, interval 0x0800

I (5175) BT_BTM: BTM_SetConnectability

I (5175) BT_BTM: BTM_SetConnectability: mode 1 [NonConn-0, Conn-1], window 0x0012, interval 0x0800

I (5185) BT_BTM: BTM_StartInquiry: mode: 1, dur: 10, rsps: 0, flt: 0

I (5135) BT_AV: event: 10
I (5195) BT_AV: event: 10
I (5195) BT_AV: event: 10
I (5205) BT_AV: event: 10
I (5205) BT_AV: Get delay report value: delay_value: 1200 * 1/10 ms
I (5205) BT_AV: Discovery started.
I (5215) BT_AV: Set delay report value: success, delay_value: 1250 * 1/10 ms
I (5415) BT_BTM: BTM_CheckEirData type=0x03

I (5415) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (5415) BT_BTM: BTM_CheckEirData type=0x05

I (5425) BT_BTM: BTM_CheckEirData type=0x04

I (5425) BT_BTM: BTM_CheckEirData type=0x07

I (5435) BT_BTM: BTM_CheckEirData type=0x06

I (5435) BT_BTM: BTM_InqDbRead: bd addr [0a6221210ac5]

I (5445) BT_BTM: BTM_CheckEirData type=0x09

result
I (5445) BT_AV: Scanned device: 0a:62:21:21:0a:c5
I (5455) BT_AV: --Class of Device: 0x2a0104
I (5455) BT_AV: --RSSI: -80
the device type is 1
I (5465) BT_BTM: BTM_CheckEirData type=0x09

device DESKTOP-OAPG4LT
I (6505) BT_BTM: BTM_CheckEirData type=0x03

I (6505) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (6505) BT_BTM: BTM_CheckEirData type=0x05

I (6505) BT_BTM: BTM_CheckEirData type=0x04

I (6515) BT_BTM: BTM_CheckEirData type=0x07

I (6515) BT_BTM: BTM_CheckEirData type=0x06

I (6525) BT_BTM: BTM_InqDbRead: bd addr [a0a4c5168d38]

I (6525) BT_BTM: BTM_CheckEirData type=0x09

result
I (6535) BT_AV: Scanned device: a0:a4:c5:16:8d:38
I (6535) BT_AV: --Class of Device: 0x2a0104
I (6545) BT_AV: --RSSI: -85
the device type is 1
I (6555) BT_BTM: BTM_CheckEirData type=0x09

device DESKTOP-MAUC8QA
I (7145) BT_BTM: BTM_CheckEirData type=0x03

I (7145) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (7145) BT_BTM: BTM_CheckEirData type=0x05

I (7155) BT_BTM: BTM_CheckEirData type=0x04

I (7155) BT_BTM: BTM_CheckEirData type=0x07

I (7165) BT_BTM: BTM_CheckEirData type=0x06

I (7165) BT_BTM: BTM_InqDbRead: bd addr [0a6221210ac5]

I (7175) BT_BTM: BTM_CheckEirData type=0x09

result
I (7175) BT_AV: Scanned device: 0a:62:21:21:0a:c5
I (7185) BT_AV: --Class of Device: 0x2a0104
I (7185) BT_AV: --RSSI: -83
the device type is 1
I (7195) BT_BTM: BTM_CheckEirData type=0x09

device DESKTOP-OAPG4LT
I (7325) BT_BTM: BTM_CheckEirData type=0x03

I (7325) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (7325) BT_BTM: BTM_CheckEirData type=0x05

I (7325) BT_BTM: BTM_CheckEirData type=0x04

I (7335) BT_BTM: BTM_CheckEirData type=0x07

I (7335) BT_BTM: BTM_CheckEirData type=0x06

I (7345) BT_BTM: BTM_InqDbRead: bd addr [a0a4c5168d38]

I (7355) BT_BTM: BTM_CheckEirData type=0x09

result
I (7355) BT_AV: Scanned device: a0:a4:c5:16:8d:38
I (7365) BT_AV: --Class of Device: 0x2a0104
I (7365) BT_BTM: BTM_CheckEirData type=0x03

I (7375) BT_BTM: BTM_CheckEirData type=0x02

I (7375) BT_BTM: btm_set_eir_uuid eir_complete_list=0x00

I (7385) BT_BTM: BTM_CheckEirData type=0x05

I (7385) BT_BTM: BTM_CheckEirData type=0x04

I (7395) BT_BTM: BTM_CheckEirData type=0x07

I (7395) BT_BTM: BTM_CheckEirData type=0x06

I (7405) BT_BTM: BTM_InqDbRead: bd addr [a0a4c5168d38]

I (7405) BT_BTM: BTM_CheckEirData type=0x09

I (7415) BT_BTM: BTM_CheckEirData type=0x08

I (7415) BT_AV: --RSSI: -80
the device type is 1
I (7425) BT_BTM: BTM_CheckEirData type=0x09

device DESKTOP-MAUC8QA
result
I (7435) BT_AV: Scanned device: a0:a4:c5:16:8d:38
I (7435) BT_AV: --Class of Device: 0x2a0104
I (7445) BT_AV: --RSSI: -84
the device type is 1
I (7445) BT_BTM: BTM_CheckEirData type=0x09

I (7455) BT_BTM: BTM_CheckEirData type=0x08

device DESKTOP-MAUC8QA
I (7575) BT_BTM: BTM_CheckEirData type=0x03

I (7575) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (7575) BT_BTM: BTM_CheckEirData type=0x05

I (7585) BT_BTM: BTM_CheckEirData type=0x04

I (7585) BT_BTM: BTM_CheckEirData type=0x07

I (7595) BT_BTM: BTM_CheckEirData type=0x06

I (7595) BT_BTM: BTM_InqDbRead: bd addr [a0a4c5168d38]

I (7605) BT_BTM: BTM_CheckEirData type=0x09

result
I (7605) BT_AV: Scanned device: a0:a4:c5:16:8d:38
I (7615) BT_AV: --Class of Device: 0x2a0104
I (7615) BT_AV: --RSSI: -81
the device type is 1
I (7625) BT_BTM: BTM_CheckEirData type=0x09

device DESKTOP-MAUC8QA
I (8315) BT_BTM: BTM_CheckEirData type=0x03

I (8315) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (8315) BT_BTM: BTM_CheckEirData type=0x05

I (8315) BT_BTM: BTM_CheckEirData type=0x04

I (8325) BT_BTM: BTM_CheckEirData type=0x07

I (8325) BT_BTM: BTM_InqDbRead: bd addr [e40d36340ddb]

I (8335) BT_BTM: BTM_CheckEirData type=0x09

result
I (8345) BT_AV: Scanned device: e4:0d:36:34:0d:db
I (8345) BT_AV: --Class of Device: 0x7c010c
I (8355) BT_AV: --RSSI: -46
the device type is 1
I (8355) BT_BTM: BTM_CheckEirData type=0x09

device smylbook5
I (8535) BT_BTM: BTM_CheckEirData type=0x03

I (8535) BT_BTM: BTM_CheckEirData type=0x02

I (8535) BT_BTM: btm_set_eir_uuid eir_complete_list=0x00

I (8535) BT_BTM: BTM_CheckEirData type=0x05

I (8545) BT_BTM: BTM_CheckEirData type=0x04

I (8545) BT_BTM: BTM_CheckEirData type=0x07

I (8555) BT_BTM: BTM_CheckEirData type=0x06

I (8555) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (8565) BT_BTM: BTM_CheckEirData type=0x09

I (8565) BT_BTM: BTM_CheckEirData type=0x08

result
I (8575) BT_AV: Scanned device: 20:04:f3:82:99:fe
I (8575) BT_AV: --Class of Device: 0x5a020c
I (8585) BT_AV: --RSSI: -61
the device type is 2
this is phone
I (8595) BT_BTM: BTM_CheckEirData type=0x09

I (8595) BT_BTM: BTM_CheckEirData type=0x08

device smylbook5
I (9445) BT_BTM: BTM_CheckEirData type=0x03

I (9445) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (9445) BT_BTM: BTM_CheckEirData type=0x05

I (9455) BT_BTM: BTM_CheckEirData type=0x04

I (9455) BT_BTM: BTM_CheckEirData type=0x07

I (9465) BT_BTM: BTM_InqDbRead: bd addr [e40d36340ddb]

I (9465) BT_BTM: BTM_CheckEirData type=0x09

result
I (9475) BT_AV: Scanned device: e4:0d:36:34:0d:db
I (9475) BT_AV: --Class of Device: 0x7c010c
I (9485) BT_AV: --RSSI: -51
the device type is 1
I (9485) BT_BTM: BTM_CheckEirData type=0x09

device smylbook5
I (9685) BT_BTM: BTM_CheckEirData type=0x03

I (9685) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (9685) BT_BTM: BTM_CheckEirData type=0x05

I (9695) BT_BTM: BTM_CheckEirData type=0x04

I (9695) BT_BTM: BTM_CheckEirData type=0x07

I (9705) BT_BTM: BTM_InqDbRead: bd addr [e40d36340ddb]

I (9705) BT_BTM: BTM_CheckEirData type=0x09

result
I (9715) BT_AV: Scanned device: e4:0d:36:34:0d:db
I (9715) BT_AV: --Class of Device: 0x7c010c
I (9725) BT_AV: --RSSI: -46
the device type is 1
I (9725) BT_BTM: BTM_CheckEirData type=0x09

device smylbook5
I (9845) BT_BTM: BTM_CheckEirData type=0x03

I (9845) BT_BTM: btm_set_eir_uuid eir_complete_list=0x01

I (9845) BT_BTM: BTM_CheckEirData type=0x05

I (9845) BT_BTM: BTM_CheckEirData type=0x07

I (9855) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (9865) BT_BTM: BTM_CheckEirData type=0x09

result
I (9865) BT_AV: Scanned device: 20:04:f3:82:99:fe
I (9875) BT_AV: --Class of Device: 0x5a020c
I (9875) BT_AV: --RSSI: -69
the device type is 2
this is phone
I (9885) BT_BTM: BTM_CheckEirData type=0x09

I (9885) BT_BTM: BTM_CheckEirData type=0x03

I (9895) BT_BTM: BTM_CheckEirData type=0x02

I (9895) BT_BTM: btm_set_eir_uuid eir_complete_list=0x00

I (9905) BT_BTM: BTM_CheckEirData type=0x05

I (9905) BT_BTM: BTM_CheckEirData type=0x04

I (9915) BT_BTM: BTM_CheckEirData type=0x07

I (9915) BT_BTM: BTM_CheckEirData type=0x06

I (9925) BT_BTM: BTM_InqDbRead: bd addr [a0a4c5168d38]

I (9935) BT_BTM: BTM_CheckEirData type=0x09

I (9935) BT_BTM: BTM_CheckEirData type=0x08

device HONOR
I (9945) BT_AV: Found a target device, address 20:04:f3:82:99:fe, name HONOR
I (9945) BT_AV: Cancel device discovery ...
result
I (9955) BT_BTM: BTM_IsAclConnectionUp: RemBdAddr: 2004f38299fe

I (9965) BT_BTM: BTM_IsAclConnectionUp: RemBdAddr: 2004f38299fe

E (9975) BT_APPL: bta_gattc_mark_bg_conn unable to find the bg connection mask for: 20:04:f3:82:99:fe
I (9975) BT_BTM: BTM_IsInquiryActive

I (9985) BT_BTM: BTM_CancelInquiry called

I (9985) BT_BTM: BTM_CancelRemoteDeviceName()

I (9995) BT_BTM: BTM_CancelRemoteDeviceName()

I (10085) BT_AV: event: 14
I (10085) BT_AV: Device discovery stopped.
I (10085) BT_AV: a2dp connecting to peer: HONOR
W (10095) BT_APPL: reset flags
I (10095) BT_A2D: A2D_FindService uuid: 110a
I (10095) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0001  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (10115) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (10115) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (10125) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0001) returned CID: 0x0040
I (10135) BT_AV: A2DP connection state: Connecting, [20:04:f3:82:99:fe]
W (11435) BT_HCI: hcif conn complete: hdl 0x81, st 0x0
I (11435) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (11445) BT_AV: ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT Connected to [20:04:f3:82:99:fe], status: 0x100
W (11475) BT_HCI: hcif link supv_to changed: hdl 0x81, supv_to 8000
I (11505) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1

I (11515) BT_BTM: btm_process_remote_ext_features: pend:0

I (11515) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
I (11575) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0040, Success
I (11575) BT_L2CAP: L2CA_ConfigReq()  CID 0x0040: fcr_present:0 (mode 0) mtu_present:1 (672)
I (11585) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0040  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (11745) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0040
I (11745) BT_L2CAP: L2CA_DataWrite()  CID: 0x0040  Len: 24
I (11805) BT_L2CAP: L2CA_DisconnectReq()  CID: 0x0040
I (11815) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (11875) BT_L2CAP: L2CAP - Calling DisconnectCfm_Cb(), CID: 0x0040
I (11875) BT_A2D: a2d_sdp_cback status: 0
I (11875) BT_BTM: btm_sec_set_security_level : sec: 0x12

I (11875) BT_BTM: BTM_SEC_REG[3]: id 37, is_orig 1, psm 0x0019, proto_id 7, chan_id 0

I (11885) BT_BTM:                : sec: 0x3092, service name [] (up to 21 chars saved)

I (11895) BT_BTM: BTM_SetOutService p_out_serv id 37, psm 0x0019, proto_id 7, chan_id 0

I (11905) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0019  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (11915) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (11925) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0019) returned CID: 0x0041
I (12475) BT_AV: ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: 438655
yesno
I (14535) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (14595) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (14595) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0040
I (14605) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0040  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (14615) BT_L2CAP: L2CA_ConfigReq()  CID 0x0040: fcr_present:0 (mode 0) mtu_present:1 (672)
I (14625) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0041, Success
I (14625) BT_L2CAP: L2CA_ConfigReq()  CID 0x0041: fcr_present:0 (mode 0) mtu_present:1 (672)
I (14635) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0041  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (14645) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0040  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (14655) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0040
I (14665) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0041
I (14665) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0041, priority:0
I (14675) BT_L2CAP: L2CA_DataWrite()  CID: 0x0040  Len: 10
I (14685) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 2
E (14695) BT_APPL: bta_av_rc_create ACP handle exist for shdl:0
I (14695) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (14705) BT_L2CAP: L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x0040  Conf Needed
I (14715) BT_L2CAP: L2CA_DisconnectRsp()  CID: 0x0040
I (14715) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14745) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (14745) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0042
I (14745) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0042  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (14765) BT_L2CAP: L2CA_ConfigReq()  CID 0x0042: fcr_present:0 (mode 0) mtu_present:1 (672)
I (14775) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0042  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (14785) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14785) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0042
I (14795) BT_L2CAP: L2CA_DataWrite()  CID: 0x0042  Len: 352
I (14805) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14805) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (14815) BT_L2CAP: L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x0042  Conf Needed
I (14815) BT_L2CAP: L2CA_DisconnectRsp()  CID: 0x0042
I (14825) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14845) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14855) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 14
I (14895) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 3
I (14905) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 12
I (14915) BT_AV: authentication success: HONOR
I (14915) BT_AV: 20 04 f3 82 99 fe
I (14925) BT_AV: A2DP audio stream configuration, codec type: 0
I (14925) BT_AV: Configure audio player: 21-15-2-35
I (14925) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0019  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (14925) BT_AV: Audio player configured, sample rate: 44100
I (14945) BT_AV: protocol service capabilities configured: 0x0
I (14945) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (14955) BT_AV: Peer device unsupport delay reporting
I (14965) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0019) returned CID: 0x0040
I (14975) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0040, Success
I (14985) BT_L2CAP: L2CA_ConfigReq()  CID 0x0040: fcr_present:0 (mode 0) mtu_present:1 (1008)
I (14995) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0040  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (15005) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0040
I (15005) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0040, priority:1
I (15015) BT_L2CAP: L2CA_SetChnlFlushability()  CID: 0x0040  is_flushable: 1
I (15025) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
W (15025) BT_APPL: new conn_srvc id:19, app_id:0
I (15035) BT_AV: A2DP connection state: Connected, [20:04:f3:82:99:fe]
I (15035) BT_AVRC: AVRC_FindService uuid: 110e
I (15045) BT_APP_CORE: ringbuffer data empty! mode changed: RINGBUFFER_MODE_PREFETCHING
I (15045) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0001  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (15065) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (15075) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0001) returned CID: 0x0042
I (15085) BT_BTM: BTM_ReadDiscoverability

I (15085) BT_BTM: BTM_ReadConnectability

I (15095) BT_BTM: BTM_BleReadDiscoverability

I (15095) BT_BTM: BTM_BleReadConnectability

I (15105) BT_BTM: BTM_SetDiscoverability

I (15105) BT_BTM: BTM_SetDiscoverability: mode 0 [NonDisc-0, Lim-1, Gen-2], window 0x0012, interval 0x0800

I (15115) BT_BTM: BTM_SetConnectability

I (15125) BT_BTM: BTM_SetConnectability: mode 0 [NonConn-0, Conn-1], window 0x0012, interval 0x0800

I (15135) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0042, Success
I (15135) BT_L2CAP: L2CA_ConfigReq()  CID 0x0042: fcr_present:0 (mode 0) mtu_present:1 (672)
I (15145) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0042  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (15155) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0042
I (15165) BT_L2CAP: L2CA_DataWrite()  CID: 0x0042  Len: 24
I (15175) BT_L2CAP: L2CA_DisconnectReq()  CID: 0x0042
I (15175) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (15185) BT_L2CAP: L2CAP - Calling DisconnectCfm_Cb(), CID: 0x0042
I (15185) BT_AVRC: avrc_sdp_cback status: 0
I (15195) BT_AVCT: AVCT_CreateConn: 0, control:3
I (15195) BT_BTM: BTM_SetOutService p_out_serv id 39, psm 0x0017, proto_id 0, chan_id 0

I (15205) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0017  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (15225) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (15225) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0017) returned CID: 0x0043
I (15245) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0043, Success
I (15245) BT_L2CAP: L2CA_ConfigReq()  CID 0x0043: fcr_present:0 (mode 0) mtu_present:1 (512)
I (15255) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0043  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (15265) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0043
I (15265) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0043, priority:0
I (15275) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (15285) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0042
I (15285) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0042  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (15295) BT_L2CAP: L2CA_ConfigReq()  CID 0x0042: fcr_present:0 (mode 0) mtu_present:1 (672)
rc event 0
I (15305) RC_CT: AVRC conn_state event: state 1, [20:04:f3:82:99:fe]
rc event 5
REMOTE_FEATURES
I (15315) BT_AVRC: AVRC_BldCommand: pdu=10 status=4
I (15315) RC_CT: AVRC remote features 259, TG features c1
I (15325) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0042  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (15345) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0042
I (15345) BT_L2CAP: L2CA_DataWrite()  CID: 0x0042  Len: 73
I (15325) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=10, opcode=0
I (15355) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (15365) BT_L2CAP: L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x0042  Conf Needed
I (15375) BT_L2CAP: L2CA_DisconnectRsp()  CID: 0x0042
I (15385) BT_AVRC: avrc_bld_get_caps
I (15385) BT_AVRC: AVRC_BldCommand: returning 4
I (15385) BT_AVCT: AVCT_MsgReq
I (15395) BT_AVCT: len: 11
I (15395) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 14
rc event 6
CAPABILITIES
I (15415) RC_CT: remote rn_cap: count 8, bitmask 0x1f26
I (15415) BT_AVRC: AVRC_BldCommand: pdu=20 status=4
I (15415) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=20, opcode=0
I (15425) BT_AVRC: avrc_bld_get_element_attr_cmd num_attr: 4
I (15425) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 1
I (15435) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 2
I (15445) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 3
I (15445) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 6
I (15455) BT_AVRC: AVRC_BldCommand: returning 4
I (15455) BT_AVCT: AVCT_MsgReq
I (15465) BT_AVCT: len: 35
I (15465) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 38
I (15475) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (15475) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (15485) BT_AVRC: avrc_bld_vol_change
I (15485) BT_AVRC: AVRC_BldCommand: returning 4
I (15495) BT_AVCT: AVCT_MsgReq
I (15495) BT_AVCT: len: 15
I (15505) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (15505) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (15515) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (15515) BT_AVRC: avrc_bld_vol_change
I (15525) BT_AVRC: AVRC_BldCommand: returning 4
I (15525) BT_AVCT: AVCT_MsgReq
I (15535) BT_AVCT: len: 15
I (15535) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (15545) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (15545) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (15555) BT_AVRC: avrc_bld_vol_change
I (15555) BT_AVRC: AVRC_BldCommand: returning 4
I (15565) BT_AVCT: AVCT_MsgReq
I (15565) BT_AVCT: len: 15
I (15575) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
rc event 2
rc event 2
METADATA
rc event 2
I (15575) RC_CT: AVRC metadata rsp: attribute id 0x1, 擦肩而过
METADATA
I (15585) RC_CT: AVRC metadata rsp: attribute id 0x2, 宇桐非/胡雯
rc event 2
METADATA
rc event 4
I (15595) RC_CT: AVRC metadata rsp: attribute id 0x4, 与你同飞
METADATA
I (15605) RC_CT: AVRC metadata rsp: attribute id 0x20,
CHANGE_NOTIFY
I (15615) RC_CT: AVRC event notification: 1
I (15615) BT_AV: Playback status changed: 0x2
I (15625) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (15625) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (15635) BT_AVRC: avrc_bld_vol_change
I (15635) BT_AVRC: AVRC_BldCommand: returning 4
I (15645) BT_AVCT: AVCT_MsgReq
I (15645) BT_AVCT: len: 15
I (15655) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (18235) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: f38299fe mode:0x2
W (18235) BT_HCI: hci cmd send: sniff: hdl 0x81, intv(400 800)
W (18275) BT_HCI: hcif mode change: hdl 0x81, mode 2, intv 800, status 0x0
I (18285) BT_AV: ESP_BT_GAP_MODE_CHG_EVT mode: 2

con0HONOR

I (15225) BT_AV: Set delay report value: success, delay_value: 1250 * 1/10 ms
W (18485) BT_HCI: hcif conn complete: hdl 0x80, st 0x0
I (18485) BT_BTM: BTM_InqDbRead: bd addr [2004f38299fe]

I (18495) BT_AV: ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT Connected to [20:04:f3:82:99:fe], status: 0x100
W (18535) BT_HCI: hcif link supv_to changed: hdl 0x80, supv_to 8000
I (18575) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1

I (18575) BT_BTM: btm_process_remote_ext_features: pend:0

I (18585) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
I (18595) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (18595) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0040
I (18605) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0040  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (18615) BT_L2CAP: L2CA_ConfigReq()  CID 0x0040: fcr_present:0 (mode 0) mtu_present:1 (672)
I (18625) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0040  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (18635) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0040
I (18645) BT_L2CAP: L2CA_DataWrite()  CID: 0x0040  Len: 55
I (18655) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (18655) BT_L2CAP: L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x0040  Conf Needed
I (18655) BT_L2CAP: L2CA_DisconnectRsp()  CID: 0x0040
I (18705) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (18745) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0041
I (18745) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0041  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (18755) BT_L2CAP: L2CA_ConfigReq()  CID 0x0041: fcr_present:0 (mode 0) mtu_present:1 (672)
I (18765) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0041  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (18765) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0041
I (18775) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0041, priority:0
I (18785) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 4
E (18785) BT_APPL: bta_av_rc_create ACP handle exist for shdl:0
I (18795) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 12
I (18805) BT_AV: A2DP connection state: Connecting, [20:04:f3:82:99:fe]
I (18815) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 2
I (18815) BT_AV: A2DP audio stream configuration, codec type: 0
I (18825) BT_AV: Configure audio player: 21-15-2-35
I (18825) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 2
I (18825) BT_AV: Audio player configured, sample rate: 44100
I (18835) BT_AV: protocol service capabilities configured: 0x0
I (18845) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (18845) BT_AV: Peer device unsupport delay reporting
I (18855) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0040
I (18865) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0040  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (18875) BT_L2CAP: L2CA_ConfigReq()  CID 0x0040: fcr_present:0 (mode 0) mtu_present:1 (1008)
I (18905) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0040  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (18905) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0040
I (18905) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0040, priority:1
I (18915) BT_L2CAP: L2CA_SetChnlFlushability()  CID: 0x0040  is_flushable: 1
I (18925) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
W (18925) BT_APPL: new conn_srvc id:19, app_id:0
I (18935) BT_AV: A2DP connection state: Connected, [20:04:f3:82:99:fe]
I (18935) BT_AVRC: AVRC_FindService uuid: 110e
I (18945) BT_APP_CORE: ringbuffer data empty! mode changed: RINGBUFFER_MODE_PREFETCHING
I (18945) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0001  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (18965) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (18975) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0001) returned CID: 0x0042
I (18985) BT_BTM: BTM_ReadDiscoverability

I (18985) BT_BTM: BTM_ReadConnectability

I (18995) BT_BTM: BTM_BleReadDiscoverability

I (18995) BT_BTM: BTM_BleReadConnectability

I (19005) BT_BTM: BTM_SetDiscoverability

I (19005) BT_BTM: BTM_SetDiscoverability: mode 0 [NonDisc-0, Lim-1, Gen-2], window 0x0012, interval 0x0800

I (19015) BT_BTM: BTM_SetConnectability

I (19025) BT_BTM: BTM_SetConnectability: mode 0 [NonConn-0, Conn-1], window 0x0012, interval 0x0800

I (19045) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0042, Success
I (19045) BT_L2CAP: L2CA_ConfigReq()  CID 0x0042: fcr_present:0 (mode 0) mtu_present:1 (672)
I (19055) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0042  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (19065) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0042
I (19065) BT_L2CAP: L2CA_DataWrite()  CID: 0x0042  Len: 24
I (19085) BT_L2CAP: L2CA_DisconnectReq()  CID: 0x0042
I (19085) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (19095) BT_L2CAP: L2CAP - Calling DisconnectCfm_Cb(), CID: 0x0042
I (19095) BT_AVRC: avrc_sdp_cback status: 0
I (19095) BT_AVCT: AVCT_CreateConn: 0, control:3
I (19105) BT_BTM: BTM_SetOutService p_out_serv id 39, psm 0x0017, proto_id 0, chan_id 0

I (19115) BT_L2CAP: L2CA_ErtmConnectReq()  PSM: 0x0017  BDA: 2004f38299fe  p_ertm_info: 0x0 allowed:0x0 preferred:0
I (19125) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (19135) BT_L2CAP: L2CAP - L2CA_conn_req(psm: 0x0017) returned CID: 0x0043
I (19145) BT_L2CAP: L2CAP - Calling Connect_Cfm_Cb(), CID: 0x0043, Success
I (19145) BT_L2CAP: L2CA_ConfigReq()  CID 0x0043: fcr_present:0 (mode 0) mtu_present:1 (512)
I (19155) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0043  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (19165) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0043
I (19175) BT_L2CAP: L2CA_SetTxPriority()  CID: 0x0043, priority:0
I (19175) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (19185) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0042
I (19195) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0042  Result: 0  Status: 0  BDA: 2004f38299fe  p_ertm_info:0x0
I (19205) BT_L2CAP: L2CA_ConfigReq()  CID 0x0042: fcr_present:0 (mode 0) mtu_present:1 (672)
rc event 0
rc event 5
I (19215) RC_CT: AVRC conn_state event: state 1, [20:04:f3:82:99:fe]
REMOTE_FEATURES
I (19225) RC_CT: AVRC remote features 259, TG features c1
I (19225) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0042  Result: 0 MTU present:0 Flush TO:0 FCR:0 FCS:0
I (19235) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0042
I (19245) BT_L2CAP: L2CA_DataWrite()  CID: 0x0042  Len: 73
I (19225) BT_AVRC: AVRC_BldCommand: pdu=10 status=4
I (19255) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=10, opcode=0
I (19255) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: f38299fe mode:0x0
I (19265) BT_L2CAP: L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x0042  Conf Needed
I (19275) BT_L2CAP: L2CA_DisconnectRsp()  CID: 0x0042
I (19285) BT_AVRC: avrc_bld_get_caps
I (19285) BT_AVRC: AVRC_BldCommand: returning 4
I (19295) BT_AVCT: AVCT_MsgReq
I (19295) BT_AVCT: len: 11
I (19295) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 14
rc event 6
CAPABILITIES
I (19315) RC_CT: remote rn_cap: count 8, bitmask 0x1f26
I (19315) BT_AVRC: AVRC_BldCommand: pdu=20 status=4
I (19315) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=20, opcode=0
I (19325) BT_AVRC: avrc_bld_get_element_attr_cmd num_attr: 4
I (19335) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 1
I (19335) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 2
I (19345) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 3
I (19355) BT_AVRC: avrc_bld_get_element_attr_cmd attr_id: 6
I (19355) BT_AVRC: AVRC_BldCommand: returning 4
I (19365) BT_AVCT: AVCT_MsgReq
I (19365) BT_AVCT: len: 35
I (19365) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 38
I (19375) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (19385) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (19385) BT_AVRC: avrc_bld_vol_change
I (19395) BT_AVRC: AVRC_BldCommand: returning 4
I (19395) BT_AVCT: AVCT_MsgReq
I (19405) BT_AVCT: len: 15
I (19405) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (19415) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (19415) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (19425) BT_AVRC: avrc_bld_vol_change
I (19425) BT_AVRC: AVRC_BldCommand: returning 4
I (19435) BT_AVCT: AVCT_MsgReq
I (19435) BT_AVCT: len: 15
I (19435) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (19445) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (19455) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (19455) BT_AVRC: avrc_bld_vol_change
I (19465) BT_AVRC: AVRC_BldCommand: returning 4
I (19465) BT_AVCT: AVCT_MsgReq
I (19475) BT_AVCT: len: 15
I (19475) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
rc event 2
rc event 2
METADATA
rc event 2
I (19485) RC_CT: AVRC metadata rsp: attribute id 0x1, 擦肩而过
rc event 2
METADATA
I (19495) RC_CT: AVRC metadata rsp: attribute id 0x2, 宇桐非/胡雯
rc event 4
METADATA
I (19505) RC_CT: AVRC metadata rsp: attribute id 0x4, 与你同飞
METADATA
I (19505) RC_CT: AVRC metadata rsp: attribute id 0x20,
CHANGE_NOTIFY
I (19515) RC_CT: AVRC event notification: 1
I (19525) BT_AV: Playback status changed: 0x2
I (19525) BT_AVRC: AVRC_BldCommand: pdu=31 status=4
I (19535) BT_AVRC: avrc_bld_init_cmd_buffer: pdu=31, opcode=0
I (19535) BT_AVRC: avrc_bld_vol_change
I (19545) BT_AVRC: AVRC_BldCommand: returning 4
I (19545) BT_AVCT: AVCT_MsgReq
I (19555) BT_AVCT: len: 15
I (19555) BT_L2CAP: L2CA_DataWrite()  CID: 0x0043  Len: 18
I (22135) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: f38299fe mode:0x2
W (22135) BT_HCI: hci cmd send: sniff: hdl 0x80, intv(400 800)
W (22265) BT_HCI: hcif mode change: hdl 0x80, mode 2, intv 800, status 0x0
I (22265) BT_AV: ESP_BT_GAP_MODE_CHG_EVT mode: 2
shangke1112 commented 5 months ago

We reproduced it ourselves and found that using esp_restart() can automatically connect. Please resend a new log with the default menuconfig.

reset the board using the esp_restart() function, then start Bluetooth to reconnect the phone, and do not re-pair.

I want to know why the automatic connection failed.

jjj19950710 commented 5 months ago

I used the default configuration file before.It can be connected, just need to click pairing again on the phone. Here is the program I am running: a2dp_sink_demo.zip

shangke1112 commented 5 months ago

@jjj19950710
Sorry for the misunderstanding.

esp_bt_gap_remove_bond_device(s_peer_bda) ;

This function in your code (main.c) will remove the device info ,and will be cause re-paring.

I (9945) BT_AV: Found a target device, address 20:04:f3:82:99:fe, name HONOR

The log means that this function has been called .