Differences between revisions 8 and 9
Revision 8 as of 2020-12-19 06:32:26
Size: 8992
Editor: PaulWise
Comment: better advice: just use bluez' copy
Revision 9 as of 2020-12-25 19:05:57
Size: 9093
Editor: ?Dave22
Deletions are marked like this. Additions are marked like this.
Line 114: Line 114:
You can verify if you already have it installed. A 'which hex2hcd' will reveal it's existence...

Broadcom hybrid wireless devices

This page describes how to add firmware from a Windows(tm) driver for Broadcom hybrid bluetooth devices found on Broadcom Wifi/BT Hybrid cards on Debian systems.


You will need to identify both your Hardware ID and the name of the missing Firmware file.

Hardware ID

<!> Your bluetooth adapter, while on the same card as your wifi will have a seperate hardware ID.

Your Bluetooth card will likely be on the USB bus, for example:

Bus 003 Device 016: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad] 


Bus 004 Device 006: ID 0a5c:21e3 Broadcom Corp. HP Portable Valentine 

See this wiki entry for more information on identifying USB devices.

You will need this identifier such as 0a5c:21e6, shown above.

Missing Firmware Filename

You can typically find the name of the missing firmware file by reading the kernel error message with one of the following commands:

pkexec dmesg | grep -i bluetooth 


pkexec dmesg | grep firmware 

and you will see an error message with the filename, for example:

bluetooth hci0: firmware: failed to load brcm/BCM20702A1-0a5c-21e6.hcd (-2)
bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2
Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e6.hcd not found

You will need this filename such as brcm/BCM20702A1-0a5c-21e6.hcd.

Obtaining Firmware

The complicated part of this is obtaining the firmware from a Windows(tm) driver package and converting it, you will first need a driver package for your card from your computer or hardware manufacturer which will likely come in the form of a windows executable file. You can obtain this by visiting the manufacturer's website and looking up your model number.

BUT: Before getting wrapped around the axle getting the file from the manufacturer's website, if you are dual-booting a Window$ system, you may already have the .hex file available. Mount your Window$ partition and do a 'find' on the filename, relacing the '.hcd' tag with '.hex'. If you have it, copy it to your work directory and proceed at 'Converting the firmware' below.

If you do not know your system manufacturer or model number you can use the following command:

pkexec dmidecode -t01

If that command is not installed you can install it with:

pkexec apt install dmidecode

The output would look something like the following, I will edit out the unique identifiers:

Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x000B, DMI type 1, 27 bytes
System Information
        Manufacturer: LENOVO
        Product Name: 20AL0097US
        Version: ThinkPad X240
        Serial Number: ABCDEF123
        UUID: 12345678-90ab-cdef-0123-456789abcdef
        Wake-up Type: Power Switch
        SKU Number: LENOVO_MT_20AL_BU_Think_FM_ThinkPad X240
        Family: ThinkPad X240

For example purposes I am writing this wiki page after assisting a user with a HP Pavilion g6-1c60ca Notebook PC, and I went to HP's support website for laptops and typed in that model number in the search box and hit submit, and due to the fact that it auto detected I was on linux, it said no drivers found. I had to then click on a Choose a Different OS link, and select Windows 7 at which point it listed various driver categories, I expanded the Driver-Network category and selected Broadcom Bluetooth Software which then downloaded https://whp-aus2.cold.extweb.hp.com/pub/softpaq/sp54001-54500/sp54245.exe

You can open the file regardless if its an exe or zip file with engrampa or file-roller, KDE's ark will open zip files but as of this writing, in Debian 10 Buster, ark does not seem to be able to open exe files.

You can then extract the files to a directory for example purposes I'll just call it /home/user/sp54245/

Finding the appropriate firmware file

In order to find the appropriate firmware file for your device you will need to locate the .inf files in the driver package and search them for your hardware id. You can recursively search all .inf files for the hardware id of your bluetooth with something like the following:

cd /home/user/sp54245

find . -name '*.inf' -type f -exec grep -A5 -i 21e3 -- {} + | grep .hex

The path above is what I've extracted the driver to in my example, /home/user/sp54245, you will replace that with where you've extracted your driver.

The 21e3 is the second half of the hardware id in the examples above which is the product id, you will need to replace that with your product id. Hardware ids are 4 hex digits 0-F that represent the vendor and product in the format VEND:PROD since the driver will be for the vendor in question, you need only search for the PROD portion of the hardware ID.

The output will look something like this:

./Win64/bcbtums-win7x64-brcm.inf-HKR,,%RAMPatchFileName%,0x00000, "BCM20702A1_001.002.014.0136.0168.hex"
./Win32/bcbtums-win7x86-brcm.inf-HKR,,%RAMPatchFileName%,0x00000, "BCM20702A1_001.002.014.0136.0168.hex"

which tells us that for this particular hardware in my example, the firmware file we want is in the Win32/ or Win64/ directory and is called BCM20702A1_001.002.014.0136.0168.hex I don't offhand know that it matters, but I'd use the one that corresponds to your Debian OS version, i.e. if you're using AMD64 (a 64bit kernel) then use the Win64 version. For all I know they're identical, but in this example we'd followed this best guess approach and it worked.

Converting the firmware

To convert this firware to a format usable by the linux btusb driver you can use the hex2hcd tool.

The bluez package includes DebianManual:hex2hcd, but if you are using and older version of bluez that does not have hex2hcd, then you will need to compile hex2hcd using the info below.

You can verify if you already have it installed. A 'which hex2hcd' will reveal it's existence...

Compiling hex2hcd

You will need to compile this, its a single C file, released under as of this writing, GPLv2. You would need at minimum gcc and gnu make, you could install these either directly or by fetching a metapackage as follows:

pkexec apt install gcc make


pkexec apt install build-essential

Once you have the necessary build tools, the process for fetching an building Jesse Sung's hex2hcd are as follows:

git clone git://github.com/jessesung/hex2hcd.git
cd hex2hcd
export PATH="$PATH:$(pwd)"

Running hex2hcd

From within the hex2hcd directory where you should be after compiling it, you can first copy the firmware hex file you need from the location you've extracted your driver to, you will need to change the directory in my example to whatever directory you've used, and whatever hex file is appropriate for your hardware, as follows:

cp /home/user/sp54245/Win64/BCM20702A1_001.002.014.0136.0168.hex .

Next you can run hex2hcd on this firmware file, outputting to whatever filename is expected by the linux btusb driver for your hardware, that you discovered from the error message, as follows:

hex2hcd BCM20702A1_001.002.014.0136.0168.hex BCM20702A1-0a5c-21e6.hcd

Now that you have the firmware file, you need only copy it to where the kernel expects to find it in /lib/firmware/ as per the error message from the kernel. Do so as follows:

cp BCM20702A1-0a5c-21e6.hcd /lib/firmware/brcm/

Final Notes

You can now either reboot, or simply unload and reload the btusb driver with the commands:

pkexec modprobe -r btusb

pkexec modprobe btusb

and reload bluetooth services with the command:

pkexec systemctl restart bluetooth

and your bluetooth issue should be resolved.

You can also remove all the Windows(tm) driver stuff, and optionally if you like either remove or archive the hex2hcd stuff and if you like remove the build dependencies (make and gcc).

There is a link to the thread used for a reference in the See Also section below.

If you're wondering what the deal is with pkexec, where many people use sudo, its because sudo is not installed by default on Debian unless you do not set a root password in the installer, where polkit which provides pkexec, which has similar functionality to sudo, is installed by default on Debian systems.

See Also


CategoryHardware | CategoryWireless