update for libusefull_macros v.0.3.2

This commit is contained in:
2025-04-28 12:38:41 +03:00
parent 9048c98099
commit 9c2b6aeebf
8 changed files with 38 additions and 129 deletions

View File

@@ -24,7 +24,7 @@
#include <asm-generic/termbits.h>
#include <stdbool.h>
#include <stdint.h>
//#include "dbg.h"
#include <usefull_macros.h>
typedef enum{ // device: tty terminal, network socket or UNIX socket
DEV_TTY,
@@ -32,27 +32,16 @@ typedef enum{ // device: tty terminal, network socket or UNIX socket
DEV_UNIXSOCKET,
} devtype;
typedef struct {
char *portname; // device filename (should be freed before structure freeing)
int speed; // baudrate in human-readable format
char *format; // format like 8N1
struct termios2 oldtty; // TTY flags for previous port settings
struct termios2 tty; // TTY flags for current settings
int comfd; // TTY file descriptor
uint8_t *buf; // buffer for data read
size_t bufsz; // size of buf
size_t buflen; // length of data read into buf
} TTY_descr2;
typedef struct{
devtype type; // type
char *name; // filename (dev or UNIX socket) or server name/IP
TTY_descr2 *dev; // tty serial device
sl_tty_t *dev; // tty serial device
char *port; // port to connect
int speed; // tty speed
pthread_mutex_t mutex; // reading/writing mutex
char eol[3]; // end of line
char seol[5]; // `eol` with doubled backslash (for print @ screen)
int exclusive;
} chardevice;
uint8_t *ReadData(int *l);