View topic - Detecting hard reboot

Page 1 of 1

Detecting hard reboot

PostPosted: Thu Oct 13, 2016 1:05 pm
by AshiGupta

I am using QNX on processor MPC8349. I want to detect hard reboot i.e weather the device rebooted due to power cycle(Hard reboot) or a shutdown was initiated from software(soft reboot). I tried checking Power reset status register but value read is 0. I believe QNX might be using there register for some purpose(don't know what) and as this register is Read/Write, the value is updated as 0.

Is there is any method available in qnx to detect type of reboot.

Ashi Gupta

Re: Detecting hard reboot

PostPosted: Tue Nov 01, 2016 10:03 am
by Thunderblade
You could include a simple command in the boot script to delete a certain file in persistent storage, like /home/user/cleanshutdown. Later, when you initiate a software-based shutdown command, you include a command like touch /home/user/cleanshutdown. On reboot, you can check if the file is present - if it is, it was a software-based shutdown. You can then delete the file, so it can be re-created on the next shutdown. If the next shutdown is a hard power-cycle, the file will not be there. On reboot, you will find it's not there so it must have been a hard reboot.


- Malte

Re: Detecting hard reboot

PostPosted: Fri Nov 11, 2016 11:47 am
by AshiGupta
Thanx i was not able to read power registers, i followed the same approach.