LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-18-2005, 11:58 PM   #1
someshss
LQ Newbie
 
Registered: Aug 2005
Posts: 5

Rep: Reputation: 0
Post Opening ttyS0


Hi All,

I am trying to open the /dev/ttyS0 port and it is not returning from "open" system call.

The program is as follows ...

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main ()
{
int fd;
fd = open("/dev/ttyS0", O_WRONLY|O_NOCTTY); // Never returns from here
if (fd < 0) {
perror ("Error\n");
return -1;
}
printf ("Success");
close(fd);
return 0;
}

In the above program, it never returns from the "open"

What may be the reason? Please help me in this regard.

Thanks
Somesh SS
 
Old 08-19-2005, 04:43 AM   #2
ankscorek
Member
 
Registered: Mar 2003
Distribution: Slackware10.2,SUSE,FC,RHL,Vector Linux,WHAX,PHLAK,bt4,ubuntu,debian,aptosid,backtrack,blackbuntu
Posts: 529

Rep: Reputation: 31
what distro are u using?
 
Old 08-19-2005, 08:53 AM   #3
Jerre Cope
Member
 
Registered: Oct 2003
Location: Texas (central)
Distribution: ubuntu,Slackware,knoppix
Posts: 323

Rep: Reputation: 37
maybe something silly

Are the permissions low enough on /dev/ttyS0?
 
Old 08-19-2005, 09:49 AM   #4
someshss
LQ Newbie
 
Registered: Aug 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Yes, Permissions are OK.

But I think I got it solved!

I just loaded serial.o driver and it returned success!

Thanks!
 
Old 08-19-2005, 09:50 AM   #5
someshss
LQ Newbie
 
Registered: Aug 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Can any one explain me why it was hanging and now when serial,o is loaded, why it works?

Regards
 
Old 08-19-2005, 08:44 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Because you need a driver for the serial port
to be able to use it...


Cheers,
Tink
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
l and ttyS0 Gins Linux - General 4 08-06-2005 01:13 PM
Using ttys0 LWATCDR Programming 5 04-26-2005 04:37 PM
problems using ttyS0 _HB_ Linux - Software 1 06-29-2004 01:27 AM
ttyS0 missing jamezg Debian 1 06-28-2003 11:22 PM
Modem ttyS0 Pedroski Linux - Software 0 01-27-2002 04:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:40 PM.

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