newboid at vodafone.ie wrote:
> Hi,
>> I am quite new to linux and I was wondering if there is a way to get a string
> from a serial port from the shell?
>> I have tried using:
>> cat < /dev/ttyS0
>> and I can see the string from the serial port, but I don't seen to see a
> way of terminating the cat command to get at the data.
>> I looked at C and it seems a bit complex for what I want to do.
If you know exactly how much data there will be you could do:
dd if=/dev/ttyS0 bs=1 count=$number_of_bytes
If it's line oriented data then I suppose you could do:
while read /dev/ttyS0
echo received: $REPLY
done
--
Pádraig Brady - http://www.pixelbeat.org
--- Following generated by rotagator ---
Wondering what the optimum flags for your
compiler and CPU combination?
http://www.pixelbeat.org/scripts/gcccpuopt
--
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!