# Laptop lid switch



## nv05 (Jul 12, 2009)

Hi,
I recently had my the motherboard of my Dell Latitude laptop replaced due to battery charging problems.  Everything is great, except that the lid switch now is active, it properly (I think) shuts off the monitor when pressed.  Unfortunately, when released the monitor does not restart...kind of a problem, when I'm used to being able to close the lid and not worry about it.  Before the MB switch, the lid switch had no effect.

The strange thing is that if I was in X, hitting ctrl-alt-bksp will turn the monitor on and I'll see my console.  If I am in console, blindly typing startx and return will start the monitor and X will be running.  However, in the latter case, when I shut down X, the console will not appear because the monitor returns to an off state.

Here's some info:
Model: Dell Latitude D610
Video: Intel 82915GM (915GM GMCH) SVGA controller
OS: Freebsd 7.2-RELEASE #0: Thu May  7 18:38:22 PDT 2009


```
# sysctl hw.acpi
hw.acpi.supported_sleep_state: S3 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S3
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: S3
hw.acpi.sleep_delay: 1
hw.acpi.s4bios: 1
hw.acpi.verbose: 0
hw.acpi.disable_on_reboot: 0
hw.acpi.handle_reboot: 0
hw.acpi.reset_video: 0
hw.acpi.acline: 1
hw.acpi.battery.life: 98
hw.acpi.battery.time: -1
hw.acpi.battery.state: 2
hw.acpi.battery.units: 2
hw.acpi.battery.info_expire: 5
...
```


```
# dmesg | grep Lid
acpi_lid0: <Control Method Lid Switch> on acpi0
```

I've tried both

```
sysctl hw.acpi.lid_switch_state=S0
```
and

```
sysctl hw.acpi.reset_video=1
```
but neither worked.

I would be extremely happy with either 
a) Lid switch does absolutely nothing
b) Lid switch shuts off monitor, but it comes back on when button is released

and any help getting me there would be greatly appreciated.  I've been googleing till my fingertips are sore and I find nothing about this problem.

Thanks.


----------



## aragon (Jul 13, 2009)

Have you tried turning it back on with xset?


```
xset dpms force on
```

Also, have a look at acpi_video(4).


----------



## nv05 (Jul 13, 2009)

Thanks for the tip 

If I press the switch in X, and then try to correctly type "xset dpms force on", it does indeed bring my monitor back on.

I've tinkered around a little bit with devd.conf, adding this code:


```
...
#Lid switch
notify 0 {
	match "system"		"ACPI";
	match "subsystem"	"Lid";
	match "notify"		"0x00";
	action "xset dpms force off";
};

notify 0 {
	match "system"		"ACPI";
	match "subsystem"	"Lid";
	match "notify"		"0x01";
	action "xset dpms force on";
}; 
...
```

And everything works now.

This is after loading acpi_video.ko, but when I unload it, everything still works.


----------



## nv05 (Jul 13, 2009)

The problem still occurs in console mode.  Is there an "xset dpms force on" equivalent for the console?


----------



## aragon (Jul 14, 2009)

nv05 said:
			
		

> The problem still occurs in console mode.  Is there an "xset dpms force on" equivalent for the console?


Have another look at acpi_video(4).  Setting those sysctl variables should give you control over it.


----------



## tangram (Jul 14, 2009)

Maybe a bit off-topic but... I and other fellow co-workers have Dell's D620 and the lid switch problem you state happens under Windows XP.

Sometimes the lid switch just shuts down the monitor and there's no way to bring it back without powering down the laptop.

Honestly I think it's just some glitch in the hardware or BIOS and it manifests regardless of OS.


----------



## nv05 (Jul 15, 2009)

Okay,
I now have the following in /etc/devd.conf:


```
notify 0 {
	match "system"		"ACPI";
	match "subsystem"	"Lid";
	match "notify"		"0x00";
	action "sysctl hw.acpi.video.lcd0.active=0 && xset dpms force off";
};

notify 0 {
	match "system"		"ACPI";
	match "subsystem"	"Lid";
	match "notify"		"0x01";
	action "xsysctl hw.acpi.video.lcd0.active=1 && xset dpms force on";
};
```

Now the monitor comes back on in either console or X.  Thanks for your help!


----------

