To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 619
618  |  620
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: 
1829 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:
  Re: (Failed) Getting LegOS 0.2.2 working on Windows
 
G'day, (...) When trying to apply the patch I get 3 rejects and a bad formated patch file error message. So I applied the patches by hand. Using your patches, I can compile everything without warning (good on yer!!!) and download legOS.srec as well (...) (25 years ago, 5-Jan-00, to lugnet.robotics.rcx.legos)
  Re: (no longer Failed) Getting LegOS 0.2.2 working on Windows
 
Way to go Paolo! So the only thing that needs to be changed is replace my patch to loader.c with yours? I'll put that onto arthurdent. Glad that it's finally solved. Now, i'll try to get Martin's LNP stuff working on windows. Peter BTW A happy new (...) (25 years ago, 10-Jan-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: (Failed) Getting LegOS 0.2.2 working on Windows
 
(...) The original loader.c doesn't compile, due to O_ASYNC (and other stuff) - worked around in the patch for Windows folks. No help there ... I did some poking and experimentation, and here's a tad more info: - The "Invalid argument" error happens (...) (25 years ago, 17-Dec-99, to lugnet.robotics.rcx.legos)

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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR