How to change bluetooth device class
Solution 1
First, find your interface name:
hciconfig
It should give you the name of the interface, e.g., hci0
.
Given that display your interface class:
hciconfig hci0 class
That should display your device class.
Finally, with super user privilege:
sudo hciconfig hci0 class 000408
should set up new class of your device.
A useful reference of bluetooth classes with hexadecimal and binary representations can be found here: http://www.question-defense.com/tools/class-of-device-bluetooth-cod-list-in-binary-and-hex
Solution 2
The BlueZ hostname
plugin overrides the Name
and Class
settings in /etc/bluetooth/main.conf
. Follow these steps to specify the Bluetooth Class of Device (CoD):
-
Skip loading the
hostname
plugin when starting the bluetooth daemon by modifying/lib/systemd/system/bluetooth.service
. Example:sudo sed -i 's/bluetoothd/bluetoothd \-\-noplugin=hostname/g' /lib/systemd/system/bluetooth.service
Alternatively you can specify an inclusion list using --plugin=<plugins>
. See bluetoothd(8)
and https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/plugins
-
Edit
/etc/bluetooth/main.conf
and specifyClass
in the General section. SpecifyName
as well if you want something other thanBlueZ X.YZ
:[General] Class = 0x1c0420 Name = UbuntuCarAudio
-
Reboot or restart the bluetooth service for the changes to take effect:
sudo systemctl daemon-reload sudo service bluetooth restart
-
Verify the changes by running
hciconfig -a
orecho 'show' | bluetoothctl
.hciconfig -a
will show you the decoded Class of Device (CoD) information:Name: 'UbuntuCarAudio' Class: 0x1c0420 Service Classes: Rendering, Capturing, Object Transfer Device Class: Audio/Video, Car Audio
Solution 3
You need to change class name in /etc/bluetooth/main.conf file.
Class = 0x00041C
Then restart bluetooth service
sudo service bluetooth restart
Then turn off your bluetooth from top panel icon and turn it on.
Related videos on Youtube
twinPrimesAreEz
Updated on September 18, 2022Comments
-
twinPrimesAreEz over 1 year
I am trying to change my advertised bluetooth device class from computer to phone, running ubuntu 12.04. I downloaded the bluez sources and edited the main.conf file to change the line
Class = 0x000100
to something else. I used
Class = 0x0c025a
Then I ran make && make install. I think that works ok because the
/etc/bluetooth/main.conf
file has been updated with my changes.Now, the problem is that when I actually try to connect to a device
hcitool cc <bdaddr>
I see that I am still advertising myself using the Class
0x000100
and not0x0c025a
.What am I missing here to get this changes to take effect?
-
cfz42 over 5 yearsThanks for this detailed answer, while it does work fine for the Name, the Class doesn't get overridden anymore, instead it's set to 0x000000. Any idea what could cause this?
-
Chris Sidi over 5 years@cfz42 I have seen the Service Classes bits get ignored, but I don't know what causes this - maybe BlueZ inspection of running services? You could try using hciconfig, e.g
sudo hciconfig hci0 class 1c0420