On Tue, 2014-10-07 at 15:52 +0200, Petter Reinholdtsen wrote:
> Here is another draft patch for hw-detect. This one is tested, and
> find the missing firmware on my X200 test laptop.
>
> This approach keep the non-functioning code
The firmware agent is never coming back, so please do remove the related
code.
> and add two new
> approaches, one looking at the meta information for loadmed modules,
> and one parsing the dmesg output. The union from all three methods
> are then presented as the list of wanted firmware.
>
> diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
> index 60c6ff4..74db55b 100755
> --- a/check-missing-firmware.sh
> +++ b/check-missing-firmware.sh
[...]
> @@ -117,11 +129,30 @@ check_missing () {
> done
> done
>
> + # Workaround for bug #725714, the kernel and udev no longer
> + # let us know via /dev/.udev/firmware-missing and
> + # /run/udev/firmware-missing which firmware files the kernel
> + # drivers look for.
This belongs in the changelog not the code.
> This approach will only find firmware for
> + # the loaded kernel modules. Modules refusing to
> + # register/load when the firmware is missing will be missed.
> + for module in $(cut -d" " -f1 /proc/modules); do
> + for fwfile in $(modinfo $module | grep ^firmware: | cut -d: -f2); do
> + log "looking for firmware file $fwfile needed by $module"
> + add_if_fw_missing "$fwfile"
> + done
> + done
> + for fwfile in $(dmesg | grep 'firmware: failed' | sed 's/.*firmware: failed to load //' | cut -d" " -f1); do
Redundant use of grep; sed can do that (sed -n 's/.../.../p').
> + # Dummy make sure '-n "$modules"' test below find something
> + module=kernel
The driver name should appear at the start of the log line (after the
timestamp). Use that instead of 'kernel'.
> + log "looking for firmware file $fwfile requested by kernel"
> + add_if_fw_missing "$fwfile"
> + done
> +
Indentation of the above is inconsistent with the surrounding code (4
spaces vs hard tab).
Ben.
> if [ -n "$modules" ]; then
> log "missing firmware files ($files) for $modules"
> return 0
> else
> - log "no missing firmware in $MISSING"
> + log "no missing firmware for any kernel module"
> return 1
> fi
> }
>
> --
> Happy hacking
> Petter Reinholdtsen
>
>
--
Ben Hutchings
Logic doesn't apply to the real world. - Marvin Minsky
Attachment:
signature.asc
Description: This is a digitally signed message part