Commit cd5a7c08 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] cdrom event notification fixes

A few fixes related to cdrom media event notification.  These are from
Alexander Kern <alex.kern@gmx.de>
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 180faf50
......@@ -472,6 +472,9 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi,
if (be16_to_cpu(eh->data_len) < sizeof(*med))
return 1;
if (eh->nea || eh->notification_class != 0x4)
return 1;
memcpy(med, &buffer[sizeof(*eh)], sizeof(*med));
return 0;
}
......
......@@ -2719,8 +2719,10 @@ int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
if (!cdrom_get_media_event(cdi, &med)) {
if (med.media_present)
return CDS_DISC_OK;
if (med.door_open)
else if (med.door_open)
return CDS_TRAY_OPEN;
else
return CDS_NO_DISC;
}
if (sense.sense_key == NOT_READY && sense.asc == 0x04 && sense.ascq == 0x04)
......@@ -2732,11 +2734,13 @@ int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
* any other way to detect this...
*/
if (sense.sense_key == NOT_READY) {
if (sense.asc == 0x3a && sense.ascq == 1)
if (sense.asc == 0x3a) {
if (sense.ascq == 0 || sense.ascq == 1)
return CDS_NO_DISC;
else
else if (sense.ascq == 2)
return CDS_TRAY_OPEN;
}
}
return CDS_DRIVE_NOT_READY;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment