We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

serial communication programm for UNIX

kellyjj
kellyjj asked
on
Medium Priority
257 Views
Last Modified: 2010-04-15
Ok,  I am trying to write a serial program.  At this point I am just trying to get the port, and dial out to another computer.  I am trying to do this on a SCO UNIX box.  Currently, I am successfully getting the port and setting the atts of it.  ( At least I think I am).  As far as I understand it  All I need to do is do a write to the port, and then I can read from it.  I am correct?  Is there anything I need to do before hand?  Thanks guys
Comment
Watch Question

Commented:
You need to use the ioperm() function to give yourself permission to write/read at that address. Did you do that? And what is the actual problem? You can use inb/oub or you can open /dev/port

Commented:
ioperm() and inb/oub are NOT the way to do this.  You can open the port with open(), read it with read() and write it with write().  If you need to set any of it's attributes use one of the termios functions (see man termios).


Commented:
ioperm() and inb/oub are NOT the way to do this.  You can open the port with open(), read it with read() and write it with write().  If you need to set any of it's attributes use one of the termios functions (see man termios).


Author

Commented:
I don't have a problem reading from the writing .  What I am having a problem with is reading from the port.  I can write ok.  For example I send to the port (modem)  AT^M  I should see back OK. But I don't.  

Commented:
Then please paste the piece of code which you are using to read. And the piece where you open the port.

Commented:
I do not have solutions, just a few hints ;-)

> I am successfully getting the port and setting the atts of it.  ( At least I think I am).
What attributes, and how are you setting this?

Use "stty -a < /dev/your_port" to check the current I/O settings for the port in question.  Post the output here.

Use simple unix level commands to check the modem is working fine.

$ cat < /dev/your_port&;cat > /dev/your_port&

and then type AT commands onthe keyboard to see you get response back from the modem.

Commented:
Do you read from the same port you write to? Try reading from another computer.

Commented:
Also make sure that the device does not have a getty set up on it.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks I thought I might not be setting things up correctly.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.