Set up the GreaseWeazle termios properly.

This commit is contained in:
David Given
2021-06-02 22:51:57 +02:00
parent e88b939866
commit 98e4094d70

View File

@@ -9,6 +9,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
static const char* gw_error(int e)
{
@@ -128,6 +129,16 @@ public:
if (_fd == -1)
Error() << fmt::format("cannot open GreaseWeazel serial port: {}", strerror(errno));
struct termios t;
tcgetattr(_fd, &t);
t.c_iflag = 0;
t.c_oflag = 0;
t.c_cflag = CREAD;
t.c_lflag = 0;
t.c_cc[VMIN] = 1;
cfsetspeed(&t, 9600);
tcsetattr(_fd, TCSANOW, &t);
_version = getVersion();
if ((_version != 22) && (_version != 24))
{