From: Elan Ruusamäe Date: Thu, 27 Mar 2014 22:57:00 +0000 (+0200) Subject: handle only firmware add requests X-Git-Tag: 0.4.11~1 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=5a873f5d5eda4af38c2cc889fd6923e654188c17;p=projects%2Frc-scripts.git handle only firmware add requests with handling all hotplug events, we ran into some kind of race condition which resulted only one of the two bnx2 devices to appear working: [ 16.425932] bnx2: Firmware file "bnx2/bnx2-rv2p-06-6.0.15.fw" is invalid after inspecting bnx2.c sourcecode, appears that this error is printed only if firmware file is too short and the firmware itself is and has always been 5696 bytes (in pld packages). internally in firmware loader, the race appeared as: + '[' ! -e /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/loading ']' + '[' -e /lib/firmware/updates/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw ']' + continue + '[' -e /lib/firmware/updates/bnx2/bnx2-rv2p-06-6.0.15.fw ']' + continue + '[' -e /lib/firmware/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw ']' + >/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/loading + echo 1 + >/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/data + cat /lib/firmware/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw /lib/firmware/firmware-loader.sh[29]: cat: : No such device --- diff --git a/firmware-loader.sh b/firmware-loader.sh index 82232a8d..d9a37821 100755 --- a/firmware-loader.sh +++ b/firmware-loader.sh @@ -1,10 +1,17 @@ #!/bin/sh set -e +# handle only firmware add requests +if [ "$SUBSYSTEM" != "firmware" ]; then + exit 0 +fi +if [ "$ACTION" != "add" ]; then + exit 0 +fi + FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ /lib/firmware/$(uname -r) /lib/firmware" -# add initrd code to print to kmsg # @param string message # @param int loglevel. defaults to "6" (info) # Log levels can be: