My DD-WRT adventures have come to an end. I spent a long time finding the perfect firmware, cramming Python into it, massaging libraries and… found an immovable roadblock.
Here’s the thing: in DD-WRT the serial port — which I intend to use for communication between the Arduino and Fonera — is connected to the Linux console. This makes sense: that port is there as an interface of last resort, but it’w only useful if it’s actually connected to something like the shell. Unfortunately, a side effect of this is that all incoming communication triggers system commands — regardless of whether it’s from an administrator who’s just accidentally screwed up his ethernet port or from a microcontroller trying to politely say hello. Worse, the console hogs the serial port, preventing my Python script from reading from it at all.
This linkage is established when the kernel is invoked. That’s not an easy thing to change without recompiling DD-WRT. It can be undone at runtime using a program called setconsole, but that program isn’t compiled into the DD-WRT firmware I have — I’d have to recompile to get it. And if I’m going to recompile things, why not just use OpenWRT? It’s smaller, easier to build and more customizable. And while DD-WRT and its community is undoubtedly better for most people trying to simply turn their routers into better routers, OWRT’s got more people ready to discuss the esoteric router territory where I’ve found myself. The order of magnitude difference in the projects’ respective IRC channel populations is proof enough of that. Sure, in OWRT exotic network configurations may require a bit more wading through documentation and conf files (as opposed to DD-WRT’s pleasantly powerful web interface). But that’s a small price to pay if the goddamn thing actually works.
So last night I successfully built and installed OpenWRT. I had to do it in a VirtualBox Ubuntu image — building OWRT on OS X is possible but a bit of a pain. Other than that, it went great. I haven’t yet put the install through its python-using paces — I found I’d accidentally left a few packages out on my first pass, so after establishing that SSH worked I set it to recompile and went to bed — but every software component I need (python-mini, setconsole, pyserial, stty, etc.) was right there in the menuconfig build system. Clearly somebody has gotten these things to work in the past — tonight I hope to be next one to accomplish that feat.