Brynet-Inc wrote:
A lot of newer systems, especially laptops, lack any APM support at all.. don't bother with it.
agpcraphael was talking about
kaworu's code which implements ACPI and not APM.
agpcraphael wrote:
i´m not a hobby-O.S developer (at least yet ), but i need the code to turn off computer to simulate a power fail.
Since you're under hosted enviroment, you host OS won't let you play with Power Management. The only exception being that you're running DOS.
If you manage to write your own OS in future, conditions will be different and complex too. As you can see, APM is old and less likely to be supported in newer PCs. Again, ACPI is a complete mess, but once you manage to keep things straight, you're done. Linux Distributions too use ACPI behind their poweroff routine.
Quote:
About the sample code posted by kaworu, can i compile that code as a kernel module ? And what about the headers in the sample code - are they standard ones ?
I'm not sure what modules are you talking about. Are you running linux?
If you are writing your own OS, you can compile that code and run (as a module, if your OS supports it). The headers in that sample code are standard as well. But as Brendan said, that particular code can break under lots of situations. Nevertheless, I've seen that code running successfully under lots of PCs. Give it a try!
Cheers.