move uart_speed to conn struct and display baudrate only for real UART
This commit is contained in:
@@ -60,9 +60,6 @@
|
||||
# define SOL_TCP IPPROTO_TCP
|
||||
#endif
|
||||
|
||||
// To memorise baudrate, we don't want to call get_speed systematically
|
||||
uint32_t uart_speed;
|
||||
|
||||
typedef struct termios term_info;
|
||||
typedef struct {
|
||||
int fd; // Serial port file descriptor
|
||||
@@ -214,8 +211,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
||||
}
|
||||
}
|
||||
}
|
||||
uart_speed = uart_get_speed(sp);
|
||||
printf("[=] UART Setting serial baudrate %u\n", uart_speed);
|
||||
conn.uart_speed = uart_get_speed(sp);
|
||||
return sp;
|
||||
}
|
||||
|
||||
@@ -422,7 +418,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
||||
cfsetospeed(&ti, stPortSpeed);
|
||||
bool result = tcsetattr(spu->fd, TCSANOW, &ti) != -1;
|
||||
if (result)
|
||||
uart_speed = uiPortSpeed;
|
||||
conn.uart_speed = uiPortSpeed;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user