Monday, May 5, 2014

BCM43142 Bluetooth: Getting It to Work on Debian Jessie

UPDATE 2015-04-30: These steps are now OBSOLETE. The updated steps are here.
UPDATE 2014-05-08: Add info to keep bluetooth working after suspend/hibernate.


Overview

In this post, I will write the steps that I took to get BCM43142 bluetooth (105b:e065) working on Debian Jessie by porting patches from Ubuntu. Basically, there are two (2) things that need to be done.
  1. Patch and recompile btusb kernel module to support BCM43142 firmware loading.
  2. Get the actual hex firmware for BCM43142 from a Windows installation (yes, you read that right) and convert it to hcd format by using hex2hcd.

Patching and Recompiling btusb Kernel Module

  1. Download and unpack kernel source: $ apt-get source linux.
  2. Download patches for Ubuntu kernel git.
    • $ wget -O bcm43142-1.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=a0d51082d501dfa1238d591707472d19ce145334"
    • $ wget -O bcm43142-2.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=176cc999e91c322cbdf8d0812198d5c93377e4de"
    • $ wget -O bcm43142-3.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=d48ff3f7cec9528442bae8775312092098c99078"
    • $ wget -O bcm43142-4.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=e9ec28bf29304076f1f51a274cafa92c114e3417"
    • $ wget -O bcm43142-5.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=6e9c2318d11c3b144ef51e7bac5aa8dbf138565b"
    • $ wget -O bcm43142-6.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=679a33feea93e910a05614c8abe50a2e9aec7228"
  3. Switch to unpacked kernel source dir and apply the six (6) patches downloaded earlier in sequence.
    • $ cd linux-3.13.10 
    • $ patch -p1 < ../bcm43142-*.patch
  4. Still inside the unpacked kernel source dir, recompile btusb module and install it.
    • $ cp /lib/modules/$(uname -r)/build/Module.symvers ./
    • $ make oldconfig
    • $ make prepare
    • $ make modules_prepare
    • $ make modules SUBDIRS=drivers/bluetooth
    • # cp drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko
    • # depmod

Getting HEX Firmware for BCM43412 and Convert It to HCD Format

  1. Get hex firmware for BC43412 from a Windows installation under C:\Windows\System32\Drivers. The file name should be like BCM43142A0_*.hex.
  2. Download and compile hex2hcd from https://github.com/jessesung/hex2hcd/archive/master.zip.
    • $ wget "https://github.com/jessesung/hex2hcd/archive/master.zip"
    • $ unzip master.zip
    • $ cd hex2hcd-master
    • $ make
  3. Convert the hex firmware to hcd format and place it in /lib/firmware with the file name "fw-105b_e065.hcd" (since according to the lsusb, the hardware is 105b:e065).
    • # ./hex2hcd BCM43142A0_*.hex /lib/firmware/fw-105b_e065.hcd
After executing all the steps above, reboot the laptop. When the laptop started again, the bluetooth might still be blocked by rfkill. Unblock it using the following command.

# rfkill unblock bluetooth

The bluetooth should be working now.

To keep bluetooth working after suspend/hibernate, make btusb kernel module to be reloaded automatically every after suspend/hibernate. You can use the following command to do this.

# cat << EOF > /etc/pm/config.d/btusb
SUSPEND_MODULES="$SUSPEND_MODULES btusb"
EOF

Any feedback, please write it on the comments below.

6 comments:

  1. Dhanar I get an error when running patch command:
    patch: ../bcm43142-3.patch: extra operand
    patch: Try 'patch --help' for more information.
    Any ideas on what could be happening?

    Thanks in advance.

    ReplyDelete
    Replies
    1. There was a typo on the patch command. I have updated it. Thank you for your comment.

      Delete
  2. I was able to make it work without recompiling the entire module like this guy did:

    https://outhereinthefield.wordpress.com/2014/03/01/ubuntu-13-10-and-bluetooth-on-broadcom-bcm43142-wifibt-combo-adapter/

    Restarted and I can see all Bluetooth devices now.

    ReplyDelete
    Replies
    1. Yes. That one will work because Ubuntu already has the patches on their kernel. But, if you are using Debian, you have to recompile the module. I have a plan to update this post when Debian Jessie is declared stable.

      Delete
  3. I am sorry, but what to do to make it work in the current release?

    ReplyDelete
    Replies
    1. Updated steps just for you:

      http://dhanar10.blogspot.com/2015/04/updated-steps-for-enabling-bcm43142.html

      Just kidding....

      Delete