尝试斐讯N1在armbian系统连接蓝牙音箱

您所在的位置:网站首页 rubyoung音响连不上蓝牙 尝试斐讯N1在armbian系统连接蓝牙音箱

尝试斐讯N1在armbian系统连接蓝牙音箱

2024-06-03 09:15| 来源: 网络整理| 查看: 265

本帖最后由 tangli159 于 2022-4-13 13:36 编辑

更新:虽然很多人按照我的帖子成功了,我还是没有成功。但是我发现了另外的方法。一直挣扎的小伙伴可以试试! 专治N1连接蓝牙音箱各种不服 https://bbs.hassbian.com/thread-16072-1-1.html

--- 想尝试用N1连接蓝牙音箱,系统是armbian 5.99,登陆进去的欢迎语写的是Debian Buster with Armbian Linux 5.3.0-aml-g12,固件来源itcommander。也尝试过更换低版本系统,以下为尝试记录,都失败了。方法一:pulseaudio 我参考的帖子有: https://bbs.hassbian.com/thread-30-1-1.html https://bbs.hassbian.com/thread-8668-1-1.html http://niminghao.com/post/raspberry-pi-with-bluetooth-speaker/ https://bbs.hassbian.com/forum.php?mod=viewthread&tid=2684 1.登录N1的ssh,输入:

armbian-config 选择network,BTinstall,安装蓝牙组件。2.安装pulseaudio sudo apt install pulseaudio-module-bluetooth 3.安装完成后执行重启pulseaudio。启动的时候用的是非root账户。 sudo killall pulseaudio pulseaudio --start 4.查看蓝牙控制器信息 sudo hciconfig -a 正常,可以获取到蓝牙地址 root@hassio:~# sudo hciconfig -a hci1: Type: Primary Bus: SDIO BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:0 acl:0 sco:0 events:0 errors:0 TX bytes:0 acl:0 sco:0 commands:0 errors:0 Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Packet type: DM1 DH1 HV1 Link policy: Link mode: SLAVE ACCEPT hci0: Type: Primary Bus: UART BD Address: 43:45:C0:00:1F:AC ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN RX bytes:3940 acl:0 sco:0 events:396 errors:0 TX bytes:61070 acl:0 sco:0 commands:396 errors:0 Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: SLAVE ACCEPT Name: 'hassio' Class: 0x2c041c Service Classes: Rendering, Capturing, Audio Device Class: Audio/Video, Portable Audio HCI Version: 5.0 (0x9) Revision: 0x122 LMP Version: 5.0 (0x9) Subversion: 0x6119 Manufacturer: Cypress Semiconductor Corporation (305) 输入 sudo hciconfig hci0 up

5.打开蓝牙管理器

bluetoothctl 一切正常,配对成功,音箱播报配对成功,系统显示音箱名字,输入Info,可以查看音箱配对信息。 输入exit退出。 [小爱音箱-0088]# info 查看声卡信息 pacmd list-sinks 提示: root@hassio:~# pacmd list-sinks 1 sink(s) available. * index: 0 name: driver: flags: DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY state: IDLE suspend cause: (none) priority: 1000 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 base volume: 65536 / 100% / 0.00 dB volume steps: 65537 muted: no current latency: 1122.93 ms max request: 344 KiB max rewind: 344 KiB monitor source: 0 sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo used by: 0 linked by: 0 configured latency: 2000.00 ms; range is 0.50 .. 2000.00 ms module: 14 properties: device.description = "Dummy Output" device.class = "abstract" device.icon_name = "audio-card" 根本没有读取到蓝牙音箱信息。 pactl list sinks 不管查询什么信息都是0声卡。 root@hassio:~# pactl list sinks Sink #0 State: SUSPENDED Name: auto_null Description: Dummy Output Driver: module-null-sink.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 14 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: auto_null.monitor Latency: 0 usec, configured 0 usec Flags: DECIBEL_VOLUME LATENCY Properties: device.description = "Dummy Output" device.class = "abstract" device.icon_name = "audio-card" Formats: pcm root@hassio:~# pactl info Server String: /run/user/0/pulse/native Library Protocol Version: 32 Server Protocol Version: 32 Is Local: yes Client Index: 36 Tile Size: 65472 User Name: root Host Name: hassio Server Name: pulseaudio Server Version: 12.2 Default Sample Specification: s16le 2ch 44100Hz Default Channel Map: front-left,front-right Default Sink: auto_null Default Source: auto_null.monitor Cookie: bc15:2647 root@hassio:~# systemctl status bluetooth ● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-01-15 05:36:41 UTC; 20min ago Docs: man:bluetoothd(8) Main PID: 780 (bluetoothd) Status: "Running" Tasks: 1 (limit: 1081) Memory: 1.6M CGroup: /system.slice/bluetooth.service └─780 /usr/lib/bluetooth/bluetoothd --noplugin=sap Jan 15 05:38:16 hassio bluetoothd[780]: Endpoint registered: sender=:1.90 path=/MediaEndpoint/A2DPSink/sbc Jan 15 05:38:16 hassio bluetoothd[780]: Endpoint registered: sender=:1.90 path=/MediaEndpoint/A2DPSource/sbc Jan 15 05:50:29 hassio bluetoothd[780]: /org/bluez/hci0/dev_9C_9D_7E_35_D1_D3/fd0: fd(24) ready Jan 15 05:53:15 hassio bluetoothd[780]: Endpoint registered: sender=:1.196 path=/MediaEndpoint/A2DPSource Jan 15 05:53:15 hassio bluetoothd[780]: Endpoint registered: sender=:1.196 path=/MediaEndpoint/A2DPSink Jan 15 05:53:16 hassio bluetoothd[780]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98) Jan 15 05:53:55 hassio bluetoothd[780]: Endpoint registered: sender=:1.252 path=/MediaEndpoint/A2DPSource Jan 15 05:53:55 hassio bluetoothd[780]: Endpoint registered: sender=:1.252 path=/MediaEndpoint/A2DPSink Jan 15 05:53:55 hassio bluetoothd[780]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98) Jan 15 05:53:55 hassio bluetoothd[780]: RFCOMM server failed for :1.252/Profile/HSPHSProfile/00001108-0000-1000-8000-00805f9b34fb: rfc 蓝牙状态确实有问题,有报错,但是换低版本系统,换外置蓝牙模块,重装pulseaudio均无法解决。 但是如果断开蓝牙,插USB声卡,执行播放命令是有声音的,pulseaudio尝试结束。

