arch-linux – 使用桌面作为蓝牙耳机

我的桌面扬声器比我的手机要好得多,所以我想用我的桌面扬声器代替我的手机.使用USB或音频插孔对我来说不方便,所以我留下了蓝牙.我已经使用bluetoothctl配对了我的手机,但在尝试连接时我得到了这个:

[bluetooth]# pair 00:00:00:00:00:00 
Attempting to pair with 00:00:00:00:00:00
[CHG] Device 00:00:00:00:00:00 Connected: yes
Request confirmation
[agent] Confirm passkey 000000 (yes/no): yes
[CHG] Device 00:00:00:00:00:00 Modalias: bluetooth:a000Aa000000000
[CHG] Device 00:00:00:00:00:00 UUIDs: 00000000-0000-1000-8000-00000a0a00aa
[CHG] Device 00:00:00:00:00:00 UUIDs: 00000000-0000-1000-8000-00000a0a00aa
...
[CHG] Device 00:00:00:00:00:00 UUIDs: 00000000-0000-1000-8000-00000a0a00aa
[CHG] Device 00:00:00:00:00:00 UUIDs: 000000000-0000-1000-8000-00000a0a00aa
[CHG] Device 00:00:00:00:00:00 Paired: yes
Pairing successful
[CHG] Device 00:00:00:00:00:00 Connected: no
[CHG] Device 00:00:00:00:00:00 RSSI: -75
[bluetooth]# connect 00:00:00:00:00:00 
Attempting to connect to 00:00:00:00:00:00
Failed to connect: org.bluez.Error.Failed

我已经在00:00:00:00:00:00更换了我的mac地址,但实际的mac地址与我手机报告的地址相匹配.我对配对引脚,Modalias和UUID做了同样的事情,虽然我不知道最后两个是什么.

解决方法:

感谢pulseaudio*的两个模块与bluez的结合,现在实际上很容易实现.

安装必备软件包:

sudo pacman -S bluez bluez-utils pulseaudio-bluetooth

将您的用户添加到pulseaudio组:

sudo usermod -a -G lp $USER

打开或重新启动蓝牙守护程序:

sudo systemctl restart bluetooth

启用蓝牙设备:

sudo hciconfig hci0 up

如果你有多个蓝牙设备,你应该用正确的标识符替换hci0,这可以通过运行没有参数的hciconfig找到.

现在我们可以使用交互式bluetoothctl实用程序连接我们的设备.

首先,我们将通过其主机名使我们的Arch机器可被发现:

$bluetoothctl
[NEW] Controller AA:BB:CC:DD:EE:FF arch [default]

[bluetooth]# agent on
Agent registered

[bluetooth]# default-agent
Default agent request successful

[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller AA:BB:CC:DD:EE:FF Discoverable: yes

您的手机现在应该可以找到您的Arch盒子.选择设备并返回到您的提示以确认:

Request confirmation
[agent] Confirm passkey 748794 (yes/no): yes
[CHG] Device FF:EE:DD:CC:BB:AA ...
... snipped ...
[agent] Authorize service 0001... (yes/no): yes
... snipped ...
[agent] Authorize service 0001... (yes/no): yes
[CHG] Controller AA:BB:CC:DD:EE:FF Discoverable: no

我有一些断开连接问题,只需在连接后运行trust命令即可解决.

[phone]# trust
[CHG] Device FF:EE:DD:CC:BB:AA Trusted: yes
Changing  trust suceeded

就是这样,你应该能够通过桌面扬声器播放音频.

上一篇:如何在Android蓝牙文件传输中检测EOF?


下一篇:声音 – 我想通过蓝牙发送音频到Android手机 – kubuntu 14.04