FreeRDP
comm_serial_sys.c File Reference
#include <winpr/assert.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
#include "comm_serial_sys.h"
#include "comm.h"
#include <winpr/crt.h>
#include <winpr/wlog.h>

Macros

#define CMSPAR   010000000000
 
#define TTY_THRESHOLD_THROTTLE   128 /* now based on remaining room */
 
#define TTY_THRESHOLD_UNTHROTTLE   128
 
#define N_TTY_BUF_SIZE   4096
 
#define BAUD_TABLE_END   0010020 /* __MAX_BAUD + 1 */
 

Functions

static BOOL commstatus_error (WINPR_COMM *pComm, const char *ctrl)
 
static BOOL get_properties (WINPR_COMM *pComm, COMMPROP *pProperties)
 
static BOOL set_baud_rate (WINPR_COMM *pComm, const SERIAL_BAUD_RATE *pBaudRate)
 
static BOOL get_baud_rate (WINPR_COMM *pComm, SERIAL_BAUD_RATE *pBaudRate)
 
static BOOL set_serial_chars (WINPR_COMM *pComm, const SERIAL_CHARS *pSerialChars)
 
static BOOL get_serial_chars (WINPR_COMM *pComm, SERIAL_CHARS *pSerialChars)
 
static BOOL set_line_control (WINPR_COMM *pComm, const SERIAL_LINE_CONTROL *pLineControl)
 
static BOOL get_line_control (WINPR_COMM *pComm, SERIAL_LINE_CONTROL *pLineControl)
 
static BOOL set_handflow (WINPR_COMM *pComm, const SERIAL_HANDFLOW *pHandflow)
 
static BOOL get_handflow (WINPR_COMM *pComm, SERIAL_HANDFLOW *pHandflow)
 
static BOOL set_timeouts (WINPR_COMM *pComm, const SERIAL_TIMEOUTS *pTimeouts)
 
static BOOL get_timeouts (WINPR_COMM *pComm, SERIAL_TIMEOUTS *pTimeouts)
 
static BOOL set_lines (WINPR_COMM *pComm, UINT32 lines)
 
static BOOL clear_lines (WINPR_COMM *pComm, UINT32 lines)
 
static BOOL set_dtr (WINPR_COMM *pComm)
 
static BOOL clear_dtr (WINPR_COMM *pComm)
 
static BOOL set_rts (WINPR_COMM *pComm)
 
static BOOL clear_rts (WINPR_COMM *pComm)
 
static BOOL get_modemstatus (WINPR_COMM *pComm, ULONG *pRegister)
 
static BOOL is_wait_set (WINPR_COMM *pComm)
 
static BOOL set_wait_mask (WINPR_COMM *pComm, const ULONG *pWaitMask)
 
static BOOL get_wait_mask (WINPR_COMM *pComm, ULONG *pWaitMask)
 
static BOOL set_queue_size (WINPR_COMM *pComm, const SERIAL_QUEUE_SIZE *pQueueSize)
 
static BOOL purge (WINPR_COMM *pComm, const ULONG *pPurgeMask)
 
static BOOL get_commstatus (WINPR_COMM *pComm, SERIAL_STATUS *pCommstatus)
 
static BOOL refresh_PendingEvents (WINPR_COMM *pComm)
 
static void consume_event (WINPR_COMM *pComm, ULONG *pOutputMask, ULONG event)
 
static BOOL unlock_return (WINPR_COMM *pComm, BOOL res)
 
static BOOL wait_on_mask (WINPR_COMM *pComm, ULONG *pOutputMask)
 
static BOOL set_break_on (WINPR_COMM *pComm)
 
static BOOL set_break_off (WINPR_COMM *pComm)
 
static BOOL set_xoff (WINPR_COMM *pComm)
 
static BOOL set_xon (WINPR_COMM *pComm)
 
static BOOL get_dtrrts (WINPR_COMM *pComm, ULONG *pMask)
 
static BOOL config_size (WINPR_COMM *pComm, ULONG *pSize)
 
