LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-19-2008, 01:54 AM   #1
F1y3r
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 0
rs-232 monitor


Hi!
I would like to build headless mp3 player/server and I would like to control it locally. I found a winamp external control scheme.Basically it's CD DSR CTS RI pins connected to the DTR through buttons.
Here's part of the script I'm looking for:
Code:
#!/usr/bin/expect
global Port
global Serial
set Serial "/dev/ttyUSB2"
set last "off"

proc cleanup {} {
global Version
global Port
   close $Port
   exit
}
trap cleanup {SIGINT SIGHUP SIGQUIT SIGUSR1 SIGTERM}

proc monitor {} {
global Port
global last
   set DCD [lindex [fconfigure $Port -ttystatus] 7]
   set DCDstate "off"
   if {$DCD == 1} {
      set DCDstate "on"
   }
   if {$DCDstate != $last} {
      catch {exec /usr/local/bin/someprogram &}
      set last $DCDstate
   }
   after 5000 monitor
}

monitor
while {1} {
   after 1000
}
When I try to execute I get this:
Code:
 [flyer@athlon ~]$ ./serial.exp 
can't read "Port": no such variable
    while executing
"fconfigure $Port -ttystatus"
    (procedure "monitor" line 4)
    invoked from within
"monitor"
    (file "./serial.exp" line 30)
What's wrong with the script? Could anyone fix it?

Thanks in advance
 
  


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
RS-232 <=> WLAN setup juhl Linux - Hardware 2 11-15-2007 07:04 AM
Rs 232 pgm - Please help madhivadhana Linux - Software 1 11-02-2007 01:18 AM
RS 232 & Handshake Hugo Orlando Programming 1 08-03-2004 12:36 AM
How to monitor RS-232 rkrijger Linux - Networking 2 10-21-2003 05:01 AM
Rs-232 yogotie Linux - Hardware 2 08-03-2003 01:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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