[comp.unix.wizards] accessing a port

bobc@killer.UUCP (Bob Calbridge) (01/04/88)

This may not be the correct group to ask this on but since a similar
problem is currently being discussed I thought I'd give it a try.
I currently do some work on a 3B2/300 under System V at a local 
community college.  Several months ago we attached a Motorola 68000
trainer board to /dev/tty34.  Up to this point we have been using 
"cu" to access the board.  It works fine since we got the baud rate
straighted out.  The trainer board has the ability to accept input
in the form of a hexfile by prefacing the input with "LO1\n".  If
communication with the board is via a modem using a terminal program
it is possible to type in the "LO1\n" and then using the terminal
programs ability to transmit an ascii file.  The problem arises when
the hexfile to be tranferred is local on the system's disk.  We have
tried using "write" for this and it doesn't work.  I wrote a short
C program that acts like write, hard coded to the device, and although
there is no reported error when the device is opened and the program
exits without error, the file itself has not be dumped to the trainer.
I started to write another C program using "curses" to make a more
interactive communication which would tell me what the board is saying
to me while I'm talking to it.  The major problem is that when I 
try to do a "board = fopen("/dev/tty34","w+")" I get a NULL result.
It appears that the only mode I can open the port in is "w".
Can anyone tell me if this is even an acceptable method of attack?
I should mention that the board is reset when the port is closed
by tieing it to DTR so that when the port is opened again so that
the board is not trying to digest any previous input.  The memory is
not affected by the reset.
Thanks in advance.
Best,
Bob