Path: utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: gbnewby@rodan.acs.syr.edu (Gregory B. Newby) Newsgroups: comp.sys.sun Subject: Serial Port Processing Keywords: Miscellaneous Message-ID: <2301@brchh104.bnr.ca> Date: 2 Apr 91 15:00:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 39 Approved: Sun-Spots@rice.edu X-Original-Date: Sat, 30 Mar 91 22:54:36 GMT X-Sun-Spots-Digest: Volume 10, Issue 75, message 22 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu Hi, all. I could use some insight into reading/writing my serial port. I'm working with a Sparcstation 1 (also tried on a Personal Iris). I can use 'cat > /dev/ttyb' to write to the device (a interface adapter for a PowerGlove, believe it or not). 'cat < /dev/ttyb' just hangs, though. But, I've been unable to get my C program to read/write to the device. I am able to get a FILE descriptor, but then it hangs when trying to read or write. Have tried fopen() and open() (which both succeed). For reading/writing, have tried such things are fprintf(), putc(), even printf() piped via the shell to the port (which have all hung until interrupted via ^c). Any ideas on what the trouble might be? Do I need to use a socket, or is there trouble with buffering? Or, an fcntl call? The SunOS manuals have not proved to be illuminating, and I've never tried this sort of thing before. I tried variations on buffer size (and unbuffered), on opening the file, and on reading/writing. All to no avail. I tested the whole shebang with my PC and a demo program (also Kermit), and was able to interact correctly. The demo program (no source, alas!) reads and writes successfully to the glove. Specifics on the incoming signal: 9-bytes, generated 30 times per second - so, there's plenty of time when it's not sending. I tried a null modem, but then couldn't even use 'cat' to write to /dev/ttyb (yes, that is definitely the correct device. /ttya doesn't work any better). The Sun port is set at its defaults: 9600 baud, 7 bits. The glove is also at 9600 baud, tho with 8 bits. This doesn't seem to matter at all on the PC. Thanks for any insight you might provide. -- Greg Newby gbnewby@rodan.acs.syr.edu gbnewby@sunrise.bitnet