Bluetooth 更改raspberry pi蓝牙设备名称?
我正在尝试将raspberry pi的蓝牙名称更改为其他名称(ip地址),这样当我扫描并配对android设备时,它会将此ip视为设备名称。它工作过一次,但后来又恢复为“树莓-0”Bluetooth 更改raspberry pi蓝牙设备名称?,bluetooth,raspberry-pi,raspbian,Bluetooth,Raspberry Pi,Raspbian,我正在尝试将raspberry pi的蓝牙名称更改为其他名称(ip地址),这样当我扫描并配对android设备时,它会将此ip视为设备名称。它工作过一次,但后来又恢复为“树莓-0” 我尝试了hciconfig set name命令,还更改了/etc/bluetooth/main.conf中的设备名称,但我的设备仍然只能看到“raspberrypi-0”。这让我发疯,如果有人知道问题是什么,请帮助我 如果要永久更改蓝牙设备名称,必须创建一个名为/etc/machine info的文件,该文件应包含
我尝试了hciconfig set name命令,还更改了/etc/bluetooth/main.conf中的设备名称,但我的设备仍然只能看到“raspberrypi-0”。这让我发疯,如果有人知道问题是什么,请帮助我 如果要永久更改蓝牙设备名称,必须创建一个名为/etc/machine info的文件,该文件应包含以下内容:
PRETTY_HOSTNAME=device-name
然后发出“service bluetooth restart”(服务蓝牙重新启动),然后将显示名称存储在/var/lib/bluetooth/xx:xx:xx:xx/config文件中。如果要更改蓝牙显示(广播)名称,则需要执行以下步骤:
注意:如果这已经与其他一些BT设备配对,那么您需要删除配对以查看同一设备(MAC)的新BT名称。@Evangelos Nannos答案仍然有效(BlueZ 5.50),但如果您想动态更改蓝牙别名,您可以尝试bluetoothctl(在Pi Zero W运行Raspbian Stretch&BlueZ 5.50上测试) 要设置新的alias open terminal,请执行以下操作:
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
使用“显示”查看当前蓝牙设置:
[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
(...)
重置别名并返回使用系统设备名称:
[bluetooth]# reset-alias
使用以下命令退出bluetootctl:
[bluetooth]# quit
启用可发现(是)设备将在扫描过程中显示为您的新BT别名 请注意,重新启动后,别名将保留! 我使用pexpect操作bluetoothctl,bash也可以。通过pexpect在Bluez5.43上注册代理时出现问题,必须升级到5.50
可选命令(注意它不会返回响应):
pi@raspberrypi:~ $ sudo hciconfig hci0 name 'New device name'
只需遵循以下步骤 步骤1-在终端中写入以下代码
sudo nano /etc/machine-info
第2步-它将打开一个空白文件,现在将这一行写入其中
PRETTY_HOSTNAME=PutYourDeviceNameHere
步骤3-现在重新启动蓝牙服务,或者您可以重新启动Raspberry Pi
service bluetooth restart
或
希望它对您有用您也可以禁用主机名插件并配置名称 运行
sudovim/etc/systemd/system/bluetooth.target.wants/bluetooth.service
并附加--noplugin=hostname
,如下所示:
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=hostname
然后编辑蓝牙配置并设置所需的名称:
sudo-vim/etc/bluetooth/main.conf
Name = YourNewName
Name = YourNewName