Wake laptop when lid is opened?

I have a SAMSUNG laptop, which by the experience in the last months, has been a great one. I am actually implementing some functionality to it, and since I noticed, I am able to wake up my laptop from sleep by just opening the lid on Windows 7, however, I need to press to power button to wake up in Ubuntu. Using a program called i-nex, I noted that the kernel DOES dettect a "lid switch", and I am looking forward to use it to wake up function. Any ideas?

enter image description here

UPDATE: Thanks @yossile for bringing up some clues! However, output of command cat /proc/acpi/wakeup does not show the LID device. I still tried the second set of commands you gave me with no effect. Then I tried experimenting, guessing that LID should be named by other value, so I tried enabling the others. No victory so far. But I noticed that devices that did not have any pci listings were disabled at all time no matter what I tried. Here is the output of command cat /proc/acpi/wakeup:

root@samsung:~# cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
PCE4      S4    *disabled  pci:0000:00:04.0
SBAZ      S4    *disabled  pci:0000:00:14.2
P0PC      S4    *disabled  pci:0000:00:14.4
GEC       S4    *disabled  
PE20      S4    *disabled  pci:0000:00:15.0
PE21      S4    *disabled  
PE22      S4    *disabled  pci:0000:00:15.2
PE23      S4    *disabled  
PWRB      S5    *enabled

So maybe it could be that LID is either GEC,PE21, or PE23?

Still, there is /proc/acpi/button/lid/LID/state file which shows that LID is opened. Any more ideas?


You can check whether the Lid open event is configured to wake up your OS by executing the cat /proc/acpi/wakeup command.
If the status of the 'LID' device is currently disabled you can try enabling it by executing:

sudo -s
echo "LID" > /proc/acpi/wakeup

This will set the status to enabled.
Running the commands again will set it back to disabled.