/usr/include/lirc/serial.h is in liblirc-dev 0.9.4c-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /****************************************************************************
** serial.c ****************************************************************
****************************************************************************
*
* common routines for hardware that uses the standard serial port driver
* @ingroup private_api
*
* Copyright (C) 1999 Christoph Bartelmus <lirc@bartelmus.de>
*
*/
/**
* @file serial.h
* @brief Common routines for hw that uses the standard serial port driver.
* @author Christoph Bartelmus
* @ingroup driver_api
*
* Here is create_lock and delete_lock which manages the legacy, serial lock files.
* The other functions are wrappers for the termio(7) IOCTL commands.
*/
/** @addtogroup driver_api
* @{
*/
#ifndef _SERIAL_H
#define _SERIAL_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* Set the cfmakeraw termio options.
*
* @param fd File opened on a serial device.
* @return 0 on errors, else 1.
*/
int tty_reset(int fd);
/**
* Set/clear CTS control line.
*
* @param enable If true sets CTS, else clears it.
* @return 0 on errors, else 1.
*/
int tty_setrtscts(int fd, int enable);
/**
* Set/clear DTR control line.
*
* @param fd File opened on a serial device.
* @param enable If true sets DTR, else clears it.
* @return 0 on errors, else 1.
*/
int tty_setdtr(int fd, int enable);
/**
* Set the speed a. k. a. baudrate.
*
* @param fd File opened on a serial device.
* @param baud Speed constant as defined for termios cfsetospeed e.g.,
* B19200
* @return 0 on errors, else 1.
*/
int tty_setbaud(int fd, int baud);
/**
* Set the character size
*
* @param fd File opened on a serial device.
* @param Number of data bits: CS5, CS6, CS7, or CS8.
* @return 0 on errors, else 1.
*/
int tty_setcsize(int fd, int csize);
/**
* Creates a lock file of the type /var/local/LCK.. + name
* @param name Name of the device
* @return non-zero if successful
* @see http://www.pathname.com/fhs/2.2/fhs-5.9.html
*/
int tty_create_lock(const char* name);
/**
* Delete any legacy lock(s) owned by this process.
* @return 0 on errors, else 1.
* @see http://www.pathname.com/fhs/2.2/fhs-5.9.html
*/
int tty_delete_lock(void);
/**
* Set RTS and DTR control lines.
*
* @param fd File opened on a serial device.
* @param rts If 0 ignored, else sets RTS.
* @param cts If 0 ignored, else sets CTS.
* @return 0 on errors, else 1.
*/
int tty_set(int fd, int rts, int dtr);
/**
* Clear RTS and DTR control lines.
*
* @param fd File opened on a serial device.
* @param rts If 0 ignored, else clears RTS.
* @param cts If 0 ignored, else clears CTS.
* @return 0 on errors, else 1.
*/
int tty_clear(int fd, int rts, int dtr);
/**
* Write a single byte to serial device.
*
* @param fd File opened on a serial device.
* @param byte Item to write.
* @return -1 on errors, else 1.
*/
int tty_write(int fd, char byte);
/**
* Read a single byte from serial device.
*
* @param fd File opened on a serial device.
* @param byte Pointer to byte to be read.
* @return -1 on errors, else 1 and data stored in *byte.
*/
int tty_read(int fd, char* byte);
/**
* Write a single byte and check the echo from remote party. Makes a
* log printout if these don't match.
*
* @param fd File opened on a serial device.
* @param byte Byte to be written.
* @return 1 if a byte is successfully written and read, else 0. It's thus
* 1 even if the echo doesn't match.
*/
int tty_write_echo(int fd, char byte);
/** @} */
#ifdef __cplusplus
}
#endif
#endif
|