root で次のように調整できた。
# echo 50 > /sys/class/backlight/psb-bl/brightness
次のバッチファイルでとりあえず動作確認。
引数は0〜100
#!/bin/sh
sudo sh -c “echo $1 > /sys/class/backlight/psb-bl/brightness”
sudo sh -c “echo $1 > /sys/class/backlight/psb-bl/brightness”
どうせだから、[Fn]+[F5]/[F6]で使えるようにする。
キーイベントを調べてみると、
$ acpi_listen
video/brightnessdown BRTDN 00000087 00000000
video/brightnessup BRTUP 00000086 00000000
video/brightnessdown BRTDN 00000087 00000000
video/brightnessup BRTUP 00000086 00000000
/etc/acpi/events/sony-brightness-down を書き換え。
# /etc/acpi/events/sony-brightness-down
#event=sony/hotkey SPIC 00000001 00000010
event=video/brightnessdown BRTDN 00000087 00000000
action=/etc/acpi/sonybright.sh down
#event=sony/hotkey SPIC 00000001 00000010
event=video/brightnessdown BRTDN 00000087 00000000
action=/etc/acpi/sonybright.sh down
/etc/acpi/events/sony-brightness-up も同じように書き換えておく。
次に/etc/acpi/sonybright.sh を書き換え。
#!/bin/bash
# TODO: Change above to /bin/sh
test -f /usr/share/acpi-support/key-constants || exit 0
BRIGHTNESS=$(cat /sys/class/backlight/psb-bl/brightness)
if [ “$BRIGHTNESS” -gt 100 ]; then
BRIGHTNESS=100
fi
if [ “x$1” = “xdown” ]; then
if [ “x$BRIGHTNESS” != “x0” ]; then
BRIGHTNESS=$(( $BRIGHTNESS – 10 ))
echo $BRIGHTNESS > /sys/class/backlight/psb-bl/brightness
else
[ -x /usr/bin/spicctrl ] && /usr/bin/spicctrl -b 0
fi
# Recent nvidia Sonys have ACPI methods that do nothing. Thanks, Sony.
[ -x /usr/bin/smartdimmer ] && smartdimmer -d 2>/dev/null
elif [ “x$1” = “xup” ]; then
if [ “x$BRIGHTNESS” != “x100” ]; then
BRIGHTNESS=$(( $BRIGHTNESS + 10 ))
echo $BRIGHTNESS > /sys/class/backlight/psb-bl/brightness
fi
[ -x /usr/bin/smartdimmer ] && smartdimmer -i 2>/dev/null
else
echo >&2 Unknown argument $1
fi
# TODO: Change above to /bin/sh
test -f /usr/share/acpi-support/key-constants || exit 0
BRIGHTNESS=$(cat /sys/class/backlight/psb-bl/brightness)
if [ “$BRIGHTNESS” -gt 100 ]; then
BRIGHTNESS=100
fi
if [ “x$1” = “xdown” ]; then
if [ “x$BRIGHTNESS” != “x0” ]; then
BRIGHTNESS=$(( $BRIGHTNESS – 10 ))
echo $BRIGHTNESS > /sys/class/backlight/psb-bl/brightness
else
[ -x /usr/bin/spicctrl ] && /usr/bin/spicctrl -b 0
fi
# Recent nvidia Sonys have ACPI methods that do nothing. Thanks, Sony.
[ -x /usr/bin/smartdimmer ] && smartdimmer -d 2>/dev/null
elif [ “x$1” = “xup” ]; then
if [ “x$BRIGHTNESS” != “x100” ]; then
BRIGHTNESS=$(( $BRIGHTNESS + 10 ))
echo $BRIGHTNESS > /sys/class/backlight/psb-bl/brightness
fi
[ -x /usr/bin/smartdimmer ] && smartdimmer -i 2>/dev/null
else
echo >&2 Unknown argument $1
fi
acpid を再起動して有効化
$ sudo /etc/init.d/acpid restart
スクリプトにおかしな所があるが、
一応こんな感じで使えるようになった。