# Mindstorms Troubles

## farrioth

Whenever I try to access my Lego USB Tower using NQC, I get the following error:

```

Could not open serial port or USB device

```

I have the legousbtower module loaded, and usb is in my USE flags.

What is my problem and how do I fix it?

Thanks for any help.

----------

## tomthewombat

If you are using Gentoo's ebuilds, i don't think they have usb support.  Use my ebuilds.  Its late here and I need to goto bed.  I'll get back to you with more info.  BTW.. if you are using my ebuilds, make sure that /usr/src/linux points to the proper kernel version.

----------

## farrioth

I'm using your ebuilds. /usr/src/linux is correct.

----------

## tomthewombat

do you have a /dev/usb/legousbtower0?

----------

## farrioth

Yes;

```

lr-xr-xr-x  1 root root       13 Jun 11  2004 lego0 -> legousbtower0

crw-rw-r--  1 root root 180, 160 Jan  1  1970 legousbtower0

```

I just noticed, on startup, that legousbtower failed to load, but when I lsmod, it is loaded:

```

legousbtower           14276  0 

```

Dmesg shows this:

```

drivers/usb/core/usb.c: registered new driver legousbtower

drivers/usb/misc/legousbtower.c: LEGO USB Tower Driver v0.9

drivers/usb/misc/legousbtower.c: LEGO USB Tower #0 now attached to major 180 minor 160

drivers/usb/misc/legousbtower.c: LEGO USB Tower firmware version is 1.0 build 134

```

----------

## Legoguy

I've tried this before with similar fate. I guess I'm glad I have a Mindstorms 1.0 set with the Serial tower and the RCX with the power jack on the back  :Very Happy: 

I ordered the USB tower from PITSCO LEGO and enjoyed using it on Windows until I relized it had lower range - I suggest getting a serial tower if you can.

----------

## tomthewombat

Try not putting the USB tower behind any hubs and btw do you use ehci (usb 2.0) in your kernel?  and do you use uhci or ohci?

----------

## tomthewombat

if you do have ehci try legousbtower.c 0.92.

Oh by the way.  Did you ever patch the legousbtower in the kernel at all?  The one currently in the kernel only works on some ohci systems.  Not uhci or ehci.

----------

## farrioth

I've tried the new version, still the same problems.

I did patch the kernel.

The tower is not behind a hub.

I don't know weather i'm using ohci or uhci. My mobo is an Asus K8V.

Ehci, ohci, and uhci are all modules, and are loaded.

----------

## tomthewombat

try it without loading the ohci or ehci.  Mainly the driver still has trouble with usb2.0 and functioning behind hubs.

----------

## farrioth

Ohci_hcd and ehci_hcd are loaded weather I like it or not.

Do I have to not compile them at all?

Note that i'm using genkernel.

----------

## tomthewombat

try rmmod

I know that the legousbtower driver has problems with ehci, but i thought it was fully fixed.  i think there is also a 0.93 though that i may have lost :-/

----------

## farrioth

Tried that, still the same problem.

----------

## tomthewombat

Sorry been busy lately.

Does the light on your tower light up when you attempt a download via nqc?

----------

## farrioth

No, I only get the error. Nqc, it seems, cannot open the device, so it terminates.

The tower lights up when I plug it in, though.

----------

## tomthewombat

do you have proper permissions to /dev/usb/legousbtower0?

do you have legousb emerged even though 2.6 already contains the module?

you are using USE=usb to emerge nqc i believe you already said.

if you say yes to all these try this:

edit my nqc ebuild on the following line

epatch ${FILESDIR}/nqc-${PV}-${My_KV}.patch

to say:

epatch ${FILESDIR}/nqc-${PV}-2.6.patch

It seems to me either nqc doesn't know howto use usb, can't find /dev/usb/legousbtower0, is trying to access a different inode (eg. /dev/legotower0), or simply doesn't have access.

are you using the right command?  'nqc -Susb -d program'

----------

## tomthewombat

Did you get it working okay?  Or will this problem require a more in-depth solution?  I'm very interested in working the bugs out.

----------

## farrioth

Sorry, due to a bug in the forums, I have not recieved topic reply notifications about this topic, and did not know about your reply until I checked this topic manually.

The nqc ebuild does not contain the line "epatch ${FILESDIR}/nqc-${PV}-${My_KV}.patch"

```
crw-rw-r--  1 root root 180, 160 Jan  1  1970 /dev/usb/legousbtower0
```

```

*  dev-lang/legousb

      Latest version available: 0.5.4

      Latest version installed: 0.5.4

      Size of downloaded files: 22 kB

      Homepage:    http://legousb.sourceforge.net/

      Description: Lego USB Tower Linux Driver Modules

      License:     GPL-2

```

----------

## tomthewombat

if you use the nqc ebuild (2.5.1-r1) in that package, it should contain that line.  This patches nqc to use USB in linux.

I feel you pain about the email notifications :-p, by the way, hehe!

----------

## farrioth

I was probably looking at 2.5.1, not 2.5.1-r1.

Still the same error.

----------

## JCDenton

 *tomthewombat wrote:*   

> Sorry been busy lately.
> 
> Does the light on your tower light up when you attempt a download via nqc?

 

I had the same problem as farrioth but my light blinks once,

but still I get the message "Couldn't open serial or usb device"

HELP ???

----------

## will_in_wi

make a symlink from /dev/usb/legousbtower0 (or whatever it is) to /dev/tower0. I need to figure out how to make that a patch as I am having permission problems with symlinks and the most recent versions of udev.

----------

