[PATCH] 2.3.14 leaves CDROM drive door locked

Andries.Brouwer@cwi.nl
Thu, 26 Aug 1999 02:58:20 +0200 (MET DST)


On 2.3.14 the CD drive door is often locked where it shouldnt.

Repeat by:
Put an audio CD in the ATAPI drive.
Invoke the program

#include <fcntl.h>
main(){
int i = open("/dev/cdrom", O_RDONLY);
if (i < 0)
perror("/dev/cdrom");
}

This will yield the output

/dev/cdrom: Wrong medium type

and now the drive door is locked, so that one
cannot replace the CD by the right one.

Explanation:

At various points the driver does a check media change,
which calls cdrom_check_status, which does a TEST_UNIT_READY.
However, the routine cdrom_queue_packet_command will always
lock the door unless called with one of a few commands,
and TEST_UNIT_READY is not one of those. So, each
cdrom_check_status, and each check media change will
lock the door. (Even after an eject the tray is withdrawn
and the door is closed again.)
This behaviour is avoided by making TEST_UNIT_READY one
of the exceptions in cdrom_queue_packet_command.

Patch:

--- /g1/linux/linux-2.3.14/linux/drivers/block/ide-cd.c Mon Aug 9 21:34:22 1999
+++ ide-cd.c Thu Aug 26 02:26:10 1999
@@ -1392,8 +1392,10 @@
and we think that the door is presently, lock it again.
(The door was probably unlocked via an explicit
CDROMEJECT ioctl.) */
- if (CDROM_STATE_FLAGS (drive)->door_locked == 0 && drive->usage &&
- (pc->c[0] != REQUEST_SENSE &&
+ if (CDROM_STATE_FLAGS (drive)->door_locked == 0 &&
+ drive->usage &&
+ (pc->c[0] != TEST_UNIT_READY &&
+ pc->c[0] != REQUEST_SENSE &&
pc->c[0] != ALLOW_MEDIUM_REMOVAL &&
pc->c[0] != START_STOP &&
pc->c[0] != MODE_SENSE_10 &&

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/