pfsensen 笔记本 Solution for laptop display going blank after lid close/reopen

2017-03-09 12:46:07 0  category: Freebsd

Just wanted to share a solution I came up with recently for getting a laptop display to turn back on properly after the lid has been closed/reopened.  I've seen the issue on Dell Latitude D600, D610, D420, and D620 models that I've re-built from salvaged parts, but other makes/models are sure to experience the problem as well.


I've spent countless hours searching on and off for a solution over the last couple of years and finally took the time to find the root cause between freebsd + the pfSense customizations.


First, all recent versions of pfsense have "hw.acpi.lid_switch_state" set to "NONE".  This is a good thing for always on applications like pfSense.  Years ago there were some 1.x builds where this was set to S1/S2/S3, so sleep/suspend mode would be initiated when the lid switch was activated.  You can check the value of "hw.acpi.lid_switch_state" by issuing the command "sysctl -a hw.acpi".  (NONE = good)


Second, you need to load the acpi_video kernel module.  You can load this manually (per reboot) via the command: "kldload acpi_video".  A long term solution that survives a reboot is to add ' acpi_video_load="YES" ' to /boot/loader.conf.


Third, you need the to set "hw.acpi.video.lcd0.active=1" after the lid is reopened.  This can be done manually by the command: "sysctl hw.acpi.video.lcd0.active=1".  Long term you will want the system to do this automatically when a lid switch change occur.  This can be done by adding the following to /etc/devd.conf.


#Added to fix issue with LCD staying blank after close/re-open.

#Lid switch

notify 0 {

       match "system"         "ACPI";

       match "subsystem"      "Lid";

       match "notify"         "0x00";

       action "sysctl hw.acpi.video.lcd0.active=0";

};


notify 0 {

       match "system"         "ACPI";

       match "subsystem"      "Lid";

       match "notify"         "0x01";

       action "sysctl hw.acpi.video.lcd0.active=1";

};


At this point you need to restart the system for the changes to /etc/devd.conf to take effect.



An option for additional power savings/heat reduction - Enable PowerD power management in pfSense.  This allows the processor speed to be dymanically adjusted via speedstep or some other method.  In pfsense 2.x you can enable this in the GUI @ System > Advanced > Misc. > Use PowerD.  Personally I set the mode to adaptive and it's been fine for home use with 10 - 15 network devices.  Once enabled, you can see the current CPU speed in the pfSense Dashboard: CPU Type > under the make/model info , Current: xxx MHz, Max: xxxx MHz.  (If you don't see Current/Max, PowerD isn't enabled.)


For refference, my kill-a-watt shows:


D420 1.2ghz C2D + mechanical HD + docking station + intel dual gigabit card + all USB/wifi/serial/etc disabled: 24 watts at idle, lid closed.


D420 1.2ghz C2D + mechanical HD + on board nic + generic "pluggable" usb 2.0 gbit nic: 18-19 watts at idle, lid closed.


D620 2ghz C2D + mechanical HD + extras disabled + on board nic + cisco usb300m usb nic: 22-23 wt at idle, lid closed.  (No noticiable difference using 60wt vs 90wt power brick.)


D620 + mechanical HD + onboard usb/nic/extras disabled + docking station + intel dual gbit NIC: 31-33 wt at idle, lid closed.


SUPERMICRO SYS-5015A-EHF (1U Intel Atom D510 + onboard dual Gigabit + mechanical 2.5" HD): 26 wt at idle.  (Due to the built in power supply fan being too noisy + all the onboard sata connections, I'm moving this from pfsense duty to a full tower case + quiet PS for NAS use.


Hope this helps for folks doing laptop builds in the future.


Note: I'm not a fan of using USB or cardbus nics with freebsd/pfsense due to driver and timeout/reset issues.  The usb nics mentioned above have not been used for more than a day or so to verify basic functionality and pull power draw stats.


Keywords: Laptop Display Blank Acpi Lid LCD open close



https://forum.pfsense.org/index.php?topic=57066.0