LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Going to sleep signal in Linux (https://www.linuxquestions.org/questions/linux-kernel-70/going-to-sleep-signal-in-linux-4175449891/)

sanjoy.net 02-12-2013 05:17 PM

Going to sleep signal in Linux
 
Hi Devs,

I have a requirement in application. It needs to be notified when the system is about to sleep, so that I can prevent the system to sleep as my application is downloading some data. I want to enable sleep after the downloading is done. So, I need the following to be specific

1. AbouttoSleep signal
2. preventSleep(bool)

Thank you
Sanjoy

PTrenholme 02-13-2013 03:16 PM

I've never need to do this, so I'm just guessing.:) If I'm right, you'll need to add a sleep action to /etc/acpi/events/ and a corresponding action script to /etc/acpi/actions.

Look at man acpid and man acpi_listen and the Wiki article on ACPI

Note: Some BIOS settings can put devices in sleep mode without communicating (much) with the OS, so you should check your BIOS settings. (A modern BIOS would, I think, first raise one of the S3 flags, but, as I said, my knowledge is all theoretical.)

P.S.: I only replied here because your query has languished for some time with no replies, and it seemed like an interesting question.


All times are GMT -5. The time now is 10:49 PM.