Topic: Work-around ideas for freeze-ups when the network drops?

We're using a Chumby in an environment where Internet connectivity isn't 100%.  The WiFi is weak (signal booster is on order) and our DSL line is on the fringe of the telco distance limit (beyond my control).  Unfortunately, Chumby's response to losing connection is to freeze solid, requiring a power-cycle reboot.  Ugh - could you imagine if your Mac or PC required a reboot whenever the net dropped?

Anyhow, I chatted with tech support about this today, and it took awhile for him to see my point: Displaying time that's several hours off, and requiring cold reboots is a Really Serious Bug, not "expected behavior."  His attitude didn't give me a lot of confidence this would be fixed anytime soon.

So, that makes me think some vigilante scripting is in order.  How hard would it be to write (in Python, picking my favorite):

needReboot = false
while True:
    time.sleep(60)

    # If network goes down, wait for it to come back up...
    while (IsNetworkDown()):
        time.sleep(120)      # Should correspond to Chumby timeout
        chumby.DisplayMessage("Network is down....")
        needReboot = true

    if (needReboot):
        chumby.Reboot()    # Script exits at this point

How hard would it be to come up with the "Reboot" and "DisplayMessage" functions?  I could also write this in C, if that's necessary.

By the way, I should point out that (except for this Really Serious Bug) we love the Chumby.  Trust me, if we didn't love it, I would've sent it back rather than spend $100 on a signal booster and contemplate a few hours of script hacking to work around the RSB.

Re: Work-around ideas for freeze-ups when the network drops?

Our internet connectivity here (a studenty area, with massively oversubscribed NTL cable lines) isn't even close to being 70%, and their customer service is TOSS, but being students they're the cheapest in the area. Anyway, not a day has gone by where i've not had to power cycle our modem & routers, and I don't fancy really having to add my chumby to this list of things that needs restarting!

How would you implement this script? Is that actual python, as it looks kinda pseudocode ish. I'm still waiting for my chumby to arrive so I can't really do any testing, but it would be nice to have this sorted & ready to use for when it arrives.

Re: Work-around ideas for freeze-ups when the network drops?

The "Reboot" and "DisplayMessage" function calls are trivial.  It's the "IsNetworkDown" function that's the hard one.

It all depends what you mean by "down":

1) The wifi dongle isn't plugged in or physically not working
2) The wifi dongle is working by there is no wifi AP available
3) There is an AP, but we can't authenticate with it
4) The AP was working, but the signal dropped (powered off, magic RF pixies, etc)
5) The AP is working, signal is strong, but the gateway has failed (ie your cable/DSL is down, etc)
6) The gateway is working, but there is no route to the servers (locks up trying to connect)
7) The servers are available but not returning data (404, 500, etc)
8) The chumby servers are available, but third-party content servers used by a widget are not

That's just off the top of my head.

Re: Work-around ideas for freeze-ups when the network drops?

Velkoosmaak:  More than pseudo code, but not ready to run either...

Duane:  I'm guessing (you would know more) that loss of connectivity with the chumby servers is what's causing the control panel to freeze up.  If the content server for a particular widget fails, hopefully just the widget hangs ("Loading...") w/o taking down the whole machine.  I'm also assuming the Linux kernel is still running and able to use the network stack in this state (true?)

Since in our case, the last mile / last 30 feet are the most prone to failure, a simple ping to my DSL provider's gateway server is a pretty good indication the network's failed enough that a reboot's in order.  Something like (in Python):

    def IsNetworkDown():
        return os.popen("ping -c 1 -t 10 xxx.xxx.xxx.1").read().find(", 0 packets received") != -1

Should fill the bill.  Can you point me to the Reboot / DisplayMessage functions?

Longer term, I'm really hoping that Chumby adds network connectivity testing (like the eight failure modes you described) to their regular QA process, and it gets fixed to the point where it can at least tell accurate time (based on the internal clock) when the net fails.

Thanks,
jp

Re: Work-around ideas for freeze-ups when the network drops?

To reboot, use the script /usr/chumby/scripts/reboot_normal.sh

To display a message on the display, either use /usr/bin/fbwrite for text, or /usr/bin/imgtool for an image - you'd probably want to shut down the Control Panel first, using /usr/chumby/scripts/stop_control_panel