将你的电脑音响用作蓝牙音响
这么做可以将你电脑上的外放设备用作蓝牙音响,通过蓝牙为你的手机提供外放。
将以下内容添加到配置文件 /etc/bluetooth/audio.conf
(如果文件不存在,创建一个):
[General] Enable=Source
阅读更多:
- Bluetooth headset
- https://gist.github.com/joergschiller/1673341
- http://www.lightofdawn.org/blog/?viewDetailed=00031
音频
如要使用蓝牙耳机或蓝牙音响设备,你需要安装 pulseaudio-bluetooth 软件包。
请参阅 Bluetooth headset (简体中文) 查看更多关于蓝牙耳机、音响设备及相关问题排查的信息。
如要让你的电脑能够作为A2DP sink被探测到(可以作为蓝牙音响播放来自于你手机的音乐),在 /etc/bluetooth/audio.conf
配置文件的[General]
栏添加以下内容:Enable=Source,Sink,Media,Socket
配对
许多蓝牙(Bluetooth)设备要求在使用时配对。 实际上的过程取决于配对涉及到的设备和这些设备的输入功能。 在移动电话上的配对过程可能会像下面那样:
- 计算机向移动电话发送一个配对请求
- 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码
- 必须在计算机上重新输入同一个序列(指上文中的PIN)。
通过执行一下命令来搜索外部设备
$ hcitool scan
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做bluez-simple-agent的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:
# bluez-simple-agent
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。
需要查看例子.请向下翻页到示例部分。
示例
西门子 S55
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)
- 根据安装步骤
$> hcitool scan Scanning ... XX:XX:XX:XX:XX:XX NAME $> B=XX:XX:XX:XX:XX:XX
在另一个终端启动simple-agent
$> su -c bluez-simple-agent Password: Agent registered
回到上一个终端
$> obexftp -b $B -l "Address book" # Phone ask for pin, I enter it and answer yes when asked if I want to save the device ... <file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /> ... $> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr" Browsing 00:01:E3:6B:FF:D7 ... Channel: 5 Connecting...done Receiving "Address book/5F07.adr"... Sending "Address book"... done Disconnecting...done $> obexftp -b 00:01:E3:6B:FF:D7 -p a ... Sending "a"... done Disconnecting...done
罗技鼠标 MX Laser / M555b
快速测试连接
$> hidd --connect XX:XX:XX:XX:XX:XX
通过桌面想到设置鼠标一实现自动重连。 如果你的桌面环境不提供对此任务的支持,参阅Bluetooth mouse manual configuration向导.
摩托罗拉 V900
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:
cd ~/ mkdir bluetooth-temp obexfs -n xx:yy:zz:... ~/bluetooth-temp cd ~/bluetooth-temp
然后浏览... 这样操作时只能访问音频、视频和图片。
摩托罗拉 RAZ
> pacman -S obextool obexfs obexftp openobex bluez
> lsusb Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module] Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> hciconfig hci0 up
> hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8 UP RUNNING RX bytes:348 acl:0 sco:0 events:11 errors:0 TX bytes:38 acl:0 sco:0 commands:11 errors:0
> hcitool dev Devices: hci0 00:16:41:97:BA:5E
注意:确保手机上的蓝牙处于打开状态并且是可见的
> hcitool scan Scanning ... 00:1A:1B:82:9B:6D [quirxi]
> hcitool inq Inquiring ... 00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204
> l2ping 00:1A:1B:82:9B:6D Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ... 44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms 44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms 44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms 44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms 44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms 44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms 6 sent, 6 received, 0% loss
> hcitool name 00:1A:1B:82:9B:6D [quirxi]
# hciconfig -a hci0 hci0: Type: BR/EDR Bus: USB BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8 UP RUNNING RX bytes:9740 acl:122 sco:0 events:170 errors:0 TX bytes:2920 acl:125 sco:0 commands:53 errors:0 Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: Link mode: SLAVE ACCEPT Name: 'BCM2045' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 2.0 (0x3) Revision: 0x204a LMP Version: 2.0 (0x3) Subversion: 0x4176 Manufacturer: Broadcoml / Corporation (15)
> hcitool info 00:1A:1B:82:9B:6D Requesting information ... BD Address: 00:1A:1B:82:9B:6D Device Name: [quirxi] LMP Version: 1.2 (0x2) LMP Subversion: 0x309 Manufacturer: Broadcom Corporation (15) Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00 <3-slot packets> <5-slot packets> <encryption> <slot offset> <timing accuracy> <role switch> <hold mode> <sniff mode> <RSSI> <channel quality> <SCO link> <HV2 packets> <HV3 packets> <A-law log> <CVSD> <power control> <transparent SCO> <AFH cap. slave> <AFH cap. master>