I need to receive data using a serial port in an application written in C, in Linux (raspbian).
This is for a half-duplex data acquisition (by RS485) so when any device is sending data, all the others must be listening.
The problem is that every char received on the serial port of the raspbian machine is sent back to the external device (in modem terminology - echo
). This happens even when the application is not running.
This must be a configuration of the serial port (in my case an USB to rs232 converter), but i can't find a way to solve this.
The output of the stty command is:
stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
-brkint -imaxbel
Thanks
Off the top of my head, it's
stty -F /dev/ttySX raw -echo -echoe -echok -echoke
There could be couple more flags, from the man page:
[-]crterase
echo erase characters as backspace-space-backspace
* crtkill
kill all line by obeying the echoprt and echoe settings
* -crtkill
kill all line by obeying the echoctl and echok settings
* [-]ctlecho
echo control characters in hat notation ('^c')
[-]echo
echo input characters
* [-]echoctl
same as [-]ctlecho
[-]echoe
same as [-]crterase
[-]echok
echo a newline after a kill character
* [-]echoke
same as [-]crtkill
[-]echonl
echo newline even if not echoing other characters
* [-]echoprt
echo erased characters backward, between '\' and '/'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.