From Windows I can communicate with a serial port device using the following commands:
mode com1: baud=9600 data=8 parity=n stop=1
copy con com1
alt+18alt+2ctrl+z
The device starts the requested operation.
When I try to accomplish the same operation from a stand-alone Debian box or from a Debian VirtualBox instance of the same Windows machine, I had no luck so far.
Here are equivalent Linux commands (at least I think so):
stty -F /dev/ttyS0 speed 9600 cs8 -cstopb -parenb
echo '\x12\x02' > /dev/ttyS0
Nothing happens.
How can I do it?
will not be interpreted, and will literally write the string
\x12\x02(and append a newline) to the specified serial port. Instead usewhich you can construct on the command line by typing CtrlVCtrlR and CtrlVCtrlB. Or it is easier to use an editor to type into a script file.
The
sttycommand should work, unless another program is interfering. A common culprit isgpsdwhich looks for GPS devices being plugged in.