Skip to content

Commit

Permalink
serial.c: force DTR serial connection flag to ON for Windows clients
Browse files Browse the repository at this point in the history
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 <Alexandra.Trifan@analog.com>
  • Loading branch information
AlexandraTrifan committed May 24, 2024
1 parent 24a7b09 commit 0d1d8cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,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;
Expand Down

0 comments on commit 0d1d8cb

Please sign in to comment.