Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jun 2004 20:41:53 +0100
From:      Lewis Thompson <lewiz@fajita.org>
To:        FreeBSD-questions <questions@freebsd.org>
Subject:   Repeated polling of CD/DVD-ROM.
Message-ID:  <20040621194153.GB2342@fajita.org>

next in thread | raw e-mail | index | archive | help

--FkmkrVfFsRoUs1wW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.

--=20
I was so much older then, I'm younger than that now.  --Bob Dylan, 1964.
------------------------------------------------------------------------
-| msn:purple@lewiz.net | jabber:lewiz@jabber.org | url:www.lewiz.org |-

--FkmkrVfFsRoUs1wW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFA1zoBItq0KFQv7T8RAqkDAKDtiP6r8EYaYUoDDjk+rTk+dlj1FACg4G3K
pa4v3Ddaq7MCJ8B75HkJva0=
=FaK+
-----END PGP SIGNATURE-----

--FkmkrVfFsRoUs1wW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040621194153.GB2342>