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 Thu 23 Oct 2014, 12:44
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 [4 Posts]  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
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 
Karl Godt


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

PostPosted: Wed 07 Aug 2013, 05:21    Post subject:  

Update :

Want first to say that the kernel acpi driver named video.ko apparently is responsible for creating sysfs files .
I detected it while running with the video.ko driver blacklisted .
Code:
/sbin/modprobe -v --first-time video brightness_switch_enabled=1

issues
Quote:
insmod /lib/modules/2.6.30.9-KRG-i486-compiled-AcerLaptop-rev1/kernel/drivers/acpi/video.ko brightness_switch_enabled=1


My script named as set_backlight
Code:
set_backlight info

issues
Quote:
GENERAL INFO:
/sys/class/backlight/acpi_video0/uevent
-rw-r--r-- 1 root root 4096 Aug 7 10:31
No entry.

CURRENT:
/sys/class/backlight/acpi_video0/actual_brightness
-r--r--r-- 1 root root 4096 Aug 7 10:31
CUR_SET='12'

SET AS:
/sys/class/backlight/acpi_video0/brightness
-rw-r--r-- 1 root root 4096 Aug 7 10:31
_SET='0'

MAXIMUM to be SET TO:
/sys/class/backlight/acpi_video0/max_brightness
-r--r--r-- 1 root root 4096 Aug 7 10:31
MAX_SET='15'

Code:
set_backlight 10

works for me currently running kernel 2.6.30.9 on Asus EeePC 1005HAG (also the Fn F5/F6 keys to step down/up the backlight) .

Reference to Thread that woke me up >
Laptop Brightness Issues- Toshiba T115d/Precise 5.7 (Solved)
http://murga-linux.com/puppy/viewtopic.php?t=87819
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


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

PostPosted: Wed 07 Aug 2013, 05:46    Post subject:  

Finally found Iguleder|'s (Dima Krassner|'s) acpi researches :

ppower 1 http://murga-linux.com/puppy/viewtopic.php?p=454711&search_id=89015258#454711
ppower 2+3 http://murga-linux.com/puppy/viewtopic.php?p=458624&search_id=89015258#458624

Power saving tweaks http://murga-linux.com/puppy/viewtopic.php?p=442436&search_id=1283945961#442436
Back to top
View user's profile Send private message Visit poster's website 
greengeek

Joined: 20 Jul 2010
Posts: 2596
Location: New Zealand

PostPosted: Sun 12 Oct 2014, 14:30    Post subject:  

Hi Karl, I am trying to use your script set_bl above but it returns an error as follows:
Code:
# set_bl 2
/sys/class/backlight/acpi_video0/brightness
/sys/class/backlight/toshiba/brightness
/usr/bin/set_bl: line 85: /sys/class/backlight/acpi_video0/ /sys/class/backlight/toshiba//brightness: No such file or directory
#


I am using a Toshiba laptop which does not seem to respond to some other common methods for backlight adjustment. It does respond to xrandr commands and the xgamma adjustments but I would like to get your script working if possible.

I do seem to have the correct directories available, so I don't know what is generating the error message. Is it normal that two forward slashes "//" are showing in the final line of the error message?

EDIT : The following commands do help me to adjust my backlight :
echo 0 > /sys/class/backlight/acpi_video0/brightness
echo 1 > /sys/class/backlight/acpi_video0/brightness
echo 2 > /sys/class/backlight/acpi_video0/brightness

No other values work on this PC so it seems that "2" is the max permissible number for my video card (early nvidia running nouveau driver at present)

EDIT 2 : I am using a Slacko 5.6 derivative

EDIT 3 : Sorry, should have posted the output of set_bl info:
Code:
# set_bl info
GENERAL INFO:
/sys/class/backlight/acpi_video0/uevent
-rw-r--r-- 1 root root 4096 Oct 13 06:28
/sys/class/backlight/toshiba/uevent
-rw-r--r-- 1 root root 4096 Oct 13 06:29
No entry.

CURRENT:
/sys/class/backlight/acpi_video0/actual_brightness
-r--r--r-- 1 root root 4096 Oct 13 06:28
/sys/class/backlight/toshiba/actual_brightness
-r--r--r-- 1 root root 4096 Oct 13 06:29
CUR_SET='2
7'

SET AS:
/sys/class/backlight/acpi_video0/brightness
-rw-r--r-- 1 root root 4096 Oct 13 06:54
/sys/class/backlight/toshiba/brightness
-rw-r--r-- 1 root root 4096 Oct 13 06:17
_SET='2
7'

MAXIMUM to be SET TO:
/sys/class/backlight/acpi_video0/max_brightness
-r--r--r-- 1 root root 4096 Oct 13 06:28
/sys/class/backlight/toshiba/max_brightness
-r--r--r-- 1 root root 4096 Oct 13 06:29
MAX_SET='2
7'
#

.
Tosh_backlight.jpg
 Description   
 Filesize   35.13 KB
 Viewed   37 Time(s)

Tosh_backlight.jpg

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
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.0637s ][ Queries: 13 (0.0036s) ][ GZIP on ]