如何更改蓝牙设备类别

twi*_*eEz 3 bluetooth 12.04

我正在尝试将我宣传的蓝牙设备类从计算机更改为手机,运行 ubuntu 12.04。我下载了 bluez 源并编辑了 main.conf 文件以更改行

Class = 0x000100 
Run Code Online (Sandbox Code Playgroud)

到别的东西。我用了

Class = 0x0c025a 
Run Code Online (Sandbox Code Playgroud)

然后我运行 make && make install。我认为这可以正常工作,因为/etc/bluetooth/main.conf文件已根据我的更改进行了更新。

现在,问题是当我实际尝试连接到设备时

hcitool cc <bdaddr>
Run Code Online (Sandbox Code Playgroud)

我看到我仍在使用 Class0x000100而不是0x0c025a.

我在这里缺少什么才能使此更改生效?

小智 9

首先,找到您的接口名称:

hciconfig
Run Code Online (Sandbox Code Playgroud)

它应该给你接口的名称,例如,hci0

鉴于显示您的界面类:

hciconfig hci0 class
Run Code Online (Sandbox Code Playgroud)

那应该显示您的设备类。

最后,具有超级用户权限:

sudo hciconfig hci0 class 000408
Run Code Online (Sandbox Code Playgroud)

应该为您的设备设置新类别。

可以在此处找到具有十六进制和二进制表示的蓝牙类的有用参考:http : //www.question-defense.com/tools/class-of-device-bluetooth-cod-list-in-binary-and-hex