Empowering the off-button

All the time new uses for computers are being imagined. Their capabilities are hardly tapped, and a rich stream of possibilities is pouring forth. From air traffic control to stealing intellectual property, the purposes to which our silicon friends are put are several and various: some use them to chat with like-minded members of obscure sects, others satiate their desire to see great art.

But at the end of the day, everybody wants ot turn their computer off, and this is where this page comes in. As any passing sophist will smugly remark, this is no more difficult than pulling a plug, however this algorithm, though possibly the most fail-safe and efficient method, has a number of flaws. First and foremost is of course its limited applicability: a laptop has no plug. Furthermore the increasing complexity of the wiring arrangements of the laptop's desk bound cousins draws into question the practicality of implementing this algorithm in anything like reasonable time. In fact due to the not inconsiderable risk of inadvertantly pulling the plug on the incorrect device in the spaghetti of wires surrounding the typical outlet, it cannot be seriously recommended as a practical solution.

In fact the best possible solution would simply to depress the so called "off button" provided superficially for this purpose on the case or at some other temptingly ergonomic location (however there are some other schools of thought). It is a shocking fact that almost any person who has had even a nodding acquaintance with a computer has been indoctrinated to such an extent to fear the "off button" that they avoid it at all costs, harboring primitive superstitions that the "computer wouldn't like it". Nonsense.

The truth of the matter is that any remotely new computer (with an ATX case) has its off button hooked up to send it a message instead of turning itself off. Being a polite bugger in its way it will most likely immediately turn itself off as soon as it gets the aforementioned message, but the principle is there: you can in theory tell the computer what to do when it gets the message. For example, one imaginative use would be to turn the computer off.

And this is what the program I wrote does - turns the "off button" into a computer turner offer, as it were. And as today's pampered machines expect a certain amount of tender loving care before they are temporarily deprived of their vital current, this program will apply all necessary unction (however extreme), in an effort to avoid a long fsck when you press the "off button" again, to turn the computer on.

Raw technical summary

Order of events

Blighter presses off button -> electrical signal -> BIOS gets hold of it -> BIOS issues APM user suspend (check power management configuration) -> APM driver says user suspend to kernel -> kernel runs /sbin/powermanager which says ignore (reject) event but sneakily runs shutdown -p now in the background.

Last modified: Mon Apr 21 23:44:55 BST 2003