From e4ed04b4f3c76b26ed15632030a7814dae3a98f5 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Fri, 29 Mar 2024 17:04:18 -0300 Subject: Small fixes for Haiku. - Changed default port. - Limited range of baudrates. - Disabled definition of ALIGN macro (not used anyway). To compile use: `EXTRA_CFLAGS=-lnetwork make` diff --git a/esputil.c b/esputil.c index f88ed75..b46bd52 100644 --- a/esputil.c +++ b/esputil.c @@ -54,7 +54,9 @@ typedef enum { false = 0, true = 1 } bool; #include #endif +#ifndef __HAIKU__ #define ALIGN(a, b) (((a) + (b) -1) / (b) * (b)) +#endif // https://datatracker.ietf.org/doc/html/rfc1055 enum { END = 192, ESC = 219, ESC_END = 220, ESC_ESC = 221 }; @@ -349,7 +351,7 @@ static speed_t termios_baud(int baud) { case 57600: return B57600; case 115200: return B115200; case 230400: return B230400; -#ifndef __APPLE__ +#if ! defined(__APPLE__) && ! defined(__HAIKU__) case 460800: return B460800; case 500000: return B500000; case 576000: return B576000; @@ -1027,6 +1029,8 @@ int main(int argc, const char **argv) { if (ctx.port == NULL) ctx.port = "COM99"; // Non-existent default port #elif defined(__APPLE__) if (ctx.port == NULL) ctx.port = "/dev/cu.usbmodem"; +#elif defined(__HAIKU__) + if (ctx.port == NULL) ctx.port = "/dev/ports/usb0"; #else if (ctx.port == NULL) ctx.port = "/dev/ttyUSB0"; #endif -- 2.45.2