Compare commits

...

2 Commits

Author SHA1 Message Date
57b9a1036c skip uart_read logic if empty 2026-04-27 13:54:29 +02:00
b4dfc516fa skip can_read logic if empty 2026-04-27 13:51:26 +02:00

View File

@ -118,6 +118,8 @@ void read_can(Tel *t, int soc) {
struct can_frame frame;
int nbytes = read(soc, &frame, sizeof(struct can_frame));
if (nbytes < 0) return; // -1 EAGAIN means empty
if (nbytes > 0) {
switch (frame.can_id) {
@ -136,6 +138,9 @@ void read_can(Tel *t, int soc) {
void read_uart(Tel *t, int fd, SerialParser *uart_str) {
char buf[128];
int n = read(fd, buf, sizeof(buf));
if (n < 0) return; // -1 EAGAIN means empty
if (n > 0) {
for (int i = 0; i < n; i++) {
char c = buf[i];