void *serial_function(void *threadNo_R)
{
int ImThreadNo = (int) threadNo_R;
fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);//
if (fd == -1)
{
/* Could not open the port. */
perror("open_port: Unable to open /dev/ttyUSB0 - ");
}
fcntl(fd, F_SETFL,0);
while(1)
{
read(fd,&dataReceived.Serial_input,1);
printf("\n From serial fn: Serial_input is:%c\n",dataReceived.Serial_input);
if(V_buf.power_window_data.front_right_up>=1)
{
writenornot= write(fd,"Window is raising:",19);
if (writenornot < 0)
{
printf("Write Failed \n");
}
else
printf("Write successfull \n");
}
}
}
In the above program serial input send via terminal which will be read by driver and further operation is carried out.If I press a key 'a' and i should press enter stroke to pass the key,whereas I'm reading both 'a' and 'enter stroke' .Is there any method such that open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY); where it is reading both key which I press and "enter" also .I want enter key should be avoided.