How to do hardware DTR/DSR flow control on Linux (serial port programming)?

26

Answering my own question, thanks to an hint from @ktf, I found out that at least since 2.6.28 [1] there are IOCTLs (TCGETX, TCSETX, TCSETXF & TCSETXW) to setup extended attributes.

They seem to have been added to the upstream kernel on 13 Oct 2008 [2].

These extra IOCTLs (compatible with SYS5) allow to configure each of the extra pins handling individually.

See the link for the original RHEL patch [3] and look on the attached test case for an example of how to use it.

The IOCTL definitions are on the "asm-generic/ioctls.h" file and the structure and flag constants are defined on "linux/termios.h" (in "/usr/include", off course).

UPDATE

Further research shows that the generic serial support for this IOCTL wasn't merged into the upstream kernel source. RHEL 5.3 has it, but not the upstream 3.0.6 kernel.
That means the ioctl() call will fail for any other kernel that didn't port the RHEL patch [4].

[1] http://lxr.free-electrons.com/ident?v=2.6.28;i=TCGETX
[2] https://lkml.org/lkml/2008/10/13/120
[3] https://bugzilla.redhat.com/show_bug.cgi?id=445211
[4] https://bugzilla.redhat.com/attachment.cgi?id=315300&action=diff

Share:
26

Related videos on Youtube

SoloWalker
Author by

SoloWalker

Updated on September 18, 2022

Comments

  • SoloWalker
    SoloWalker over 1 year

    How do I get the play head to consecutively go through the timeline containing objects in 4 frames on the click of a button using actionscript 3

    • Admin
      Admin over 12 years
      Voted to delete my answer to increase the chances of getting better answers. This really seems to be an interesting problem other people have faced, too. Interestingly there were at least 3 kernel patches (2001, 2008 and 2010) to address this issue, but none of them seem to be implemented in current ditribution kernels. Looks like only solution (if not taking the custom cable option) would be to patch the kernel on your own. If it's for POS terminals where you have control over all installes software, a BSD UNIX could also worth a try.
    • Admin
      Admin over 12 years
      This comment actually helped me. I found that Red Hat Enterprise Linux 5.3 included a patch to fix this problem [1] on a 2.6.18 kernel. Since RHEL is pretty much a kind of industry standard I believe it's pretty safe to use their patch [2]. [1] rhn.redhat.com/errata/RHSA-2009-0225.html [2] bugzilla.redhat.com/show_bug.cgi?id=445211
  • SoloWalker
    SoloWalker over 8 years
    Okay, that's helpful but how do I get it to loop as in go back to first frame and continue
  • Amy Blankenship
    Amy Blankenship over 8 years
    Compare currentFrame to totalFrames. If you're on the last frame, gotoAndStop(1)