ryantimwilson / rpms / systemd

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