[PLUG] Serial Port Programming

Richard C. Steffens rsteff.l at comcast.net
Fri Oct 29 03:14:36 UTC 2004


I'm playing with a device called an X-10 Powerhouse model CP290. It's a 
computer interface for the X-10 home control system* that connects to a 
computer via a serial port. I used to have it connected to my old DOS laptop 
running software that came with it many years ago (1980's, I think). For some 
reason, this software will not work with Pentium class processors, and 
although I've never found an explanation, in my experience, it is true. This 
little device has worked well for years, only needing to be reloaded after a 
power failure.

A few weeks ago, the hard drive on the laptop died. I decided that it was time 
to find a Linux solution to communicating with the thing and went looking on 
the web. I found a program**, downloaded and compiled it, and tried to get it 
to work. I've gotten it to the point where I've confirmed that I'm trying to 
talk to the right serial port, ttyS0, made the correct owner:group 
assignments, and made the error message change from not being able to open 
the serial port to Input/output error.

The first time I compiled it, I didn't notice a warning:

tty.c: In function `setup_tty':
tty.c:96: warning: passing arg 2 of `connect' from incompatible pointer type

Lines 95-98 read:

  /* connect to serial port daemon */
  r = connect (tty, &inaddr, size of (inaddr));
  if (r==0)
 return;

As this message is already getting long, I'll start by asking: is chasing this 
warning  likely to be productive in getting communication working between the 
computer and the CP290? If not, do you have any suggestions as to where to 
look. (I realize that I haven't provided much of the code from the file 
tty.c, and will do so for anyone who'd like to look deeper.) 

A couple of other details: The CP290 has a simple RS-232 hardware interface, 
three wires: Transmit, Receive, Ground. There is no hardware handshake.

With a little light box just attached to the CP290 the green LED for RD lights 
up. With it just attached to my laptop, TD, RTS, and DTR are lit***. 

Alternatively, can anyone recommend an example of a working program that can 
communicate with a serial port and let me set the baud rate, parity, stop 
bits, etc, without that program needing to hear back from the device on the 
other end of the port right away? (I've tried cu, but it appears to want more 
in the way of handshaking from a terminal, or modem, or something.)

Thanks for any advice.

-- 
Regards,

Dick Steffens
http://home.comcast.net/~rsteff/

* X-10 automation sends control signals over the 110 volt power lines to 
modules that plug into a standard outlet, and then control devices, such as 
lamps that are plugged into them. It takes advantage of the very short period 
of time when the AC voltage on the power line is 0 to send out a DC pulse 
with an address and an instruction. If you're not familiar with it, and want 
more details, I can get more long winded about it. :-)

** ftp://ftp.foxharp.boston.ma.us/pub/pgf/x10/

*** For you youngsters who haven't had the joy of working with serial devices:
RD = Receive Data
TD = Transmit Data
RTS = Request To Send
DTR = Data Terminal Ready



More information about the PLUG mailing list