From: ·······@arti.vub.ac.be
Subject: serial port connection to lisp
Date: 
Message-ID: <l3k7k931zd.fsf@artipc18.vub.ac.be>
Hi

can anyone tell me how to open an IO connection to the serial port in
Lisp?
I am running RedHat Linux 8.0, allegro Common lisp 6.2.
I tried the following:

  CL-USER(1): (setf ss (open "/dev/ttyS0"))
  #<TERMINAL-SIMPLE-STREAM /dev/ttyS0 for input fd 8 @ #x71a4d14a>

which works but returns only an input port.

The following does not work:

  CL-USER(2): (setf ss (open "/dev/ttyS0" :direction :io))
  Error: File #p"/dev/ttyS0" already exists.
    [condition type: FILE-ERROR]

And neither does the following:

  CL-USER(3): (setf ss (open "/dev/ttyS0" :direction :io)) :if-exists :append))
  Error: seek with file descriptor 9 resulted in error (code 29): Illegal seek.
     [condition type: FILE-ERROR]

Now lastly, the following does not generate an error

   [1] CL-USER(18): (setf ss (open "/dev/ttyS0" :direction :io :if-exists :overwrite))
   #<TERMINAL-SIMPLE-STREAM /dev/ttyS0 fd 12 @ #x716b9e22>

but this does not seem to work.

Thanks, Joachim.
From: ·······@arti.vub.ac.be
Subject: Re: serial port connection to lisp
Date: 
Message-ID: <l3bs5l2yjo.fsf@artipc18.vub.ac.be>
> Hi
> 
> can anyone tell me how to open an IO connection to the serial port in
> Lisp?
>    [1] CL-USER(18): (setf ss (open "/dev/ttyS0" :direction :io :if-exists :overwrite))
>    #<TERMINAL-SIMPLE-STREAM /dev/ttyS0 fd 12 @ #x716b9e22>
> 
> but this does not seem to work.

Sorry, this DOES seem to work (ttyS0 settings were not ok.), so I
think the problem is solved.

J.