[mythtv-users] Way to tell BE came up after power fail?

Gary Buhrmaster gary.buhrmaster at gmail.com
Thu Oct 24 00:46:11 UTC 2013


On Thu, Oct 24, 2013 at 12:07 AM, Craig Huff <huffcslists at gmail.com> wrote:
> I have discovered that my IR transceiver device instance in /dev doesn't get
> properly created after a power failure until the second time the system is
> brought up.  I'm looking for something to tell programmatically that the
> system came up for the first time after a power failure (or the power was
> shut off) as opposed to an normal shutdown and reboot from S4/S5.

Rather than try to detect a power failure, detect the lack of your device
node.  Before rebooting, check for the existence of a flag file, if it exists,
do not reboot again.  If it does not, "touch" it, and reboot.  Remove the
flag file before exiting.

More generally, it might be interesting to determine where the failure
really is.  Does your machine boot too quickly?  Does your transceiver
take too long to initialized?  Does the `dmesg` output differ in the cases?
If this is a timing issue, in some cases, motherboards can be told to wait
just a little bit before booting, or grub can delay the boot.

> Does anyone know of something in /proc or /sys that I could read that would
> indicate this condition so I can force a reboot automatically (I'm
> especially concerned with the case when I'm not around to do it manually)?
> In the meantime, I'm searching /proc and /sys and googling.  If I find
> something, I'll report back.

I am unaware of any direct way (although if I was guessing, I would
look in the acpi sections), but there are indirect ways by seeing if
the "last" command (and the underlying utmp file) shows a "crash"
entry.

Personally, I would spend time on trying to fix the underlying cause
(the IR device not initializing) rather than trying to build in bypasses.

Gary


More information about the mythtv-users mailing list