![]() |
| | #1 |
| Registered User Join Date: May 2008
Posts: 2
| Passing serial settings from pseudoterminal to physical port 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. |
| djinn is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| 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. |
| matsp is offline | |
| | #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... |
| djinn is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| serial port to poll on request | infineonintern | C++ Programming | 2 | 06-11-2009 06:52 AM |
| Can't Read From Serial Port | HalNineThousand | Linux Programming | 14 | 03-20-2008 05:56 PM |
| brace-enclosed error | jdc18 | C++ Programming | 53 | 05-03-2007 05:49 PM |
| DOS, Serial, and Touch Screen | jon_nc17 | A Brief History of Cprogramming.com | 0 | 01-08-2003 04:59 PM |
| serial port settings | jonrodde | C Programming | 1 | 08-21-2002 03:53 AM |