[vox-tech] success with usb lego on linux!

2002-07-07 Thread Peter Jay Salzman

WOO HOO!  WOO HOO!  success!

this is totally brand spanking new.  be the first on your block to use
usb lego under linux.



step 1: getting the code

i can now use usb lego mindstorms under linux.  the linux driver *just*
got released a few days ago.  the download url is in one of my previous
posts.


step 2: patching software
=
export $USB = "/usr/src/linux"

the code includes lego.c and lego_usb.h which go in $USB/drivers/usb.
there's also a patch for $USB/drivers/usb/Makefile.  the patch allows
you to choose "lego" from the kernel usb menu in make {menu|x|}config.

i pointed out some problems with the driver initialization.  the patch
was included in my last email.  the patch is appied in the "wrong
direction" so you need to install it as patch -R < linux.patch or else
do the patch by hand (it's like 1 or 2 lines).   hopefully, he'll
release the updated copy rather than the old copy and a (broken) patch.

you also need to patch nqc.  hopefully, nqc with usb enabled support
will be released soon.


step 3: the device file
===
the device file is hardcoded into nqc as "/dev/usb", whether you have
devfs or not.  so, contrary to the readme that comes with the driver,
you must create the device file there:

mknod /dev/usb/legotower c 180 64

this will hopefully change soon.  also, i'm pretty sure an official
linux kernel major number will be assigned to lego mindstorms sometime
soon.


step 4: insert the module
=
modprobe -a lego


step 5: download the firmware
=
./nqc -Susb -firmware ../../firm0309.lgo

nota bene: -S always refers to the device file you're using, like
/dev/ttyS0 or /dev/ttyS1.  except when you use USB.  then you just use
"usb".   make sense?  no?  me neither.  hopefully this will change soon.


here's what i've tested:

* downloaded firmware 0309 (mindstorms 1.5) to RCX 1.0 (mindstorms 1.0)
  using the USB tower from mindstorms 2.0.

* downloaded firmware 0309 (mindstorms 1.5) to RCX 2.0 (mindstorms 2.0)
  using the USB tower from mindstorms 2.0.


and then there was linux!
ooo-yeeeaa.

pete
-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] Re: lego USB tower module - the author speaks

2002-07-07 Thread Peter Jay Salzman

sorry to respond to my own email, but i think richard switched the order
of the new lego.c and the old lego.c.

when you apply the patch, you'll either need to use "-R" since the patch
takes the "new version to the old version" or just apply the patch by
hand.

pete

begin p  
> hoo kay,
> 
> presumably you saw my email to the module author.  this was his
> response.
> 
> pete
> 
> 
> - Forwarded message from Richard Lucock -
> 
> From: Richard Lucock
> Subject: Re: lego USB tower
> To: [EMAIL PROTECTED]
> 
> Hi,
> 
> > loaded.  there are two curious things about the above output:
> > first, lego was assigned minor number 0, when it should've taken 64.
> 
> An error; 0 is the index into my local table, I forgot to add
> the offset (64) when printing this message. By the way, the value for
> the minor number will change when I get an official value, for the
> moment I have just stolen the one for the rio500.
> 
> > second, the "device node registration failed" message is disheartening.
> 
> Another error; the code shouldn't fail here, since a NULL
> return just means that devfs is not in use (Since the kernel routine
> devfs_register() is actually available on your system, I assume that
> you are using a 2.4 or later kernel; I haven't really thought about
> support for 2.2 or earlier).
> 
> I have attached a patch for both of these errors.
> 
> Good luck,
> Richard
> 
> 
> --- lego.cSun Jul  7 19:28:57 2002
> +++ lego.c.orig   Mon Jul  1 22:30:31 2002
> @@ -951,7 +951,7 @@
>goto probe_exit;
>}
>  
> -   info(__FUNCTION__ ": Allocated minor %d", lego_minor+LEGO_MINOR);
> +   info(__FUNCTION__ ": Allocated minor %d", lego_minor);
>  
> /* Private data for this instance */
>  
> @@ -1011,7 +1011,10 @@
> }
>  
> if(lego->devfs == NULL)
> -  dbg(__FUNCTION__ ": device node registration failed");
> +  {
> +  err(__FUNCTION__ ": device node registration failed");
> +  goto probe_exit;
> +  }
>  
> init_MUTEX(&(lego->lock));

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] lego USB tower module - the author speaks

2002-07-07 Thread Peter Jay Salzman

hoo kay,

presumably you saw my email to the module author.  this was his
response.

pete


- Forwarded message from Richard Lucock -

From: Richard Lucock
Subject: Re: lego USB tower
To: [EMAIL PROTECTED]

Hi,

> loaded.  there are two curious things about the above output:
> first, lego was assigned minor number 0, when it should've taken 64.

An error; 0 is the index into my local table, I forgot to add
the offset (64) when printing this message. By the way, the value for
the minor number will change when I get an official value, for the
moment I have just stolen the one for the rio500.

