I am trying to change a raspberry pi's bluetooth name to something else (an ip address) so that when I scan and pair my android device it will see this ip as the device name. It worked once but then went back to appearing as "raspberrypi-0"
I have tried both the hciconfig set name command, and have also changed the device name inside /etc/bluetooth/main.conf but still all my device sees is "raspberrypi-0". Its driving me crazy so if anyone knows what the issue is please help!
If you want to change the bluetooth device name permanently, you have to create a file called /etc/machine-info which should have the following content:
PRETTY_HOSTNAME=device-name
Then issue "service bluetooth restart" after that
@Evangelos Nannos answer still works (BlueZ 5.50) but if you want to change bluetooth alias on the fly you may try bluetoothctl (tested on Pi Zero W running Raspbian Stretch & BlueZ 5.50)
To set new 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
Use show to see current bluetooth settings:
[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
(...)
Reset alias and go back to using system device name with:
[bluetooth]# reset-alias
Exit bluetootctl with:
[bluetooth]# quit
With Discoverable on (yes) the device will show up during scaning as Your New BT Alias.
Take note that alias will be kept after reboot!
I've use pexpect to manipulate bluetoothctl, bash works too. There were problems registering Agent on BlueZ 5.43 via pexpect, had to upgrade to 5.50
Alternative command (note it will not return a response):
pi@raspberrypi:~ $ sudo hciconfig hci0 name 'New device name'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With