public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: "Bc. Michal Semler" <cijoml@volny.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: CD-ROM can't be ejected
Date: Thu, 16 Sep 2004 09:36:17 +0200	[thread overview]
Message-ID: <20040916073616.GO2300@suse.de> (raw)
In-Reply-To: <200409160918.40767.cijoml@volny.cz>


(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;
}

-- 
Jens Axboe


  reply	other threads:[~2004-09-16  7:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15 22:25 CD-ROM can't be ejected Bc. Michal Semler
     [not found] ` <c93051e804091517017ff9f29f@mail.gmail.com>
2004-09-16  6:55   ` Bc. Michal Semler
2004-09-16  7:09 ` Jens Axboe
2004-09-16  7:18   ` Bc. Michal Semler
2004-09-16  7:36     ` Jens Axboe [this message]
2004-09-16  8:13       ` Bc. Michal Semler
2004-09-16  9:05         ` Jens Axboe
2004-09-16  9:13           ` Bc. Michal Semler
2004-09-16 10:22             ` Jens Axboe
2004-09-16 11:44               ` Denis Vlasenko
2004-09-16 12:20                 ` Bc. Michal Semler
2004-09-16 12:19               ` Bc. Michal Semler
2004-09-16 12:24                 ` Jens Axboe
2004-09-16 12:29                   ` Bc. Michal Semler
2004-09-16 12:31                   ` Bc. Michal Semler
2004-09-16 12:36                   ` Bc. Michal Semler
2004-09-16 21:48                   ` Bc. Michal Semler
2004-09-16 22:17                     ` Tim Fairchild
2004-09-16 12:52                 ` Marc Ballarin
2004-09-17  8:32       ` James Cloos
2004-09-17  8:43         ` Jens Axboe
2004-09-17  9:00           ` Meelis Roos
2004-09-17 20:27           ` James Cloos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040916073616.GO2300@suse.de \
    --to=axboe@suse.de \
    --cc=cijoml@volny.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox