l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social Gathering
Next Installfest:
TBA
Latest News:
Nov. 18: Officers elected
Page last updated:
2003 Sep 15 11:50
Events
 Meetings
 Installfests
 Demos
 Photos
Services
 Library
 LERT
 Jobs
 Documents
Interact
 Mailing Lists
 - Search
 - Archives
 Chat (IRC)
 Social Networks
About Us
 Members
 Projects
 Testimonials
 Call for Speakers
 Why Not MS?
 Finances
 Sponsors

^Home
?Search
?News & RSS
?Calendar
@Contact Us
$Buy Stuff
=Printable


The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Driver Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Driver Question



On Sun, 14 Sep 2003, Mark K. Kim wrote:

> I think I understood it correctly but I wasn't sure exactly how to do it
> so I was just giving you some pointers.  Anyway, I'm sorta interested in
> this too so I poked around a bit some more.  Looks like the easiest
> technique is to:
> 
>    (1) Trap SIGIO signal using signal() system call.
>    (2) fcntl(fd, F_SETFL, O_ASYNC);
>    (3) fcntl(fd, F_SETOWN, getpid());  (might not be necessary)
>    (4) wait for SIGIO signal, handle it in your signal handler.
> 
> I haven't tried it.  If it doesn't work, refer to the "fcntl" man page and
> look for any information on asynchronous I/O (grep for "async").  If that
> doesn't work either, try reading section 12.6 in "Advanced Programming in
> the UNIX Environment" by W. Richard Stevens.

I still think select() is the way to go. (Mark beat me to the punch.)
Signals are an unnecessarily complicated way to approach the problem.

The select() call will block until your driver has data available.  You
can timeout periodically if you want to provide UI updates like clock
displays, but select() lets you block on one or more streams until they
have input, which seems perfect for the application.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------


_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
facebook
LUGOD Group on Facebook

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
1105 Kennedy Place, Suite 1, Davis, CA 95616
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Marc Hall
For a generous donation to allow us to continue meeting at the Davis Library.