LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-05-2009, 03:58 AM   #1
ankur_hill
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Rep: Reputation: 0
How to get event when device creation is completed by mknod on linux Ubuntu 8.04?


Hi,


I need to use a device (/dev/ttyS5) which is created by a process which is launched by my program.

However, after launching the process, it takes some time for /dev/ttyS5 device to come up.

hence i need to use sleep() for for 3~4 seconds after launching the process and hope that device becomes ready by that time.

is there any way to get some kind or signal or event by which i can know if device is ready? sleep() is really bad way to handle this situation.


regards,
Anks

PS: Child process that I am launching is not written by me. hence its not possible for me to modify its source code.
 
Old 08-05-2009, 07:59 AM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Maybe a trick like:
Code:
while (open ("/dev/ttyS5", "r") < 0) {
   usleep (100000);
}
 
Old 08-06-2009, 07:21 AM   #3
ankur_hill
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by jf.argentino View Post
Maybe a trick like:
Code:
while (open ("/dev/ttyS5", "r") < 0) {
   usleep (100000);
}
Yes that is a nice trick! actually i was thinking if it would be possible to receive some event when device is ready. but i guess this is the only way.

thanks Argentino!

regards,
Ankur
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual C++ form creation event? chrisliando Programming 3 11-07-2007 01:22 AM
No synaptics event device found sfulysses Linux - Desktop 0 08-04-2007 06:54 AM
Joystick is making an event device not js ForYouAndI.com Linux - Hardware 0 03-11-2007 10:12 AM
device node created using mknod dissapear after reboot minike Slackware 2 12-13-2006 05:12 PM
Device drivers : How to insmod and mknod through an application program? shendeswanand Linux - Newbie 0 02-08-2006 11:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:08 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