方法二:bluealsa 参考链接: https://leeyr.com/327.html https://bbs.hassbian.com/thread-5375-1-1.html https://blog.csdn.net/weixin_45820944/article/details/104236412 https://forum.armbian.com/topic/6480-bluealsa-bluetooth-audio-using-alsa-not-pulseaudio/ https://www.sigmdel.ca/michel/ha/opi/opipc2_bluetooth_en.html http://niminghao.com/post/raspberry-pi-with-bluetooth-speaker/ https://blog.csdn.net/lee_jimmy/article/details/96739656

1.输入

sudo apt-get install bluealsa 很不幸的是bluealsa好像树莓派里面才有,斐讯N1是没有的,网上所谓换源等方法都没有用,你只能得到报错 E: Unable to locate package bluealsa 2.那么就尝试编译bluealsa,我找到了如何在香橙派上面编译bluealsa的参考资料 sudo apt install libtool -y 中间遇到过缺少文件的报错,我第二次运行编译的时候就不报错了。更详细的信息请进参考链接https://www.sigmdel.ca/michel/ha/opi/opipc2_bluetooth_en.html里面查看。 3.运行bluealsa sudo bluealsa &

此时进行bluetoothctl等一系列蓝牙配对操作,同样的配对成功。 输入

alsamixer -D bluealsa 可以看到配对音箱的信息,应该是OK了。 4.添加用户到蓝牙组 sudo usermod -aG bluetooth penny 5.测试发声 nano /etc/asound.conf 编辑内容: pcm.!default { type plug slave.pcm { type bluealsa device "蓝牙音箱MAC地址" profile "a2dp" } hint { show on description "BT Speaker" } } sudo reboot 通过winscp拷贝了一个example.wav文件,路径是/root/example.wav。 重连蓝牙设备,检查alsamixer -D bluealsa里面是不是仍然有蓝牙音箱信息,运行下列代码。 aplay example.wav

此时蓝牙音箱发声成功! 但是并没有完,我输入

speaker-test 蓝牙音箱并没有声音,证明默认输出设备始终不是蓝牙音箱。我暂且搁置,安装mopidy,采取了论坛里常用的mopidy安装教程,也修改了相关的配置信息。 在使用pulseaudio和hassio的add-on mopidy情况下,有一次能在hassio的输出设备里面看到蓝牙音箱,不过并没有发出声音。 之后再尝试pulseaudio,bluealsa,add-on版本mopidy,或者直接安装mopidy,都没有在输出音频设备里读取蓝牙音箱成功过,所以也没有发声成功。

总结:虽然我尝试了两种蓝牙音箱连接N1方式,也成功发出过声音,但是还是都失败了。 排除mopidy:我认为和mopidy的安装无关,因为speaker-test命令从蓝牙音箱发生失败。而且输入查看蓝牙状态的命令,虽然有提示运行,但是始终都有部分报错。 排除蓝牙音箱问题:我尝试更换过两个不同品牌的蓝牙音箱,情况一样。 排除N1蓝牙硬件故障:尝试添加外置USB蓝牙模块,问题存在。 我查询到了其他人N1连接成功的记录,所以我更倾向于是armbian系统的问题。不过我也尝试过低版本的armbian,仍然存在这个问题,所以暂时搁置N1的蓝牙音箱连接计划。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3