linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Brain <brain@jbrain.com>
To: linux-serial@vger.kernel.org
Subject: Transmitting chars when DTR/RTS are low
Date: Tue, 23 Mar 2004 23:28:47 -0600	[thread overview]
Message-ID: <40611C8F.6040806@jbrain.com> (raw)

I apologize in advance if this is a FAQ, as I have scoured newsgroups
and web pages for a few days looking for the answer, to no avail, but
many folks in this area seemed to have lots of related wisdom.  If you
will indulge me:

I am writing an application that will emulate a modem on Linux (so that
older apps that expect a modem and an AT command set can be null-modem
connected to a Linux PC and never know the difference.  Instead of phone
line, the connection will be IP (atdt192.168.0.1:23 etc.)  There are a
few other attempts out there, but the ones I find are either commercial
or with Windows.

I have written the application, and almost all of it is working.  Both
sides can communicate, and all seems well.  However, many null modem
cables place DCD with the DTR pin.  In order, thus, to emulate a DCD to
the non PC system, I need to bring DTR low until an IP connection comes in.

This is my problem.  When I do that, the 16550A I have cannot send any
characters out.  I would chalk it up to that being the way it is, but I
have here right next to me a Windows applicaiton that is doing the exact
same thing, and all is working well.  I see DTR and RST low on my modem
line tester, and I can send and receive chars from COM1 via Win32.

I have read all of char/serial.c, and cannot see the issue from there.

I am using CLOCAL on my setattr.  Seeing a post in here from long ago
about misuse of TIOCMSET and TIOCMGET in setting DTR lines and such low
(and clobbering OUT1 and OUT2), I switched my code tonight to:

  int status;
  //old code
  //ioctl(cfg->fdTTY, TIOCMGET, &status);
  //status &= ~TIOCM_DTR;
  //ioctl(cfg->fdTTY, TIOCMSET, &status);
  status = TIOCM_DTR;
  ioctl(cfg->fdTTY, TIOCMBIC, &status);
  printf("Dropping DSR\n");
  return status;

with no luck.

I surmise that I am stepping out of the bounds of what Linux wants to do
with a serial port, but I refuse to believe it cannot be done.  I can
only assume I am missing some trivial item...  I looked at DZCOMM, but
it simply maps into the same APIs I am using.

Would anyone have a clue as to my error?  I can send source if wanted
(it's open source, and only 42kB of an app at that).

Jim Brain



                 reply	other threads:[~2004-03-24  5:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40611C8F.6040806@jbrain.com \
    --to=brain@jbrain.com \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).