lkml.org 
[lkml]   [2008]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sr: update to follow tray status correctly
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.

Thanks!
Daniel

#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) {
perror("open");
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;
}
\
 
 \ /
  Last update: 2008-02-06 18:11    [W:0.081 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site