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:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 24: LUGOD election season has begun!
Page last updated:
2003 Sep 15 15:06

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



Would not the select() stop the application, forcing it to wait for the
data?

The application (real time simulation) cannot block or run timeouts or spend
any time testing to see if data is available.
The only time it wants to be bothered is when data is available, otherwise
"leave-me-alone". Since the I/O is async it seems that a push system is more
advantagous...

Granted signals are more complicated, but they might be necessary in some
cases. I fiddled with a very non-elegant approach where the driver set a
flag in the data file and the application read the file (about 64 chars) on
each pass and tested the flag, if true it accepted the data and reset the
flag with a write to the file, if false it ignored the data. It works but
waste CPU resources big time...

You spend all the effort to design a Ferrari (the interrupt driver and
board) and then install a VW engine(the fiddle thingy) to make it run ;-)

Thanks for the put
John W.

----- Original Message -----
From: "Jeff Newmiller" <jdnewmil@dcn.davis.ca.us>
To: <vox-tech@lists.lugod.org>
Sent: Monday, September 15, 2003 10:26 AM
Subject: 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

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



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
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!