Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 196879

Summary: ioctl CDROM_DRIVE_STATUS, with no disk gives CDS_TRAY_OPEN even if the tray is closed on SATA/SCSI devices
Product: Gentoo Linux Reporter: Sergey A. Sukiyazov <sukiyazov>
Component: [OLD] Core systemAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Severity: major Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: patch

Description Sergey A. Sukiyazov 2007-10-24 06:29:13 UTC
>From  David Martin <>
  Subject  [PATCH] SCSI not showing tray status correctly
  Date  Mon, 27 Dec 2004 06:26:32 +0100
Digg This  When trying to get the drive status via ioctl CDROM_DRIVE_STATUS, with no disk 
it gives CDS_TRAY_OPEN even if the tray is closed.

ioctl works as expected with ide-cd driver. Here is the patch to get the same 
behaviour on SCSI drives for kernel 2.6.10. 2.4 branch have same problem.

Get from Debian bug #447337 (

Reproducible: Always

Steps to Reproduce:
1. Close empty CD tray.
2. call state = ioctl(device_handle, CDROM_DRIVE_STATUS);
3. state always gives CDS_TRAY_OPEN even if the tray is closed.

Patch for solve this problem present at Debian bug #447337 by URL:

I apply this patch. It work correctly. Now ioctl(device_handle, CDROM_DRIVE_STATUS) returns right result.
Comment 1 Mike Pagano gentoo-dev 2007-10-25 00:24:03 UTC
Submission of patch to lkml:
Comment 2 Maarten Bressers (RETIRED) gentoo-dev 2007-10-25 22:35:50 UTC
The patch has been sent upstream (again), we'll wait for their response.
Comment 3 Mike Pagano gentoo-dev 2007-12-19 19:23:18 UTC
submission thread:
Comment 4 Daniel Drake (RETIRED) gentoo-dev 2008-01-24 13:20:30 UTC
Created attachment 141718 [details, diff]

Sorry for the delay here.
Please apply this patch instead, and confirm it solves the issue.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2008-02-07 11:49:22 UTC
I went ahead and tested this myself. It needed some extra work (another patch backported first, and a fix applying after), but it's done now. Patches 2100, 2101, and 2102 queued for next gentoo-sources-2.6.24 release
Comment 6 Daniel Drake (RETIRED) gentoo-dev 2008-02-10 00:39:13 UTC
Fixed in gentoo-sources-2.6.24-r1 (genpatches-2.6.24-2)
Not planning on backporting to 2.6.23 as this is more than a simple bugfix.