bugst / go-serial

A cross-platform serial library for go-lang.
BSD 3-Clause "New" or "Revised" License
617 stars 188 forks source link

Data sent with Write method are present at the beginning of data read with Read method #177

Closed dpmik closed 4 months ago

dpmik commented 4 months ago

Describe the problem

I tried to use this library on Linux. Unfortunately everything written in Tx is echoed on the Rx side. Is there a way to disable this behaviour? I am using an USB port attached to an FTDI chip (USB to RS232 converter): /dev/ttyUSB0. The port is detected by enumerators.GetDetailedPortsList(). I've tried to find a way to turn off this "echo behaviour" but I was not able to find a proper solution. Same port opened with minicom work as expected so the behaviour seems to be specific of this library.

To reproduce

  1. Open a serial port
  2. Write something
  3. Try to read

In step 3 the received DATA BUFFER starts with the DATA written on step 2

Please double-check that you have reported each of the following

before submitting the issue.

Expected behavior

Transmitted data are not reported as a prefix of Read data.

Operating system and version

Linux

Please describe your hardware setup

No response

Additional context

No response

Issue checklist

cmaglie commented 4 months ago

I cannot reproduce the behavior you described (even using an FTDI cable) and you did not provide the source code you're using to check.

Does it happen if you use a terminal emulator, like putty? It could be the device attached to the FTDI cable that echoes back the characters received?

cmaglie commented 4 months ago

Same port opened with minicom work as expected

Ah, I see. Please copy your golang source code that exposes the problem.

dpmik commented 4 months ago

It turned out that the attached device had echo enabled. Minicom was able to have a clear interaction because of the initialization string sent to the device on startup. Sorry for the confusion. Closing the invalid bug.