AVRCP与一些手机不兼容,无法建立连接,绝对音量不工作 (AUD-6106)
经测试,AVRCP在一些品牌手机上不工作,包括以下型号 HUAWEI MATE40 HarimonyOS 4.2.0 HUAWEI MATE30 HarimonyOS 4.2.0 XIAO MI 8 Android 9 XIAO MI 11 Android 12
原工程使用IDF 5.1,复现环境为 idf v5.3.1, adf v2.7, pipeline_a2dp_sink_stream 例子, ESP32-Lyrat V4.3 board
I (199) esp_image: segment 3: paddr=00050020 vaddr=400d0020 size=b6b20h (748320) map
I (455) esp_image: segment 4: paddr=00106b48 vaddr=40089190 size=0edf4h ( 60916) load
I (492) boot: Loaded app from partition at offset 0x10000
I (492) boot: Disabling RNG early entropy source...
I (504) cpu_start: Multicore app
I (513) cpu_start: Pro cpu start user code
I (513) cpu_start: cpu freq: 160000000 Hz
I (513) app_init: Application information:
I (516) app_init: Project name: bt_sink_demo
I (521) app_init: App version: 1
I (525) app_init: Compile time: Feb 21 2025 07:23:14
I (531) app_init: ELF file SHA256: d7f45a415...
I (537) app_init: ESP-IDF: v5.3.1-395-g707d097b01-dirty
I (543) efuse_init: Min chip rev: v0.0
I (548) efuse_init: Max chip rev: v3.99
I (553) efuse_init: Chip rev: v3.0
I (558) heap_init: Initializing. RAM available for dynamic allocation:
I (565) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (571) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (577) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (583) heap_init: At 3FFCC500 len 00013B00 (78 KiB): DRAM
I (590) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (596) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (602) heap_init: At 40097F84 len 0000807C (32 KiB): IRAM
I (610) spi_flash: detected chip: generic
I (613) spi_flash: flash io: dio
W (617) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (631) coexist: coex firmware version: 4482466
I (636) main_task: Started on CPU0
I (646) main_task: Calling app_main()
I (656) BLUETOOTH_EXAMPLE: [ 1 ] Init Bluetooth
I (656) BTDM_INIT: BT controller compile version [bc393dd]
I (666) BTDM_INIT: Bluetooth MAC: c4:de:e2:19:fb:8a
I (666) phy_init: phy_version 4830,54550f7,Jun 20 2024,14:22:08
I (1336) BLUETOOTH_EXAMPLE: [ 2 ] Start codec chip
I (1346) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
W (1346) i2c_bus_v2: I2C master handle is NULL, will create new one
I (1346) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (1356) gpio: GPIO[23]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (1386) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1386) ES8388_DRIVER: init,out:02, in:00
I (1386) AUDIO_HAL: Codec mode is 2, Ctrl:1
I (1396) BLUETOOTH_EXAMPLE: [ 3 ] Create audio pipeline for playback
I (1396) BLUETOOTH_EXAMPLE: [4] Create i2s stream to write data to codec chip
I (1406) BLUETOOTH_EXAMPLE: [4.1] Get Bluetooth stream
W (1416) BT_BTC: A2DP Enable with AVRC
I (1426) A2DP_STREAM: Unhandled A2DP event: 4
W (1426) AUDIO_THREAD: Make sure selected the CONFIG_SPIRAM_BOOT_INIT and CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY by make menuconfig
I (1436) AUDIO_THREAD: The audio_a2dp_stream_thread task allocate stack on internal memory
I (1446) BLUETOOTH_EXAMPLE: [4.2] Register all elements to audio pipeline
I (1456) BLUETOOTH_EXAMPLE: [4.3] Link it together [Bluetooth]-->bt_stream_reader-->i2s_stream_writer-->[codec_chip]
I (1466) AUDIO_PIPELINE: link el->rb, el:0x3ffd699c, tag:bt, rb:0x3ffd6eb8
I (1476) BLUETOOTH_EXAMPLE: [ 5 ] Initialize peripherals
E (1476) gpio: gpio_install_isr_service(502): GPIO isr service already installed
I (1486) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (1496) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (1506) AUDIO_THREAD: The esp_periph task allocate stack on internal memory
I (1516) BLUETOOTH_EXAMPLE: [ 5.1 ] Create and start input key service
I (1516) AUDIO_THREAD: The input_key_service task allocate stack on internal memory
W (1536) PERIPH_TOUCH: _touch_init
I (1536) BLUETOOTH_EXAMPLE: [5.2] Create Bluetooth peripheral
I (1546) BLUETOOTH_EXAMPLE: [5.3] Start all peripherals
I (1546) BLUETOOTH_EXAMPLE: [ 6 ] Set up event listener
I (1556) BLUETOOTH_EXAMPLE: [6.1] Listening event from all elements of pipeline
I (1566) BLUETOOTH_EXAMPLE: [ 7 ] Start audio_pipeline
I (1586) AUDIO_ELEMENT: [bt-0x3ffd699c] Element task created
I (1586) AUDIO_THREAD: The i2s task allocate stack on internal memory
I (1586) AUDIO_ELEMENT: [i2s-0x3ffd5520] Element task created
I (1596) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:359, MEM Total:133556 Bytes
I (1616) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:1 I (1616) AUDIO_PIPELINE: Pipeline started I (1616) BLUETOOTH_EXAMPLE: [ 8 ] Listen for all pipeline events W (11106) BT_HCI: hcif conn complete: hdl 0x80, st 0x0 W (11156) BT_HCI: hcif link supv_to changed: hdl 0x80, supv_to 8000 I (12176) A2DP_STREAM: A2DP bd address:, [50:8e:49:55:ad:15] I (12356) A2DP_STREAM: A2DP audio stream configuration, codec type 0 I (12356) A2DP_STREAM: Bluetooth configured, sample rate=44100 I (12366) A2DP_STREAM: Unhandled A2DP event: 5 I (12366) BLUETOOTH_EXAMPLE: [ * ] Receive music info from Bluetooth, sample_rates=44100, bits=16, ch=2 I (12416) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_PAUSE I (12416) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:4 W (12546) BT_APPL: new conn_srvc id:19, app_id:0 I (12546) A2DP_STREAM: A2DP bd address:, [50:8e:49:55:ad:15] I (12546) A2DP_STREAM: A2DP connection state = CONNECTED 此处应打印 AVRC conn_state evt I (12866) A2DP_STREAM: AVRC register event notification: 13, param: 0x0 I (12866) A2DP_STREAM: rn_param.volume:63 W (15746) BT_HCI: hci cmd send: sniff: hdl 0x80, intv(400 800) W (16176) BT_HCI: hcif mode change: hdl 0x80, mode 2, intv 800, status 0x0 W (19196) BT_HCI: hcif ssr evt: st 0x0, hdl 0x80, tx_lat 800 rx_lat 800 I (21636) BLUETOOTH_EXAMPLE: [ * ] input key id is 6 I (21636) BLUETOOTH_EXAMPLE: [ * ] [long Vol+] Vol+ I (23286) BLUETOOTH_EXAMPLE: [ * ] input key id is 6 I (23286) BLUETOOTH_EXAMPLE: [ * ] [long Vol+] Vol+ W (45686) BT_HCI: hcif mode change: hdl 0x80, mode 0, intv 0, status 0x0 W (45726) BT_APPL: bta_dm_act no entry for connected service cbs I (45726) A2DP_STREAM: A2DP bd address:, [50:8e:49:55:ad:15] I (45726) A2DP_STREAM: A2DP connection state = DISCONNECTED W (45816) BT_HCI: hcif disc complete: hdl 0x80, rsn 0x13
Hi @Jack-Agilian 需要获取手机的 HCI log 来确定手机是否支持