LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Should be dead simple - read/write serial port from bash (https://www.linuxquestions.org/questions/linux-software-2/should-be-dead-simple-read-write-serial-port-from-bash-479483/)

ericcarlson 09-01-2006 12:15 PM

Should be dead simple - read/write serial port from bash
 
Hi, I can only use bash for this and although there are many C examples just need the basics of reading & writing to a serial port, its controlling a modem.

I'm trying things like this

#!/bin/sh
echo ATD555667676; > /dev/ttyS1
read LINE < /dev/ttyS1
echo $LINE

but its not sending it (minicom is fine, its not a hardware problem).
Basically I just need the read and write commands, I want to do things like "Send AT", wait for "OK", "Dial number" when recieved, if "BUSY" then blah blah...
Thanks in advance

Oxagast 09-01-2006 12:21 PM

Quote:

Originally Posted by ericcarlson
Hi, I can only use bash for this and although there are many C examples just need the basics of reading & writing to a serial port, its controlling a modem.

I'm trying things like this

#!/bin/sh
echo ATD555667676; > /dev/ttyS1
read LINE < /dev/ttyS1
echo $LINE

but its not sending it (minicom is fine, its not a hardware problem).
Basically I just need the read and write commands, I want to do things like "Send AT", wait for "OK", "Dial number" when recieved, if "BUSY" then blah blah...
Thanks in advance

take away that ; that you have in between the ATD string and the > /dev/ttyS1.

echo ATD555667676 > /dev/ttyS1

seraph-seph 10-21-2006 02:04 PM

Hi

I'm having some troubles reading the serial por using cat /dev/ttyS0 since the data received does not have the return carriage (char 13), insted of it uses the char 20 to idicate the end of transmission.

Any sugestions how to print or read the buffer without using cat

Mario

randyding 10-21-2006 08:35 PM

How are you setting the baud rate and flow control parameters. Modems are especially picky.


All times are GMT -5. The time now is 11:19 PM.