From 48880cb18dded1d95d52aec5bae55ff31dcf2ad5 Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 30 Jun 2021 19:41:13 +0200 Subject: Add OSX CI target, fix OSX build --- backends/visca.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'backends/visca.c') diff --git a/backends/visca.c b/backends/visca.c index a36b139..6ae14d9 100644 --- a/backends/visca.c +++ b/backends/visca.c @@ -4,9 +4,12 @@ #include #include -#ifndef _WIN32 +#ifdef __linux__ #include #include +#elif __APPLE__ + #include + #include #endif #include "visca.h" @@ -89,9 +92,6 @@ static int ptz_configure_instance(instance* inst, char* option, char* value){ LOG("Direct device connections are not possible on Windows"); return 1; #else - - struct termios2 device_config; - options = strchr(value, ' '); if(options){ //terminate port name @@ -108,6 +108,8 @@ static int ptz_configure_instance(instance* inst, char* option, char* value){ //configure baudrate if(options){ + #ifdef __linux__ + struct termios2 device_config; //get current port config if(ioctl(data->fd, TCGETS2, &device_config)){ LOGPF("Failed to get port configuration data for %s: %s", value, strerror(errno)); @@ -123,6 +125,12 @@ static int ptz_configure_instance(instance* inst, char* option, char* value){ if(ioctl(data->fd, TCSETS2, &device_config)){ LOGPF("Failed to set port configuration data for %s: %s", value, strerror(errno)); } + #elif __APPLE__ + speed_t speed = strtoul(options, NULL, 10); + if(ioctl(data->fd, IOSSIOSPEED, &speed)){ + LOGPF("Failed to set port configuration data for %s: %s", value, strerror(errno)); + } + #endif } return 0; #endif -- cgit v1.2.3