Subversion Repositories oBacklight

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/tags/oBacklight 0.3.2/src/changelog.txt
0,0 → 1,21
2010-06-29 Marcus Uddenhed <marcus@osource.se>
 
* oBacklight.sh (file): Removed .sh file ending for startup script conformance.
 
* oBacklight (core): Rewritten entire core to use ACPI calls instead of folder monitoring.
 
* changelog.txt (text): Fixed faulty changelog format & missing changes from 2010-06-15.
 
* readme.txt (text): Minor text changes.
 
2010-06-15 Marcus Uddenhed <marcus@osource.se>
 
* readme.txt (text): Added contact information.
 
* license.txt (file): Added License file.
 
2010-05-01 Marcus Uddenhed <marcus@osource.se>
 
* readme.txt (file): Created.
 
* oBacklight.sh (file): Created.
/tags/oBacklight 0.3.2/src/license.txt
0,0 → 1,20
Copyright (c) 2010, oSource Development
 
All rights reserved.
 
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
 
* Neither the name of the oSource Development nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/tags/oBacklight 0.3.2/src/oBacklight
0,0 → 1,136
#!/bin/bash
 
#####################################################################
# Simple script to catch the changes to backlight events on sony #
# in combination with nvidia_bl. #
# #
# Tested with a Sony Vaio VPCCW1S1E Laptop. #
# #
# This has been tested on openSUSE 11.2 & 11.3 but should #
# work on any distributions. #
# #
# Released under the BSDL Licens #
# #
# Developer: oSource Development #
# DevTeam: Marcus Uddenhed #
# Version: 0.3.2 #
# #
# Web: http://dev.osource.se/software/obacklight/ #
# Rss: http://dev.osource.se/category/obacklight/feed/ #
# #
# Last Updated: 2010-06-24 13:21 #
# #
#####################################################################
 
### BEGIN INIT INFO
# Provides: oBacklight
# Required-Start: $acpid
# Default-Start: 5
# Default-Stop: 0 1 2 3 6
# Short-Description: Provides a backlight event handler for nvidia_bl
# Description: Provides a backlight event handler for nvidia_bl.
# Captures all backlight events from ACPI Events.
### END INIT INFO
 
init() {
# Default parameters
BBL="2" # Default brightness level when on battery(0-7).
SCB="sony" # Set which system ACPI is used.
# run 'sudo ls /sys/class/backlight' to determine your type.
# Available options: sony
 
# Set correct value to /sys/class/backlight/nvidia_backlight/brightness
GVAR=$(cat /sys/class/backlight/nvidia_backlight/brightness)
if [ "$GVAR" > "7" ]
then
echo "7" > /sys/class/backlight/nvidia_backlight/brightness
fi
 
# Check if oBacklight.def exists
if [ ! -e "/root/oBacklight.def" ]
then
echo "7" > /root/oBacklight.def
fi
}
 
start() {
 
/etc/init.d/oBacklight run &
 
}
 
stop() {
 
echo $(cat /sys/class/backlight/nvidia_backlight/brightness) > /root/oBacklight.def
killall -r oBacklight
 
}
 
run() {
 
GVAR=$(cat /root/oBacklight.def)
echo $GVAR > /sys/class/backlight/nvidia_backlight/brightness
 
if [ "$SCB" = "sony" ]
then
 
while [ exit != 130 ]
do
 
GVAR=$(cat /sys/class/backlight/nvidia_backlight/brightness)
 
CMD=$(acpi_listen -c 1 | egrep -o " [0-9].+" | egrep -o "[0-9].+")
 
# Brightness down acpi event
if [ "$CMD" == "00000001 00000010" ]
then
if [ "$GVAR" != "0" ]
then
SVAR=$(($GVAR - 1))
echo $SVAR > /sys/class/backlight/nvidia_backlight/brightness
echo $SVAR > /root/oBacklight.def
fi
fi
 
# Brightness up acpi event
if [ "$CMD" == "00000001 00000011" ]
then
if [ "$GVAR" != "7" ]
then
SVAR=$(($GVAR + 1))
echo $SVAR > /sys/class/backlight/nvidia_backlight/brightness
echo $SVAR > /root/oBacklight.def
fi
fi
 
# AC to battery change
if [ "$CMD" == "00000081 00000000" ]
then
if [ "$GVAR" > "$BBL" ]
then
echo $BBL > /sys/class/backlight/nvidia_backlight/brightness
echo $BBL > /root/oBacklight.def
fi
fi
 
done
 
fi
 
}
 
case $1 in
start)
start
;;
stop)
stop
;;
run)
init
run
;;
*)
echo "start|stop|run"
;;
esac
/tags/oBacklight 0.3.2/src/readme.txt
0,0 → 1,22
Release notes for oBacklight v0.3.2 2010-06-29
==============================================
 
Overview:
Simple script to catch the changes to backlight events on laptops in combination with
the nvidia_bl found here: http://www.nvnews.net/vbulletin/showthread.php?t=143025
 
Purpose:
Provide bridge between nvidia_bl and FN brightness keys.
 
Issue Summary:
* Totally rewritten core functionality to use ACPI events instead of folder monitoring.
 
Notes:
This script has been tested on openSUSE 11.2 & 11.3 but should work on any distribution and with Sony Vaio VPCCW1S1E Laptop.
 
Disclaimer:
This software is released with the BSDL license and the license is in the license.txt file that should accompany this software.
 
Contact:
http://dev.osource.se/
http://dev.osource.se/software/obacklight/