Thread: Passing serial settings from pseudoterminal to physical port

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    Passing serial settings from pseudoterminal to physical port

    Hi,

    I have a daemon that redirects data from physical serial port (/dev/ttySx) to different data consumer processes using pseudo-terminals (/dev/pts/X). In the daemon I can redirect the data from serial port to any of my pseudo-terminals with dup2() function. But is there a way to do something similar to serial port settings? I mean that if the data consumer changes the pseudo-terminal settings with ioctl or tcsetattr(), I would like get the same changes to the physical serial port.

    Any advices are greatly appriciated, thanks in advance.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can probably poll the pts and see if it's changed, and set the physical port. Of course, that's going to waste CPU-time if you do it really often. The other option would be to add a protocol to inform you of any changes on the PTS by modifying the ioctl that does the tcsetattr() within the PTS driver. That's much more complex, but viable if you are reaosonably familiar with kernel-side programming.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    2
    Thanks for your reply! Yes, I think polling would be one option, but as you say it wastes CPU time and my CPU time is limited.

    Unfortunately I have very little kernel programming experience so that option does not sound very tempting either.

    I think third option would be to create a communication method between data consumers and the daemon. This way a data consumer could notify the daemon when changes have been made. This would remove the need for polling. I was hoping for a simpler solution though...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  5. serial port settings
    By jonrodde in forum C Programming
    Replies: 1
    Last Post: 08-21-2002, 03:53 AM