Code:
/* blocking mode */
main()
{ int d
d=open("/dev/tty1", O_RDWR); /** sometimes just hang-up here **/
write(d, "TEST", 4);
close(d);
}
I suggest follow:
Code:
int d;
d = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
write(d, "TEST", 4);
close(d);
Becouse with O_NDELAY, routine would'n care DCD signal state... I think that's the problem...
O_NOCTTY tells that this isn't controlling terminal, so abort signals etc wouldn't mess up the process.
You can change mode on the fly to blocking with:
Code:
fcntl(d, F_SETFL, 0);
and non blocking:
Code:
fcntl(d, F_SETFL, FNDELAY);
I'm sorry of this messy post, hope you understand me

no sleep whole night
