Difference between revisions of "ACPI on the 770"

From ThinkWiki
Jump to: navigation, search
 
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:
  
 
lid.sh
 
lid.sh
=============================
 
#!/bin/sh
 
  
tmp=${4: -1:1}
+
    #!/bin/sh
status=`/bin/awk '/^(lcd|crt):/ { ORS=""; print $2 }' /proc/acpi/ibm/video`
+
   
matches="13579bdf"
+
    tmp=${4: -1:1}
 
+
    status=`/bin/awk '/^(lcd|crt):/ { ORS=""; print $2 }' /proc/acpi/ibm/video`
 
+
    matches="13579bdf"
 
+
   
if [[ $matches = *$tmp* ]]
+
   
then
+
   
    if [ "$status" == "enableddisabled" ]; then
+
    if <nowiki>[[ $matches = *$tmp* ]]</nowiki>
        /bin/echo lcd_disable,crt_enable >/proc/acpi/ibm/video
+
    then
    #elif [ "$status" == "disabledenabled" ]; then
+
        if [ "$status" == "enableddisabled" ]; then
    #    /bin/echo lcd_enable >/proc/acpi/ibm/video
+
            /bin/echo lcd_disable,crt_enable >/proc/acpi/ibm/video
     elif [ "$status" == "enabledenabled" ]; then
+
        elif [ "$status" == "enabledenabled" ]; then
        /bin/echo lcd_disable >/proc/acpi/ibm/video
+
            /bin/echo lcd_disable >/proc/acpi/ibm/video
 +
        fi
 +
     else
 +
        /bin/echo lcd_enable >/proc/acpi/ibm/video
 
     fi
 
     fi
  
else
 
    /bin/echo lcd_enable >/proc/acpi/ibm/video
 
fi
 
==============================
 
  
 
events/lid
 
events/lid
==============================
+
    event=button/lid LID0 00000080.*
event=button/lid LID0 00000080.*
+
    action=/etc/acpi/actions/lid.sh %e
action=/etc/acpi/actions/lid.sh %e
+
 
==============================
 
  
[[:Category:770|770]][[Category:770]]
+
[[Category:770]]

Latest revision as of 18:32, 1 February 2006

Here are several ACPI scripts that has enabled me to view turn on/off the screen when closing the monitor.

NOTE: Requires the ibm_acpi module to be installed into the kernel.


lid.sh

   #!/bin/sh
   
   tmp=${4: -1:1}
   status=`/bin/awk '/^(lcd|crt):/ { ORS=""; print $2 }' /proc/acpi/ibm/video`
   matches="13579bdf"
   
   
   
   if [[ $matches = *$tmp* ]]
   then
       if [ "$status" == "enableddisabled" ]; then
            /bin/echo lcd_disable,crt_enable >/proc/acpi/ibm/video
       elif [ "$status" == "enabledenabled" ]; then
            /bin/echo lcd_disable >/proc/acpi/ibm/video
       fi
   else
       /bin/echo lcd_enable >/proc/acpi/ibm/video
   fi


events/lid

   event=button/lid LID0 00000080.*
   action=/etc/acpi/actions/lid.sh %e