Hi,
I am porting an application written in C to C#. It includes Serial Comm. with the comms tty device (Serial Port).
In C an ioctl call gets the device details in Termio structure, sets the device details (port) and writes the device details back
making another ioctl call. I need to map the corresponding port settings (MARKED IN RED) in my C# code.
Please find below the code written in C..
// open tty port for connection to LSA
P_clock_lsa_fd=open(LSA_CHANNEL_DEVICE, O_RDWR|O_NDELAY|O_NOCTTY|O_NSHARE);
// make an ioctl call to obtain device details in
// the termio structure tbuf
if (ioctl(P_clock_lsa_fd, TCGETA, &tbuf)==-1)
{
// failed to obtain device details
}
tbuf.c_iflag= IGNBRK /* ignore break condition */
| INPCK /* input parity checking enabled */
| ISTRIP; /* strip to 7 bits */
tbuf.c_oflag=0; /* No post-process output mapping */
tbuf.c_cflag= B2400 /* 2400 baud */
| CS7 /* 7-bit characters */
| CREAD /* enable receiver */
| PARENB /* parity processing enabled */
| CLOCAL; /* no modem control */
tbuf.c_lflag=0; /* No terminal specific options required */
tbuf.c_cc[VMIN]=1; /* read request satisfied after one character */
tbuf.c_cc[VTIME]=5; /* 0.5 sec inter-character timeout */
/* (with VMIN=1 and reads of 1 char, this is */
/* meaningless, I think) */
// write device details back
if (ioctl(P_clock_lsa_fd, TCSETA, &tbuf)==-1)
{
// error updating device details
}
Can you please help me out in mapping these settings of the port for my C# Code.
Thanks and Regards,
Malay Agarwal

Query regarding calling serial ports in C#!!!
haihtomy
IGNBRK: you can't ignore them. Not an issue, breaks are old school.
INPCK: automatic when you set the Parity property
ISTRIP: automatic when you set the Databits property
B2400: automatic when you set the BaudRate property
CS7: automatic when you set the Databits property
CREAD: always on
PARENB: hmm, how's that different from INPCK
CLOCAL: keep the Handshake property to its default of None
VMIN: automatically enabled, use the DataReceived event
VTIME: ReadTimeout property.
Nothing too weird, you can make it work. Start with HyperTerminal first.