home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] how to programatically kill minicom without resetting it?

  • Subject: Re: [OCLUG-Tech] how to programatically kill minicom without resetting it?
  • From: Aidan Van Dyk <aidan [ at ] highrise [ dot ] ca>
  • Date: Wed, 13 Mar 2013 09:10:49 -0400
kill -9 will absolutely prevent *minicom* from resetting the modem.  With
kill -9 (-KILL), minicom is gone, it can't reset it.  That's the point of
-KILL.

But as the kernel device is closed when minicom is killed, whatever driver
is responsible for it may be doing something...

I know this is the whole "use the tool you know" thing, but it might be
better to use something intended for "scripting" serial ports, or even fall
back to setserial and if you don't like io in bash, expect (or perl even if
tk isn't your thing).

If you want a shell script that talks to modems as an example, HylaFAX uses
shell for probing modems:
    http://git.hylafax.org/HylaFAX?a=blob;f=etc/probemodem.sh.in;hb=master

a.


On Wed, Mar 13, 2013 at 7:29 AM, Robert P. J. Day <rpjday [ at ] crashcourse [ dot ] ca>wrote:

>
>   i'm currently working with minicom to initialize a modem using
> a minicom "runscript" -- for those of you unfamiliar with this, you
> can run:
>
>   $ minicom -S script
>
> where "script" is a shell script that minicom will execute, doing
> things like sending various "AT" commands to the modem. at the end
> of all that, i get the desired
>
>   Modem is connected
>
> but at that point, if i invoked minicom in the foreground, it's
> obviously still running and it will have a lock file on the device
> file (in my case, /dev/ttyUSB0). that means i can't start pppd on
> that port since i will immediately get
>
>   Device ttyUSB0 is locked by pid ....
>
> so what i want is for minicom to now exit gracefully *without*
> resetting the modem, since that would defeat everything's that's
> been done up to now. that's equivalent to exiting minicom manually
> with "Q" (quit with no reset) as opposed to "X" (exit and reset),
> and i need to do that programatically from within a script.
>
>   all the documentation i've seen suggests that can be done with
>
> $ killall -9 minicom
>
> which (as i read it) *claims* that that will kill minicom without
> resetting the modem, but that just doesn't seem true with all the
> tests i've run -- resets it every time.
>
>   i know i can cheat and simply "rm" the lock file under /var/lock,
> but that's seems tacky and i'd rather do this the right way. anyone
> know how to kill off a minicom session without resetting the modem
> it's talking to?
>
> rday
>
> ______________________________**_________________
> Linux mailing list
> Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca
> http://oclug.on.ca/mailman/**listinfo/linux<http://oclug.on.ca/mailman/listinfo/linux>
>
>


-- 
Aidan Van Dyk                                             Create like a god,
aidan [ at ] highrise [ dot ] ca                                       command like a king,
http://www.highrise.ca/                                   work like a
slave.