2017-08-20 12:49:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
FIRMWARE_DIRS="/lib/firmware /lib/firmware/postmarketos"
|
|
|
|
|
|
|
|
exec >>/var/log/firmwareload.log 2>&1
|
|
|
|
|
|
|
|
if [ ! -e "/sys/$DEVPATH/loading" ]; then
|
2022-10-14 11:46:40 +00:00
|
|
|
echo "firmware loader misses sysfs directory"
|
|
|
|
exit 1
|
2017-08-20 12:49:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
for DIR in $FIRMWARE_DIRS; do
|
2022-10-14 11:46:40 +00:00
|
|
|
[ -e "$DIR/$FIRMWARE" ] || continue
|
|
|
|
echo "loading $DIR/$FIRMWARE"
|
|
|
|
echo 1 > "/sys/$DEVPATH/loading"
|
|
|
|
cat "$DIR/$FIRMWARE" > "/sys/$DEVPATH/data"
|
|
|
|
echo 0 > "/sys/$DEVPATH/loading"
|
|
|
|
exit 0
|
2017-08-20 12:49:55 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# shellcheck disable=SC2039
|
|
|
|
echo -1 > "/sys/$DEVPATH/loading"
|
|
|
|
echo "cannot find firmware file '$FIRMWARE'"
|
|
|
|
exit 1
|