> second, the "device node registration failed" message is disheartening.

Another error; the code shouldn't fail here, since a NULL
return just means that devfs is not in use (Since the kernel routine
devfs_register() is actually available on your system, I assume that
you are using a 2.4 or later kernel; I haven't really thought about
support for 2.2 or earlier).

I have attached a patch for both of these errors.

Good luck,
Richard


--- lego.c  Sun Jul  7 19:28:57 2002
+++ lego.c.orig Mon Jul  1 22:30:31 2002
@@ -951,7 +951,7 @@
   goto probe_exit;
   }
 
-   info(__FUNCTION__ ": Allocated minor %d", lego_minor+LEGO_MINOR);
+   info(__FUNCTION__ ": Allocated minor %d", lego_minor);
 
/* Private data for this instance */
 
@@ -1011,7 +1011,10 @@
}
 
if(lego->devfs == NULL)
-  dbg(__FUNCTION__ ": device node registration failed");
+  {
+  err(__FUNCTION__ ": device node registration failed");
+  goto probe_exit;
+  }
 
init_MUTEX(&(lego->lock));
 




- End forwarded message -

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] mindstorms

2002-07-07 Thread Peter Jay Salzman

begin David Margolis <[EMAIL PROTECTED]> 
> 
> It would also be pimping to use a palm or zaurus or some other ir enabled
> handheld as a programmable remote control.
 
hmm... you jogged my memory.  IIRC, someone is working on a pda IR
driver.  i forget where i read this; you might want to check out
sourceforge or dave baum's "nqc" site.

pete

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] mindstorms

2002-07-07 Thread David Margolis



On Sun, 7 Jul 2002, Peter Jay Salzman wrote:

> i'm teaching a class on robotics this summer, and we have them stocked.
> so i cheated.
>

Hmm, well I just took the plunge and purchased a version 1.0 set off eBay
so it looks like I'll be getting the serial tower.  Good or bad, I'm not
sure - I can always upgrade, firmware or hardware (if need be) later.

Flipping through eBay, it looks like a lot of the parts are available
seperately.  I haven't seen the tower, but lots of motors/sensors are
available there and know you can get lots of individual parts from online
vendors.  Ebay has some interesting _my dog ate half of the pieces_ type
as is sets that might be good for someone looking to find extra parts cheap.

> i'm wondering - maybe you can purchase it mail order from lego?  i mean,
> surely there's got to be a way to replace lost or broken parts.  they
> prolly don't expect you to buy a whole new $200 set if you accidentally
> step on the tower.   at least, they better not!  :-)
>

I think I read that if you step on it, they cover it, but if you sit on
it, you have to buy a whole new set. :]

>
> no, not without a driver.  i read specifically in dave baum's book
> "definitive guide to lego mindstorms" that the protocol used is a
> simpler version of irda, but not irda itself.

It's too bad that's not standardized.  I've got two laptops with never
before used IR ports.  It would be nice to take advantage of that.  But
both said laptops also have unused serial ports so ...

It would also be pimping to use a palm or zaurus or some other ir enabled
handheld as a programmable remote control.

>
> the word "simpler" might be encouraging that someone, somewhere might
> write something.  the "hard part" of reverse engineering the lego IR
> protocol may have been done by the lego linux usb people, unless the
> tower is simply a device that reads raw data and converts it to the lego
> IR protocol using hard firmware.
>
> at this point, i'm starting to walk on shaky ground, so i better back
> off from saying anything else.   :-)
>
> pete
>

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] php install issue

2002-07-07 Thread Eric Engelhard

Rod Roark wrote:

> I'd love to see what you come up with.  BTW have you looked
> at PHP's GD-based image drawing support yet?

I've decided to speak about php/MING at the next CVBIG meeting (next
Monday before LUGOD). I also looked at the GD functions. Very cool,
thanks!
-- 
Eric Engelhard - www.cvbig.org - www.sagresdiscovery.com
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] mindstorms

2002-07-07 Thread Peter Jay Salzman

hi david,

begin David Margolis <[EMAIL PROTECTED]> 
> Was obtaining the serial (which I presume is the "old" IR tower)
> difficult?  Where did you find it.

i'm teaching a class on robotics this summer, and we have them stocked.
so i cheated.

> I suppose you could buy the old set on eBay or off the shelf of a
> store.
 
i'm wondering - maybe you can purchase it mail order from lego?  i mean,
surely there's got to be a way to replace lost or broken parts.  they
prolly don't expect you to buy a whole new $200 set if you accidentally
step on the tower.   at least, they better not!  :-)

> Here's another question: Do you suppose one could configure the built
> in IR port on a laptop to talk to the RCX?  It would be neat if I
> could type little bits of code and beam them over that way!

no, not without a driver.  i read specifically in dave baum's book
"definitive guide to lego mindstorms" that the protocol used is a
simpler version of irda, but not irda itself.

