From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,17bb5c047554c2dc,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1993-09-02 07:21:05 PST Newsgroups: comp.unix.osf.osf1 Path: gmd.de!xlink.net!howland.reston.ans.net!usc!yeshua.marcam.com!zip.eecs.umich.edu!caen!malgudi.oar.net!picker!hchen From: hchen@picker.com (Hong Chen) Subject: read tty port ??? Message-ID: <1993Sep2.141653.6416@picker.com> Organization: Picker International, Inc. Date: Thu, 2 Sep 1993 14:16:53 GMT Hi net, I have a problem regarding reading the tty port. Following is a very simple codes, open a tty port, write a command to it, then try to read back a response. The problem is I got here is I can't read back anything. This is on DEC alpha OSF/1 1.2. I wonder anyone out there can give me a hint. It can't be hardware problem, when I use "cu" direct connect to the tty port, I get back the response. Any input will be appreciated. Please mail me the response to Thank you very much in advance. --------------------------include codes--------------------------- #include #include #include #include main() { int fd, count, total; char answer=' '; char str[256]; if ((fd = open("/dev/tty00",O_RDWR|O_NDELAY))== -1) { printf("Unable to Open /dev/tty00\n"); return(-1); } if (write(fd,"@43!",4)!=4) { printf("Write: errno: %d\n",errno); } total = 0; while (total < 1) { ioctl(fd,FIONREAD,&count); if (count) { read(fd,str,count); printf("respoce: [%s]\n",str); total = total + count; } printf("count = %d\n", count); } if (answer!='G') { printf("Error was detected: %c\n", answer); } } -------------------- end include codes-----------------------------