Subject:
|
Re: (Failed) Getting LegOS 0.2.2 working on Windows
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Wed, 5 Jan 2000 00:28:21 GMT
|
Viewed:
|
1972 times
|
| |
| |
I had the same problem. Under NT WS 4.0 and same instruction for LegOS 0.2.2.
Now I've solved!!! I'm here to explain how.
> I did some poking and experimentation, and here's a tad more info:
> - The "Invalid argument" error happens the very first time keepaliveSend() is
> called.
Same problem. I've solved getting back the source to the original version (no
more WINNT stuff).
> - Using the -v verbose switch yieldsd nothing more, since dll dies before it
> really gets off the ground. The IR tower LED never comes on.
I've read that you already made the led tower come green with the same
modification I've made, I think.
> Any further ideas?
Here is my diff for the original files (pre legOS-0.2.2-Win.diff) to make it
works with less modification in sources than from the patches from Peter Van
der Beken.
It works very well on my system (NT 4.0 SP6a) and I hope it works for you too.
I've also included the last patch I've found in
http://www.lugnet.com/robotics/rcx/legos/?n=601. Note that without this last
patch dll seems to lost sync (thanks Peter).
In the patches, I've also eliminated all warnings in compiling (I hate
them)... :-)
Here is my diff file (legOS-0.2.3-Win.diff). If you have problems using it I
can put it on my web server.
--------------------------- snipsnip
--- legOS\util\dll-src\loader.c Fri Oct 29 21:55:30 1999
+++ legOS\util\dll-src\loader.c Wed Jan 05 00:05:38 2000
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
+#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <signal.h>
@@ -79,6 +80,7 @@
int verbose_flag=0;
+void sigio_handler(int signo);
//! blocking I/R write.
/*! \return number of bytes written, or negative for error.
@@ -135,8 +137,13 @@
gettimeofday(&timeout,0);
total=REPLY_TIMEOUT+length*BYTE_TIME;
elapsed=0;
- do {
+ do {
+
+#if defined(WINNT)
+ sigio_handler(SIGIO);
+#else
usleep(total-elapsed);
+#endif
gettimeofday(&now,0);
elapsed=1000000*(now.tv_sec - timeout.tv_sec ) +
@@ -155,10 +162,12 @@
return -1;
}
+static struct timeval last;
+
void sigio_handler(int signo) {
if(signo==SIGIO) {
- struct timeval last,now;
+ struct timeval now;
unsigned long diff;
unsigned char buffer[256];
@@ -170,7 +179,7 @@
if(diff> 10000*LNP_BYTE_TIMEOUT) {
if(verbose_flag)
- fprintf(stderr,"#time %lu ",diff);
+ fprintf(stderr,"\n#time %lu ",diff);
lnp_integrity_reset();
}
len=read(rcxFD(),buffer,256);
@@ -213,11 +222,15 @@
} while(diff < 100000);
read(rcxFD(),buffer,256);
+ gettimeofday(&last,0);
+
// install IO handler
//
+#if !defined(WINNT)
signal(SIGIO,sigio_handler);
fcntl(rcxFD(),F_SETFL,O_ASYNC);
fcntl(rcxFD(),F_SETOWN,getpid());
+#endif
}
void ahandler(const unsigned char *data,unsigned char len,unsigned char src) {
@@ -266,7 +279,7 @@
unsigned char buffer[256+3];
while((opt=getopt_long(argc, argv, "r:p:s:v",
- long_options, &option_index) )!=-1) {
+ (struct option *)long_options, &option_index) )!=-1) {
switch(opt) {
case 'r':
sscanf(optarg,"%x",&rcxaddr);
--- legOS\util\dll-src\convert.c Sun Oct 31 16:50:39 1999
+++ legOS\util\dll-src\convert.c Tue Jan 04 23:56:38 2000
@@ -154,7 +154,7 @@
// read command-line options
//
while((opt=getopt_long(argc, argv, "s:v",
- long_options, &option_index) )!=-1) {
+ (struct option *)long_options, &option_index) )!=-1) {
unsigned tmp;
switch(opt) {
--- legOS\util\dll-src\lx.c Sun Oct 31 16:43:18 1999
+++ legOS\util\dll-src\lx.c Sun Jan 02 23:46:45 2000
@@ -48,7 +48,7 @@
int lx_write(const lx_t *lx,const unsigned char *filename) {
- int i,rc,fd=creat(filename,S_IRUSR | S_IWUSR | S_IRGRP);
+ int i,rc,fd=open(filename,O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,S_IRUSR |
S_IWUSR | S_IRGRP);
unsigned short tmp;
if(fd<0)
@@ -80,7 +80,7 @@
}
int lx_read(lx_t *lx,const unsigned char *filename) {
- int i,rc,fd=open(filename,O_RDONLY);
+ int i,rc,fd=open(filename,O_RDONLY | O_BINARY);
unsigned char buffer[6];
unsigned short tmp;
--------------------------- snipsnip
You can apply it with "patch -u -b < legOS-0.2.3-Win.diff" starting from
original files in LegOS-0.2.3.tar.gz.
For the remaining procedure I've used the original by Peter Van der Beken that
I've found at http://arthurdent.dorm.duke.edu/legos/archives/windows/legOS-
0.2.2/
Let me know if it works for you.
Bye,
Paolo.
|
|
Message has 2 Replies:
Message is in Reply To:
13 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|