Read and write /dev/ttya?

Skip Montanaro montnaro at spyder.crd.ge.com
Sat Jan 19 13:39:47 AEST 1991


I'm trying to write some code to control a Lyon-Lamb MiniVAS animation
sequencer and am having a bit of a problem getting status info back from the
device.

The MiniVAS is an RS-232 device. I have it plugged into /dev/ttya on a Sun-3
through a null modem. Some of the commands evoke a one or more character
response from the box which have to be read to determine the transaction
status. For instance, the initialization sequence "VSG" evokes an "I"
response when initialization is complete.

All communication with the device is printable ASCII, so for simplicity I'm
just using stdio. I'm successful writing to the device. (This I know because
the MiniVAS and the VTR do the anticipated things.) However, I can't seem to
read the response stream. Here's what I'm doing in effect (sans declarations
and error checking):

	f = fopen("/dev/ttya", "r+");
	fprintf(f, "VSG");
	fflush(f);

	ch = getc(f);

	if (ch != 'I') ...

The getc() just hangs. What am I doing wrong?

Thx,

--
Skip (montanaro at crdgw1.ge.com)



More information about the Comp.unix.programmer mailing list