static BOOL immediate_char (WINPR_COMM *pComm, const UCHAR *pChar)
 
static BOOL reset_device (WINPR_COMM *pComm)
 
const SERIAL_DRIVERSerialSys_s (void)
 

Variables

static const speed_t BAUD_TABLE [][3]
 
static const ULONG SERIAL_SYS_SUPPORTED_EV_MASK
 
static const SERIAL_DRIVER SerialSys
 

Macro Definition Documentation

◆ BAUD_TABLE_END

#define BAUD_TABLE_END   0010020 /* __MAX_BAUD + 1 */

◆ CMSPAR

#define CMSPAR   010000000000

WinPR: Windows Portable Runtime Serial Communication API

Copyright 2011 O.S. Systems Software Ltda. Copyright 2011 Eduardo Fiss Beloni belon.nosp@m.i@os.nosp@m.syste.nosp@m.ms.c.nosp@m.om.br Copyright 2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2014 Hewlett-Packard Development Company, L.P.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ N_TTY_BUF_SIZE

#define N_TTY_BUF_SIZE   4096

◆ TTY_THRESHOLD_THROTTLE

#define TTY_THRESHOLD_THROTTLE   128 /* now based on remaining room */

◆ TTY_THRESHOLD_UNTHROTTLE

#define TTY_THRESHOLD_UNTHROTTLE   128

Function Documentation

◆ clear_dtr()

static BOOL clear_dtr ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ clear_lines()

