https://www.slackwiki.com/index.php?title=Btfirmware-nonfree&feed=atom&action=historyBtfirmware-nonfree - Revision history2024-03-28T10:02:22ZRevision history for this page on the wikiMediaWiki 1.40.0https://www.slackwiki.com/index.php?title=Btfirmware-nonfree&diff=981&oldid=prevRworkman: Created page with "I recently was presented with a Thinkpad T430s containing a Broadcom BCM20702 bluetooth chip, and bluetooth wouldn't work at all on it. <code>$ lsusb Bus 003 Device 009: ID 0..."2015-11-25T04:15:21Z<p>Created page with "I recently was presented with a Thinkpad T430s containing a Broadcom BCM20702 bluetooth chip, and bluetooth wouldn't work at all on it. <code>$ lsusb Bus 003 Device 009: ID 0..."</p>
<p><b>New page</b></p><div>I recently was presented with a Thinkpad T430s containing a Broadcom BCM20702 bluetooth chip, and bluetooth wouldn't work at all on it.<br />
<br />
<code>$ lsusb<br />
Bus 003 Device 009: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]<br />
</code><br />
<br />
On boot, I saw this in /var/log/syslog: <br /><br />
<code>Nov 24 13:37:35 liberty kernel: bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2</code> <br /><br />
Sure enough, /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd did not exist.<br />
<br />
After a bit of research, I determined that nobody had already written clear instructions on just how to obtain the needed firmware. There were a few results with links to different firmware that someone had already obtained from some mysterious source, and vague references about "get it from your Windows system" and such, but well, I don't have a Windows system.<br />
<br />
I went to the Lenovo support site, downloaded the bluetooth driver file (currently located at https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/g4wb12ww.exe but of course, this link will not always be valid), and poked around a bit in its contents. To do that, you'll first need to get innoextract (see http://constexpr.org/innoextract/ or search SlackBuilds.org for it).<br />
<br /><br />
<code><br />
root@liberty:~/fw# ls <br /><br />
g4wb12ww.exe <br /><br />
root@liberty:~/fw# innoextract g4wb12ww.exe <br /><br />
...lots of output, all extracted to an "app/" directory... <br /><br />
</code> <br /><br />
<br />
Now to see if we can find the important bits in here... I notice that the firmware expected to be loaded has "0a5c-21e6" in the name, and the usb ID of the bluetooth hardware is "0a5c:21e6" so let's poke around and see if we can find anything with that name: <br /> <br /><br />
<code>find app/ -name "*0a5c*" -o -name "*0A5C*"</code> <br /> <br /><br />
Hmm, no output. Okay. <br /> <br /><br />
<code> <br /><br />
root@liberty:~/fw#grep -Eir 0a5c.*21e6 . <br /><br />
Binary file ./app/Win64/BTW.msi matches <br /><br />
./app/Win64/bcbtums-win7x64-brcm.inf:%BRCM20702Thinkpad.DeviceDesc%=RAMUSB21E6, USB\VID_0A5C&PID_21E6 ; 20702 non-UHE Lenovo Japan <br /><br />
Binary file ./app/Win32/BTW.msi matches <br /><br />
./app/Win32/bcbtums-win7x86-brcm.inf:%BRCM20702Thinkpad.DeviceDesc%=RAMUSB21E6, USB\VID_0A5C&PID_21E6 ; 20702 non-UHE Lenovo Japan <br /><br />
</code> <br /> <br /><br />
Well, I don't want to poke around in binary files too much, but I know that .inf are plaintext files, so let's look in there. That "DeviceDesc" looks important, so we'll search for that in the .inf file once we get it opened. I use vi, but hopefully you know your editor well enough to do the equivalent, and you'll find something like this: <br /> <br /><br />
<br />
<code><br />
... <br /><br />
%BRCM20702Thinkpad.DeviceDesc%=RAMUSB21E6, USB\VID_0A5C&PID_21E6 ; 20702 non-UHE Lenovo Japan <br /><br />
... <br /><br />
;;;;;;;;;;;;;RAMUSB21E6;;;;;;;;;;;;;;;;; <br /><br />
<br /><br />
[RAMUSB21E6.CopyList]<br /><br />
bcbtums.sys<br /><br />
BCM20702A1_001.002.014.0449.0462.hex<br /><br />
<br /><br />
[RAMUSB21E6.NTX86]<br /><br />
Include=bth.inf<br /><br />
Needs=BthUsb.NT<br /><br />
FeatureScore=F0<br /><br />
CopyFiles=RAMUSB21E6.CopyList<br /><br />
<br /><br />
[RAMUSB21E6.NTX86.hw]<br /><br />
AddReg=RAMUSB21E6.NTX86.hw.reg<br /><br />
<br /><br />
[RAMUSB21E6.NTX86.hw.reg]<br /><br />
HKR,,LowerFilters, 0x00010000, "bcbtums"<br /><br />
HKR,,%RAMPatchFileName%,0x00000, "BCM20702A1_001.002.014.0449.0462.hex"<br /><br />
HKR,,%RemoteWakeEnabled%,0x00010001,1<br /><br />
HKR,,%DeviceRemoteWakeSupported%,0x00010001,1<br /><br />
<br /><br />
[RAMUSB21E6.NTX86.Services]<br /><br />
needs=BthUsb.NT.Services<br /><br />
AddService=bcbtums,,BCBTUMS_Service_Inst, BTWSECFL_EventLog_Inst<br /><br />
<br /><br />
... <br /><br />
</code><br />
<br /><br />
I happen to know from my research that the firmware files are .hex file, so this line is awesome to see: <br /><br />
<code>HKR,,%RAMPatchFileName%,0x00000, "BCM20702A1_001.002.014.0449.0462.hex"</code><br />
<br /><br />
<br />
Copy that file out of the directory structure into a place that's easier to work with:<br /><br />
<code><br />
root@liberty:~/fw# cp app/Win64/BCM20702A1_001.002.014.0449.0462.hex . <br /><br />
root@liberty:~/fw# ls <br /><br />
BCM20702A1_001.002.014.0449.0462.hex app/ g4wb12ww.exe <br /><br />
</code><br />
<br /><br />
Now we need to put this in a form that the linux kernel expects, so that's where hex2hcd comes in: <br /><br />
<code><br />
root@liberty:~/fw# git clone git://github.com/jessesung/hex2hcd.git <br /><br />
Cloning into 'hex2hcd'...<br /><br />
remote: Counting objects: 8, done.<br /><br />
remote: Compressing objects: 100% (7/7), done.<br /><br />
remote: Total 8 (delta 1), reused 8 (delta 1), pack-reused 0<br /><br />
Receiving objects: 100% (8/8), 8.71 KiB | 0 bytes/s, done.<br /><br />
Resolving deltas: 100% (1/1), done.<br /><br />
Checking connectivity... done.<br /><br />
root@liberty:~/fw# cd hex2hcd/<br /><br />
root@liberty:~/fw/hex2hcd# make<br /><br />
gcc -O2 -march=native hex2hcd.c -o hex2hcd<br /><br />
</code><br />
<br />
Now we use hex2hcd:<br />
<code><br />
root@liberty:~/fw/hex2hcd# ./hex2hcd ../BCM20702A1_001.002.014.0449.0462.hex ../BCM20702A1-0a5c-21e6.hcd <br /><br />
... lots of text and binary data ...<br /><br />
</code><br />
<br />
Finally, let's back up a directory, make sure what think is there is actually there, and copy it into place:<br />
<br />
<code><br />
root@liberty:~/fw/hex2hcd# cd ..<br /><br />
root@liberty:~/fw# ls<br /><br />
BCM20702A1-0a5c-21e6.hcd BCM20702A1_001.002.014.0449.0462.hex app/ g4wb12ww.exe hex2hcd/<br /><br />
root@liberty:~/fw# cp BCM20702A1-0a5c-21e6.hcd /lib/firmware/brcm/<br /><br />
</code><br />
<br />
The first person who finds this useful is expected to clean up the formatting and such. :-) Enjoy! -RW</div>Rworkman