chg: less fallbacks

This commit is contained in:
iceman1001 2019-05-07 12:05:37 +02:00
commit 7785dcbce4

View file

@ -106,15 +106,12 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
uart_reconfigure_timeouts(sp, UART_FPC_CLIENT_RX_TIMEOUT_MS); uart_reconfigure_timeouts(sp, UART_FPC_CLIENT_RX_TIMEOUT_MS);
if (!uart_set_speed(sp, speed)) { if (!uart_set_speed(sp, speed)) {
// trying some fallbacks automatically // try fallback automatically
speed = 115200; speed = 115200;
if (!uart_set_speed(sp, speed)) { if (!uart_set_speed(sp, speed)) {
speed = 9600; uart_close(sp);
if (!uart_set_speed(sp, speed)) { printf("[!] UART error while setting baudrate\n");
uart_close(sp); return INVALID_SERIAL_PORT;
printf("[!] UART error while setting baudrate\n");
return INVALID_SERIAL_PORT;
}
} }
} }
conn.uart_speed = uart_get_speed(sp); conn.uart_speed = uart_get_speed(sp);