View Single Post
Old 04-28-2010, 03:50 AM   #1
Shaggy
Wizard
Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.Shaggy ought to be getting tired of karma fortunes by now.
 
Shaggy's Avatar
 
Posts: 4,293
Karma: 529619
Join Date: May 2007
Device: iRex iLiad, DR800SG
Shutdown mode - proof of concept

Before I start, standard warnings. I'm just messing around with this. I have no idea yet if there are any serious side effects (assume there are until we learn otherwise). Mostly this is just theoretical for now, so TRY AT YOUR OWN RISK

OK, on to the interesting part. Given some recent discussions about the DR800 only having a sleep mode and not a real "off" available to the user, I decided to play around on my device with some scripts.

I created myShutdown.desktop in the Personal Documents folder with this:
Code:
[Desktop Entry]
Name=myShutdown
Type=Application
Exec=/media/mmcblk0p1/Programs/myShutdownScript.sh
Then I created myShutdownScript.sh in the SD card's Programs folder with this:
Code:
#!/bin/sh
shutdown -h -P now >> /media/mmcblk0p1/Programs/myShutdownLog.txt 2>&1

When you click on the desktop item, after 5 seconds the screen goes blank. The next press on the power switch causes a complete bootup sequence.

So, I'm assuming that the device does not just go to sleep, but actually shuts down.

The questions still remaining:
  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?

In theory (once it's completed and fully tested), what this will let people do is choose to power off the device instead of put it into sleep mode. The benefits are that if you know it's not going to be used for awhile, it will (theoretically, but not proven yet) preserve battery. The drawback is that when you do want to use it again you have to do a full boot, which takes 40-50 seconds.

Last edited by Shaggy; 04-28-2010 at 03:56 AM.
Shaggy is offline   Reply With Quote