0

Laptop: HP Omen 16 (2022 model)

Ubuntu: 22.04.1

I performed a fresh installation of Ubuntu 22.04 on a brand-new laptop. Wi-Fi is working great, but bluetooth is not working at all; this is exactly opposite of what my general experience has been in the past.

The underside of the laptop says:

Contains MediaTek Radio Model: MT7922A22M

lsusb shows the device:

Bus 001 Device 003: ID 0489:e0e0 Foxconn / Hon Hai Wireless_Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x0489 Foxconn / Hon Hai
  idProduct          0xe0e0 
  bcdDevice            1.00
  iManufacturer           5 MediaTek Inc.
  iProduct                6 Wireless_Device
  iSerial                 7 000000000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00fe
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          8 Config_01
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass        224 Wireless
      bFunctionSubClass       1 Radio Frequency
      bFunctionProtocol       1 Bluetooth
      iFunction               4 BT_FUNCTION

But hciconfig dev says that no devices are present.

Also, rfkill has not blocked anything:

ID TYPE      DEVICE      SOFT      HARD
 0 bluetooth hci0   unblocked unblocked
 1 wlan      phy0   unblocked unblocked
2

1 Answer 1

2

EDIT (May 2023): This issue is no longer present in Ubuntu 23.04. The shipped bluetooth driver works out-of-the-box, perfectly fine. So, the original workaround (see below the line) is only needed in Ubuntu versions 22.10 and lower.


So, I have finally "solved" the issue.

It seems that the firmware/driver is already present in the kernel, called mt7921e I believe.

After reading this thread, I too suspected that the device/manufacturer code (0489:e0e0) is very new and hence not yet present in the kernel. So, the kernel is simply not detecting the bluetooth adapter.

Here is link to a database that shows info about the support of this wireless chip.

I checked out the latest source code of btusb generic driver in the kernel, and noticed that the code of my chip (0489:e0e0) was missing in drivers/bluetooth/btusb.c. BTW, the built driver is present at /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko, which in my case is /lib/modules/5.15.0-46-generic/kernel/drivers/bluetooth/btusb.ko.

I also noticed a new patch which adds the relevant code to the kernel.

So, now either I could wait for Canonical to backport this patch to Ubuntu 22.04 (don't know how long will that take, if it ever happens), or I could try to hack it on my laptop. I decided to do the latter.

Now, either I could grab the source code then patch it then build a new btusb.ko (cumbersome), or I could just hex edit the existing btusb.ko (simple binary patching). I decided to do the latter.

Doing dpkg -S /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko shows that it is provided by the package linux-modules-extra-5.15.0-46-generic. I suspect from the version numbers in the package name that I will have to redo this whole procedure every time there is a kernel/driver update. Oh well. After I downloaded the source code using apt-get source linux-modules-extra-5.15.0-46-generic, I could see that a device/manufacturer code was present in btusb.c that was very similar to mine.

{ USB_DEVICE(0x0489, 0xe0cd), .driver_info = BTUSB_MEDIATEK |
                         BTUSB_WIDEBAND_SPEECH |
                         BTUSB_VALID_LE_STATES },

So. in btusb.ko, there is already a 0489:e0cd present, I just need to edit it to 0489:e0e0.

Now, I used GHex (any hex editor can be used) to edit the btusb.ko. Be careful of the endianness. On my laptop, the code 0489:e0cd was found as bytes 89 04 CD E0. And I replaced it with bytes 89 04 E0 E0. Also, be careful of multiple occurrences, make sure to find-and-replace them all. Also, don't forget to preserve a backup of it before editing it.

Now simply do:

sudo modprobe -r btusb
sudo modprobe -v btusb

And now the bluetooth should work... unless you have UEFI Secure Boot enabled, like me!

The kernel will reject the module/driver because it only accepts modules digitally signed by a trusted party, in this case, Canonical. Modifying even one byte of the btusb.ko makes it "tampered with".

Now, it may sound a bit crazy, but you could make yourself a trusted party to the UEFI of your laptop, and sign the edited btusb.ko yourself. This would make the kernel happily accept it.

THIS IS RISKY, I DO NOT RECOMMEND THIS. This increases your attack surface (for bootloader malware), and also puts the burden of securely maintaining the secret signing key on your shoulders.

If you are experienced and you know what you are doing and want to continue, read on.

Refer to the documentation (and also this one) to essentially:

  1. Generate a new key-pair for yourself. (public and private key)
  2. Keep the private key at a secure location.
  3. Enroll the public key (as a MOK) into the UEFI.
  4. Reboot and finish enrolling the public key.
  5. Sign the btusb.ko kernel using the private key. The btusb.ko will be modified in-place.
  6. Reload the module: sudo modprobe -r btusb; sudo modprobe -v btusb.
  7. Success :-)

And now the bluetooth should work. At least until the next kernel/driver update.

Let's see how long it takes for Ubuntu 22.04 to introduce support for this chip.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .