PreQuit
Stephan Kleinert (2271) 70 posts |
Hi all, I’m writing a little tool that’s supposed do some (hardware) cleanup tasks before the system is shut down. Problem is, I never seem to get the PreQuit (8) message. Regardless whether I react to WimpPoll Reason Codes 17 or 18. Am I doing something very wrong here? Kind regards, |
Rick Murray (539) 13841 posts |
How are you looking for the message? I think (at work, not by computer!) that it is sent recorded (poll event 18) not as a normal message (poll event 17). Isn’t there a system variable to specify an Obey file to run after the system has shut down? It could be dangerous to assume PreQuit means shutdown. What if something (unsaved data) objects and stops the shutdown and you decide not to go ahead and shut down after all? Plus, PreQuit is sent while the system is still fully functioning rather than post shutdown. |
Rick Murray (539) 13841 posts |
In the updated user guide: Choices.Boot:
|
Richard Coleman (3190) 54 posts |
Hi Stephan, there is also the Shutdown (14) message which is broadcast by the Task Manager which has various flags to control what happens when shutdown occurs. But I guess if you’re wanting to do some hardware cleanup then you might also like to have a look at the service call Shutdown (&7E) which I think is the module equivalent to the PreQuit message, and Shutdown Complete (&80) which is when the message “It is now safe to turn your computer off” appears on the screen. Whether you get the Shutdown Complete service call when the system is rebooting rather than just shutting down I don’t know, but that may be the service call you are looking for. I have used it in the past to kill the Ethernet module once the computer was shutdown. |
Stephan Kleinert (2271) 70 posts |
Thank you all! |
André Timmermans (100) 655 posts |
Stephan, check your call to Wimp_Initialise. I you pass it a list of messages you are interested in, check if that list contains PreQuit. |
Stephan Kleinert (2271) 70 posts |
@André: Thanks. That indeed was my mistake in the first place ;) |
John Williams (567) 768 posts |
I’m intrigued to know the nature of these (hardware) cleanup tasks, now Rick has told us how to do it! |
Stephan Kleinert (2271) 70 posts |
@John Williams: Nothing extraordinary ;) a friend of mine is building a custom case, and in addition to switching off the power supply, we need to switch a relay (that’s between his audio out and the native raspi audio out) beforehand to avoid ‘plops’ on the speaker. At least, that’s the plan… |