Each Bluetooth device has a user-friendly local name as well as an unique 48-bit hexadecimal device address (eg, C0:F8:DA:9D:CF:DF). The default local name may be too generic, eg, ubuntu-0, to identify you to the rest of the world. This post shows you how to assign a more descriptive local name.
To find out the current local name of the Bluetooth device, execute the following command:
$ hciconfig -a hci0: Type: BR/EDR Bus: USB BD Address: C0:F8:DA:9D:CF:DF ACL MTU: 1022:8 SCO MTU: 121:3 UP RUNNING PSCAN ISCAN <..sniped> Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'ubuntu-0' Class: 0x6e0100 Service Classes: Networking, Rendering, Capturing, Audio, Telephony Device Class: Computer, Uncategorized HCI Version: 3.0 (0x5) Revision: 0x9999 LMP Version: 3.0 (0x5) Subversion: 0x9999 Manufacturer: Atheros Communications, Inc. (69)
The name that other Bluetooth devices will see is ubuntu-0. Suppose you want to rename the device penguin. Execute the following command with root privilege:
$ sudo hciconfig hci0 name penguin
To verify that the name was modified:
$ hciconfig -a hci0: Type: BR/EDR Bus: USB BD Address: C0:F8:DA:9D:CF:DF ACL MTU: 1022:8 SCO MTU: 121:3 UP RUNNING PSCAN ISCAN <..sniped> Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'penguin' Class: 0x6e0100 Service Classes: Networking, Rendering, Capturing, Audio, Telephony Device Class: Computer, Uncategorized HCI Version: 3.0 (0x5) Revision: 0x9999 LMP Version: 3.0 (0x5) Subversion: 0x9999 Manufacturer: Atheros Communications, Inc. (69)
The local name was only temporarily modified to penguin. It will revert back to ubuntu-0 at the next system reboot or the next Bluetooth daemon restart.
To make the change permanent, manually edit the Bluetooth configuration file. The config file is located in /var/lib/bluetooth/ under the sub-directory named by the Bluetooth device address (see below).
$ cat /var/lib/bluetooth/C0\:F8\:DA\:9D\:CF\:DF/config name ubuntu-0 pairable yes class 0x6e0100 onmode connectable mode connectable
Modify the line name ubuntu-0 to name penguin, and save the file.
$ sudo vi /var/lib/bluetooth/C0\:F8\:DA\:9D\:CF\:DF/config
Now, your new Bluetooth local name will persist even after a system reboot.
If you are interested in Bluetooth, please see my earlier post:
3 comments:
Thanks !
Do you know if it is possible to change the name of peripherals? Eg, my headset shows up as LG-074-GA, which is obviously the hostname hardcoded into the headset. Can it be aliased? I have tried editing /var/bluetooth/nn:nn:nn:nn:nn:nn:/names, though they get reset back on connection.
I have used the following command that seems to update the name in the config file without editing.
dbus-send --system --dest=org.bluez --print-reply hci0 org.bluez.Adapter.SetProperty string:Name variant:string:penguin
in addition to the
hciconfig hci0 name penguin
command.
Post a Comment