le_tty.h File Reference
Go to the source code of this file.
Functions | |
int | le_tty_Open (const char *ttyDev, int flags) |
void | le_tty_Close (int fd) |
le_result_t | le_tty_SetBaudRate (int fd, tty_Speed_t ttyRate) |
le_result_t | le_tty_GetBaudRate (int fd, tty_Speed_t *ttyInRatePtr, tty_Speed_t *ttyOutRatePtr) |
le_result_t | le_tty_SetFraming (int fd, char parity, int wordSize, int stopBits) |
le_result_t | le_tty_SetFlowControl (int fd, tty_FlowControl_t ttyFlowControl) |
le_result_t | le_tty_SetCanonical (int fd) |
le_result_t | le_tty_SetRaw (int fd, int numChars, int timeout) |
Detailed Description
Legato tty API include file
Copyright (C) Sierra Wireless Inc.
Function Documentation
◆ le_tty_Close()
void le_tty_Close | ( | int | fd | ) |
Close and unlock a serial port file descriptor.
- Parameters
-
[in] fd File descriptor
◆ le_tty_GetBaudRate()
le_result_t le_tty_GetBaudRate | ( | int | fd, |
tty_Speed_t * | ttyInRatePtr, | ||
tty_Speed_t * | ttyOutRatePtr | ||
) |
Get baud rate of serial port.
- Returns
- LE_OK if successful = - LE_NOT_FOUND if speed is not supported by legato
- LE_FAULT for any other error
- Parameters
-
[in] fd File Descriptor [out] ttyInRatePtr input baud rate [out] ttyOutRatePtr output baud rate
◆ le_tty_Open()
int le_tty_Open | ( | const char * | ttyDev, |
int | flags | ||
) |
Open a serial port device and lock it for exclusive use.
- Returns
- Serial port file descriptor number on success.
- -1 on failure.
- Note
- Previous versions of le_tty_Open() would exit the process with LE_FATAL if the tty failed to successfully open; now either a file descriptor is returned or -1 on failure.
- Parameters
-
[in] ttyDev Path name [in] flags flags used in open(2)
◆ le_tty_SetBaudRate()
le_result_t le_tty_SetBaudRate | ( | int | fd, |
tty_Speed_t | ttyRate | ||
) |
Set baud rate of serial port.
- Returns
- LE_OK if successful
- LE_UNSUPPORTED if value cannot be set
- LE_NOT_FOUND if value is not supported
- LE_FAULT for any other error
- Parameters
-
[in] fd File Descriptor [in] ttyRate Baud rate
◆ le_tty_SetCanonical()
le_result_t le_tty_SetCanonical | ( | int | fd | ) |
Set serial port into terminal mode. Converts EOL characters to unix format, enables local echo, line mode, etc.
- Returns
- LE_OK if successful
- LE_UNSUPPORTED if canonical mode cannot be set
- LE_FAULT for any other error
- Parameters
-
[in] fd File Descriptor
◆ le_tty_SetFlowControl()
le_result_t le_tty_SetFlowControl | ( | int | fd, |
tty_FlowControl_t | ttyFlowControl | ||
) |
Set flow control option on serial port. Flow control options are: LE_TTY_FLOW_CONTROL_NONE - flow control disabled LE_TTY_FLOW_CONTROL_XON_XOFF - software flow control (XON/XOFF) LE_TTY_FLOW_CONTROL_HARDWARE - hardware flow control (RTS/CTS)
- Returns
- LE_OK if successful
- LE_UNSUPPORTED if value cannot be set
- LE_NOT_FOUND if value is not supported
- LE_FAULT for any other error
- Parameters
-
[in] fd File decriptor [in] ttyFlowControl Flow control option
◆ le_tty_SetFraming()
le_result_t le_tty_SetFraming | ( | int | fd, |
char | parity, | ||
int | wordSize, | ||
int | stopBits | ||
) |
Set framing on serial port. Use human-readable characters/numbers such as 'N', 8, 1 to indicate parity, word size and stop bit settings.
- Returns
- LE_OK if successful
- LE_UNSUPPORTED if value cannot be set
- LE_NOT_FOUND if value is not supported
- LE_FAULT for any other error
- Parameters
-
[in] fd File Descriptor [in] parity Parity ('N','O','E') [in] wordSize Data bits (5,6,7,8) [in] stopBits Stop bits (1,2)
◆ le_tty_SetRaw()
le_result_t le_tty_SetRaw | ( | int | fd, |
int | numChars, | ||
int | timeout | ||
) |
Set serial port into raw (non-canonical) mode. Disables conversion of EOL characters, disables local echo, sets character mode, read timeouts, etc.
- Returns
- LE_OK if successful
- LE_UNSUPPORTED if raw mode cannot be set
- LE_FAULT for any other error
- Parameters
-
[in] fd File Descriptor [in] numChars Number of bytes returned by read(2) when a read is performed. [in] timeout when a read(2) is performed return after that timeout. The timeout value is given with 1 decimal places.