Virtual COM port on Linux

Dave Smith dave at thesmithfam.org
Mon Mar 15 12:32:40 MDT 2010


Dave Smith wrote:
> That's what I was looking for. I didn't escape the 'x' when I tried 
> initially.

Actually, that appears to not work as I expected. The first problem is 
that echo needs -n to *not* print a newline character, which would not 
normally be a problem (but for purity's sake I added -n). The second 
problem is that the last byte (0x00) does not get written to the device, 
I assume because echo interprets it as a null-termination character. 
After it failed to turn on the relay, here's what I did to investigate:

echo -n $'\xff\x01\x00' > /tmp/foo.txt
hexdump -C /tmp/foo.txt
0000000 ff 01

And ls -l confirms that the file is only 2 bytes in size (not 3 as I 
expected). Is it not possible to write a 0x00 byte as the final byte 
using echo?

Any ideas why this happens?

--Dave


More information about the PLUG mailing list