mirror of https://github.com/FOME-Tech/openblt.git
macos port
This commit is contained in:
parent
1539b090c7
commit
4a57078e37
|
@ -162,33 +162,11 @@ bool SerialPortOpen(char const * portname, tSerialPortBaudrate baudrate)
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
/* Input modes - clear indicated ones giving: no break, no CR to NL,
|
options.c_cflag |= ( CLOCAL | CREAD | CS8); // Configure the device : 8 bits, no parity, no control
|
||||||
* no parity check, no strip char, no start/stop output (sic) control.
|
options.c_iflag |= ( IGNPAR | IGNBRK );
|
||||||
*/
|
options.c_cc[VTIME]=0; // Timer unused
|
||||||
options.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
|
options.c_cc[VMIN]=0; // At least on character before satisfy reading
|
||||||
/* Output modes - clear giving: no post processing such as NL to CR+NL. */
|
if (tcsetattr(portHandle, TCSANOW, &options) == -1)
|
||||||
options.c_oflag &= ~(OPOST);
|
|
||||||
/* Control modes - set 8 bit chars */
|
|
||||||
options.c_cflag |= (CS8);
|
|
||||||
/* Local modes - clear giving: echoing off, canonical off (no erase with
|
|
||||||
* backspace, ^U,...), no extended functions, no signal chars (^Z,^C).
|
|
||||||
*/
|
|
||||||
options.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
|
|
||||||
/* Configure timeouts. */
|
|
||||||
options.c_cc[VMIN] = 0;
|
|
||||||
options.c_cc[VTIME] = 1; /* in units of 1/10th of a second */
|
|
||||||
/* Set the new options for the port. */
|
|
||||||
if (tcsetattr(portHandle, TCSAFLUSH, &options) == -1)
|
|
||||||
{
|
|
||||||
SerialPortClose();
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Turn on DTR. */
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
iFlags = TIOCM_DTR;
|
|
||||||
if (ioctl(portHandle, TIOCMBIS, &iFlags) == -1)
|
|
||||||
{
|
{
|
||||||
SerialPortClose();
|
SerialPortClose();
|
||||||
result = false;
|
result = false;
|
||||||
|
|
Loading…
Reference in New Issue