Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transferring \n from perl to linux via serial port

Status
Not open for further replies.

nirmalguna

Programmer
Joined
Oct 7, 2006
Messages
6
Location
US
Hi,

I am trying to control an OMAP with Linux, from a Windows laptop running Perl via serial port. I could open serial port (COM1) and send commands, but not able to execute them by sending the enter key. I tried \n but it only moving the cursor to the next line, and not imitating enter key. Code is below. Any suggestions? Please help!!

---------



open( PORT, "+>COM1") or die "Cant open COM1 - $!";

$msg="ls\n";



print PORT $msg;

---------

The output comes as
.#ls
|



but doesnt execute..

Thanks!
 
are you trying to run the 'ls' operating system command?

- Kevin, perl coder unexceptional!
 
Hi Kevin,
Yes, I am trying to execute the OS command ls . Later on, I am planning to control the OMAP thru serial port via perl.. Thanks!
 
you could try \r or \r\n as carriage returns ^M, or ^M^N respectively

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Hi Paul,
I did try them. Also tried the binmode(). But it goes to thenext line, but doesnt come up with the prompt - meaning it dint execute the previous statement.

E.g.

.#ls -- followed by \r\n
.| -- consider | as cursor position
 
how is this:

open( PORT, "+>COM1") or die "Cant open COM1 - $!";

connecting with Linux?

- Kevin, perl coder unexceptional!
 
No, that is connecting to the COM port. My OMAP board running linux is connected to the COM port and accepts commands..
 
ahh.... well, I don't know how to what you are trying to do. Maybe somone else will so check back.

- Kevin, perl coder unexceptional!
 
From the top, please state your problem, and only the problem, then skip a line (or two), and declare what you've tried, and what your findings are ...

BTE an OMAP is a what?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Objective - I want to control linux via serial port.

Problem - I am able to send commands. But not able to send the Carriage return key to make linux execute.

Platform - Using Perl on MSDOS(WinXP) to control serial port.

Tries - Used \n, \r\n and also under bitmode() of perl.

Findings - The cursor on linux prompt moves to next line, but command prompt doesnt appear and the command is not executed either.

Thanks for your time Paul.
 
And OMAP is a Texas Instruments processor I am using as platform for my chip characterization.
 
These Guys might be the best to ask, the \r should work, but the dev network for OMAP chips would be best placed, could be that it's a proprietary OS

HTH

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top