Ignoring MODEM control commands on pty driver.
i am using the pty driver to communicate between 2 processes. on the master side i am creating a master pty and in the slave side, i am using the slave name to create the slave file descriptor.
On the master side i am trying the ioctl TIOCMGET comamnd for modem control, which is not valid for a pty driver. so i am getting the ioctl failure.
But is there any way, i can ignore the TIOCMGET call and return ioctl success.
Sample Code given below:
int devfd;
char slave[12];
int status = 0;
pid = forkpty(&devfd,slave,NULL,NULL);
status = grantpt(devfd);
if (status != -1)
status = unlockpt(devfd);
status = ioctl(devfd, TIOCMGET,&arg);
printf("ioctl21 TIOCMGET status =%d, errno = %d\n",status,errno);
--- Here i get the status as -1 and errno = 22 (EINVAL).
--- can anybode help me in getting this sattus as 0, for this pty. I dont want any modem commands, only i want the ioctl to succeed.
--Many thanks
Last edited by mrsq; 09-02-2009 at 11:52 PM.
Reason: corrected TIOCMGET command!
|