[ltp] T42 issues powering off lcd with setterm

Dave Wood linux-thinkpad@linux-thinkpad.org
Fri, 26 Dec 2008 06:12:33 +0000


On (10:54 25/12/08), Dave Wood <dave@unrealize.co.uk> put forth the proposition:
> I have a problem getting the lcd screen to power off on my T42 via setterm
> command.
>
> After some messing around trying to get Fn-F3 to work I discovered that the
> lcd will only power off manually *if* crt was enabled first. I made a
> script in /etc/acpi to do this which works with a hotkey file.
>
> This works great for manual switching but I still cannot get the screen to
> power off automatically with setterm. It blanks just fine but powerdown
> setting seems to get ignored. I can't find anything in the BIOS that looks
> useful either.
>
> Has anyone got any ideas about this? This is in console by the way. I'm not
> using X.

Ok an update. I've made a small script that when run will turn off the lcd
if brightness = 0 and if lcd is enabled (typical state of blanking but
backlight on).

Now the question is - how to detect when the screen has woken up, or when
mouse or keyboard has been used. I have been looking for the correct device
file to detect this, but in vain so far.

If anyone has ideas that would be great.

#!/bin/sh

while ( true )
do
     LCD_BRIGHTNESS=`awk '{print $2}' /proc/acpi/ibm/brightness | head -n 1`
     LCD_STATE=`awk '{print $2}' /proc/acpi/ibm/video | head -n 2 | tail -n 1`
     CRT_STATE=`awk '{print $2}' /proc/acpi/ibm/video | head -n 3 | tail -n 1`

     if [[ $LCD_BRIGHTNESS == "0" && $LCD_STATE == "enabled" ]]
         then
             {
                 # Need this test because T42 won't switch off lcd unless crt is on
                 [[ $CRT_STATE == "disabled" ]] && echo crt_enable > /proc/acpi/ibm/video
                 echo lcd_disable > /proc/acpi/ibm/video
                 echo off > /proc/acpi/ibm/light
             }
     fi
sleep 1
done

At the moment the only way to wake up the screen with this script is via hotkey Fn-F3.
*If you don't have a key combo to wake up display, don't run this script!*

At the moment it looks like I may have to poll keyboard in c/c++ but I would be glad of any ideas to detect keypress and wake up screen.

> -- 
>
> -- 
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad

-- 
Committee, n.:
	A group of men who individually can do nothing but as a group
decide that nothing can be done.
		-- Fred Allen