LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Maarten Bressers <mbres@gentoo.org>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	axboe@kernel.dk, tasio@hierro.tasio.net, dsd@gentoo.org
Subject: Re: [PATCH RESEND] SCSI not showing tray status correctly
Date: Thu, 25 Oct 2007 18:24:53 -0500	[thread overview]
Message-ID: <1193354693.3301.45.camel@localhost.localdomain> (raw)
In-Reply-To: <20071025223037.C077D65309@smtp.gentoo.org>

On Thu, 2007-10-25 at 22:30 +0000, Maarten Bressers wrote:
> From: David Martin <tasio@tasio.net>
> 
> Greetings,
> 
> The following patch was submitted to the lkml in 2004 by David Martin
> (http://lkml.org/lkml/2004/12/27/1). It wasn't accepted, but I was
> unable to find a reason why, so I'm resending it now.

Well, sending SCSI patches to the kernel mailing list but not to
linux-scsi is usually a good enough reason.

> Without this patch the SCSI ioctl CDROM_DRIVE_STATUS always returns
> CDS_TRAY_OPEN even if the tray is closed. This patch fixes that.
> Gentoo bug report: http://bugs.gentoo.org/show_bug.cgi?id=196879
> 
> Signed-off by: Maarten Bressers <mbres@gentoo.org>
> 
> ---
> 
> --- a/drivers/scsi/sr_ioctl.c	2007-10-09 22:31:38.000000000 +0200
> +++ b/drivers/scsi/sr_ioctl.c	2007-10-25 22:57:21.000000000 +0200
> @@ -310,6 +310,8 @@ int sr_lock_door(struct cdrom_device_inf
>  
>  int sr_drive_status(struct cdrom_device_info *cdi, int slot)
>  {
> +	struct media_event_desc med;
> +
>  	if (CDSL_CURRENT != slot) {
>  		/* we have no changer support */
>  		return -EINVAL;
> @@ -317,7 +319,10 @@ int sr_drive_status(struct cdrom_device_
>  	if (0 == test_unit_ready(cdi->handle))
>  		return CDS_DISC_OK;
>  
> -	return CDS_TRAY_OPEN;
> +	if (!cdrom_get_media_event(cdi, &med) && med.door_open)
> +		return CDS_TRAY_OPEN;
> +
> +	return CDS_NO_DISC;
>  }
>  
>  int sr_disk_status(struct cdrom_device_info *cdi)

This patch is too simplistic.  ide-cd.c:ide_cdrom_drive_status() looks
to be a reasonable implementation.  However, the worry is that
GET_EVENT_NOTIFICATION is a MMC command; devices not conforming to MMC
won't support it.  In theory, they should just return ILLEGAL_REQUEST,
but USB devices have been known to crash when given commands they don't
understand.  How widely tested has this been (if it's been in Gentoo
since 2004, then it's probably widely tested enough)?

James



  reply	other threads:[~2007-10-25 23:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 22:30 Maarten Bressers
2007-10-25 23:24 ` James Bottomley [this message]
2007-10-27 22:58 Maarten Bressers
2007-10-31  3:32 ` James Bottomley

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=1193354693.3301.45.camel@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=axboe@kernel.dk \
    --cc=dsd@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mbres@gentoo.org \
    --cc=tasio@hierro.tasio.net \
    --subject='Re: [PATCH RESEND] SCSI not showing tray status correctly' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).