I'm working on putting together a little Raspberry-Pi box which will connect to the net through a cellular-modem (like a Huawei E220, E1750, or E173). It needs to be able to sit there and run for months and months, fixing its own connectivity issues by itself.
Up until now, it has used a wifi hotspot and a little USB wifi dongle. If there are any issues with connecting to the internet, the RasPi is able to completely cycle the power to the hotspot to reboot that, then it unloads the usb wifi-dongle drivers and loads them again.
I'm hoping to eliminate the wifi-dongle-to-hotspot arrangement, and just use a 3G/cellular modem. But I'm worried about the modem, after months of use, getting into some hung state. So, I'd like a way for the RasPi to "reboot" the cellular modem as much as possible.
What I've tried, so far, is just unloading the three drivers which seem to be used by it (usbserial, usb-wwan, and options), and then reloading them. When I do this, the /dev/ttyUSB0 and /dev/ttyUSB1 do disappear and reappear, and AT commands still work. However, when I try to connect back to the network (with "pon gprs", say), the connection gets aborted somewhere in the compression negotiation. But, if I physically unplug the modem and plug it back it, it works fine, again.
So, something about the modem or drivers isn't getting reset "enough" when I just try to unload/reload the drivers. So, I guess I have two questions:
1 - Does anybody seen this behavior (of the modem dialing fine, but then failing during negotiation of the protocols, after messing with the drivers)? And, if so, is there a way for me to help the cellular modem get its head straight? 2 - Is there, perhaps, another way to reset the modem, but sending some magic bytes to the driver or USB port or something?