This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Lego IR tower USB driver vs. Cygwin

A bit of background for those who aren't Lego fans...
Lego (as in childrens' brick toy) make a robotics kit named Mindstorms. The 
robot is controlled by a microprocessor brick named the RCX.which is 
programmed on a PC. The program is downloaded to the RCX via infra-red 
communications. The PC end of the IR is a device (called the tower) that, 
until recently, plugged into a serial port. Later versions of MIndstorms 
use a USB tower instead. Lego provides Windows software for programming and 
downloading the users' software into the RCX via the tower. Naturally, 
various people have hacked the software. There is an alternate operating 
system for the RCX called LegOS. With it comes programs for downloading to 
the RCX. The serial version of the tower software for LegOS works 
successfully under both Windows and Unix.

For the USB tower, however, there is less support. There is no Unix driver 
(yet). There is a version of the download software that (apparently) works 
with older versions of Cygwin and/or Windows. However, there has been no 
success (that I know of) of using the USB tower with recent versions of Cygwin.

The download program attempts to open a device named \\.\legotower1. This 
works via the standard Win32 call CreateFile(). However, under Cygwin, the 
effect is quite strange. When you try to open the device using:
	open("\\\\.\\legotower1, O_RDWR)
the machine hangs for a considerable period (~30 seconds). In this time, 
the machine is essentially dead - the mouse cursor moves but the cursor in 
a bash shell window stops flashing and Alt-Tab does nothing. Eventually the 
open succeeds. However, writing to the opened device does nothing. I've 
also tried with the device name "//./legotower1" instead with exactly the 
same result. It is definitely opening the device since, if I spell 
legotower wrongly or if I use legotower2, I get a "no such file or 
directory" response. This happens just using "cat" from a shell prompt too 
- "cat > //./legotower1".

I've tried debugging it to see the exact parameters that open() eventually 
uses when it internally calls CreateFIle() - so far no success.

I'm doing this using Cygwin version 1.3.9-1 under Windows 98 SE.

Can somebody please explain to me why:
- this would (presumably) have worked with older versions of Cygwin
- why opening the device works with Win32 CreateFile() but not Cygwin open()
- why the long hang
- why I can't write to the device even after it does open
Has anybody got any suggestions on how to debug this further?

Thanks in advance for any help,

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]