lkml.org 
[lkml]   [2004]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: CD-ROM can't be ejected
Date
Dne čt 16. září 2004 09:36 jste napsal(a):
> (don't top post, and don't trim cc list!)
>
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > notas:/home/cijoml# mount /cdrom/
> > notas:/home/cijoml# umount /cdrom/
> > notas:/home/cijoml# strace -o eject /dev/hdc
> > eject: unable to eject, last error: Nep?ípustný argument
> >
> > As you can see, I dont't enter to directory...
> >
> > And output is included
> >
> > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)
>
> That's the important bit, the reason you get EINVAL passed back is
> because eject tries the floppy eject as well and decides to print the
> warning from that. It really should just stop of it sees -EIO, only
> continue if EINVAL/ENOTTY is passed back.
>
> Try this little c program and report back what it tells you. Compile
> with
>
> gcc -Wall -o eject eject.c
>
> and run without arguments.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <string.h>
> #include <sys/ioctl.h>
> #include <linux/cdrom.h>
>
> int main(int argc, char *argv[])
> {
> int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> struct cdrom_generic_command cgc;
> struct request_sense sense;
>
> memset(&cgc, 0, sizeof(cgc));
> memset(&sense, 0, sizeof(sense));
>
> cgc.cmd[0] = 0x1b;
> cgc.cmd[4] = 0x02;
> cgc.sense = &sense;
> cgc.data_direction = CGC_DATA_NONE;
>
> if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> printf("eject worked\n");
> return 0;
> }
>
> printf("command failed - sense %x/%x/%x\n", sense.sense_key, sense.asc,
> sense.ascq); return 1;
> }

2.4.27-mh1
notas:~# /home/cijoml/eject
ATAPI device hdc:
Error: Not ready -- (Sense key=0x02)
(reserved error code) -- (asc=0x53, ascq=0x02)
The failed "Start/Stop Unit" packet command was:
"1b 00 00 00 02 00 00 00 00 00 00 00 "
command failed - sense 2/53/2


2.6.9-rc2
notas:~# mount /cdrom/
notas:~# umount /cdrom/
notas:~# /home/cijoml/eject
Here isn't opened
command failed - sense 2/53/2
notas:~# eject /cdrom/
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
Here is cd-rom opened
eject: unable to eject, last error: Nepřípustný argument
notas:~# /home/cijoml/eject
Here is cd-rom opened
eject worked

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

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