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 / 1915
1914  |  1916
Subject: 
Liblnp bug found and squashed ?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 14 Jun 2001 21:53:07 GMT
Viewed: 
1663 times
  
This is no good: I'm beginning to talk to myself  ;]

This is a follow-up on my previous post, and (hopefully) an answer to
problem number 3. 'Bit technical I'm afraid.

I'M STILL STUCK ON THE OTHER PROBLEMS (as of tonight anyway it's 23:48 and
I'm at work :<<<<)

I took a comprehensive look at the lnpd+liblnp/liblnp/stub.c (implementation
of the lnp library for the pc side) and IMHO it looks like there's a bug
crawling in there, but I'm in no way an expert on these matters. Anyway,
this is how the story goes :

the "transmit_ack" function, does a write in the "socket_fd" but, unlike the
"lnp_logical_write", it does not protect itself from receiving messages (no
"block_rcv" call) while doing so. Is this on purpose or a mistake ?

I changed it and it looks as if this was the reason I had hangups on the PC
side (esp. when using "lnp_xxx_write" from whithin a handler). Hence the post.

Below is my version of the "transmit_ack" function :

static int transmit_ack(void)
{
    fd_set fds;
    struct timeval timeout;
    int result;
    static unsigned char ack_byte = LNPD_ACK_OK;

    block_rcv();

    // wait for socket to become writeable
    while (1)
    {
        FD_ZERO(&fds);
        FD_SET(socket_fd,&fds);
        msecs2timeval( ACK_TIMEOUT, &timeout);
        result = select(socket_fd+1,NULL,&fds,NULL,&timeout);
        if (result == 1 ) break;
        if ( result < 0 && errno == EINTR ) continue;
        // timed out
        unblock_rcv();
        return -1;
    }
    // write ACK
    if ( (result = write(socket_fd,&ack_byte,1) ) != 1 ) {
        unblock_rcv();
        return -1;
    }

    unblock_rcv();
    return 0;
}



Message is in Reply To:
  Lnp collision under Linux
 
Hi ! I'm having trouble trying to make a Linux box (Mandrake 7.2 kernel 2.2.17-21mdksmp) communicate with my RCX. My ultimate goal is to try and make the PC control the RCX via infrared (so as not to suffer from the RCX memory limitations). To do (...) (23 years ago, 11-Jun-01, to lugnet.robotics.rcx.legos)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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