Skip navigation.
Home
The QNX Community Portal

View topic - Detecting hard reboot

Detecting hard reboot

For discussion of realtime and/or embedded programming.

Detecting hard reboot

Postby AshiGupta » Thu Oct 13, 2016 1:05 pm

Hello,

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
AshiGupta
Active Member
 
Posts: 19
Joined: Wed Aug 24, 2016 11:09 am

Re: Detecting hard reboot

Postby Thunderblade » Tue Nov 01, 2016 10:03 am

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.

HTH,

- Malte
Thunderblade
Senior Member
 
Posts: 487
Joined: Thu Apr 07, 2005 11:52 am

Re: Detecting hard reboot

Postby AshiGupta » Fri Nov 11, 2016 11:47 am

Thanx Malte...as i was not able to read power registers, i followed the same approach.
AshiGupta
Active Member
 
Posts: 19
Joined: Wed Aug 24, 2016 11:09 am


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 3 guests