[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] [PATCH] Linux drive detection without medium

From: plaum
Subject: [Libcdio-devel] [PATCH] Linux drive detection without medium
Date: Fri, 22 Apr 2005 23:17:58 +0200 (CEST)

Hi all,

I just updated gmerlin ( for use of libcdio.
It's was really easy and everything works great so far (tested
analog audio playback and ripping via cdparanoia) except for one:
The linux driver detects CD Drives only, when a disk is in the
drive. I managed to track the problem down to 2 issues:

1. In the function is_cdrom_linux(...) in the file lib/driver/gnu_linux.c,
   the CDROMREADTOCHDR ioctl gets called, which fails when the drive is
   empty. The CDROM_GET_CAPABILITY ioctl always succeeds for CDrom drives
   and fails for hard disks etc.

2. For some reasons, at least my (2.6.10) Kernel fails to open empty drives,
   when only O_RDONLY is used. Changing the open flag to
   O_RDONLY|O_NONBLOCK, the call succeeds also for emtpy drives.
   By the way, the cdrom header file in the kernel says explicitely,
   that O_RDONLY|O_NONBLOCK should used whenever a cdrom is touched.

The attached patch against 0.73 (1) fixes the ioctl and (2) introduces
an additional flag argument for the function cdio_generic_init. The
linux driver will use O_RDONLY|O_NONBLOCK, the other drivers which use
this function (osx and solaris) use O_RDONLY to resemble the old behaviour
(I don't have access to these systems).

Please cc me, I'm not subscribed



Attachment: patch.txt
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]