Quote:
Originally Posted by GRAHAM HAMILTON
Hello,
I have a low end 7" CnMBook running modified Debian OS. Is there any way to adjust the screen brightness, if possible by adding a Fn command Up and Down?
Many thanks,
GH
|
Do you know which graphics chip it has? The
lspci command might show. It may be that the /sys/devices/... path is influenced by the model.
It's not a popular machine so netsearching for CnMBook and brightness is not helpfule but
netsearching for debian and brightness may help.
Here's a script that works on the Samsung N150:
Code:
#!/bin/bash
# increase/decrease/set/get the backlight brightness (range 0-255)
#
# 6jun10 Charles
# * Creation by copying from http://wiki.archlinux.org/index.php/Samsung_N150#Backlight
# * Added fullpath to setcpi so can be run by non-root users wth simple sudo.
# * Changed adjusment AMOUNT from 8 to (current brightness / 10) + 1
# PCI device on which to operate
DEVICE=00:02.0
# Minimum backlight value reachable via "down"
MIN=1
# Default backlight level when toggling on
DEFAULT=64
#get current brightness in hex and convert to decimal
var1=`/sbin/setpci -s $DEVICE F4.B`
var1d=$((0x$var1))
let AMOUNT=1+var1d/10
case "$1" in
up)
#calculate new brightness
var2=`echo "ibase=10; obase=16; a=($var1d+$AMOUNT);if (a<255) print a else print 255" | bc`
echo "$0: increasing brightness from 0x$var1 to 0x$var2"
/sbin/setpci -s $DEVICE F4.B=$var2
;;
down)
#calculate new brightness
var2=`echo "ibase=10; obase=16; a=($var1d-$AMOUNT);if (a>$MIN) print a else print $MIN" | bc`
echo "$0: decreasing brightness from 0x$var1 to 0x$var2"
/sbin/setpci -s $DEVICE F4.B=$var2
;;
set)
#n.b. this does allow "set 0" i.e. backlight off
echo "$0: setting brightness to 0x$2"
/sbin/setpci -s $DEVICE F4.B=$2
;;
get)
echo "$0: current brightness is 0x$var1"
;;
toggle)
if [ $var1d -eq 0 ] ; then
echo "toggling up"
/sbin/setpci -s $DEVICE F4.B=$DEFAULT
else
echo "toggling down"
/sbin/setpci -s $DEVICE F4.B=0
fi
;;
*)
echo "usage: $0 {up|down|set <val>|get|toggle}"
;;
esac
exit 0
The PCI device path "00:02.0" and field "F4.B" are hardware dependent; the values above are for the N150 which uses the Intel GMA3150 built into the Intel NM10 (formerly Pineview) chipset.
The method to map an Fn key to call it depends on which desktop you are using. Assuming the script is /usr/local/sbin/backlight, for Xfce the method is
Code:
Menu->Settings->Keyboard->"Application Shortcuts"
Add
Command: sudo /usr/local/sbin/backlight up
Shortcut: (pressed Fn+Up), got XF86MonBrightnessUp
and similarly for down.
The sudoers file must be configured to allow the user to run /usr/local/sbin/backlight, for example by:
Code:
Cmnd_Alias NETBOOK_CMDS = /usr/local/sbin/backlight, /usr/local/sbin/rftoggle, /usr/local/sbin/cpufreq_toggle
%users ALL=(ALL) NOPASSWD: NETBOOK_CMDS