LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2009, 03:05 PM   #1
Sneezie
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
Serial port polling


I am building a shell script on a Dreambox (Sat receiver).

What I need to do is sending a command through the serial port to steer my dish. This was easy to do and it worked with no problems at first attempt.

I need to wait for the answer from the other device from the same port (when the dish is in the new desired position. It can take from few seconds to 30-40 seconds), and, after that and only after that, I can continue with the other commands of the script.
I therefore need to poll the serial port and read what the other device answers. Possibly with the least load on the CPU of the machine.
This is what I still cannot do and I would really be very thankful if you could give me a hint on how to do it...


The shell has a very limited number of commands. It is just a subset of the usual shells.
Therefore I need to use very basic commands (compiling a C program is an option, but I would need to delve in crosscompiling and other quite difficult things, for me at least).

I thank you in advance for your help!

Sneezie
 
Old 03-15-2009, 03:30 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Well you only need to print out the contents of the tty file and watch for it match a specific string. You should be able to do something like:

Code:
cat /dev/ttyS0 | grep response
Where response is the line you are waiting for from the dish. That is of course assuming you have grep. If not, then that changes things. It might help to post a list of what commands you actually have available if the shell is really that minimal.
 
Old 04-06-2009, 01:55 AM   #3
nissenisse
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Question

Quote:
Originally Posted by Sneezie View Post
I am building a shell script on a Dreambox (Sat receiver).

What I need to do is sending a command through the serial port to steer my dish. This was easy to do and it worked with no problems at first attempt.
Can you help me there, then? I have a script for a Dreambox 7020 almost ready, what I need now is how to send a command on the serial port...
 
Old 04-06-2009, 04:57 PM   #4
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Sending a command should look something like:

Code:
echo "command" > /dev/ttyS0
 
Old 04-06-2009, 05:40 PM   #5
nissenisse
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by MS3FGX View Post
Sending a command should look something like:

Code:
echo "command" > /dev/ttyS0
Thanks, I guess the serial port on a 7020 is /dev/ttyS2 (but I'm not sure). I also assume that I may need to do a SETSERIAL command first.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 09:32 PM
Parallel Port & Serial Port device identification helpmeforlinux Linux - Hardware 3 01-02-2007 01:15 AM
timedia 4 port serial port i/o card configuration binu_edl Linux - Hardware 0 03-09-2006 09:39 AM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM
Using an USB port as a standard DB9 Serial Port Lsteele Linux - Newbie 1 10-22-2005 09:48 AM


All times are GMT -5. The time now is 12:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration