Bug#760813: firmware-b43-installer: Package device detection fails without PCI hardware

2016-03-23 Thread Elliott Mitchell
tags 760813 + patch
quit

For the heck of it, I'm attaching a patch that takes the suboptimal, but
functional approach.  This looks for 47[01][0-9a-f] chips.  This should
include some of the earlier 47xx chips which share the same firmware.
This is a pretty broad brush, but I know there are quite a few other
types of devices out there.

I also looked through https://wireless.wiki.kernel.org/en/users/Drivers/b43
and added everything that was there.  Some of those need kernel 3.18,
but I imagine the next version of firmware-b43-installer will be out near
the next Debian release when I imagine that will be standard.  I actually
prefer the script's new default of simply always installing the firmware
and not bothering to check for presence of the hardware.

While I was at it, the attached patches also do some cleanup on the
script.  The big case statement is using ranges to match multiple chips,
since that blob is getting too big otherwise.  Also moved the detection
of the BCM4306/3 chips inside the case statement (should be faster).


One major remaining concern with the postinst script.  What about systems
with multiple Broadcom 802.11 chips installed?  If I have a very recent
system, I might plug in an old legacy chip card for initial installation
when the firmware/driver for a newer chip isn't readily available.  In
this case, the script will fail since it has a legacy chip, when it
should succeed because it also has a newer chip...

Got to revisions of the patch, the difference is rev1 is more aggressive
about combining chip id ranges together.  I don't know which you prefer.


-- 
(\___(\___(\__  --=> 8-) EHM <=--  __/)___/)___/)
 \BS (| ehem+sig...@m5p.com  PGP 87145445 |)   /
  \_CS\   |  _  -O #include  O-   _  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445


--- firmware-b43-installer.postinst.orig2015-04-05 19:21:07.0 
-0700
+++ firmware-b43-installer.postinst 2016-03-23 20:52:14.0 -0700
@@ -67,48 +67,46 @@
 exit 0
 fi
 
-# Fix for BCM4306/3 [14e4:4320] (rev 03)
-chip=`lspci -n | grep -o "14e4:4320 (rev 03)"` || true
-if [ "$chip" ] ; then
-   echo "Your card is BCM4306/3 [14e4:4320] (rev 03), firwmare 5.100.138 will 
be used"
-   latest_firmware
-   exit 0
-fi 
-
-# Fix for BCM4306/3 [14e4:4324] (rev 03)
-chip=`lspci -n | grep -o "14e4:4324 (rev 03)"` || true
-if [ "$chip" ] ; then
-   echo "Your card is BCM4306/3 [14e4:4324] (rev 03), firwmare 5.100.138 will 
be used"
-   latest_firmware
-   exit 0
-fi
-   
 # check chip
-pci=`lspci -n | grep -o "14e4:[1234567890abcdef]\+"` || true
+pci=`lspci -n -d 14e4: | grep -o "14e4:[1234567890abcdef]\+"` || true
 
-if [ -n "$pci" ]; then
-   for device in $pci; do
-   device_id=`echo $device | cut -d: -f2`
-   case $device_id in
-   4301 | 4306 | 4320 |4324 | 4325)
-   legacy=1
-   ;;
-   4307 | 4311 | 4312 | 4315 | 4318 | 4319 | 4321 | 4328 | 4329 | 
432b | 432c | 4331 | 4353 | 4357 | 5354)
-   latest=1
-;;
-   4322 | 4358 | 4365 | 4727 | a8d8)
-   # b43 upstream says 3.6+ for a8d8
-   unsupported="$unsupported $device_id"
-   ;;
-   0576 | 4313 | 432a | 432d | 4358 | 4359 | 435a | a99d)
-nottested=1
-;;
-   *)
-   ;;
-   esac
-   done
+if [ -z "$pci" ]; then
+   echo "No Broadcom 802.11 chips found, aborting firmware installation."
+   exit 1
 fi
 
