LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 07-08-2003, 09:53 PM   #1
chr15t0
Member
 
Registered: Jun 2002
Location: London
Distribution: Slackware
Posts: 201

Rep: Reputation: 30
Serial comms - script to poll /dev/ttyS0


I am setting up a test involving 2 machines. brezhnev - a headless Slackware 9 server, and alexis, a battered old laptop with Slack 8.1. I aim to simulate a situation where alexis will be used to monitor the serial port on a P(A)BX. In this test I will present dummy data to ttyS0 on brezhnev, and read it over a null modem cable into a file on alexis.

I have so far managed to set up brezhnev to look for a login on his first serial port when he boots, by including the following line in his /etc/inittab:

s1:12345:respawn:/sbin/agetty -L ttyS0 9600 vt100

I fire up minicom on alexis, configure it, reboot brezhnev and when he comes back up, I get a login. I am then able to dump data out onto brezhnev's serial port with the following command:

root@brezhnev:$ cat logfile > /dev/ttyS0

The contents are dumped into the login screen within minicom on alexis. This indicates that the serial comms are working between the two, but I would like to script the interaction to make it run automatically and inifnitely.

My latest attempt involved installing the UUCP slackware package and using the 'cu' utility. The command below initiates a connection:

cu -l /dev/ttyS0 --parity=none -s9600

And then I have to issue the command '~c' to download a file from brezhnev. From that point, all data echo'd to brezhnev's ttyS0 is visible to alexis, however, this still isn't automated, because I have to issue the '~c' command. I have tried hacking together a PERL script - it works as far as making the connection, but I can't maintain the dialogue (don't know what else to call it) to send this final command to the process.

Does anyone have any idea of how I could script this UUCP solution, or of another way to develop a script to check the serial port on an infinite loop for data - and then do something with it... ?


Many thanks,
christo
 
Old 07-08-2003, 11:18 PM   #2
chr15t0
Member
 
Registered: Jun 2002
Location: London
Distribution: Slackware
Posts: 201

Original Poster
Rep: Reputation: 30
Device::SerialPort (on CPAN) did the trick

nunnite,

christo x
 
  


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
writing to serial port, /dev/ttyS0 togunter Programming 2 06-08-2008 10:27 AM
ttyS0 - I only have one serial interface, believe me. calutateo Linux - Hardware 3 06-25-2005 01:55 AM
Unable to communicate using serial port (COM1) /dev/ttys0 vinaybms Linux - Networking 1 03-11-2005 09:08 AM
serial: ttyS0 - how to use the IRQ ?hi! cardias Programming 1 09-01-2004 12:10 PM
Telnet into Cisco router via /dev/ttyS0 (aka COM1 serial port) naesyllek Linux - Networking 2 06-25-2003 06:33 PM


All times are GMT -5. The time now is 02:10 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration