0
votes

My Raspberry Pi is configured for Bluetooth. I change the friendly name using hciconfig:

$ sudo hciconfig hci0 name "MyTest"
$ sudo hciconfig -a hci0
hci0:   Type: Primary  Bus: UART
...
UP RUNNING PSCAN ISCAN 
Name: 'MyTest'
...

On a different Ubuntu box, I scan for nearby devices:

$ sudo bluetoothctl
# scan on
...
[NEW] Device DC:A6:32:88:A6:12 raspberrypi
[CHG] Device DC:A6:32:88:A6:12 Name: MyTest
[CHG] Device DC:A6:32:88:A6:12 Alias: MyTest

Why does it show three different items? And where is it picking the name "raspberrypi" from? Is Pi also broadcasting its host name? Regards.

1

1 Answers

1
votes

The first thing to mention is that hciconfig has been deprecated by the BlueZ developers in 2017 so will be removed from systems at some point in the future.

The current tool for this job is btmgmt (assuming you have an up-to-date system).

sudo btmgmt name MyRaspberryPi MyPi

In /etc/bluetooth/main.conf there is this information:

# Defaults to 'BlueZ X.YZ', if Name is not set here and plugin 'hostname' is not loaded.
# The plugin 'hostname' is loaded by default and overides the Name set here so
# consider modifying /etc/machine-info with variable PRETTY_HOSTNAME=<NewName> instead.
#Name = BlueZ