Add termios support to libserialport and set_baudrate error handling

This fixes issues with flashing with FT232H
This commit is contained in:
Marek Kraus 2022-11-22 13:55:38 +01:00
parent 807c21bbef
commit dd2801d6e9
2 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,9 @@ elseif(UNIX AND NOT APPLE)
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
target_compile_definitions(libblisp_obj PRIVATE
LIBSERIALPORT_ATBUILD
HAVE_TERMIOS2_SPEED
HAVE_STRUCT_TERMIOS2
HAVE_DECL_BOTHER
"SP_API=__attribute__((visibility(\"default\")))"
"SP_PRIV=__attribute__((visibility(\"hidden\")))")
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")

View File

@ -69,7 +69,10 @@ int32_t blisp_device_open(struct blisp_device* device, const char* port_name)
// } else {
device->current_baud_rate = 500000;
// }
sp_set_baudrate(serial_port, device->current_baud_rate);
ret = sp_set_baudrate(serial_port, device->current_baud_rate);
if (ret != SP_OK) {
return -1; // TODO: Handle this
}
device->serial_port = serial_port;
return 0;