0

I can connect to and use my HiFi system via BT just fine but... it is listed as 'Headset' in my audio device list. A totally minor issue but a bit confusing.

I found out that the (probable...) reason behind this 'misunderstanding' is that the device reports its class as 0x240404 (Wearable headset device) instead of the likely more appropriate 0x240428 (HiFi Audio Device).

Unfortunately simply editing the /var/lib/bluetooth/[MAC address]/[another MAC address]/info file doesn't work, as the file gets rewritten at each service restart and the reported class gets back everytime.

How can I override the reported class for the device? (It can't be changed from the HiFi device itself, at least according to the manual there's no BT 'advanced options' where I could operate...)

2 Answers 2

0

I am assuming you're using Gnome as your desktop environment. Similar options might exist or not exist in other environments.

I solved the problem described by you on my Ubuntu 20.04.5 LTS several weeks ago and did not yet upgrade to 22.04.1 LTs - but checked the changelogs.

It is more than probable that your HiFi Audio Device supports more than one Bluetooth profile - so do most of the recent BT headsets.

A general word about two-way Bluetooth-Connections: There is no "non-proprietary generig" way (or at least I don't know any), to have a two-way HighQuality audio connection via Bluetooth. Device Manufacturers might supply proprietary, device-specific software to accomplish this. In most cases this software would not be compiled for Linux.

One possible workaround could be a Bluetooth USB dongle being recognized as a (two-way) sound card by your Computer. But this is beyound your original question.

using your HiFi Audio device to play sounds coming from your computer

Once you have connected your HiFi Audio device via Bluetooth, go to gnome-control-center sound (either by klicking through "settings" or by running that command after pressing F2 or Ctrl+Alt+T (3 at the same time)).

First scroll down to "Input" and set it to something else but not your HiFi Audio device connected via Bluetooth - or mute it. Either will work.

Second go up to "Output" and choose your OutputDevice (obvious) and the Bluetooth profile of your choice beside Configuration (A2DP Sink with one of the supplied Codecs)

On Ubuntu 20.04.5 LTS I had to do an additional step before this became possible:

Unfortunately the above-mentioned package's "activity" looks like a one-time shot packaging https://github.com/EHfive/pulseaudio-modules-bt for Ubuntu 20.04 LTS.

The version of pulseaudio found on Ubuntu 22.04 should be able to support this "out of the box" - according to the changelogs I read (did not test with a live ubuntu 22.04.1). If not - find a suitable ppa for 22.04 of pulseaudio-modules-bt - chances are high.

1
  • Thanks for your reply, but I do get audio from the HiFi, it's just that it's reported as headset. There's only one output profile when I select the device and it's "High Fidelity Playback (A2DP Sink)" which seems correct btw...
    – sverx
    Sep 19, 2022 at 16:11
0

As I couldn't find a better solution, I just hacked the bluetooth daemon code. In case someone else needs it - or something similar, I added one line into bluez src/device.c device_set_class function. It's a terrible solution (any headset device will be miscategorized as HiFi) but it serves my purpose.

void device_set_class(struct btd_device *device, uint32_t class)
{
    if (device->class == class)
        return;

    DBG("%s 0x%06X", device->path, class);

  if ((class & 0xffffff)==0x240404)   class=0x240428;    // BT speaker fix!

    device->class = class;

    store_device_info(device);

    g_dbus_emit_property_changed(dbus_conn, device->path,
                        DEVICE_INTERFACE, "Class");
    g_dbus_emit_property_changed(dbus_conn, device->path,
                        DEVICE_INTERFACE, "Icon");
}

though I suspect there should be a better way. Anyone?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.