LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 08-14-2008, 08:47 AM   #1
whiteghetto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Rep: Reputation: 0
Serial Port


Hello all and thanks for all your previous help.
I am using Ubuntu 8.04 with a USB > Serial adapter.

Is there a way I can send serial commands via a shell script?
Anyone able to provide some assistance in doing so?
 
Old 08-14-2008, 08:54 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by whiteghetto View Post
Hello all and thanks for all your previous help.
I am using Ubuntu 8.04 with a USB > Serial adapter.

Is there a way I can send serial commands via a shell script?
Anyone able to provide some assistance in doing so?

Try "echo <whatever command you want> > <device name>"

like:

echo "test output to serial terminal" > /dev/ttyUSB0

Replace the ttyXXX device with whatever yours is.
 
Old 08-14-2008, 09:17 AM   #3
whiteghetto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
thanks, I will try that out
also, is there a way to create a console connection in Ubuntu?
should I install Putty?
 
Old 08-14-2008, 10:58 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by whiteghetto View Post
thanks, I will try that out
also, is there a way to create a console connection in Ubuntu?
should I install Putty?
Install Putty where??? Putty (as far as I know), is for Windows. Linux has built-in SSH client and server capabilities.

Yes, there's a way to create a serial-console in Linux. Off the top of my head, I can't remember, but a quick Google should turn up something. It's not difficult, and involves getting agetty configured and running on a serial port..
 
Old 08-14-2008, 11:52 AM   #5
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
or where you asking for something like gtkterm or minicom?
http://www.jls-info.com/julien/linux/
http://alioth.debian.org/projects/minicom/
http://en.wikipedia.org/wiki/Minicom

You can have putty in linux too - but you can do without - just a terminal and ssh will do.
 
Old 08-14-2008, 01:02 PM   #6
whiteghetto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
thanks for the help

I am able to connect in X with Putty, but my goal is to send commands to a machine via the serial connection in a shell script. I have been unable to see a way to do this with minicom.

My goal is to send "SL:01:6:10000,N" to the device connected on ttyUSB0 with a line speed of 19200

Last edited by whiteghetto; 08-14-2008 at 01:04 PM.
 
Old 08-14-2008, 02:44 PM   #7
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
You can use setserial to setup the line speed and other transmission options like 8n1, then just echo stuff to it as suggested in a previous post.
 
Old 08-14-2008, 02:48 PM   #8
whiteghetto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
thank you very much.
I will apt-get setserial and see if I can get it running
 
Old 08-14-2008, 03:34 PM   #9
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: PCLINUXOS
Posts: 2,918

Rep: Reputation: 103Reputation: 103
What are you sending serial commands to? You are logging onto another computer or device?
c-kermit can run scripted commands VIA serial.
 
Old 08-15-2008, 08:05 AM   #10
whiteghetto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
thanks again for the help.
I am testing some DSL equipment and sending commands to a loop length simulator.
I got it to work with this line

echo -e SL:01:8:3000,N '\r' > /dev/ttyUSB0

before this, I installed minicom and changed the default line speed to 19200
 
  


Reply



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
IBM AIX 5.2/5.3 serial port/tty0 port vinod_balani AIX 2 02-19-2006 03:38 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:31 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
Open Source Consulting | Domain Registration