File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,13 +97,15 @@ void hal_flash_lock(void)
9797{
9898}
9999
100- #include <termio.h>
101100#include <fcntl.h>
102101#include <err.h>
103- #include <linux/serial.h>
104102
105103static int rate_to_constant (int baudrate ) {
104+ #ifdef __MACH__
105+ #define B (x ) case x: return x
106+ #else
106107#define B (x ) case x: return B##x
108+ #endif
107109 switch (baudrate ) {
108110 B (50 ); B (75 ); B (110 ); B (134 ); B (150 );
109111 B (200 ); B (300 ); B (600 ); B (1200 ); B (1800 );
@@ -119,7 +121,6 @@ default: return 0;
119121static int serial_open (const char * device , int rate )
120122{
121123 struct termios options ;
122- struct serial_struct serinfo ;
123124 int fd ;
124125 int speed = 0 ;
125126
@@ -129,8 +130,10 @@ static int serial_open(const char *device, int rate)
129130
130131 speed = rate_to_constant (rate );
131132
133+ #ifndef __MACH__
132134 if (speed == 0 ) {
133135 /* Custom divisor */
136+ struct serial_struct serinfo ;
134137 serinfo .reserved_char [0 ] = 0 ;
135138 if (ioctl (fd , TIOCGSERIAL , & serinfo ) < 0 )
136139 return -1 ;
@@ -149,6 +152,7 @@ static int serial_open(const char *device, int rate)
149152 (float )serinfo .baud_base / serinfo .custom_divisor );
150153 }
151154 }
155+ #endif
152156
153157 fcntl (fd , F_SETFL , 0 );
154158 tcgetattr (fd , & options );
You can’t perform that action at this time.
0 commit comments