+for device in $pci; do
+   device_id=${device#14e4:}
+   case $device_id in
+   4301 | 4306 | 4325)
+   legacy=1
+   ;;
+   4320 | 4324)
+   chip=`lspci -n -d ${device}`
+   if [ "${chip}" != "${chip%${device} (rev 03)}" ] ; then
+  latest=1
+   else
+  legacy=1
+   fi
+   ;;
+   4307 | 4311 | 4312 | 4315 | 4318 | 4319 | 4321 | 4322 | 4328 | 4329 | 
432b | 432c | 4331 | 4350 | 4353 | 4357 | 4358 | 4359 | 43a9 | 43aa | 
47[01][0-9a-f] | a8d8 | a8db | 5354)
+   latest=1
+   ;;
+   4322 | 4358 | 4360 | 4365 | 43a0 | 43b1 | 4727)
+   unsupported="$unsupported $device_id"
+   ;;
+   4313)
+   # need to distinguish BCM4311 (untested) from BCM4313 (not 
supported)
+   nottested=1
+   ;;
+   0576 | 432a | 432d | 4358 | 4359 | 435a | a8d6 | a99d)
+   nottested=1
+   ;;
+   *)
+   ;;
+   esac
+done
+
 if [ "$legacy" ]; then
echo "An unsupported BCM4301, BCM4306 or BCM4306/2 device was found."
echo "Use b43legacy firmware (firmware-b43legacy-installer package) 
instead."
--- firmware-b43-installer.postinst.orig2015-04-05 19:21:07.0 
-0700
+++ firmware-b43-installer.postinst

Bug#760813: firmware-b43-installer: Package device detection fails without PCI hardware

2016-03-23 Thread Elliott Mitchell
found 760813 1:019-2
quit

I should add onto this report.  While not the identifier of the 802.11
core, `lspci -n -d 14e4:` gives:
00:00.0 0600: 14e4:4716 (rev 01)
00:00.1 0600: 14e4: (rev 01)

So looking for PCI device id 4716 should nominally work.

Better tests is to do something like `ls /sys/class/net/wlan?/phy80211`
which will provide an indication if the driver has managed to detect a
802.11 core and loaded (gah! didn't make good observations of the
situation with driver loaded, but firmware absent).

A few more observations:

$ cat /sys/devices/bcma0\:1/manuf
0x4BF
$ cat /sys/devices/bcma0\:1/id
0x812
$ ls /sys/devices/bcma0\:1/net
wlan0

I'll admit checking for 47[0-9][0-9] may well be the simplest solution.


-- 
(\___(\___(\__  --=> 8-) EHM <=--  __/)___/)___/)
 \BS (| ehem+sig...@m5p.com  PGP 87145445 |)   /
  \_CS\   |  _  -O #include  O-   _  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445



Bug#760813: firmware-b43-installer: Package device detection fails without PCI hardware

2014-09-07 Thread Elliott Mitchell
Package: firmware-b43-installer
Version: 1:015-14.1

I'm having an entertaining time with DebWRT trying to get an embedded
device running with Debian.  Inside firmware-b43-installer's postinst
script it tests for Broadcom hardware using the line:

pci=`lspci -n | grep -o "14e4:[1234567890abcdef]\+"` || true

This though requires a system that has PCI *somewhere* on it and the
Broadcom chip to be attached to that.  The device I'm working with is a
Broadcom 4718, where the 802.11n core is I suspect a variant of the
Broadcom 4329.

Values of interest from /sys/devices/ssb0:0

vendor
0x04bf

coreid
0x0812

name
IEEE 802.11

revision
17

uevent
MODALIAS=ssb:v04BFid0812rev11


Looks like the version of the b43 driver in the Linux kernel I'm working
with lacks support, but I suspect a later version will support the 802.11
core.  Once that comes down the pipeline the above test will be causing
problems.


-- 
(\___(\___(\__  --=> 8-) EHM <=--  __/)___/)___/)
 \BS (| ehem+sig...@m5p.com  PGP 87145445 |)   /
  \_CS\   |  _  -O #include  O-   _  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org