lkml.org 
[lkml]   [1998]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: AIC and CDROM
On Wed, Sep 16, 1998 at 02:19:17PM -0600, Erik Andersen wrote:
>
> > One problem, however is that when I try to open the
> > /dev/cdrom, e.g., to eject the CDROM but there is no
> > disc in the drive, the open fails. I have done the last
> > few updates to cdtool which includes "cdeject".
> > "cdeject" fails on the open of /dev/cdrom (link to
> > /dev/scd0) when no disc is in the drive. If a disc
> > is in the drive, or if the drive is open (tray drive),
> > cdeject works (ejects the disc or closes the tray).
> >

Ok, here is what I see with no disc in the drive:

andersen:/home/andersen % mount /cdrom1
mount: No medium found

andersen:/home/andersen % eject -h
Eject version 1.5 by Jeff Tranter (jeff_tranter@pobox.com)
[-----snip----]

andersen:/home/andersen % eject /dev/hdd
eject: open failed for `/dev/hdd': No medium found

Ok, from an strace, I see:
open("/dev/hdd", O_RDONLY) = -1 ERRNO_123 (No medium found)


Ah, I understand. The deal here is that you are taking the same path as
mount here, i.e. you are opening along the "open_for_data" path. What you
want to do here is open with a
fd = open(device, O_RDONLY | O_NONBLOCK);
This way you tell the driver that it is only being opened for subsequent
ioctl calls, so it skips the media checking and such. This is backward
compatable with 2.0.x kernels, which will ignore the O_NONBLOCK and
behave as expected also. The code in cdtool needs to be changed, as
it is not up to date.

-Erik

--
Erik B. Andersen Web: http://www.inconnect.com/~andersen/
email: andersee@debian.org
--This message was written using 73% post-consumer electrons--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.046 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site