Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-17-2004, 10:00 PM   #1
LQ Newbie
Registered: Mar 2004
Posts: 21

Rep: Reputation: 15
Using serial port with external device


I am new to linux and was just wondering how one can see the status of the serial in i have to write a program to send and receive data thru the serial port.....but i dunno what the address of my serial port is (ttyS0-ttyS29)....there r a lot of ttyS* in my /dev directory....

i just wanted to check how to assign

ttyfd = open("/dev/ttyS_",O_RDWR);

in the program, i am using the above line to open the serial port but i need to know which number it is say 0 or 1 etc.....

Any help will be greatly appreciated .....

Thanks a lot...
Old 03-18-2004, 11:13 AM   #2
LQ Guru
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
COM2=/dev/ttyS1 ... etc
ttyfd = open("/dev/ttyS0",O_RDWR | O_NOCTTY);
For more info:
See the Serial-Programming-HOWTO @
And this:
Old 03-18-2004, 09:26 PM   #3
LQ Newbie
Registered: Mar 2004
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks a lot for the reply....
the link was really helpful....

helped solve another probem about flags as well...

Thanks again...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling external electronics via the serial port... anybody know anything? Napalm Llama Linux - Hardware 11 02-20-2005 06:46 AM
trouble Installing multi port serial device unforgivn Linux - Hardware 0 06-02-2004 05:40 AM
Data acquisition from a device through serial port in linux newtolinux123 Linux - Newbie 1 04-22-2004 08:27 AM
zoom external serial with usb to serial adapter foustware Linux - Hardware 1 12-07-2003 02:02 AM
Connecting to a device (say, a switch) using serial port spuud Linux - Networking 1 09-20-2003 04:36 PM

All times are GMT -5. The time now is 01:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration