Patch from Burkhard Plaum:

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 reason, at least my (GNU/Linux 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.

rocky: also made a change to eject to continue even if we can't get
the drive status -- which we can't with an empty CD-ROM drive.
This commit is contained in:
rocky
2005-04-23 01:16:19 +00:00
parent 15ddfdbc2c
commit 320c9bd55f
5 changed files with 19 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: generic.h,v 1.13 2005/03/01 00:40:39 rocky Exp $
$Id: generic.h,v 1.14 2005/04/23 01:16:19 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -101,7 +101,7 @@ extern "C" {
/*!
Initialize CD device.
*/
bool cdio_generic_init (void *p_env);
bool cdio_generic_init (void *p_env, int open_mode);
/*!
Reads into buf the next size bytes.