LKML Archive on
help / color / mirror / Atom feed
From: Daniel Drake <>
To: James Bottomley <>
Cc: Maarten Bressers <>,,,,
Subject: Re: [PATCH] sr: update to follow tray status correctly
Date: Wed, 06 Feb 2008 17:09:26 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <1199551191.3399.29.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

Hi James,

James Bottomley wrote:
> It's been a while with no status on this one, so I corrected the patch
> based on my original input.  The attached is what I think is the best
> way of doing this (I've replaced the home grown test_unit_ready routine
> with the SCSI one and updated some of the sense check conditions).

Many thanks for following up on this. The user has not responded to my 
request for him to test your patch, so I decided to try it myself. I'm 
using Linus git as of today, I noticed the patch is merged.

It doesn't work for me. On unpatched 2.6.24, I get the behaviour 
previously described - the ioctl always gives CDS_TRAY_OPEN regardless 
of tray status. On 2.6.24-git which includes your patch, I instead 
always get CDS_DISC_OK. I have confirmed that on 2 systems this is 
because scsi_test_unit_ready() is returning 0.

Before I dig further, does this work for you? I have attached the test 
program I am using.


[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 684 bytes --]

#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <linux/cdrom.h>
#include <unistd.h>
#include <stdio.h>

int main(void)
	int fd = open("/dev/sr0", O_RDONLY | O_NONBLOCK);
	int ret;
	if (fd < 0) {
		return 1;

	ret = ioctl(fd, CDROM_DRIVE_STATUS, 0);
	printf("ioctl result %d\n", ret);

	switch(ret) {
		case CDS_NO_INFO: printf("CDS_NO_INFO\n"); break;
		case CDS_NO_DISC: printf("CDS_NO_DISC\n"); break;
		case CDS_TRAY_OPEN: printf("CDS_TRAY_OPEN\n"); break;
		case CDS_DRIVE_NOT_READY: printf("CDS_DRIVE_NOT_READY\n"); break;
		case CDS_DISC_OK: printf("CDS_DISC_OK\n"); break;
		default: printf("Unknown\n"); break;
	return 0;

  reply	other threads:[~2008-02-06 17:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27 22:58 [PATCH RESEND] SCSI not showing " Maarten Bressers
2007-10-31  3:32 ` James Bottomley
2008-01-05 16:39   ` [PATCH] sr: update to follow " James Bottomley
2008-02-06 17:09     ` Daniel Drake [this message]
2008-02-06 19:01       ` James Bottomley
2008-02-06 20:54         ` Daniel Drake

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:

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

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] sr: update to follow tray status correctly' \

* 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).