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