Changing the pibberry pi bluetooth device name?

I am trying to change the bluetooth pa name for raspberry to something else (ip address) so that when I scan and connect my android device, it will see this ip as the device name. It worked once but then came back to "raspberrypi-0"

I tried the hciconfig set name command and also changed the device name inside /etc/bluetooth/main.conf, but still my device sees "raspberrypi-0". This is driving me crazy, so if anyone knows what the problem is, please help!

+4


source to share


3 answers


If you want to constantly change the name of the bluetooth device, you need to create a file called / etc / machine -info, which should have the following content:

PRETTY_HOSTNAME=device-name

      



Then do "restart bluetooth service" after that

+15


source


Stores the display name in the file / var / lib / bluetooth / xx: xx: xx: xx: xx: xx / config. If you want to change the name of the Bluetooth display (broadcast), you need to follow these steps:

  • delete / var / lib / bluetooth / xx: xx: xx: xx: xx: xx / config file.
  • Edit /etc/bluetooth/main.conf(For ex: Name =% d-% h for name = abcd-5)
  • restarting the bluetooth service.


Note. If this is already paired with some other BT devices, so you need to remove pairing to see the new BT name of the same device (MAC).

+1


source


@Evangelos Nannos answer still works (BlueZ 5.50) but if you want to change bluetooth alias on the fly you can try bluetoothctl (tested on Pi Zero W with Raspbian Stretch & BlueZ 5.50)

To set a new alias, open a 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 the show to see the 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 the alias and revert to using the system device name with:

    [bluetooth]# reset-alias

      

Exit bluetootctl with:

    [bluetooth]# quit

      


If Discoverable is enabled (yes) , the device will show as Your New BT Alias during scanning .

Please note that the alias will be saved after reboot!

I am using pexpect to control bluetoothctl, bash works too. There were problems when registering an Agent on BlueZ 5.43 via pexpect, I had to update to 5.50

0


source







All Articles