LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-13-2014, 12:15 PM   #1
homer_3
Member
 
Registered: May 2008
Posts: 99

Rep: Reputation: 15
Can't get expect to spawn minicom


I'm trying to automate sending some commands over serial through minicom and have a super simple expect script to spawn minicom, but minicom doesn't spawn. Instead my terminal clears and I get some funky highlighting. The expect script I'm using is below.

Code:
#!/usr/bin/expect
spawn minicom
 
Old 03-13-2014, 01:03 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
That is because Expect is not designed to co-operate with a program like Minicom.

Minicom is a full screen application. The application uses special codes to place certain information on the screen. And it puts the information in the place where it is appropriate, not even in a specila sequence. I assume it uses the ncurses library, much the same as cfdisk or midnight commander. That means it outputs a lot of escape codes which are just rubbish in your Expect session.

Expect OTOH expects (no pun intended) strictly a stream I/O. Like you use in a telnet session. You send something, the remote site answers with a nice string, often terminated with CRLF.

So if you want to send something, forget about Minicom and go for Expect all the way. It means that you cannot use Minicom to handle the interface to the serial communication layer. But Expect can do that. You must open a device to which Expect can talk. Plenty examples in the Expect documentation. I would not be surprised if TCL provides high level libraries.

jlinkels
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] spawn usage in expect command screwzm Linux - Software 0 01-15-2013 09:44 AM
expect and spawn fails with ; figure20012 Linux - Newbie 7 09-12-2012 05:50 AM
Expect spawn shell commands finwe Linux - Newbie 3 09-19-2011 12:27 AM
Expect: spawn id expr4 not open gabes Linux - General 3 09-15-2011 12:07 PM
[SOLVED] spawn with Expect script najee1987 Linux - General 5 05-25-2011 01:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:35 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