View previous topic :: View next topic |
Author |
Message |
topper_harley Guru
Joined: 05 Apr 2006 Posts: 363 Location: Treviso / Udine (Italy)
|
Posted: Tue Jun 13, 2006 3:50 pm Post subject: Editare initscript per luminosità lcd [risolto] |
|
|
Sto seguendo la guida alla gestione energetica del manuale di gentoo sul mio Toshiba Satellite M40 141.
http://www.gentoo.org/doc/it/power-management-guide.xml
Purtroppo la parte riguardante la luminosità dell' LCD non può essere applicata perchè Toshiba Tecra S1 non è ancora supportato dal kernel.
Cercando un po' in giro ho trovato questo:
http://tz.exit0.net/tecras1.html
Funziona perfettamente:
per ottenere il livello attuale:
Code: | localhost ~ # /opt/s1bl/s1bl -g
brightness level: 7
|
per modificare il livello:
Code: | localhost ~ # /opt/s1bl/s1bl -s 5
brightness level: 5 |
Adesso però vorrei creare un initscript, sulla falsariga di quello del manuale di gentoo che porti la luminosità a 7 (il max) quando sono nel runlevel default, e a 4 quando sono nel runlevel battery.
Come posso fare? _________________ http://topperh.ath.cx
Jabber: topper_harley@jabber.org
ICQ: 224179391
MSN: Topper_Harley80@gmail.com
Last FM
Last edited by topper_harley on Tue Jun 13, 2006 5:00 pm; edited 1 time in total |
|
Back to top |
|
|
richard77 Apprentice
Joined: 21 Apr 2004 Posts: 281
|
Posted: Tue Jun 13, 2006 4:38 pm Post subject: |
|
|
Questo è lo script che propone la guida:
Code: |
#!/sbin/runscript
set_brightness() {
if on_ac_power
then
LEVEL=${BRIGHTNESS_AC:-7}
else
LEVEL=${BRIGHTNESS_BATTERY:-4}
fi
if [ -f /proc/acpi/ibm/brightness ]
then
ebegin "Setting LCD brightness"
echo "level ${LEVEL}" > /proc/acpi/ibm/brightness
eend $?
elif [[ -e /usr/bin/acpitool && -n $(acpitool -T | grep "LCD brightness") ]]
then
ebegin "Setting LCD brightness"
acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
eend $?
else
ewarn "Setting LCD brightness is not supported."
ewarn "For IBM Thinkpads, check that ibm_acpi is loaded into the kernel"
ewarn "For Toshiba laptops, you've got to install app-laptop/acpitool"
fi
}
start() {
set_brightness
}
stop () {
set_brightness
}
|
Io lo cambierei con:
Code: |
#!/sbin/runscript
set_brightness() {
if on_ac_power
then
LEVEL=${BRIGHTNESS_AC:7}
else
LEVEL=${BRIGHTNESS_BATTERY:5}
fi
if [[ -e /opt/s1bl/s1bl && -n $(/opt/s1bl/s1bl -g | grep "brightness level:") ]]
then
ebegin "Setting LCD brightness"
/opt/s1bl/s1bl -s $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
eend $?
else
ewarn "WTF?"
fi
}
start() {
set_brightness
}
stop () {
set_brightness
}
|
L'ho fatto a occhio incrociando i comandi che hai dato tu con lo script. Ovviamente non posso prendermi responsabilità. (però se noti non ci sono rm -rf / ) _________________ Fletto i muscoli e sono nel vuoto |
|
Back to top |
|
|
topper_harley Guru
Joined: 05 Apr 2006 Posts: 363 Location: Treviso / Udine (Italy)
|
Posted: Tue Jun 13, 2006 4:59 pm Post subject: |
|
|
Grazie mille per l'aiuto!!!
Il tuo script è senz'altro ottimo, ma essendo un totale ignorante ho trovato un approccio più semplice che sembra funzionare comunque:
Ho fatto due script, rispettivamente /etc/init.d/lcd_hi
Code: |
#!/sbin/runscript
start() {
/opt/s1bl/s1bl -s 7
} |
e /etc/init.d/lcd_low
Code: |
#!/sbin/runscript
start() {
/opt/s1bl/s1bl -s 3
} |
Con rc-update li ho assegnati rispettivamente al runlevel default il primo e battery il secondo.
Per adesso sembra funzionare molto bene...
Quote: | (però se noti non ci sono rm -rf / ) |
rm -rf / ???
Che comando curioso... L'ho appena lanciato, a cosa serve??? _________________ http://topperh.ath.cx
Jabber: topper_harley@jabber.org
ICQ: 224179391
MSN: Topper_Harley80@gmail.com
Last FM |
|
Back to top |
|
|
MeMyselfAndI l33t
Joined: 15 Nov 2005 Posts: 784 Location: Between the monitor and the chair
|
Posted: Tue Jun 13, 2006 6:51 pm Post subject: |
|
|
se l'hai davvero lanciato lo capirai a breve.. ma spero per te che non ti sia fatto prendere la mano e che tu stia scherzando |
|
Back to top |
|
|
topper_harley Guru
Joined: 05 Apr 2006 Posts: 363 Location: Treviso / Udine (Italy)
|
Posted: Tue Jun 13, 2006 9:36 pm Post subject: |
|
|
MeMyselfAndI wrote: | se l'hai davvero lanciato lo capirai a breve.. ma spero per te che non ti sia fatto prendere la mano e che tu stia scherzando |
lol
Ho fatto un po di prove e credo di poter dire che gli script che ho fatto funzionano benone!!! _________________ http://topperh.ath.cx
Jabber: topper_harley@jabber.org
ICQ: 224179391
MSN: Topper_Harley80@gmail.com
Last FM |
|
Back to top |
|
|
|