View Single Post
Old 04-28-2010, 04:22 AM   #3
ex-IRX developer
Gertjan doesn't litterGertjan doesn't litterGertjan doesn't litter
Gertjan's Avatar
Posts: 158
Karma: 224
Join Date: Oct 2008
Device: Irex DR800S, DR1000S, iLiad
Originally Posted by Shaggy View Post
  1. Do running applications react badly to this? This should cause a SIGTERM to be sent to them and potentially a SIGKILL if they don't stop within 5 seconds (that interval can be adjusted), but is this going to have any serious side effects? IE will viewers not save correctly before stopping, etc. I'm assuming they will gracefully stop after a SIGTERM, but I don't know.
  2. Is the device really going to a poweroff state, or is it just halting the kernel (and still drawing power somewhere)? The -P flag theoretically tells it to poweroff when it halts, but it depends on the version of linux and whether or not it honors that flag. I did notice that after it went blank, plugging in the power connector caused it to boot without pressing the switch. Not sure if that normally happens when the device is really off.
  3. There is no indication to the user that anything is happening. You click on the icon, and then 5 seconds later the screen goes blank. That's it. It would be nice to figure out a way to get a popup "Device is shutting down" displayed. That's further down the road though.
  4. Anything else I'm not thinking of. Does iRex want to step in and say this is a really bad idea, or should I keep going with it?
Interesting idea. Though shutting down like this may work, the system is not designed to this way. When you look into SYSD (system.c) you'll see that DR1000 does various things before turning off. Most importantly, it unmounts the volume (/media/mmcblk0p1). This triggers running applications to commit changes and close their files. Doing this before calling shutdown will probably make it safer.

A cleaner approach would be to follow the path of SYSD's API call "sysShutdown". For DR1000 this triggers the shutdown, on DR800 it goes to standby mode. With a bit of juggling, a call could be added to do the complete shutdown for DR800.
Gertjan is offline   Reply With Quote