From e02bc6943c0092a7c79c52d758b2317582b327d9 Mon Sep 17 00:00:00 2001 From: AlexandraTrifan Date: Wed, 8 May 2024 15:51:32 +0300 Subject: [PATCH] serial.c: force DTR serial connection flag to ON for Windows clients On Linux and MacOS the serial connection handler has the DTR flag configured as ON by default. The Windows handler has it OFF by default, which prevents a successful serial connection because the driver expects it to be ON. This issue can be reproduced using UART over USB. Signed-off-by: AlexandraTrifan --- serial.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/serial.c b/serial.c index a7b5736f4..56ec04933 100644 --- a/serial.c +++ b/serial.c @@ -375,6 +375,11 @@ static int apply_settings(struct sp_port *port, unsigned int baud_rate, { int ret; +#ifdef _WIN32 + ret = libserialport_to_errno(sp_set_dtr(port, SP_DTR_ON)); + if (ret) + return ret; +#endif ret = libserialport_to_errno(sp_set_baudrate(port, (int) baud_rate)); if (ret) return ret;