mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
STM32: Check that termios attributes are set successfully
This commit is contained in:
@@ -200,9 +200,10 @@ bool STM32::open() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct termios tty;
|
struct termios tty = {};
|
||||||
|
struct termios compare = {};
|
||||||
|
|
||||||
if(tcgetattr(fd, &tty) < 0) {
|
if(tcgetattr(fd, &tty) != 0) {
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -229,6 +230,11 @@ bool STM32::open() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tcgetattr(fd, &compare) != 0 || memcmp(&tty, &compare, sizeof(struct termios)) != 0) {
|
||||||
|
close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create threads
|
// Create threads
|
||||||
readThread = std::thread(&STM32::readTask, this);
|
readThread = std::thread(&STM32::readTask, this);
|
||||||
writeThread = std::thread(&STM32::writeTask, this);
|
writeThread = std::thread(&STM32::writeTask, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user