static BOOL clear_lines ( WINPR_COMM *  pComm,
UINT32  lines 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_rts()

static BOOL clear_rts ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ commstatus_error()

BOOL commstatus_error ( WINPR_COMM *  pComm,
const char *  ctrl 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_size()

static BOOL config_size ( WINPR_COMM *  pComm,
ULONG *  pSize 
)
static

◆ consume_event()

static void consume_event ( WINPR_COMM *  pComm,
ULONG *  pOutputMask,
ULONG  event 
)
static
Here is the caller graph for this function:

◆ get_baud_rate()

static BOOL get_baud_rate ( WINPR_COMM *  pComm,
SERIAL_BAUD_RATE pBaudRate 
)
static
Here is the call graph for this function:

◆ get_commstatus()

static BOOL get_commstatus ( WINPR_COMM *  pComm,
SERIAL_STATUS pCommstatus 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_dtrrts()

static BOOL get_dtrrts ( WINPR_COMM *  pComm,
ULONG *  pMask 
)
static
Here is the call graph for this function:

◆ get_handflow()

static BOOL get_handflow ( WINPR_COMM *  pComm,
SERIAL_HANDFLOW pHandflow 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_line_control()

static BOOL get_line_control ( WINPR_COMM *  pComm,
SERIAL_LINE_CONTROL pLineControl 
)
static
Here is the call graph for this function:

◆ get_modemstatus()

static BOOL get_modemstatus ( WINPR_COMM *  pComm,
ULONG *  pRegister 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_properties()

static BOOL get_properties ( WINPR_COMM *  pComm,
COMMPROP pProperties 
)
static

◆ get_serial_chars()

static BOOL get_serial_chars ( WINPR_COMM *  pComm,
SERIAL_CHARS pSerialChars 
)
static
Here is the call graph for this function:

◆ get_timeouts()

static BOOL get_timeouts ( WINPR_COMM *  pComm,
SERIAL_TIMEOUTS pTimeouts 
)
static

◆ get_wait_mask()

static BOOL get_wait_mask ( WINPR_COMM *  pComm,
ULONG *  pWaitMask 
)
static

◆ immediate_char()

static BOOL immediate_char ( WINPR_COMM *  pComm,
const UCHAR *  pChar 
)
static
Here is the call graph for this function:

◆ is_wait_set()

static BOOL is_wait_set ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ purge()

static BOOL purge ( WINPR_COMM *  pComm,
const ULONG *  pPurgeMask 
)
static
Here is the call graph for this function:

◆ refresh_PendingEvents()

static BOOL refresh_PendingEvents ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_device()

static BOOL reset_device ( WINPR_COMM *  pComm)
static

◆ SerialSys_s()

const SERIAL_DRIVER* SerialSys_s ( void  )

WinPR: Windows Portable Runtime Serial Communication API

Copyright 2014 Hewlett-Packard Development Company, L.P.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the caller graph for this function:

◆ set_baud_rate()

static BOOL set_baud_rate ( WINPR_COMM *  pComm,
const SERIAL_BAUD_RATE pBaudRate 
)
static
Here is the call graph for this function:

◆ set_break_off()

static BOOL set_break_off ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ set_break_on()

static BOOL set_break_on ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ set_dtr()

static BOOL set_dtr ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ set_handflow()

static BOOL set_handflow ( WINPR_COMM *  pComm,
const SERIAL_HANDFLOW pHandflow 
)
static
Here is the call graph for this function:

◆ set_line_control()

static BOOL set_line_control ( WINPR_COMM *  pComm,
const SERIAL_LINE_CONTROL pLineControl 
)
static
Here is the call graph for this function:

◆ set_lines()

static BOOL set_lines ( WINPR_COMM *  pComm,
UINT32  lines 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_queue_size()

static BOOL set_queue_size ( WINPR_COMM *  pComm,
const SERIAL_QUEUE_SIZE pQueueSize 
)
static
Here is the call graph for this function:

◆ set_rts()

static BOOL set_rts ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ set_serial_chars()

static BOOL set_serial_chars ( WINPR_COMM *  pComm,
const SERIAL_CHARS pSerialChars 
)
static

NOTE: Only XonChar and XoffChar are plenty supported with the Linux N_TTY line discipline.

ERRORS: ERROR_IO_DEVICE ERROR_INVALID_PARAMETER when Xon and Xoff chars are the same; ERROR_NOT_SUPPORTED

Here is the call graph for this function:

◆ set_timeouts()

static BOOL set_timeouts ( WINPR_COMM *  pComm,
const SERIAL_TIMEOUTS pTimeouts 
)
static
Here is the call graph for this function:

◆ set_wait_mask()

static BOOL set_wait_mask ( WINPR_COMM *  pComm,
const ULONG *  pWaitMask 
)
static
Here is the call graph for this function:

◆ set_xoff()

static BOOL set_xoff ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ set_xon()

static BOOL set_xon ( WINPR_COMM *  pComm)
static
Here is the call graph for this function:

◆ unlock_return()

static BOOL unlock_return ( WINPR_COMM *  pComm,
BOOL  res 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_on_mask()

static BOOL wait_on_mask ( WINPR_COMM *  pComm,
ULONG *  pOutputMask 
)
static
Here is the call graph for this function:

Variable Documentation

◆ BAUD_TABLE

const speed_t BAUD_TABLE[][3]
static

◆ SERIAL_SYS_SUPPORTED_EV_MASK

const ULONG SERIAL_SYS_SUPPORTED_EV_MASK
static
Initial value:
=
#define SERIAL_EV_TXEMPTY
Definition: libwinpr/comm/comm.h:86
#define SERIAL_EV_RING
Definition: libwinpr/comm/comm.h:92
#define SERIAL_EV_RX80FULL
Definition: libwinpr/comm/comm.h:94
#define SERIAL_EV_BREAK
Definition: libwinpr/comm/comm.h:90
#define SERIAL_EV_RXCHAR
Definition: libwinpr/comm/comm.h:84
#define SERIAL_EV_DSR
Definition: libwinpr/comm/comm.h:88
#define SERIAL_EV_RXFLAG
Definition: libwinpr/comm/comm.h:85
#define SERIAL_EV_RLSD
Definition: libwinpr/comm/comm.h:89
#define SERIAL_EV_ERR
Definition: libwinpr/comm/comm.h:91
#define SERIAL_EV_CTS
Definition: libwinpr/comm/comm.h:87

◆ SerialSys

const SERIAL_DRIVER SerialSys
static