[ltp] Re: T61, Lenovo quality, Linux pre-installed, alternatives

Stefan Monnier linux-thinkpad@linux-thinkpad.org
Fri, 09 May 2008 22:34:59 -0400


> I am not sure if "off" works, I'll tell in a few hours.
> Btw., ...
>   echo off >$FPRDEV/power/level
>  ... not the same as ...
>   echo "off">$FPRDEV/power/level
>  ... because the first variant might inlcude a space and a line break to
> the o and the two f.

Actually, no, they are 100% identical.  Neither will add a space, but
they both will add a newline.  If you don't want the newline, use the
"-n" argument to echo.

And indeed, I'm using the patch below to /etc/init.d/sysfsutils, because
some files in /sys need a terminating newline and others not.
Can't remember if that changes was for the fingerprint reader or
something else.


        Stefan


--- /etc/init.d/sysfsutils.dpkg-orig    2008-03-30 10:35:42.000000000 -0400
+++ /etc/init.d/sysfsutils      2008-03-30 10:33:16.000000000 -0400
@@ -44,7 +44,10 @@
                     fi
                 elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
                     if [ -f "/sys/$f1" ]; then
-                        echo -n "$f2" > "/sys/$f1"
+                       # Some fields need a terminating newline, others
+                       # need the terminating newline to be absent :-(
+                        echo -n "$f2" > "/sys/$f1" 2>/dev/null ||
+                           echo "$f2" > "/sys/$f1"
                     else
                         log_failure_msg "unknown attribute $f1"
                     fi