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