Skip navigation.

Fat R笔记……与减肥无关

Fat awful terrible Rubbish-bin

bluez重新配对蓝牙设备

,

对于某些已经配对的蓝牙设备,如果该设备后来另外与其它设备配对了,则再与本机连接时需要重新配对。例如蓝牙耳机,在与本机连接时配对了一次,后来拿到其它地方与其它主机配对了,拿回来后需要再与本机配对才能在本机上使用。然而问题在于bluez连接蓝牙设备时,如果设备已经配对了,是不会重新出现输入pin的对话框的,从而使得本机无法连接蓝牙设备。

解决的方法很简单,删除/var/lib/bluetooth/*并重启bluez即可:
sudo rm -rf /var/lib/bluetooth/*;sudo /etc/init.d/bluez-utils restart


bluetooth目录下面的子目录是蓝牙适配器的baddr,子目录里面是linkkeys文件,因此删除linkkeys文件里面的需要重新配对的蓝牙设备baddr对应的那行应该也可以。

另外,我的系统locale是gbk,弹出的输入pin对话框不能正确显示中文,估计对话框用的是utf-8,于是编辑/usr/bin/pinwrapper,在bluez-pin命令前面加上LC_ALL=zh_CN.UTF8:
$ cat /usr/bin/pinwrapper
#/bin/sh

if [ -x /usr/bin/bluez-pin ]
then
        LC_ALL=zh_CN.UTF8 /usr/bin/bluez-pin "$@"
else
        /usr/lib/kdebluetooth/kbluepin "$@"
fi

这样就能正确显示中文了。

faint! gthread初始化后崩溃的问题ubuntu的中文输入法。。。

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31