Tuesday, December 26, 2006

Linux: Netgear Open Source Wireless-G Router

Summary:

I just bought Netgear's Open Source Wireless-G Router, model KWGR614. The setup wizard doesn't work with Firefox. I spent a lot of time fighting with tech support. They told me to use Internet Explorer even though the box says, "Open source code enables router customization for Linux developers and hobbyists". I tried to fix the source myself, but the C code for the admin interface is specifically missing from the source download. I'm quite frustrated.
In the setup wizard, I tried to click the "Next" button, and it didn't do anything. I got the error, '"document.forms.MatchSubnet" has no properties'. I'm using the Firebug Firefox extension (which I love) to see such error messages.

I decided to call tech support. It was some woman in India, of course. Here were her suggestions over the course of a 45 minute conversation with her:
  • Use XP
  • Pay for premium support (Yeah right! Pay $35 for a problem in their code!?!)
  • Use XP
  • Pay for premium support
  • She finally acknowledged the problem
  • Switch laptops
  • Reset the box
  • Use Safari
  • Use IE
  • Firewall problem?
  • Contact Linux vendor
  • Contact Linux vendor
  • Contact Linux vendor
After 45 minutes, she finally let me talk to her supervisor. He was friendly, humble, and knowledgeable. He was smart enough to ask which distro I was using--Ubuntu. He said that he had tried it with Firefox. However, it turned out that he had tried the WGR614 with Firefox, not the KWGR614. I'm guessing that the K means "the open source version".

He was able to tell me that I can go to the "basicsetting.htm" page in the admin utility in order to bypass the setup wizard. Still, there were silly errors all over the place. For instance, on one screen, I clicked "Next" and it tried to actually download the results of the CGI. It turned out to be a 0 length file. I'm guessing the headers were just really messed up. On another page, there was a parsing error. It's clear that the admin utility wasn't written cleanly by anyone who knew anything about the Web.

I tried looking for help in the forums and on Google, but I can't find many other Linux users who have tried this. I'm guessing that it's brand new, and all the other Linux users already had an AP. That would have included me, except my AP recently broke. (It was a D-Link. It would freeze up every couple minutes, and hard resetting it didn't help.)

In trying to fix the Netgear, I checked to see if there were any firmware updates. I was already using the most recent firmware (0.0.9.25 or something like that).

Next, I tried to download the source and fix it myself. It's open source--the road is often a little bumpy, right? I found the HTML containing the error, but the CGI (written in C) was specifically missing. In it's place was a ".a" file:
$ cd ~/Desktop/KWGR614_V1.0.0_09.25NA_src
$ grep -ril MatchSubnet .
grep: ./linux-2.4.x/drivers/net/re865x/cle/cle: No such file or directory
./user/boa/src/dni/libhttp_dni.a
./user/boa/src/www/CA_Welcome.html
The earlier support guy said he was going to submit a bug and inform the developers, which was really my goal in the first place. However, I just got another email:
My name is Patty and I am a Netgear level 2 technician. Could you please state the problem that you are trying to report? I have read the notes and the notes are not clear to the problem you are having with the router. As soon as the information is received I can then have it looked into.
Ugh! It doesn't work in Firefox. Is that really that hard to understand?

My buddy said he has a Linksys WRT54GL. He said the source is available for that as well, and there are already open source hacks for it. My guess is that Netgear is throwing out the KWGR614 as a lame attempt to try to capture some of the open source market. Ok, they got me, but not for long! I think I'll just return it and buy the Linksys!

Friday, December 08, 2006

Linux: Coping With Settings on Remote Systems

If you're like me, you probably end up working a lot on remote systems. It can be a pain to manage your settings on them. I think we all have a way of dealing with this. Ideally, we'd all manage our dot files in some publicly accessible source control. If you're a mere mortal like me, though, you just want a way to copy your dot files to the remote system and install your ssh key.

If so, then the following snippit from my .zshrc may be helpful to you. It's been tested with zsh, but probably works just fine in .bashrc. If you add to your .zshrc, remember to re-source that file or re-login. Edit to suit your tastes:
# Install my ssh key on a remote system.
ssh-installkey() {
[ -n "$1" ] || {
echo "usage: ssh-installkey username@host" >&2
return 1
}
ssh $1 "mkdir -p -m 700 .ssh"
ssh $1 "cat >> ~/.ssh/authorized_keys2" < ~/.ssh/id_dsa.pub
}

# Install some basic settings on the remote system for things like zsh, vim,
# and screen. Then, try to change shells.
#
# This does not call ssh-installkey because that command should not be executed
# multiple times. Call it first.
ssh-installsettings() {
[ -n "$1" ] || {
echo "usage: ssh-installsettings username@host" >&2
return 1
}
scp -r \
.zlogin .zshenv .zshrc \
.vim .vimrc \
.screenrc \
$1:
echo "Attempting to set login shell." >&2
ssh $1 "chsh -s /usr/bin/zsh"
}

Wednesday, December 06, 2006

Python: Trick of the Day

Let's say you have a function that makes use of a global. (Pretend for a moment that global isn't a dirty word.) Let's say you want to define that global within that function, but only if it doesn't already exist. You can use "globals()" and "setdefault" together in the following, fun one-liner:
x = globals().setdefault("x", 0)
This will get the value of the global x. If x didn't already exist, it'll be initialized to 0.