Sponsored Content
Top Forums Programming How to read the CTS and DSR of RS232 in Unix using C language? Post 44372 by Perderabo on Friday 5th of December 2003 02:03:53 AM
Old 12-05-2003
Please click on the rules link at the bottom of the page. I have deleted your other thread.

You're not going to be able to do what you want. Use the command "man termios" to see what is available from the terminal driver. Use our search function to searc this forum to see some examples of termios in use.

In you have the hardware, you can use modem control signals, but the driver does it on your behalf. For an incoming line, a open() call raises DTR which signals the modem that it may auto-answer a call. When it does, it will raise DSR which causes the open to complete. If DSR drops, a hup signal is generated. A very clever program might be able to use all of this to "read" the state of the DSR signal. But open() is an expensive system call and the bandwidth would be low.

Some unix systems (maybe most? or all?) you can use CTS for hardware flow control of output, and RTS for hardware flow control of input. There is no hope for RTS, but a clever program might be able to determine the state of CTS by seeing if a non-blocking write() succeeds. But DSR would need to be high.

You might be able to have a simple switch send a break character. Anyone who uses a Sun with a terminal console knows how easy that is. You can arrange for a break character to send an INT signal to the program.
 

10 More Discussions You Might Find Interesting

1. Programming

RS232 communication optimisation

Need help for RS232 communication with switches in order to optimise the data traffic. How to manipulate different flags in termios struct to do the same? (1 Reply)
Discussion started by: ManishSaxena
1 Replies

2. UNIX for Advanced & Expert Users

VNC via Rs232

Hi ! Is there somebody who is able to connect a VNC session via serial cable ? There is a hint on the VNC homepage that it is possible to configure that. But how? thanks joerg (2 Replies)
Discussion started by: joerg
2 Replies

3. Solaris

rs232 pci-card

hello mates, do you know a manufactor for rs232 serial pci cards for the sparc architecture? it seems that there is no original product from sun for that purpose. strange, isn't it? problem is that i have a V250 with only one db9 rs232 serial port, and i need it for a modem connection, but i also... (1 Reply)
Discussion started by: pressy
1 Replies

4. Programming

How to set the DSR pin using a C Code

Hi, I am a newbie using linux. I want to use the 9 pins of the COM port for data transmission. I am trying to write a code to toggle the DTR pin in /dev/ttyS0. Can any one help by giving a sample code or links that will help me pick up fast Regards (2 Replies)
Discussion started by: Srikanthks_2000
2 Replies

5. UNIX for Dummies Questions & Answers

Can A File Be Copied to an RS232 Port on Unix?

We have a text/csv file (4mb) sitting on a Unix box. The PC belongs to a retail store and they're asking me to bring the file over to Windows so they can import the file. Can a file be copied to an rs232 port? If so how? The idea is that I'll hook up a null modem cable to the Unix com port,... (2 Replies)
Discussion started by: alivebyscience
2 Replies

6. Programming

Help to filter read through reference file by using c language

Input_file #tmp_2 werweraewghe @tmp_2 123sdfs57a #tmp_1 aewrgheheghe @tmp_1 457awrerfa87 #tmp_4 trtyrghe @tmp_4 8898rtyr2 reference_file #tmp_4 #tmp_1 (14 Replies)
Discussion started by: cpp_beginner
14 Replies

7. Programming

regarding adding fields to DSR protocol in ns2.34

hi i am student doing project in ns2.34. i hav to add field in route cache and packet of DSR routing protocol. which files hv to be changed...pl help me (1 Reply)
Discussion started by: khubalkar
1 Replies

8. Homework & Coursework Questions

regarding adding fields to DSR protocol in ns2.34

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: want to add field to route cache and packet of DSR routing protocol in ns2.34, add field, DSR package in ns2.34... (2 Replies)
Discussion started by: khubalkar
2 Replies

9. IP Networking

How to configure RHEL6 to support Aleton 4408 in DSR mode?

