解决: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
本文来自博客园,作者:闹闹爸爸,转载请注明原文链接:https://www.cnblogs.com/wanglouxiaozi/p/17783238.html