0

I code a program which two computer communicate each other with serial port in cross platform but my program dont run cross platform but run linux to linux or windows to windows . I think my serial port settings arent the same.My settings:

WINDOWS:
DCB properties;
GetCommState(serialPort, &properties);

properties.Parity = NOPARITY;
properties.BaudRate=9600;
properties.ByteSize = 8;
properties.StopBits = ONESTOPBIT;

SetCommState(serialPort, &properties);

LINUX:

struct termios properties;

tcgetattr(serialPort, &properties);

properties.c_cflag = CS8|CREAD|B9600|CLOCAL;
properties.c_iflag = IGNBRK;
properties.c_oflag = 0;
properties.c_lflag = 0;
properties.c_cc[VMIN] = 1;
properties.c_cc[VTIME]= 0;

tcsetattr(serialPort, TCSANOW, &properties);

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by JRM
1

I'm certainly no expert, but I believe the serial I/O is setup with a tty device , then an emulation is setup in termcap. There is a command line program to do this, but I don't remember what it is.

The serial device gets associated with serial port, the device is associated with the emulation and a login profile is created.
You can tinker with the selected termcap for various effects and the login profile will determine the level of security, plus shell scripts to be run at login.
I don't think you can do much with Linux without a login shell!

Sorry to ramble, but i think that's roughly the area you need to be looking at...

Votes + Comments
Nice ~~ SpS
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.