Repeated polling of CD/DVD-ROM.

Lewis Thompson lewiz at fajita.org
Mon Jun 21 12:42:04 PDT 2004


Hi,

I have written some code that does some rather nasty stuff to determine
whether or not there is media in the drive.  It is basically this:

open('/dev/dvd', 'rb')
read(1)

  at which point if I get an exception (in Python) I know there is no
media (or it is blank).  If it throws no exception I consider the disc
to be good.

  I know how bad this is (I unfortunately don't understand ioctls and
need this to work quickly in the short term -- I plan on learning more
about this stuff and doing it properly later) but my question is this:

Does the device actually get read /every/ time I do this operation?  (it
gets called every two seconds)  It looks to me that after an initial
probe there are no further accesses, which makes me wonder if further
down some caching is done.  Anybody know what is really going on?

  Thanks,

-lewiz.

-- 
I was so much older then, I'm younger than that now.  --Bob Dylan, 1964.
------------------------------------------------------------------------
-| msn:purple at lewiz.net | jabber:lewiz at jabber.org | url:www.lewiz.org |-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040621/9b581835/attachment.bin


More information about the freebsd-questions mailing list