On 5/28/14, 5:12 AM, "Dr. Michael J. Chudobiak" <[email protected]>
wrote:
>> Sounds cool and easy to implement hardware-wise.
>> Can you share the code for that?
>
>Something like this:
>
>// use plain old open to avoid any buffering etc
>int enablefd = open("/proc/sys/kernel/sysrq", O_SYNC | O_RDWR);
>int trgfd = open("/proc/sysrq-trigger", O_SYNC | O_RDWR);
>
>// enable sysrq
>write(enablefd, "1\n", 2);
>close(enablefd);
>
>// sync disks
>write(trgfd, "s\n", 2);
>
>// remount ro
>write(trgfd, "u\n", 2);
>close(trgfd);
>
>// poweroff
>system ("/usr/bin/systemctl poweroff -f");
>
>exit(0);
>
>
>As I mentioned, I use full data+metadata journaling on the filesystem,
>not just metadata.
>
>The only issue is that the system doesn't restart if power is reapplied
>before the supercap is fully discharged. You have to wait 10 seconds or
>so before a restart is possible. I'm not sure how to fix that.
You need a small state machine which you can implement with a GreenPAK.
http://www.silego.com/products/greenpak.html
Regards,
John
>
>- Mike
>
>--
>For more options, visit http://beagleboard.org/discuss
>---
>You received this message because you are subscribed to the Google Groups
>"BeagleBoard" group.
>To unsubscribe from this group and stop receiving emails from it, send an
>email to [email protected].
>For more options, visit https://groups.google.com/d/optout.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.