

在archlinux中使用蓝牙耳机
source link: https://www.lujun9972.win/blog/2017/07/18/%E5%9C%A8archlinux%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%93%9D%E7%89%99%E8%80%B3%E6%9C%BA/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在archlinux中使用蓝牙耳机
安装必要的软件包
pacman -S bluez bluez-utils bluez-firmware pulseaudio-bluetooth pavucontrol pulseaudio-alsa
- bluez软件包提供蓝牙协议栈
- bluez-utils软件包提供bluetoothctl工具
- pulseaudio-bluetooth则为bluez提供了PulseAudio音频服务,若没有安装则蓝牙设备在配对完成后,连接会失败,提示
- pavucontrol则提供了pulseaudio的图形化控制界面
- pulseaudio-alsa(可选)则使pulseaudio和alsa协同使用,之后就可以用alsamixer来管理蓝牙音频了
启动蓝牙服务
systemctl enable bluetooth systemctl start bluetooth
启动pulseaudio服务
pulseaudio -k # 确保没有pulseaudio启动 pulseaudio --start # 启动pulseaudio服务
将用户加入lp用户组
安装bluz后就应该会自动创建lp用户组了,因此无需自己再创建新组
usermod -a -G lp $USER
默认情况下,蓝牙仅为 lp 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改/etc/dbus-1/system.d/bluetooth.conf文件中相应的组配置来实现。
配置蓝牙(摘自archwiki)
启动bluetoothctl交互命令.可以输入 help
列出所有有效的命令.
- 输入
power on
命令打开控制器电源。默认是关闭的。 - 输入
devices
命令获取要配对设备的 MAC 地址。 - 如果设备未在清单中列出,输入
scan on
命令设置设备发现模式。 - 输入
agent on
命令打开代理。 - 输入
pair $MAC
开始配对(支持 tab 键补全)。 - 如果使用无 PIN 码设备,再次连接可能需要手工认证。输入
trust $MAC
命令。 - 用
connect $MAC
命令建立连接。
以下为一个交互实例:
# bluetoothctl [NEW] Controller 00:10:20:30:40:50 pi [default] [bluetooth]# agent KeyboardOnly Agent registered [bluetooth]# default-agent Default agent request successful [bluetooth]# scan on Discovery started [CHG] Controller 00:10:20:30:40:50 Discovering: yes [NEW] Device 00:12:34:56:78:90 myLino [CHG] Device 00:12:34:56:78:90 LegacyPairing: yes [bluetooth]# pair 00:12:34:56:78:90 Attempting to pair with 00:12:34:56:78:90 [CHG] Device 00:12:34:56:78:90 Connected: yes [CHG] Device 00:12:34:56:78:90 Connected: no [CHG] Device 00:12:34:56:78:90 Connected: yes Request PIN code [agent] Enter PIN code: 1234 [CHG] Device 00:12:34:56:78:90 Paired: yes Pairing successful [CHG] Device 00:12:34:56:78:90 Connected: no [bluetooth]# connect 00:12:34:56:78:90 Attempting to connect to 00:12:34:56:78:90 [CHG] Device 00:12:34:56:78:90 Connected: yes Connection successful
设置自动启动蓝牙
将 /etc/bluetooth/main.conf
最后的 AutoEnable
值修改为 true
ansible localhost -m lineinfile -a "path=/etc/bluetooth/main.conf line='AutoEnable=true'"
指定使用蓝牙音频输出
通过 pavucontrol
的"Playback"和"Pecording"标签页重定向音频的输入和输出
Recommend
-
122
Ansible Arch Linux Role This role is intended for automation of first-time setup and configuration file synchronization of an Arch Linux development environment. It should not be used for day-to-day maintenance/updates. Don't run...
-
71
Linux - @Danswerme - 目前使用的是 Dejavu 和微米黑字体,中文感觉还可以,英文总给人一种乱糟糟的感觉,一些符号在命令行下有些重叠。有没有什么工整一点的字体?大家都用的什么字体呢? 另外网易云音乐
-
67
r/archlinux: For users of the much loved Linux distro, Arch Linux.
-
52
笔者在几个月前切换到 Linux 下干活,使用 Xmodmap 交换掉 CapsLock 和 Ctrl。 但 Xmodmap 只能改键无法区分是哪个键盘硬件设备(偏偏 HHKB 的 Caps 本来就在左边),而且只在 X11 下好使(Virtual Console 下不起作用)。 于是近日研究了...
-
60
最近发现我的 ArchLinux 每次解锁之后屏幕背光都会设置为最大,今晚终于有时间把它修复了。 写这篇文章介绍在 ArchLinux 下开机(Boot)和解锁(Resume)时,如何恢复此前的屏幕背光。 先解释背光控制的机制,再给如何入配置和调试。 本文...
-
12
在 Archlinux 上使用 Magic Keyboard女朋友献祭了她的 Magic Keyboard 给我以代替噪音过大的青轴机械键盘,经过一番配置和摸索之后,我真香了(我拿到的 Magic Keyboard 是 en-US 布局的,只不过 Caps Lock 被本地化为了 中/英
-
5
在Archlinux下安装和使用Skype 虽然说在skype的官方下载网站上没有列出sky for linux的下载地址, 但Redhat/Fedora/CentOS系的用户可以从 https://go...
-
9
使用snap在archlinux上安装skype 之前写过一篇文章讲了如何通过archlinuxcn仓库来安装skype....
-
12
配置Tripwire 创建keyfile 安装完之后,还需要用 twadmin 生成 site-keyfile 和 local-keyfile twadmin --generate-keys --local-keyfile tw.localkey --site-keyfile...
-
7
archlinux使用virtualbox的几个要点 - 暗无天日 archlinux使用virtualbox的几个要点 根据archwiki 的说法,操作系统是linux内核的话,使用 virtualbox-host-modul...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK