H1940 screen dimming under GPE

From: Tom Talpey <tmtalpey_at_rcn.com>
Date: Thu, 01 Feb 2007 13:03:51 -0500

The H1940's GPE environment uses a daemon called ipaq-sleep to
control screen auto-dimming and suspend, which in turn depends
on a missing executable /usr/bin/bl to control the backlight. The
one in the OE build tree is obsolete and also incompatible with the
H1940 support.

So here's a shell script to do it, just unpack it into /usr/bin and
be sure to chmod +x /usr/bin/bl. Works for me!

Be careful of the extra two spaces after "on" in line 13. The
ipaq_sleep program is very picky about where it finds the number.
Also, the "toggle" option is used by the long-power-press key
handler to switch the backlight on and off manually, but that
doesn't seem to work properly due to the name of the key, or
something.

I have a similar fix for the Opie install too, but it requires minor
code changes in libopie2, which means a rebuild.

Tom.

Index: rootfs/usr/bin/bl
===================================================================
--- /dev/null
+++ rootfs/usr/bin/bl
@@ -0,0 +1,43 @@
+#!/bin/sh
+# get/set relative screen brightness
+
+dv='/sys/class/backlight/s3c2410-bl'
+br=`cat $dv/brightness 2>/dev/null`
+bm=`cat $dv/max_brightness 2>/dev/null`
+bl=`expr $br \* 256 / $bm 2>/dev/null`
+
+case x$1 in
+"x")
+ case x$bl in
+ x|x0) echo "off " ;;
+ *) echo "on " $bl ;;
+ esac
+ exit 0
+ ;;
+"xtoggle")
+ case x$bl in
+ x|x0) bl=256 ;;
+ *) bl=0 ;;
+ esac
+ ;;
+"xon")
+ bl=256
+ ;;
+"xoff")
+ bl=0
+ ;;
+x[0-9]*)
+ if [ $1 -gt 255 ] ; then
+ bl=256
+ else
+ bl=$1
+ fi
+ ;;
+*)
+ echo "usage: $0 [on|off|toggle|<0-255>]" 2>&1
+ exit 1
+ ;;
+esac
+
+expr $bl \* $bm / 256 > $dv/brightness 2>/dev/null
+exit 0
Received on Thu Feb 01 2007 - 13:04:27 EST

This archive was generated by hypermail 2.2.0 : Thu Feb 01 2007 - 13:04:44 EST