daandemeyer / rpms / systemd

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