My lovely (but shy) wife came up with the idea of building a robot to unplug and replug the device, controlled by telephone (so that when I noticed the problem, I could call home and reboot the machine).
I improved on the idea by having the computer monitor it's own internet connection, and decide to reboot the router whenever it cannot find the internet any more. And I thought that a relay switch would be more practical than an arm which unplugs and re-plugs the device.
Then I started trying to answer the question "How do I get my computer to switch on or off a device that's plugged in?"
The obvious, but expensive, answer was home automation technology, like X10 or the newer replacements. Many hundreds of dollars later, I could have a system which was capable of switching off any lamp or dimmer in the house, and maybe also my router. That research is for another blog entry, but for now, let's say it's way too much overkill for my problem.
Then I started researching computer-controlled relays. I was almost ready to break out the soldering iron with some simple plans that would control a 125 volt relay from the parallel port, when I noticed this: http://www.thinkgeek.com/gadgets/electronic/6ee4/
"Mmmmm", thought I, "this is interesting. It is a 120 volt switch, controlled by the computer. Now how can I switch my USB port on or off?"
After some research, I discovered the USB spec says it's possible to control the power to individual ports. Then I discovered that not all USB controllers support this, and I discoverd that I've used all my USB port already, so I don't have a free USB port to plug this into.
After yet more research I discovered how to get the Linux USB driver to enable/disable power on a specific port, and I discovered which brand of USB hub supports this feature.
Finally, I bought a new USB hub that supports power control, a "Mini power minder", and I wrote some custom code to monitor the network and drive the power to the USB port. "FLCR-2" ("Fast, Lightweight, Cablemodem Reconnector") was born!
What are the lessons learned?
- It's OK to search far and wide for ideas, when you really don't know what you're looking for.
- Linux is better than Windows, because many things that are simply impossible in Windows are difficult but possible in Linux. Windows can't switch off a USB port on demand, Linux can.