device IO

From: Joe Pfeiffer <jjpfeifferjr_at_comcast.net>
Date: Fri 10 Jun 2005 12:01:16 AM GMT
Message-ID: <17064.55372.332895.182722@snowball.wb.comcast.net>
I'm attempting to use legolog
(http://www.cs.toronto.edu/cogrobo/Legolog/) and eclipse to
communicate with a Lego RCX, using the Lego USB infrared tower.

The device is opened as a stream, commands are written to it, and
sensor values are read from it.  Commands are written using the
following bottom-level code:

% putRcxByte(+Ascii): Sends Ascii character to Rcx using infrared tower
putRcxByte(Ascii) :-
    rcxStream(Rcx),
    put(Rcx, Ascii),
    flush(Rcx).

flush appears to be implemented internally using an lseek system call
(based on output of strace).  Unfortunately, the driver for this
device (as well as other non file-like devices) is not seekable, so
the flush causes an abort (I have verified that hacking the driver to
do nothing but return success on an lseek solves the problem, but not
in an acceptable way).

So...  is there a way around this?  I haven't found a flavor of open
that simply opens the stream with no buffering (this would be my first
choice); am I stuck doing the device IO in C?  Note that an implicit
flush won't help, as commands don't necessarily end with a newline.

Thanks!
Received on Fri Jun 10 01:04:53 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:37 PM GMT GMT