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

Adam Lackorzynski adam at os.inf.tu-dresden.de
Mon Apr 25 22:12:57 UTC 2016


Hi,

On Fri Apr 22, 2016 at 12:37:20 +0200, Marcin Szewczyk wrote:
> 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.

I'd just use TIOCMBIS/TIOCMBIC, TIOCSDTR even does not exist on my
system (anymore).
 
> 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.

I'll look over call sites and probably will make it more consistent with
its usage. sec==0 probably has the intention that it means "just off"
and the comment is misleading.

Thanks!


Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/



More information about the minicom-devel mailing list