l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Sep 15 11:50

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

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD 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
PO Box 2082, Davis, CA 95617
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:
Sunset Systems
Who graciously hosts our website & mailing lists!