the word "simpler" might be encouraging that someone, somewhere might
write something.  the "hard part" of reverse engineering the lego IR
protocol may have been done by the lego linux usb people, unless the
tower is simply a device that reads raw data and converts it to the lego
IR protocol using hard firmware.

at this point, i'm starting to walk on shaky ground, so i better back
off from saying anything else.   :-)

pete

> On Sat, 6 Jul 2002, Peter Jay Salzman wrote:
> 
> > ok, i obtained the serial IR tower.
> >
> > i plugged the tower into my server, satan (the 2nd serial port).
> > After putting batteries into the RCX and downloading the Mindstorm
> > 1.5 firmware from katherine's website, i ran:
> >
> > nqc -S/dev/ttyS1 -firmware firm0309.lgo
> >
> > in the console, it printed:
> >
> > .draining .draining .draining .draining .draining .draining
> >
> > a whole bunch of times.  "0" appeared on the RCX and it began to
> > increase.  presumably, "draining" means the process of writing data
> > from an output buffer to the tower and the numbers on the RCX are
> > almost certainly the number of bytes read by the RCX.
> >
> > finally, the following appeared on the console:
> >
> > Current Version: 00030001/00030009
> >
> > and the RCX sang a pleasant tune.  i take this to be a good sign.
> >
> > pete
> >
> > ps- there is now a linux usb tower kernel driver.  i'll try it out
> > tonight.

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] lego USB tower

2002-07-07 Thread Peter Jay Salzman

sent to the author of the lego USB tower device driver.  any comments
welcome.



- Forwarded message from p -

dear richard,

this morning i tried out the lego linux USB patch.   the patches applied
flawlessly to the kernel source code (2.4.18) and to the most recent nqc
source code.

i made a char device file of (major/minor) number of (180/64) called
/dev/legotower.

did a modprobe -a lego and this is what was printed:

  satan# modprobe -a lego
  usb.c: registered new driver Lego Tower
  lego.c: probe_lego: USB Lego Tower (interface 0) found at address 2
  lego.c: probe_lego: Allocated minor 0
  lego.c: probe_lego: device node registration failed
  lego.c: v1.0:USB Lego driver

using lsmod i see that lego.o and the associated usb modules have
loaded.  there are two curious things about the above output:

first, lego was assigned minor number 0, when it should've taken 64.

second, the "device node registration failed" message is disheartening.

going through the code, i see in function static void *probe_lego:

   if(lego->devfs == NULL)
   {
  err(__FUNCTION__ ": device node registration failed");
  goto probe_exit;
   }

   probe_exit:

   if(err)
   {
  free_lego_resources(lego);
  lego = NULL;
   }


to my untrained eyes, this code looks like the module can't be used
unless the system is a devfs system.  i'm assuming that lego->devfs is
NULL for non devfs systems and that err() sets err, some "errno-like"
variable.

is this not correct?

and if it is correct, then i'm thinking that lego.o should unload
itself.

any thoughts on how to get this module to use the correct minor number
(other than compiling devfs into the kernel).

thanks!
pete

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] php install issue

2002-07-07 Thread Rod Roark

On Saturday 06 July 2002 07:28 pm, Eric Engelhard wrote:
> ...
> I now have have MING on my box at home and tested with some sample
> scripts from http://www.neuralust.com/%7Emingdocs/.
>
> For those interested, I'm trying php/MING as a graphical environment for
> displaying genomic information.

I'd love to see what you come up with.  BTW have you looked 
at PHP's GD-based image drawing support yet?

-- Rod
   http://www.sunsetsystems.com/

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] mindstorms

2002-07-07 Thread David Margolis

Was obtaining the serial (which I presume is the "old" IR tower)
difficult?  Where did you find it.  I suppose you could buy the
old set on eBay or off the shelf of a store.

Here's another question: Do you suppose one could configure the built
in IR port on a laptop to talk to the RCX?  It would be neat if I could
type little bits of code and beam them over that way!

Dave

On Sat, 6 Jul 2002, Peter Jay Salzman wrote:

> ok, i obtained the serial IR tower.
>
> i plugged the tower into my server, satan (the 2nd serial port).  After
> putting batteries into the RCX and downloading the Mindstorm 1.5
> firmware from katherine's website, i ran:
>
> nqc -S/dev/ttyS1 -firmware firm0309.lgo
>
> in the console, it printed:
>
> .draining
> .draining
> .draining
> .draining
> .draining
> .draining
>
> a whole bunch of times.  "0" appeared on the RCX and it began to
> increase.  presumably, "draining" means the process of writing data from
> an output buffer to the tower and the numbers on the RCX are almost
> certainly the number of bytes read by the RCX.
>
> finally, the following appeared on the console:
>
> Current Version: 00030001/00030009
>
> and the RCX sang a pleasant tune.  i take this to be a good sign.
>
> pete
>
> ps- there is now a linux usb tower kernel driver.  i'll try it out
> tonight.
> ___
> vox-tech mailing list
> [EMAIL PROTECTED]
> http://lists.lugod.org/mailman/listinfo/vox-tech
>

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech