Dear colleages,
I have written a command-line program that uses the serial port (TTYS0) for communication with an embedded device.
I need to port this program to Windows, so I tried to compile it under the Cygwin environment. I changed the name of the serial port from '/dev/TTYS0' to 'COM1:'.
The program compiles well, but when I start it, it terminates with an error on the function tcgetattr(), although it goes well over opening the serial port (see listing below). I'm getting error #25 "Not a typewriter".
Does anybody know why this is happening and can provide a solution?
Thank you very much in advance ar
if( (fhSerial = open(szSerialFileN,O_RDONLY)) == -1 ){ BailOut("Unable to open the serial port!\n"); } if( val == S_SET ){ if( tcgetattr(fhSerial,&OldSerialMode) != 0 ){ /*DEBUG*/ printf("'%s' %i",strerror(errno),errno); BailOut("Unable to read the serial port settings!\n"); }