Bug#599741: firmware-b43legacy-installer: fails when there are multiple devices with similar PCI id
tags 599741 patch
thanks
On Sun, Oct 10, 2010 at 01:40:54PM -0400, Jaime Di Cristina wrote:
> The postinst script (firmware-b43legacy-installer.postinst) fails when
> multiple PCI devices are found with PCI ids starting with 14e4.
[...]
> From looking at the other install script (for b43) it seems to me that
> it suffers from the same bug.
I can confirm this issue also affects firmware-b43-installer and
firmware-b43-lpphy-installer.
Attached is a patch for correcting this. Each firmware-b43* postinst
was amended to loop through listed Broadcom devices.
Geoff
diff -Nru b43-fwcutter-013/debian/firmware-b43-installer.postinst b43-fwcutter-013/debian/firmware-b43-installer.postinst
--- b43-fwcutter-013/debian/firmware-b43-installer.postinst 2010-05-11 09:48:46.000000000 +1000
+++ b43-fwcutter-013/debian/firmware-b43-installer.postinst 2010-11-07 23:59:29.000000000 +1100
@@ -2,8 +2,6 @@
set -e
-tmp=`mktemp -q -d`
-
# check kernel version
if dpkg --compare-versions 2.6.25 gt `uname -r | cut -d- -f1`; then
echo "Kernel too old. This firmware needs >= 2.6.25!."
@@ -13,29 +11,46 @@
# check chip
pci=`lspci -n | grep -o "14e4:[1234567890]\+"` || true
+
if [ -n "$pci" ]; then
- if [ "`echo $pci | cut -d: -f2`" = "4301" ] && \
- [ "`echo $pci | cut -d: -f2`" = "4306" ]; then
- echo "Not supported card here (PCI id $pci)!"
- echo "Use b43legacy firmware."
- echo "Aborting."
- exit 1
- elif [ "`echo $pci | cut -d: -f2`" = "4315" ]; then
- echo "Not supported low-power chip with PCI id $pci!"
- echo "Aborting."
- exit 1
- elif [ "`echo $pci | cut -d: -f2`" = "4321" ] && \
- [ "`echo $pci | cut -d: -f2`" = "4324" ] && \
- [ "`echo $pci | cut -d: -f2`" = "4325" ] && \
- [ "`echo $pci | cut -d: -f2`" = "4328" ] && \
- [ "`echo $pci | cut -d: -f2`" = "4329" ] && \
- [ "`echo $pci | cut -d: -f2`" = "43b5" ]; then
- echo "Not supported chip: PCI id $pci!"
- echo "Aborting!"
- exit 1
- fi
+ for device in $pci; do
+ device_id=`echo $device | cut -d: -f2`
+ case $device_id in
+ 4301 | 4306)
+ legacy=1
+ ;;
+ 4315)
+ lpphy=1
+ ;;
+ 4321 | 4324 | 4325 | 4328 | 4329 | 43b5)
+ unsupported="$unsupported $device_id"
+ ;;
+ *)
+ ;;
+ esac
+ done
+fi
+
+if [ "$legacy" ]; then
+ echo "An unsupported BCM4301, BCM4303 or BCM4306/2 device was found."
+ echo "Use b43legacy firmware (firmware-b43legacy-installer package) instead."
+ echo "Aborting."
+ exit 1
+elif [ "$lpphy" ]; then
+ echo "An unsupported BCM4312 Low-Power (LP-PHY) device was found."
+ echo "Use b43 LP-PHY firmware (firmware-b43-lpphy-installer package) instead."
+ echo "Aborting."
+ exit 1
+elif [ "$unsupported" ]; then
+ echo -n "Unsupported device(s) found: PCI id "
+ for device_id in $unsupported; do echo -n "14e4:$device_id "; done
+ echo
+ echo "Aborting."
+ exit 1
fi
+tmp=`mktemp -q -d`
+
cd $tmp
export FIRMWARE_INSTALL_DIR="/lib/firmware"
diff -Nru b43-fwcutter-013/debian/firmware-b43legacy-installer.postinst b43-fwcutter-013/debian/firmware-b43legacy-installer.postinst
--- b43-fwcutter-013/debian/firmware-b43legacy-installer.postinst 2010-05-11 09:49:30.000000000 +1000
+++ b43-fwcutter-013/debian/firmware-b43legacy-installer.postinst 2010-11-07 23:30:58.000000000 +1100
@@ -3,16 +3,24 @@
set -e
# check chip
+supported=0
pci=`lspci -n | grep -o "14e4:[1234567890]\+"` || true
+
if [ -n "$pci" ]; then
- if [ "`echo $pci | cut -d: -f2`" != "4301" ] && \
- [ "`echo $pci | cut -d: -f2`" != "4306" ] && \
- [ "`echo $pci | cut -d: -f2`" != "4320" ]; then
- echo "Not supported card here (PCI id $pci)!"
- echo "Use b43 firmware. This is just for the b43legacy driver."
- echo "Aborting."
- exit 1
- fi
+ for device in $pci; do
+ device_id=`echo $device | cut -d: -f2`
+ if [ $device_id = 4301 ] || [ $device_id = 4306 ] || [ $device_id = 4320 ]; then
+ supported=1
+ break
+ fi
+ done
+fi
+
+if [ "$supported" = 0 ]; then
+ echo "No supported card found."
+ echo "Use b43 firmware. This is just for the b43legacy driver."
+ echo "Aborting."
+ exit 1
fi
tmp=`mktemp -q -d`
diff -Nru b43-fwcutter-013/debian/firmware-b43-lpphy-installer.postinst b43-fwcutter-013/debian/firmware-b43-lpphy-installer.postinst
--- b43-fwcutter-013/debian/firmware-b43-lpphy-installer.postinst 2010-05-11 09:52:37.000000000 +1000
+++ b43-fwcutter-013/debian/firmware-b43-lpphy-installer.postinst 2010-11-07 23:31:19.000000000 +1100
@@ -2,8 +2,6 @@
set -e
-tmp=`mktemp -q -d`
-
# check kernel version
if dpkg --compare-versions 2.6.32 gt `uname -r | cut -d- -f1`; then
echo "Kernel too old. This firmware needs >= 2.6.32!."
@@ -12,16 +10,28 @@
fi
# check chip
+supported=0
pci=`lspci -n | grep -o "14e4:[1234567890]\+"` || true
+
if [ -n "$pci" ]; then
- if ! echo $pci | grep -q '14e4:4315'; then
- echo "Not supported card here (PCI id $pci)!"
- echo "Use proper b43 or b43legacy firmware."
- echo "Aborting."
- exit 1
- fi
+ for device in $pci; do
+ device_id=`echo $device | cut -d: -f2`
+ if [ $device_id = 4315 ]; then
+ supported=1
+ break
+ fi
+ done
+fi
+
+if [ "$supported" = 0 ]; then
+ echo "No supported card found."
+ echo "Use proper b43 or b43legacy firmware."
+ echo "Aborting."
+ exit 1
fi
+tmp=`mktemp -q -d`
+
cd $tmp
export FIRMWARE_INSTALL_DIR="/lib/firmware"
Reply to: