OESF Portables Forum
Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Debian => Topic started by: cortez on October 16, 2007, 06:01:10 am
-
It's kind of irritating that a lot of distributions lack working brightness adjustment these days, while that's the most simple way of conserving the battery.
Since debian also lacks this control using Fn-3 and Fn-4, I thought I'd give it a try myself. Here's my solution:
First, copy the Angstrom script to /usr/bin and make it executable. The script I use is:
#!/bin/sh
# display-brightness.sh
# simple script to set display-brightness for zaurus clamshell
# author: patrick steiner <[EMAIL PROTECTED]>
# modified by: Ian Munsie <[EMAIL PROTECTED]>
# version: 1.01 | 13.07.2007 15:00
STEP=5
MIN=1
DRIVER="`ls /sys/class/backlight/|head -n 1`"
BRIGHTNESS_FILE="/sys/class/backlight/$DRIVER/brightness"
MAX_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/max_brightness`
POWER_FILE="/sys/class/backlight/$DRIVER/power"
POWER_ON=0
if [ ! -n "$1" ]; then
echo "max / current"
echo "$MAX_BRIGHTNESS / $ACTUAL_BRIGHTNESS"
elif [ "$1" = "up" ]; then
#test -x /usr/bin/bl && bl on
echo $POWER_ON >> $POWER_FILE
ACTUAL_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/actual_brightness`
let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS+$STEP
test "$CURRENT_BRIGHTNESS" -gt "$MAX_BRIGHTNESS" &&
CURRENT_BRIGHTNESS=$MAX_BRIGHTNESS
echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE
elif [ "$1" = "down" ]; then
ACTUAL_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/actual_brightness`
let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS-$STEP
test "$CURRENT_BRIGHTNESS" -lt "$MIN" && CURRENT_BRIGHTNESS=$MIN
echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE
else
echo -e "\nUsage:\n\t `basename $0` [up | down]\n"
fi
Next, apt-get xbindkeys and xbindkeys-config
Use xbindkeys-config to assign the display-brightness script to the Fn-3 and Fn-4 using the parameters down and up respectively. Then run xbindkeys
Et voila!
-
Wow. That's nice!
It's good to see your "decaffeinated" Z running Debian?
I simply use the setfl script from pdaXrom and change the brightness adjustment interval from 1 to 5, then use the icewm to bind the keys.
https://www.oesf.org/forum/index.php?act=fi...&pid=168157 (https://www.oesf.org/forum/index.php?act=findpost&pid=168157)
-
@cortez: so would you be interested in making sound play (through the speaker) as well?
-
It's good to see your "decaffeinated" Z running Debian?
I simply use the setfl script from pdaXrom and change the brightness adjustment interval from 1 to 5, then use the icewm to bind the keys.
https://www.oesf.org/forum/index.php?act=fi...&pid=168157 (https://www.oesf.org/forum/index.php?act=findpost&pid=168157)
Maybe I should use the search option a bit more often... Oh, and by the way, my C750 is still dead, it's my replacement C3100 that's running Debian
@cortez: so would you be interested in making sound play (through the speaker) as well?
I'm still in the exploration-phase, so I haven't been able to test the sound I'm afraid. It's really amazing that so far everything I install seems to work. No stability problems whatsoever. Ever tried the Mozilla variant Kazehakase? Anyway, give me a bit more time, and maybe I can help.
First I have to setup a build system. What do you guys use, scratchbox?
-
little problem again with the setfl script : my default user cannot change the brightness because it cannot access /sys/class/backlight/corgi-bl/brightness .....
should i use sudo setfl or is there a better way ?
-
Actually I find xbindkeys works better than the keys setting in IceWM. xbindkeys is totally WM-independent and it can correctly pick up the Fn key, which the .icewm/keys setting fails to bind. Now I can use [Fn]+3 & 4 to turn backlight up and down easily.
Scratchbox seems an ideal choice. But I have yet to spare some solid time to learn the basics and get some initial practice. So for now I am still using the native toolchain to build several apps that are missing in the official feeds. The GCC 4.2.1 toolchain really rocks! With a big (512MB) swap in both my internal CF and "external" microdrive many programs got compiled with ease.
Truly, most Debian ARM packages just work and they run faster than I assumed (after worrying so much about optimization and perfecting builds in the air ).
As for compiling strategy, I would use whatever available in the official feeds, while compiling new stuff (missing and "experimental") and recompiling things to better the performance along the way.
-
little problem again with the setfl script : my default user cannot change the brightness because it cannot access /sys/class/backlight/corgi-bl/brightness .....
should i use sudo setfl or is there a better way ?
How about:
creating a wheel group.
adding your user to the wheel group,
then visudo to set up the rights for the wheel group,
then chgrp wheel setfl
?
-
little problem again with the setfl script : my default user cannot change the brightness because it cannot access /sys/class/backlight/corgi-bl/brightness .....
should i use sudo setfl or is there a better way ?
How about:
creating a wheel group.
adding your user to the wheel group,
then visudo to set up the rights for the wheel group,
then chgrp wheel setfl
?
well,
surprisingly, i could not create a wheel group :
addgroup failed with error code
so i decided to put a my_user NOPASSWD: ALL in sudoers for my normal user...
now sudo setfl - is working
thanks
-
Related to this I'm playing with "gpe-conf" (the gpe-settings-apps)
So far I've got "date & time" , "network" (partial) , "users manager" , "usb" , "screen setup" (backlight!!), "cardinfo", "sytem info" working.
more on this later.
Chero.
-
Related to this I'm playing with "gpe-conf" (the gpe-settings-apps)
So far I've got "date & time" , "network" (partial) , "users manager" , "usb" , "screen setup" (backlight!!), "cardinfo", "sytem info" working.
more on this later.
Chero.
would you tell us more ? what did you install actually ? are these applets or menu items ? under which window manager ?
-
Related to this I'm playing with "gpe-conf" (the gpe-settings-apps)
So far I've got "date & time" , "network" (partial) , "users manager" , "usb" , "screen setup" (backlight!!), "cardinfo", "sytem info" working.
more on this later.
Chero.
would you tell us more ? what did you install actually ? are these applets or menu items ? under which window manager ?
I compiled gpe-conf and they are menu-items. The window manager doesn't matter.
-
Amy chance of a deb of it? or tar ball?
-
That's the plan, but the project is sleeping right now.
I have to include some config files in /etc to make everything work.
Chero
-
I think everything *except* gpe-conf and bl can be found in the feeds at the moment. Snarfing gpe-conf from Angstrom and getting the GPE support libraries from the feeds worked for me (as well as snarfing Angstrom's bl script in /usr/bin, which really does nothing more than invokes gpe-conf).
-
Found this worked for me pretty well.
###########################
# xbindkeys configuration #
###########################
#
# Version: 0.1.3
#
# If you edit this, do not forget to uncomment any lines that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier (on my keyboard):
# Control, Shift, Mod1 (Alt), Mod2 (NumLock),
# Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#
# Another way to specifie a key is to use 'xev' and set the
# keycode with c:nnn or the modifier with m:nnn where nnn is
# the keycode or the state returned by xev
#
# This file is created by xbindkey_config
# The structure is :
# # Remark
# "command"
# m:xxx + c:xxx
# Shift+...
#keystate_numlock = enable
#keystate_scrolllock = enable
#keystate_capslock = enable
#BrDown
"/usr/bin/display-brightness.sh down"
m:0x10 + c:12
Mod2 + 3
#BrUp
"/usr/bin/display-brightness.sh up"
m:0x10 + c:13
Mod2 + 4
#Left Click
#"xmodmap -e "pointer = 1 2 3""
# alt
#Middle Click
#"xmodmap -e "pointer = 2 3 1""
# m:0x0 + c:68
#Right click
#"xmodmap -e "pointer = 3 1 2""
# m:0x40 + c:105
# control
#Backlight On
"bl on"
m:0x10 + c:14
Mod2 + 5
#Backlight Off
"bl off"
m:0x10 + c:15
Mod2 + 6
#Home Row
#Calendar
#"xfce-terminal"
#Address
#Mail
#Home
#Menu
# End of xbindkeys configuration
file is .xbindkeyrc