read on pty files is not hapenning!
i have 2 pty devices (/dev/ptya0 -master & /dev/ttya0 -slave). i am able to open both devices. Both devices file descriptor is same. i am writing to master pty but while reading from the slave its not reading.
Sample code:
Master:
int serialDev,i;
char ch = 'M';
serialDev = open("/dev/ptyp9",O_RDWR|O_NOCTTY);
while(1)
{
i = write(serialDev,&ch,1);
printf("i= %d\n",i);
}
Slave:
int fd,i;
char ch;
fd = open("/dev/ttyp9",O_RDWR);
printf("fd= %d\n",fd);
while(1)
{
i = read(fd,&ch,1);
if(ch != 0)
printf("ch= %d\n",ch);
}
Thanks in advance!!!
|