Unix: update clear() function and use it to flush IO buffers when opening the serial port


The IO buffers may contain some leftovers from the previous data, which
was possibly received with different parameters. This can lead to
reading some garbage bytes right after opening the serial port.
Fix it by explicitly clearing the IO buffers during the initialization
of the port.
Do it by calling the pre-existing clear() function. Do not handle the
return value, because failing here wouldn't be a hard error.

Note that this fix really depends on the device driver
implementation - if it does not support flushing the IO buffers, then
this change actually does nothing. It's known that some
USB <-> serial converters do not implement it.

Task-number: QTBUG-115205
Pick-to: 6.6 6.5 6.2
Change-Id: I6feb1a5d6d95b8d90d23428f48147fc664edf9fa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
commit430a7464c03395f81100b8c6b9b38a8d0825432f
parent6c92cd294a07a9f8342ab055bb1d8208376d55fd
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeWed, 18 Oct 2023 11:34:27 +0200