OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Brightness Control
cortez
post Oct 16 2007, 02:01 AM
Post #1





Group: Members
Posts: 376
Joined: 18-March 04
From: The Netherlands
Member No.: 2,380



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:

CODE
#!/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!
Go to the top of the page
 
+Quote Post
ZDevil
post Oct 16 2007, 02:07 AM
Post #2





Group: Members
Posts: 2,003
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882



Wow. That's nice!

It's good to see your "decaffeinated" Z running Debian? biggrin.gif

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. smile.gif
http://www.oesf.org/forum/index.php?act=fi...&pid=168157
Go to the top of the page
 
+Quote Post
ZDevil
post Oct 16 2007, 04:52 AM
Post #3





Group: Members
Posts: 2,003
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882



@cortez: so would you be interested in making sound play (through the speaker) as well? wink.gif
Go to the top of the page
 
+Quote Post
cortez
post Oct 16 2007, 11:55 AM
Post #4





Group: Members
Posts: 376
Joined: 18-March 04
From: The Netherlands
Member No.: 2,380



QUOTE(ZDevil @ Oct 16 2007, 12:07 PM) *
It's good to see your "decaffeinated" Z running Debian? biggrin.gif

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. smile.gif
http://www.oesf.org/forum/index.php?act=fi...&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 rolleyes.gif

QUOTE(ZDevil @ Oct 16 2007, 02:52 PM) *
@cortez: so would you be interested in making sound play (through the speaker) as well? wink.gif

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?
Go to the top of the page
 
+Quote Post
jpmatrix
post Oct 16 2007, 01:15 PM
Post #5





Group: Members
Posts: 1,019
Joined: 15-February 05
From: France
Member No.: 6,477



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 ? smile.gif
Go to the top of the page
 
+Quote Post
ZDevil
post Oct 16 2007, 01:33 PM
Post #6





Group: Members
Posts: 2,003
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882



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 laugh.gif ).
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.
Go to the top of the page
 
+Quote Post
ZDevil
post Oct 16 2007, 01:35 PM
Post #7





Group: Members
Posts: 2,003
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882



QUOTE(jpmatrix @ Oct 16 2007, 11:15 PM) *
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 ? smile.gif



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
?
Go to the top of the page
 
+Quote Post
jpmatrix
post Oct 17 2007, 03:27 AM
Post #8





Group: Members
Posts: 1,019
Joined: 15-February 05
From: France
Member No.: 6,477



QUOTE(ZDevil @ Oct 16 2007, 11:35 PM) *
QUOTE(jpmatrix @ Oct 16 2007, 11:15 PM) *
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 ? smile.gif



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 sad.gif

so i decided to put a my_user NOPASSWD: ALL in sudoers for my normal user...
now sudo setfl - is working smile.gif

thanks smile.gif
Go to the top of the page
 
+Quote Post
Chero
post Oct 21 2007, 11:52 PM
Post #9





Group: Members
Posts: 1,141
Joined: 22-April 04
From: Belgium
Member No.: 2,962



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.
Go to the top of the page
 
+Quote Post
jpmatrix
post Oct 22 2007, 07:34 AM
Post #10





Group: Members
Posts: 1,019
Joined: 15-February 05
From: France
Member No.: 6,477



QUOTE(Chero @ Oct 22 2007, 09:52 AM) *
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 ?
Go to the top of the page
 
+Quote Post
Chero
post Oct 22 2007, 11:46 AM
Post #11





Group: Members
Posts: 1,141
Joined: 22-April 04
From: Belgium
Member No.: 2,962



QUOTE(jpmatrix @ Oct 22 2007, 05:34 PM) *
QUOTE(Chero @ Oct 22 2007, 09:52 AM) *
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.
Go to the top of the page
 
+Quote Post
scottlfa
post Oct 25 2007, 04:03 PM
Post #12





Group: Members
Posts: 283
Joined: 1-October 07
From: Blacksburg, SC, USA
Member No.: 20,773



Amy chance of a deb of it? or tar ball?
Go to the top of the page
 
+Quote Post
Chero
post Oct 25 2007, 10:00 PM
Post #13





Group: Members
Posts: 1,141
Joined: 22-April 04
From: Belgium
Member No.: 2,962



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
Go to the top of the page
 
+Quote Post
judecn
post Nov 25 2007, 06:31 PM
Post #14





Group: Members
Posts: 11
Joined: 25-November 07
Member No.: 20,984



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).
Go to the top of the page
 
+Quote Post
scottlfa
post Nov 25 2007, 08:05 PM
Post #15





Group: Members
Posts: 283
Joined: 1-October 07
From: Blacksburg, SC, USA
Member No.: 20,773



Found this worked for me pretty well.

CODE
###########################
# 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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 27th December 2014 - 12:52 AM