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 <[email protected]>
  • Loading branch information
AlexandraTrifan committed May 24, 2024
1 parent 18df990 commit e02bc69
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 @@ -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;
Expand Down

0 comments on commit e02bc69

Please sign in to comment.