aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions/caldata.sh
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/lib/functions/caldata.sh')
-rw-r--r--package/base-files/files/lib/functions/caldata.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh
index 6862da7164..e22c7d27e6 100644
--- a/package/base-files/files/lib/functions/caldata.sh
+++ b/package/base-files/files/lib/functions/caldata.sh
@@ -64,7 +64,8 @@ caldata_from_file() {
[ -n "$target" ] || target=/lib/firmware/$FIRMWARE
- dd if=$source of=$target iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
+ # dd doesn't handle partial reads from special files: use cat
+ cat $source | dd of=$target iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $source"
}
@@ -73,13 +74,14 @@ caldata_sysfsload_from_file() {
local offset=$(($2))
local count=$(($3))
+ # dd doesn't handle partial reads from special files: use cat
# test extract to /dev/null first
- dd if=$source of=/dev/null iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
+ cat $source | dd of=/dev/null iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $source"
# can't fail now
echo 1 > /sys/$DEVPATH/loading
- dd if=$source of=/sys/$DEVPATH/data iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null
+ cat $source | dd of=/sys/$DEVPATH/data iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null
echo 0 > /sys/$DEVPATH/loading
}