dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
2
share rss forum feed


Maxo
Your tax dollars at work.
Premium,VIP
join:2002-11-04
Tallahassee, FL

1 edit
reply to dlsauers

Re: BASH script serial input

Is it possible something like this may work?

while read LINE; do
  #whatever
done < /dev/ttyUSB0
 
I have my laptop with me, but my serial cable is at home, and I'm out traveling right now so I can't test it. I'm sure that this exactly wouldn't work, but perhaps a variation on the loop.

--
"Padre, nobody said war was fun now bowl!" - Sherman T Potter

»maxolasersquad.com/

»maxolasersquad.blogspot.com

»www.facebook.com/maxolasersquad

dlsauers

join:2005-10-25
Wellston, OH

said by Maxo:
Is it possible something like this may work?

I'll try that ... I have things working with dd and nuking its extraneous output off to /dev/null land...but it seems to miss data at points due to dd or seomthing else and thats an issue,

I really would like to get this to work with exec and telnet via ser2net.. but BASH doesn't seem to want to co-operate with

exec 6/dev/tcp/192.168.0.2/9200

When its this device.

I can telnet into it and see the line on the screen change with the data, but its one line it keeps over writing, but if I use exec in the script it never gets any data.


leibold
Premium,MVM
join:2002-07-09
Sunnyvale, CA
kudos:9
Reviews:
·SONIC.NET

said by dlsauers:

I have things working with dd and nuking its extraneous output off to /dev/null land...but it seems to miss data at points due to dd or seomthing else and thats an issue,

You put the dd command into a loop and keep opening and closing the serial device. It is no surprise that this causes you to loose data.
Make sure that you keep the serial device open ( Maxo See Profile showed an example of how to do a loop that keeps the serial port open).

As for the "one line it keeps over writing" there is apparently a difference in end-of-line handling between the old and new adapter. You may be able to compensate by using the stty options icrnl and -inlcr to convert carriage returns into new lines (line feed).
--
Got some spare cpu cycles ? Join Team Helix or Team Starfire!