Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Editare initscript per luminosità lcd [risolto]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
topper_harley
Guru
Guru


Joined: 05 Apr 2006
Posts: 363
Location: Treviso / Udine (Italy)

PostPosted: Tue Jun 13, 2006 3:50 pm    Post subject: Editare initscript per luminosità lcd [risolto] Reply with quote

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
View user's profile Send private message
richard77
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 281

PostPosted: Tue Jun 13, 2006 4:38 pm    Post subject: Reply with quote

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 / :evil: )
_________________
Fletto i muscoli e sono nel vuoto
Back to top
View user's profile Send private message
topper_harley
Guru
Guru


Joined: 05 Apr 2006
Posts: 363
Location: Treviso / Udine (Italy)

PostPosted: Tue Jun 13, 2006 4:59 pm    Post subject: Reply with quote

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 / :evil: )

rm -rf / ???

Che comando curioso... L'ho appena lanciato, a cosa serve??? :roll: :roll: :roll:
_________________
http://topperh.ath.cx
Jabber: topper_harley@jabber.org
ICQ: 224179391
MSN: Topper_Harley80@gmail.com
Last FM
Back to top
View user's profile Send private message
MeMyselfAndI
l33t
l33t


Joined: 15 Nov 2005
Posts: 784
Location: Between the monitor and the chair

PostPosted: Tue Jun 13, 2006 6:51 pm    Post subject: Reply with quote

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 :D
Back to top
View user's profile Send private message
topper_harley
Guru
Guru


Joined: 05 Apr 2006
Posts: 363
Location: Treviso / Udine (Italy)

PostPosted: Tue Jun 13, 2006 9:36 pm    Post subject: Reply with quote

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 :D


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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum