65878a
From 0f9f786f2f6fa8e7aa0c00b29c36296e8b291d76 Mon Sep 17 00:00:00 2001
65878a
From: Lukas Nykryn <lnykryn@redhat.com>
65878a
Date: Thu, 27 Feb 2014 11:06:37 +0100
65878a
Subject: [PATCH] cdrom_id: use the old MMC fallback
65878a
65878a
https://bugzilla.redhat.com/show_bug.cgi?id=1038015
65878a
The problem seems to be that the your virtual DVD is emulating a really
65878a
old DVD device, and doing it kind of strangely.
65878a
65878a
> dracut:# /lib/udev/cdrom_id --debug /dev/sr0
65878a
> probing: '/dev/sr0'
65878a
> INQUIRY: [IMM     ][Virtual CD/DVD   ][0316]
65878a
> GET CONFIGURATION failed with SK=5h/ASC=24h/ACQ=00h
65878a
65878a
So your virtual drive rejects the GET CONFIGURATION command as illegal.
65878a
65878a
Other pre-MMC2 drives that don't accept this command usually return the
65878a
error
65878a
SK=5h,ASC=20h (invalid/unsupported command code), in which case cdrom_id
65878a
tries an older method, and then ID_CDROM_MEDIA_TRACK_COUNT_DATA gets set
65878a
and all the /dev/disk/by-label (etc) links get set up.
65878a
65878a
The virtual drive returns the error SK=5h,ASC=24h (invalid field in
65878a
Command Descriptor Block), which cdrom_id doesn't handle, so it gives up
65878a
and the links never get made.
65878a
65878a
The ideal solution would be to make the IMM to emulate a device that's
65878a
less than 15 years old, but I'm not going to hold my breath waiting for
65878a
that.
65878a
65878a
So probably cdrom_id should also use the old MMC fallback when the error
65878a
is SK=5h,ASC=24h, and then all of this would work as expected.
65878a
65878a
Suggested-by:Luca Miccini <lmiccini@redhat.com>
65878a
65878a
Conflicts:
65878a
	src/udev/cdrom_id/cdrom_id.c
65878a
---
65878a
 src/udev/cdrom_id/cdrom_id.c | 2 +-
65878a
 1 file changed, 1 insertion(+), 1 deletion(-)
65878a
65878a
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
65878a
index 1ad0459..ae19542 100644
65878a
--- a/src/udev/cdrom_id/cdrom_id.c
65878a
+++ b/src/udev/cdrom_id/cdrom_id.c
65878a
@@ -555,7 +555,7 @@ static int cd_profiles(struct udev *udev, int fd)
65878a
         if ((err != 0)) {
65878a
                 info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
65878a
                 /* handle pre-MMC2 drives which do not support GET CONFIGURATION */
65878a
-                if (SK(err) == 0x5 && ASC(err) == 0x20) {
65878a
+                if (SK(err) == 0x5 && (ASC(err) == 0x20 || ASC(err) == 0x24)) {
65878a
                         log_debug("drive is pre-MMC2 and does not support 46h get configuration command\n");
65878a
                         log_debug("trying to work around the problem\n");
65878a
                         ret = cd_profiles_old_mmc(udev, fd);