Re: [PATCH] sr: update to follow tray status correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux