解决:AP6256模块-蓝牙HFP模式无声音

问题描述:

blueZ5.50+Pulseaudio13.0, 使用bluetoothctl 连接成功蓝牙耳机以后:

1. 执行 pactl set-card-profile $card_num headset_handsfree 设置蓝牙耳机工作在HFP模式;

2. 执行 pactl set-default-sink $sink_index 设置蓝牙耳机为默认的sink;

3.执行 pactl set-default-source $source_index 设置蓝牙耳机为默认的source;

4. 然后执行 aplay -D pulse xxx.wav 播放音乐。

现象:

蓝牙耳机无声音!

 pactl list cards 结果如下:

复制代码
Card #2
        Name: bluez_card.BC_2E_F6_2A_70_81
        Driver: module-bluez5-device.c
        Owner Module: 24
        Properties:
                device.description = "FreeBuds 3"
                device.string = "BC:2E:F6:2A:70:81"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headphone"
                bluez.path = "/org/bluez/hci0/dev_BC_2E_F6_2A_70_81"
                bluez.class = "0x240418"
                bluez.alias = "FreeBuds 3"
                device.icon_name = "audio-headphones-bluetooth"
        Profiles:
                a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
                headset_handsfree: Headset Handsfree (HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: headset_handsfree
        Ports:
                headphone-output: Headphone (priority: 0, latency offset: 0 usec, available)
                        Part of profile(s): a2dp_sink, headset_handsfree
                headphone-input: Bluetooth Input (priority: 0, latency offset: 0 usec, available)
                        Part of profile(s): headset_handsfree
复制代码

从上面的Profiles信息来看,当前蓝牙耳机支持的模式有A2DP和HFP,所以没有声音肯定不是蓝牙耳机的问题。

 

解决办法:

针对于Broadcom BCM2835, BCM4354 和 BCM43438,这些适配器可能有错误的SCO(SCO是HSP和HFP使用的音频协议,SCO音频需要通过HCI接口路由才能与PulseAudio一起工作)音频路由。使用这个命令(root用户)来修复路由:

hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01

参考文档:

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index10h3

posted @   闹闹爸爸  阅读(369)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示