Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 May 2013, 11:14
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
backlight settings cl script
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 2675
Location: Kiel,Germany

PostPosted: Fri 01 Jun 2012, 15:58    Post subject:  backlight settings cl script
Subject description: netbook was having "0" in daylight
 

Good day !

Today i booted my netbook to find having set a zero in

" /sys/class/backlight/acpi_video0/brightness " .

I remember iguleder had a small c binary in his squeeze dpup times nearly two years ago , but that had not been accessible for me today .

So i hug a script called " set_bl " -- if anyone discovers bugs or different paths or max values, please let me know :

Code:
#!/bin/sh
# Wriiten by Karl Reimer Godt
# Applies the usual "Puppy License"
Version='1.0 Puppy-Linux-Racy_5.3 KRG'

bckl_dir=`echo -e /sys/class/backlight/*/`
curr_file=/sys/class/backlight/*/actual_brightness
set_file=/sys/class/backlight/*/brightness
max_file=/sys/class/backlight/*/max_brightness
uevent_file=/sys/class/backlight/*/uevent

usage(){
MSG="
$0 [list|info|help|version] [ # [FILENAME]]

Script to set the display brightness for Laptops.
Defaultfilename : /sys/class/backlight/*/brightness

"
if [ "$2" ];then
MSG="$MSG

$2"
fi
echo "$MSG"
[ "$DISPLAY" ] && xmessage -bg blue3 "$MSG"
exit $1
}

case $1 in
help) usage 0;;
version) echo -e "\n$0: Version '$Version'\nTry help for more info\n"
exit 0;;
list) if find /sys -name "backlight" ;then :
else echo "No backlight support detected. Did the driver load?"
exit 1;fi
ls -1 /sys/class/backlight/*/
exit $?
;;
info)


echo "GENERAL INFO:"
ls -l $uevent_file |rev|sed 's- -\n-'|rev
CONT=`cat $uevent_file`
[ "$CONT" ] || CONT='No entry.'
echo "$CONT"
echo

echo "CURRENT:"
ls -l $curr_file |rev|sed 's- -\n-'|rev
CONT=`cat $curr_file`
[ "$CONT" ] || CONT='No entry.'
echo "CUR_SET='$CONT'"

echo

echo "SET AS:"
ls -l $set_file |rev|sed 's- -\n-'|rev
CONT=`cat $set_file`
[ "$CONT" ] || CONT='No entry.'
echo "_SET='$CONT'"

echo

echo "MAXIMUM to be SET TO:"
ls -l $max_file |rev|sed 's- -\n-'|rev
CONT=`cat $max_file`
[ "$CONT" ] || CONT='No entry.'
echo "MAX_SET='$CONT'"

;;

[0-9]*)
VAL=$1

if [ "$2" ];then
[ -e "$2" ] || usage 1 "'$2' does not exist."
[ -d "$2" ] && usage 1 "Is a directory."
[ -f "$2" ] || usage 1 "Not a regular file."
echo $VAL > "$2"
exit $?;fi

if find $bckl_dir -name "brightness";then
echo $VAL > $bckl_dir/brightness
else
usage 1 "Not Found."
fi
exit $?
;;
"") usage 1 "Need Parameter.";;
*) usage 1 "Unknown Parameter.";;
esac
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0360s ][ Queries: 11 (0.0032s) ][ GZIP on ]