OESF Portables Forum
Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: eviLjazz on June 07, 2004, 12:34:23 am
-
Hi everybody,
just stumbled over jgraves post here:
http://www.zaurususergroup.com/index.php?n...iewtopic&t=3262 (https://www.oesf.org/forums/index.php?showtopic=3262)
It\'s very nice, but it needs xkeymouse to function properly.
I\'ve merged his scripts and got it working with the default openbox window manager. OpenBox can be configured with keymappings that can also execute apps or scripts. This is also the way changing the screen orientation works (that is: Sys_Req is triggered and openbox launches chkhinge).
Here is my merged version of jgraves\' scripts:
#!/bin/sh
# Get the current value
CURRENT_VALUE=`cat $HOME/Choices/common/backlight`
MIN_VALUE=0
MAX_VALUE=6
case "$1" in
up)
#If it is not already at the max value, increment it one.
if [ $CURRENT_VALUE = $MAX_VALUE ]; then
NEW_VALUE=$(($CURRENT_VALUE))
else
NEW_VALUE=$(($CURRENT_VALUE+1))
fi
;;
down)
#If it is not already at the min, decrement it one and save it.
if [ $CURRENT_VALUE = $MIN_VALUE ]; then
NEW_VALUE=$(($CURRENT_VALUE))
else
NEW_VALUE=$(($CURRENT_VALUE-1))
fi
;;
esac
setfl $NEW_VALUE
echo $NEW_VALUE > $HOME/Choices/common/backlight
UPDATE: I suggest using Zazz\' fl below instead of this merged script, as it is faster and doesn\'t stress the internal flash memory by writing the current brightness value over and over again.
Just save it into a file named light in /usr/local/bin and make it executable by chmod 755 /usr/local/bin/light.
You can now control the brightness level with
light up
or
light down
To make things work without using the terminal everytime, just add the following lines to the end of the <keyboard> element in the /etc/xdg/openbox/rc.xml (or $HOME/.config/openbox/rc.xml) file:
light down
light up
UPDATE: If you want to use Zazz\' fl below, just change light down to fl - and light up to fl +.
</keyboard> is the closing tag.
You\'ll need to restart either openbox or the whole X11. Simplest way is pressing CTRL-ALT-Backspace and just restarting the X11 Server via startx.
Using Fn-3 will lower the brightness, Fn-4 vice versa.
Please note, that this will only work, if you\'re using the openbox window manager. This is what comes with the default install of pdaXrom.
Regards,
evilJazz
-
This is a very useful feature, handled this way. I didn\'t have time to compile xkeymouse, but this was a simple one. 8)
I hope that the pdaXrom team gathers and includes these tricks in the next release! (maybe you should send it to them)
Anyway, thanks.
Zumi
-
I really hated those awkward scripts, storing the current value on the vulnerable nand flash, etc, so I modified \'setfl\' into what I called \'fl\' which has the following usage output:
Usage: fl [-+0-6?]
-: decrement brightness
+: increment brightness
0: set backlight off
1,2,3,4,5: set intermediate brightness
6: set maximum brightness
?: query current brightness value
Delete the funny script and directly bind \'fl -\' and \'fl +\' to the Fn+3/4 key combinations.
Binary and source attached.
-
The drain on the internal flash NAND was a problem I was thinking about before. I suggest using fl instead of light. It\'s also faster.
Zazz, btw, using labels and gotos in a high-level language as C is ugly and a no-go IMO.
Anyway, thanks for providing your tool!
I\'ve updated my article above.
-
Yes, goto\'s can result in worse code. But goto\'s can result in better code too, so what\'s the point here? ... Blaming bad code on goto\'s is silly... Goto\'s are often very useful for error cases, or odd cases that aren\'t structured and where structured constructs only result in strange and non-obvious code... So people, please don\'t vilify the poor goto...
--Linus Torvalds, 1998
-
Muhar
-
Binary and source attached.
Hey, this looks really nice, but where exactly do I find the code? Sorry if it's a dumb question, but I'm new!
I stumbled across this thread while looking for references to the "backlight" application behaviour. When the backlight switches off, so do updates to the display. I wrote a Perl script which increments a variable once per second and prints it out. When the backlight switches off, the variable still increments but nothing prints out. Is this intentional?
It would also be nice to make the home key suspend, perhaps in combination with shift or something to prevent it being hit accidentally. I seem to remember this is a bit like how the Psion 3a worked! And opening the clamshell doesn't switch on the machine.
-
Looks like the attachement didn't survive the forum transition. I have temporarily placed a copy here (http://zaurus.zapto.org/zazz/fl/) for download.
-
Brilliant. Thanks for the quick reply. I'll play with it when I get home.
-
What would be the file to edit to have it working with xfce4 ? does any1 have an idea ?
-
Very nice job Zazz. There's a similar thread with code at http://externe.net/zaurus/forum/viewtopic....1e23d8230cf494d (http://externe.net/zaurus/forum/viewtopic.php?t=618&highlight=backlight&sid=0eda10142c516972c1e23d8230cf494d), but fl is a little bit more user friendly.
The thread by jgraves seems to have gone walkabout, but the benefit of setting up the key mappings for FN-3 and FN-4 in xkeymouse is that it will work under any window manager.
# /etc/xkmc snippet
# keycode, modifier, action, action arg, extra parameters...
keycode=51, Mod2Mask, Exec, /usr/local/bin/fl -, NoFork, NoAutoRepeat
keycode=52, Mod2Mask, Exec, /usr/local/bin/fl +, NoFork, NoAutoRepeat