[repost] HAL fails to probe audio CD-ROM on Linux if dev.cdrom.check_media==1

Andrey Borzenkov arvidjaar at mail.ru
Sun May 28 00:12:39 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

{pts/1}% sysctl dev.cdrom.check_media
dev.cdrom.check_media = 1
{pts/1}% dmesg | tail -1
cdrom: pid 32653 must open device O_NONBLOCK!

When opening non-data CD and check_media set to true, cdrom driver on Linux 
refuses normal open and forces usage of O_NONBLOCK. IIRC it has been standard 
for quite some time. Because O_NONBLOCK does not harm in general, what about 
this patch?

- -andrey


Index: hald/linux2/probing/probe-volume.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-volume.c,v
retrieving revision 1.30
diff -u -p -r1.30 probe-volume.c
- --- hald/linux2/probing/probe-volume.c  12 May 2006 16:43:44 -0000      1.30
+++ hald/linux2/probing/probe-volume.c  28 May 2006 07:12:21 -0000
@@ -343,7 +343,11 @@ main (int argc, char *argv[])

        dbg ("Doing probe-volume for %s\n", device_file);

- -       fd = open (device_file, O_RDONLY);
+       /* Opening non-data CD fails if dev.cdrom.check_media == 1 */
+       if (is_disc)
+               fd = open (device_file, O_RDONLY|O_NONBLOCK);
+       else
+               fd = open (device_file, O_RDONLY);
        if (fd < 0)
                goto out;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEeU1sR6LMutpd94wRAmQpAKCC6XPSW5xywbWJwxexXNxFiDh+6ACffhDX
Y1X2FsQPoLKWhH0sgn9sYYg=
=/Ppv
-----END PGP SIGNATURE-----


More information about the hal mailing list