analogdevicesinc / libiio

A cross platform library for interfacing with local and remote Linux IIO devices
http://analogdevicesinc.github.io/libiio/
GNU Lesser General Public License v2.1
471 stars 309 forks source link

serial.c: force DTR serial connection flag to ON for Windows clients #1163

Closed AlexandraTrifan closed 1 month ago

AlexandraTrifan commented 1 month ago

PR Description

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. The first serial connection through libiio will block while initializing due to this flag. Using a different terminal emulator for the first connection will set the DTR flag to ON. Any subsequent libiio connection (prior to a reset) will be functional.

Serial connection opening is handled separately for Windows (can be checked in libserialport: https://github.com/sigrokproject/libserialport/blob/master/serialport.c#L488 and https://github.com/sigrokproject/libserialport/blob/master/serialport.c#L549 ).

PR Type

PR Checklist