Dears How to configure RHEL6 to support Aleton 4408 in DSR(Direct Server Return) mode We have config Aleton 4408 + Windows 2008R2 then Windows set loopback interface with VIP. the exec the following command in CMD netsh interface ipv4 set interface "net" weakhostreceive=enabled netsh... (0 Replies)
Discussion started by: nnnnnnine
0 Replies

10. IP Networking

Source IP address field in RREP on DSR routing

Hello I have a question about routing in MANET using Dynamic Source Routing protocol. IN RFC4728 (DSR) in section "IP fields" of RREP (Route Reply) packet we have this: ok. I read in several books and also in rfc4728 that: when a source node (node that initiate route discovery process)... (1 Reply)
Discussion started by: acu281
1 Replies
pmux_stty(1)						      General Commands Manual						      pmux_stty(1)

NAME
- set the options for a port on the HP AD278A/AD279A PCI Mux card. SYNOPSIS
options] DESCRIPTION
The command options are used to turn on and off a number of special flags. These flags are used to control driver I/O processing on a PCI Multiplexer port. These commands are enhancements to the standard commands, and affects the operation of the port. Many of the output modes are implemented in the AD278A/AD279A PCI Mux hardware. This allows greater throughput with less CPU processing overhead than other serial I/O devices. There are some features which are still handled by the line discipline and the use of these fea- tures results in traditional CPU overheads and throughput. If flag is not enabled then maximum output performance is achieved. Even if flag is enabled, the settings are handled in the hardware and maximum output performance will still be maintained. Following are the settings that are handled in hardware: The use of other settings results in additional software overhead on output characters. Use of "raw" mode on input also maximizes throughput and reduces CPU processing overheads. However, even in raw mode some and settings require line discipline intervention. Applications that want maximum throughput and/or minimal CPU overhead must avoid the following set- tings: The line discipline also supports the "block mode" feature. When a device is in "block mode", software overhead is introduced to handle the device protocol and the benefits of the AD278A/AD279A HP PCI Mux hardware are also mitigated. The commands are usually enabled at the terminal using the format: pmux_stty [+(-) option] or, they may be entered from the console, and redirected to the port in which they are to take effect. For example, pmux_stty [+(-) option] < /dev/tty2a1 See below for the new naming conventions used for HP AD278A/AD279A PCI Mux ports. DISPLAY OPTIONS
To see the complete list of available options and syntax for the command, enter without any options. The options are: Report the current settings of the pmux_stty options. Display the HP AD278A/AD279A PCI Mux hardware configuration, including the logical card number, ID, slot, and type of the cards that are installed and configured. Use pmux_stty dtr 1 to force the DTR control signal high, regardless of the application. Ignore (do not ignore) the option, which permits any character to act as an XON character for resuming output. A number of applications enable the feature in the standard profile. This destroys the integrity of software flow control because any user type ahead is erroneously interpreted as an XON after the terminal sends an XOFF. The command is provided to correct the most common application-related problems experienced when running terminals at high speed. NOTE: is transparent to users. It should always be set for terminal speeds above 9600bps when hardware flow con- trol is not used. Ignore (do not ignore) the option, which is used by some applications to disable XON/XOFF software flow control. Setting this option forces the driver to apply XON/XOFF flow control to the port, regardless of whether or not the application has set Perform physical loopback test. Invoke the loopback test with loopback plug connected to a port. e.g., Display the current status of the RS-232 modem control signals (RTS, CTS, DSR, DCD, DTR, and RI) for a port. Restart stopped output exactly as if an XON character was received. Forces a port to honor and pass (not pass) XON/XOFF software flow control, until the port is closed, or the option is disabled. This is useful for applications that need to see XON/XOFF characters. NAMING CONVENTION
HP AD278A/AD279A PCI Mux ports use the following syntax for naming device files: where categoties are: tty = direct connect ttyd = modem dial-in cul = modem dial-out cua = modem dial-out with automatic caller refers to a device instance number refers to a port module whose valid range is 'a' to 'd' and refers to a port number whose valid range is 1 to 16. SEE ALSO
stty(1), termio(7), modem(7). pmux_stty(1)
All times are GMT -4. The time now is 06:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy