Minicom unable to disconnect modem/drop DTR on a ttyUSB device

Marcin Szewczyk Marcin.Szewczyk at wodny.org
Fri Apr 22 10:37:20 UTC 2016


Hi,

recently I noticed that requesting a hangup of a modem on a ttyUSB port
does not work. The problem is that an attempt to drop DTR is
ineffective. A patch from 2008[4] helped but...

Back in 2008 a bug concerning DTR was discussed[1], but then it was
about not rising DTR back up in kernels 2.6.25 through 2.6.25.7[2][3].
This time (3.16.7-ckt25-1) DTR on ttyUSB is not dropped at all.

Before the kernel patch a minicom patch was proposed[4] but it seems it
has never entered the upstream code. That patch works in my ttyUSB case
as well. I am not sure if it is a kernel bug or a minicom bug. The way
of dropping/rising DTR using specialized functions[4] seems more
straightforward than resetting baud rate for a moment, especially if
there is a suspicion that minicom in the only software relying on this
method[1]. I do not know if it is still true that usb-serial driver is
the only one maintained[5] so one can think it is like a reference
implementation.

Maybe the patch could be included upstream? Is minicom still maintained?
There are a few old bugs hanging on bugs.debian.org.



As a side note I would like to point to some inconsistency in code
concerning DTR switching inside the m_dtrtoggle() function in sysdep1.c.
All system-dependant cases are constructed in the following way:
#v+
drop_dtr ();
if (sec > 0) {
    sleep (sec);
    rise_dtr ();
}
#v-

This means that if I wanted to use the function to drop/rise DTR without
any delay (sec == 0) the rising code would never be executed. The
m_dtrtoggle() function's descriptions says "Drop DTR line and raise it
again" so it probably should rise DTR back, even if sec == 0. I suppose
the problem has never been spotted because:
- the manual page states that "P - Drop DTR time. If you set this to 0,
  minicom hangs up by sending a Hayes-type hangup sequence. If you
  specify a non-zero value, the hangup will be done by dropping the DTR
  line. The value tells in seconds how long DTR will be kept down.",
- the m_dtrtoggle() function is called only from two places in dial.c
  and in both cases it is assured that sec has a positive value.



[1]: https://lists.alioth.debian.org/pipermail/minicom-devel/2008/000864.html
[2]: https://lists.alioth.debian.org/pipermail/minicom-devel/2008/000868.html
[3]: https://lists.alioth.debian.org/pipermail/minicom-devel/2008/000873.html
[4]: https://lists.alioth.debian.org/pipermail/minicom-devel/2008/000849.html
[5]: https://lists.alioth.debian.org/pipermail/minicom-devel/2008/000866.html

-- 
Marcin Szewczyk
http://wodny.org



More information about the minicom-devel mailing list