Bug 16341 - Fix for minicom detecting modem status lines
Summary: Fix for minicom detecting modem status lines
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: David E. O'Brien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-01-25 06:50 UTC by Andre Albsmeier
Modified: 2000-11-11 22:19 UTC (History)
0 users

See Also:


Attachments
file.diff (1010 bytes, patch)
2000-01-25 06:50 UTC, Andre Albsmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Albsmeier 2000-01-25 06:50:01 UTC
When attempting to dial a number within the dial dialog of minicom
(CTRL-A D), minicom sometimes fails with the error message "You are
already online! Hang up first.". Here is why this might happen:

minicom uses the following code to determine if someone is online:

sysdep1.c, line 172:

----------------------- snip ---------------------------

/* 
 * Get the dcd status
 */
int m_getdcd(fd)
int fd;
{
#ifdef TIOCMODG
  int mcs;
  
  ioctl(fd, TIOCMODG, &mcs);
  return(mcs & TIOCM_CAR ? 1 : 0);
#else
  (void)fd;
  return(0); /* Impossible!! (eg. Coherent) */
#endif
}

----------------------- snap ---------------------------


It tries to determine the carrier detect signal from the modem. To find
out why this fails sometimes, I added some debug stuff to the above
code and the result was that the ioctl fails with error 25 which is
ENOTTY (Inappropriate ioctl for device). Therefore the result in
mcs was undefined and random garbage was returned.

Fix: OK, this may be complete bullsh*t but this is what I have done:

I didn't find any reference of TIOCMODG in the kernel sources, especially
not in i386/isa/sio.c. So I replaced all occurences of TIOCMODG with
TIOCMGET and all TIOCMODS with TIOCMODS in sysdep1.c. Then I examined
the result of mcs while playing around with the modem and the values
returned were OK as far as I could tell from the modem LEDs.

The other way would probably be to implement TIOCMODG and TIOCMODS sysctls
but I really don't know much about sysctls :-).

For reference, here is my patch to sysdep1.c:
How-To-Repeat: 
Just enter some syslog() debug statements in the above code in order
to log errno.
Comment 1 Steve Price freebsd_committer freebsd_triage 2000-01-29 21:19:18 UTC
Responsible Changed
From-To: freebsd-ports->obrien

Over to port's maintainer. 
Comment 2 David E. O'Brien freebsd_committer freebsd_triage 2000-11-11 22:18:52 UTC
State Changed
From-To: open->closed

Committed.  Thanks for the patch!!