jav*_*cky 5 bluetooth raspberry-pi raspbian
我正在尝试将覆盆子pi的蓝牙名称更改为其他东西(一个IP地址),这样当我扫描并配对我的Android设备时,它会将此ip视为设备名称.它工作了一次但后来又出现了"raspberrypi-0"
我已经尝试过hciconfig set name命令,并且还更改了/etc/bluetooth/main.conf中的设备名称,但我的设备仍然看到的是"raspberrypi-0".它让我发疯,所以如果有人知道问题是什么请帮助!
小智 16
如果要永久更改蓝牙设备名称,则必须创建名为/ etc/machine-info的文件,该文件应具有以下内容:
PRETTY_HOSTNAME=device-name
Run Code Online (Sandbox Code Playgroud)
然后发出"服务蓝牙重启"
@Evangelos Nannos 的答案仍然有效(BlueZ 5.50),但如果您想即时更改蓝牙别名,您可以尝试bluetoothctl(在运行Raspbian Stretch & BlueZ 5.50 的Pi Zero W上测试)
设置新别名打开终端:
pi@raspberrypi:~ $ bluetoothctl
[bluetooth]# system-alias 'Your New BT Alias'
Changing Your New BT Alias succeeded
[CHG] Controller AA:BB:CC:DD:EE:FF Alias: Your New BT Alias
Run Code Online (Sandbox Code Playgroud)
使用show查看当前的蓝牙设置:
[bluetooth]# show
Controller AA:BB:CC:DD:EE:FF
Name: Some_other_name #default or as PRETTY_HOSTNAME
Alias: Your New BT Alias #alias will be shown when scanning for bt devices
(...)
Run Code Online (Sandbox Code Playgroud)
重置别名并返回使用系统设备名称:
[bluetooth]# reset-alias
Run Code Online (Sandbox Code Playgroud)
使用以下命令退出 bluetootctl:
[bluetooth]# quit
Run Code Online (Sandbox Code Playgroud)
随着可发现的(是),设备将scaning作为在显示你的BT别名。
请注意别名将在重新启动后保留!
我已经使用 pexpect 来操作 bluetoothctl,bash 也可以。通过 pexpect 在 BlueZ 5.43 上注册 Agent 时出现问题,必须升级到 5.50
替代命令(注意它不会返回响应):
pi@raspberrypi:~ $ sudo hciconfig hci0 name 'New device name'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13779 次 |
| 最近记录: |