[ale] Linux Does it Again!

Danny Cox danscox at mindspring.com
Thu Jan 20 19:19:28 EST 2005


All,

	Just wanted to tell y'all this story.  I'm continually amazed at the
wonderful things that folks do because they love Linux.

	This Christmas, I finally got a Lego Mindstorms kit.  It has lots of
parts, but the 'brick' is a microcontroller that can drive three motors,
and receive input from three sensors.  Programs are written on a PC, and
downloaded via an infrared transmitter they call the 'tower' to the
brick.

	I did a little homework previous to getting into it, and found NQC,
"Not Quite C", a language developed by David Baum, which looks a lot
like C, but isn't really, that runs under Linux.  In addition to
compiling source to microcode, it also drives the infrared tower.  The
tower is USB, and the NQC source gives a link to the Linux USB driver
for the thing.

	Well, I've done a little kernel hacking, and I can spot iffy code
sometimes.  This was iffy code.  Upon initialization, it would be
kmalloc()-ing various members of it's structure, but upon failure, it
simply bailed.  It never kfree()-ed what it had grabbed!  Memory leaks
for sure!  I continued googling around, and stumbled across an entry for
a patch or two to the driver.  The patches were done by Greg KH, Mister
USB himself!  Hmm!  I'm running Fedora Core 3, so I looked
in /lib/modules/2.6.10-1.741_FC3/kernel/drivers/usb/misc, and found,
would you believe it? "legousbtower.ko"!  It's ready to go!  I started a
tail -f on messages, plugged in the tower, and Bingo! it recognized it
right off!  I had to add a line to the permissions and rules for the
hotplug stuff to create the /dev link, but there it was!

	And they say that Linux isn't a SERIOUS OS.  Let's see you find a
legousbtower module on Solaris! ;-)

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny



More information about the Ale mailing list