dbus problem
Oguz Yarimtepe
comp.ogz at gmail.com
Thu Jul 17 11:32:02 UTC 2008
I tried to run the script below to test and adjust my brightness form
console at my hardy. Although i am able to set and get the brightness
values i dont see any change at the backlight. I dont know where to
check. What can be the reason?
Power Manager Brightness Applet is not working, too.
#!/bin/bash
#dependencies : hal and dbus
if [ "x$*" = "x" ]
then
echo ""
echo "Usage : $0 [OPTION]"
echo ""
echo 'Options :'
echo ' get : get the current brightness level'
echo ' up : increase the brightness with one level'
echo ' down : decrease the brightness with one level'
echo ' <level> : set the brigtness level'
exit
fi
dest="org.freedesktop.Hal"
object_path="/org/freedesktop/Hal/devices/computer_backlight_0"
message="org.freedesktop.Hal.Device.LaptopPanel.GetBrightness"
#get the current brightness
value="$(dbus-send --system --print-reply --dest="$dest"
"$object_path" "$message" | grep int32 | awk '{print $2}')"
echo "your current brightness level is : $value"
#change the current brightness
if [ "x$1" = "xget" ]
then
echo "your current value is: $value"
exit 0
elif [ "x$1" = "xup" ]
then
value="$(( $value +1 ))"
elif [ "x$1" = "xdown" ]
then
value="$(( $value - 1 ))"
else
value="$1"
fi
message="org.freedesktop.Hal.Device.LaptopPanel.SetBrightness"
dbus-send --system --print-reply --dest=$dest $object_path $message int32:$value
echo "your new brighness level is :$value"
--
Oğuz Yarımtepe
More information about the ubuntu-users
mailing list