[udev/f14/master] - more cdrom_id patches Resolves: rhbz#637495

Harald Hoyer harald at fedoraproject.org
Thu Oct 7 16:01:16 UTC 2010


commit e31ef1c26455d4e0a8231b2e12c4fea2edf0ff84
Author: Harald Hoyer <harald at redhat.com>
Date:   Thu Oct 7 18:02:10 2010 +0200

    - more cdrom_id patches
    Resolves: rhbz#637495

 ... 0101-cdrom_id-Add-media-status-debugging.patch |    4 +-
 ..._id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch |    4 +-
 ... 0103-cdrom_id-Fix-DVD-RW-media-detection.patch |    4 +-
 ...x-DVD-blank-detection-for-sloppy-firmware.patch |    4 +-
 ...y-reading-the-medium-if-all-MMC-commands-.patch |   66 +++++++++++
 ...m_id-Try-reading-the-medium-if-all-MMC-co.patch |   66 +++++++++++
 ...ll-back-to-CDROM_DRIVE_STATUS-if-all-MMC-.patch |   38 ++++++
 ...om_id-Don-t-read-beyond-last-track-in-TOC.patch |   56 +++++++++
 ...quest-the-drive-profile-features-with-a-d.patch |  124 ++++++++++++++++++++
 Makefile.git                                       |    4 +-
 udev.spec                                          |   39 ++++---
 11 files changed, 385 insertions(+), 24 deletions(-)
---
diff --git a/0001-cdrom_id-Add-media-status-debugging.patch b/0101-cdrom_id-Add-media-status-debugging.patch
similarity index 92%
rename from 0001-cdrom_id-Add-media-status-debugging.patch
rename to 0101-cdrom_id-Add-media-status-debugging.patch
index f282114..a97a186 100644
--- a/0001-cdrom_id-Add-media-status-debugging.patch
+++ b/0101-cdrom_id-Add-media-status-debugging.patch
@@ -1,7 +1,7 @@
 From 24af530a543c70ac59fdd244377d648ef77a0e21 Mon Sep 17 00:00:00 2001
 From: Martin Pitt <martin.pitt at ubuntu.com>
 Date: Thu, 12 Aug 2010 07:10:12 +0200
-Subject: [PATCH 01/23] cdrom_id: Add media status debugging
+Subject: [PATCH 1/9] cdrom_id: Add media status debugging
 
 Show which media status the hardware originally reports, since we mangle it in
 some cases.
@@ -22,5 +22,5 @@ index 83e95d5..d59991c 100644
  	/* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */
  	if (!cd_media_cd_rom)
 -- 
-1.7.2.2
+1.7.2.3
 
diff --git a/0003-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch b/0102-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
similarity index 94%
rename from 0003-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
rename to 0102-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
index d476ee5..d742dd6 100644
--- a/0003-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
+++ b/0102-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
@@ -1,7 +1,7 @@
 From b367a1c9d8a0f565effcdb45f86a365be1c8b622 Mon Sep 17 00:00:00 2001
 From: Jan Drzewiecki <jonie at icpnet.pl>
 Date: Fri, 13 Aug 2010 07:24:29 +0200
-Subject: [PATCH 03/23] cdrom_id: Drop MEDIA_SESSION_NEXT for DVD-RW-RO
+Subject: [PATCH 2/9] cdrom_id: Drop MEDIA_SESSION_NEXT for DVD-RW-RO
 
 Commit cf2205a fixed the media status for fresh DVD-RW in restricted overwrite
 mode, but missed a detail: We should not report the ID_CDROM_MEDIA_SESSION_NEXT
@@ -30,5 +30,5 @@ index d59991c..f9d6e0b 100644
  	cd_media_session_count = header[9] << 8 | header[4];
  	cd_media_track_count = header[11] << 8 | header[6];
 -- 
-1.7.2.2
+1.7.2.3
 
diff --git a/0020-cdrom_id-Fix-DVD-RW-media-detection.patch b/0103-cdrom_id-Fix-DVD-RW-media-detection.patch
similarity index 96%
rename from 0020-cdrom_id-Fix-DVD-RW-media-detection.patch
rename to 0103-cdrom_id-Fix-DVD-RW-media-detection.patch
index 4a91a4e..28882a6 100644
--- a/0020-cdrom_id-Fix-DVD-RW-media-detection.patch
+++ b/0103-cdrom_id-Fix-DVD-RW-media-detection.patch
@@ -1,7 +1,7 @@
 From 2458db3edd8d66827b34978ff471dff8f879e9ab Mon Sep 17 00:00:00 2001
 From: Martin Pitt <martin.pitt at ubuntu.com>
 Date: Mon, 30 Aug 2010 15:33:26 +0200
-Subject: [PATCH 20/23] cdrom_id: Fix DVD-RW media detection
+Subject: [PATCH 3/9] cdrom_id: Fix DVD-RW media detection
 
 Commit cf2205a19 applied the "restricted overwrite" vs. "sequential" DVD-RW
 test to feature_profiles() (which reads the drive capabilities), which caused
@@ -49,5 +49,5 @@ index f9d6e0b..8480d7b 100644
  	case 0x1B:
  		info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile);
 -- 
-1.7.2.2
+1.7.2.3
 
diff --git a/0021-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch b/0104-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
similarity index 95%
rename from 0021-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
rename to 0104-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
index d033307..81e3d09 100644
--- a/0021-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
+++ b/0104-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
@@ -1,7 +1,7 @@
 From 5e267ea5a36de0b2a9a8965ca93dd45bbd6b1a8b Mon Sep 17 00:00:00 2001
 From: Jan Drzewiecki <jonie at icpnet.pl>
 Date: Tue, 31 Aug 2010 00:37:28 +0200
-Subject: [PATCH 21/23] cdrom_id: Fix DVD blank detection for sloppy firmware
+Subject: [PATCH 4/9] cdrom_id: Fix DVD blank detection for sloppy firmware
 
 Reportedly, many CD drive firmwares will only consider the MSB in a READ
 command, thus if we request 17 blocks to be read, we'll actually only get 16 in
@@ -38,5 +38,5 @@ index 8480d7b..0153af6 100644
  		err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer));
  		if ((err != 0)) {
 -- 
-1.7.2.2
+1.7.2.3
 
diff --git a/0105-cdrom_id-Try-reading-the-medium-if-all-MMC-commands-.patch b/0105-cdrom_id-Try-reading-the-medium-if-all-MMC-commands-.patch
new file mode 100644
index 0000000..1af41ec
--- /dev/null
+++ b/0105-cdrom_id-Try-reading-the-medium-if-all-MMC-commands-.patch
@@ -0,0 +1,66 @@
+From ea88774a922c734afd751a59d8102bfa4806a1a6 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Tue, 5 Oct 2010 14:34:55 +0200
+Subject: [PATCH 5/9] cdrom_id: Try reading the medium if all MMC commands fail
+
+Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks
+like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older
+(pre-MMC2) "READ DISC INFORMATION" command. In that case, check if we can read
+data from the drive, and assume that we have a CD-ROM medium if it succeeds.
+---
+ extras/cdrom_id/cdrom_id.c |   32 ++++++++++++++++++++++++++++++--
+ 1 files changed, 30 insertions(+), 2 deletions(-)
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index 0153af6..f65f04f 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -350,6 +350,34 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si
+ 	return 0;
+ }
+ 
++static int cd_profiles_broken_mmc(struct udev *udev, int fd)
++{
++	struct scsi_cmd sc;
++	unsigned char buffer[16 * 2048];
++	int err;
++
++	/* we land here if both the standard and the old MMC commands failed;
++	 * this might happen on broken wanna-be-CD USB drives like the IronKey.
++	 * As a last resort, try to read data to see whether it has a medium.
++	 */
++	scsi_cmd_init(udev, &sc, buffer, sizeof(buffer));
++	scsi_cmd_set(udev, &sc, 0, 0x28);
++	scsi_cmd_set(udev, &sc, 5, 0);
++	scsi_cmd_set(udev, &sc, 8, 16);
++	scsi_cmd_set(udev, &sc, 9, 0);
++	err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer));
++	if ((err != 0)) {
++	    info(udev, "READ DATA failed, assuming no medium\n");
++	    return -1;
++	}
++
++	/* that's all we can claim if we can read data */
++	info(udev, "READ DATA succeeded, assuming CD-ROM medium\n");
++	cd_media = 1;
++	cd_media_cd_rom = 1;
++	return 0;
++}
++
+ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ {
+ 	struct scsi_cmd sc;
+@@ -364,8 +392,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ 	err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
+ 	if ((err != 0)) {
+ 		info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
+-		info(udev, "no current profile, assuming no media\n");
+-		return -1;
++		info(udev, "no current profile, probing readability of medium\n");
++		return cd_profiles_broken_mmc(udev, fd);
+ 	};
+ 
+ 	cd_media = 1;
+-- 
+1.7.2.3
+
diff --git a/0106-Revert-cdrom_id-Try-reading-the-medium-if-all-MMC-co.patch b/0106-Revert-cdrom_id-Try-reading-the-medium-if-all-MMC-co.patch
new file mode 100644
index 0000000..dfc052d
--- /dev/null
+++ b/0106-Revert-cdrom_id-Try-reading-the-medium-if-all-MMC-co.patch
@@ -0,0 +1,66 @@
+From 13e0fca5dff286921a8df0cd737e6e1224e53275 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Tue, 5 Oct 2010 14:57:04 +0200
+Subject: [PATCH 6/9] Revert "cdrom_id: Try reading the medium if all MMC commands fail"
+
+Turns out we can do this much simpler by assuming that cd_media_compat() works,
+which seems to be the case for the IronKey.
+
+This reverts commit ea88774a922c734afd751a59d8102bfa4806a1a6.
+---
+ extras/cdrom_id/cdrom_id.c |   32 ++------------------------------
+ 1 files changed, 2 insertions(+), 30 deletions(-)
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index f65f04f..0153af6 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -350,34 +350,6 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si
+ 	return 0;
+ }
+ 
+-static int cd_profiles_broken_mmc(struct udev *udev, int fd)
+-{
+-	struct scsi_cmd sc;
+-	unsigned char buffer[16 * 2048];
+-	int err;
+-
+-	/* we land here if both the standard and the old MMC commands failed;
+-	 * this might happen on broken wanna-be-CD USB drives like the IronKey.
+-	 * As a last resort, try to read data to see whether it has a medium.
+-	 */
+-	scsi_cmd_init(udev, &sc, buffer, sizeof(buffer));
+-	scsi_cmd_set(udev, &sc, 0, 0x28);
+-	scsi_cmd_set(udev, &sc, 5, 0);
+-	scsi_cmd_set(udev, &sc, 8, 16);
+-	scsi_cmd_set(udev, &sc, 9, 0);
+-	err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer));
+-	if ((err != 0)) {
+-	    info(udev, "READ DATA failed, assuming no medium\n");
+-	    return -1;
+-	}
+-
+-	/* that's all we can claim if we can read data */
+-	info(udev, "READ DATA succeeded, assuming CD-ROM medium\n");
+-	cd_media = 1;
+-	cd_media_cd_rom = 1;
+-	return 0;
+-}
+-
+ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ {
+ 	struct scsi_cmd sc;
+@@ -392,8 +364,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ 	err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
+ 	if ((err != 0)) {
+ 		info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
+-		info(udev, "no current profile, probing readability of medium\n");
+-		return cd_profiles_broken_mmc(udev, fd);
++		info(udev, "no current profile, assuming no media\n");
++		return -1;
+ 	};
+ 
+ 	cd_media = 1;
+-- 
+1.7.2.3
+
diff --git a/0107-cdrom_id-Fall-back-to-CDROM_DRIVE_STATUS-if-all-MMC-.patch b/0107-cdrom_id-Fall-back-to-CDROM_DRIVE_STATUS-if-all-MMC-.patch
new file mode 100644
index 0000000..a587b51
--- /dev/null
+++ b/0107-cdrom_id-Fall-back-to-CDROM_DRIVE_STATUS-if-all-MMC-.patch
@@ -0,0 +1,38 @@
+From 678df8a461c7573bf423a39be383bc7b70d943df Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Tue, 5 Oct 2010 14:59:51 +0200
+Subject: [PATCH 7/9] cdrom_id: Fall back to CDROM_DRIVE_STATUS if all MMC commands fail
+
+Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks
+like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older
+(pre-MMC2) "READ DISC INFORMATION" command. In that case, check if
+cd_media_compat() detected that there is a disc present, and assume that we
+have a CD-ROM medium.
+---
+ extras/cdrom_id/cdrom_id.c |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index 0153af6..e7a3e40 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -364,8 +364,14 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
+ 	err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
+ 	if ((err != 0)) {
+ 		info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
+-		info(udev, "no current profile, assuming no media\n");
+-		return -1;
++		if (cd_media == 1) {
++			info(udev, "no current profile, but disc is present; assuming CD-ROM\n");
++			cd_media_cd_rom = 1;
++			return 0;
++		} else {
++			info(udev, "no current profile, assuming no media\n");
++			return -1;
++		}
+ 	};
+ 
+ 	cd_media = 1;
+-- 
+1.7.2.3
+
diff --git a/0108-cdrom_id-Don-t-read-beyond-last-track-in-TOC.patch b/0108-cdrom_id-Don-t-read-beyond-last-track-in-TOC.patch
new file mode 100644
index 0000000..b7a2443
--- /dev/null
+++ b/0108-cdrom_id-Don-t-read-beyond-last-track-in-TOC.patch
@@ -0,0 +1,56 @@
+From 1ebd2a5620c93ef4698485d392c19ded675412d2 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Tue, 5 Oct 2010 17:56:19 +0200
+Subject: [PATCH 8/9] cdrom_id: Don't read beyond "last track" in TOC
+
+Read the first and last track from the TOC header, and do not go beyond that
+stated number of tracks when reading the TOC. Otherwise we interpret random
+data which leads to bogus tracks. (Reported on an IronKey, which reported 1
+data track, and 4 audio tracks which weren't actually present.)
+---
+ extras/cdrom_id/cdrom_id.c |   11 ++++++++---
+ 1 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index e7a3e40..1b43fe4 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -712,7 +712,7 @@ static int cd_media_toc(struct udev *udev, int fd)
+ 	struct scsi_cmd sc;
+ 	unsigned char header[12];
+ 	unsigned char toc[2048];
+-	unsigned int len, i;
++	unsigned int len, i, num_tracks;
+ 	unsigned char *p;
+ 	int err;
+ 
+@@ -728,11 +728,13 @@ static int cd_media_toc(struct udev *udev, int fd)
+ 	}
+ 
+ 	len = (header[0] << 8 | header[1]) + 2;
+-	info(udev, "READ TOC: len: %d\n", len);
++	info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]);
+ 	if (len > sizeof(toc))
+ 		return -1;
+ 	if (len < 2)
+ 		return -1;
++	/* 2: first track, 3: last track */
++	num_tracks = header[3] - header[2] + 1;
+ 
+ 	/* empty media has no tracks */
+ 	if (len < 8)
+@@ -750,7 +752,10 @@ static int cd_media_toc(struct udev *udev, int fd)
+ 		return -1;
+ 	}
+ 
+-	for (p = toc+4, i = 4; i < len-8; i += 8, p += 8) {
++	/* Take care to not iterate beyond the last valid track as specified in
++	 * the TOC, but also avoid going beyond the TOC length, just in case
++	 * the last track number is invalidly large */
++	for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) {
+ 		unsigned int block;
+ 		unsigned int is_data_track;
+ 
+-- 
+1.7.2.3
+
diff --git a/0109-cdrom_id-request-the-drive-profile-features-with-a-d.patch b/0109-cdrom_id-request-the-drive-profile-features-with-a-d.patch
new file mode 100644
index 0000000..65da170
--- /dev/null
+++ b/0109-cdrom_id-request-the-drive-profile-features-with-a-d.patch
@@ -0,0 +1,124 @@
+From d7cd2b16110c806128747ee245aaa883dd52039d Mon Sep 17 00:00:00 2001
+From: Harald Hoyer <harald at redhat.com>
+Date: Thu, 7 Oct 2010 17:02:21 +0200
+Subject: [PATCH 9/9] cdrom_id: request the drive profile features with a dynamic length
+
+Some drives don't like huge feature buffers, so we query twice. First
+run for the current profile and to get the length.
+Second time we query the whole profile feature set.
+---
+ extras/cdrom_id/cdrom_id.c |   81 ++++++++++++++++++++++++++++---------------
+ 1 files changed, 53 insertions(+), 28 deletions(-)
+
+diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
+index 1b43fe4..ec001cd 100644
+--- a/extras/cdrom_id/cdrom_id.c
++++ b/extras/cdrom_id/cdrom_id.c
+@@ -398,12 +398,12 @@ static int cd_profiles(struct udev *udev, int fd)
+ 	unsigned int i;
+ 	int err;
+ 
++	/* First query the current profile */
+ 	scsi_cmd_init(udev, &sc, features, sizeof(features));
+ 	scsi_cmd_set(udev, &sc, 0, 0x46);
+-	scsi_cmd_set(udev, &sc, 7, (sizeof(features) >> 8) & 0xff);
+-	scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff);
++	scsi_cmd_set(udev, &sc, 8, 8);
+ 	scsi_cmd_set(udev, &sc, 9, 0);
+-	err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features));
++	err = scsi_cmd_run(udev, &sc, fd, features, 8);
+ 	if ((err != 0)) {
+ 		info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
+ 		/* handle pre-MMC2 drives which do not support GET CONFIGURATION */
+@@ -415,31 +415,6 @@ static int cd_profiles(struct udev *udev, int fd)
+ 		return -1;
+ 	}
+ 
+-	len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
+-	info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len);
+-
+-	if (len > sizeof(features)) {
+-		info(udev, "can not get features in a single query, truncating\n");
+-		len = sizeof(features);
+-	}
+-
+-	/* device features */
+-	for (i = 8; i+4 < len; i += (4 + features[i+3])) {
+-		unsigned int feature;
+-
+-		feature = features[i] << 8 | features[i+1];
+-
+-		switch (feature) {
+-		case 0x00:
+-			info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4);
+-			feature_profiles(udev, &features[i]+4, features[i+3]);
+-			break;
+-		default:
+-			info(udev, "GET CONFIGURATION: feature 0x%04x <ignored>, with 0x%02x bytes\n", feature, features[i+3]);
+-			break;
+-		}
+-	}
+-
+ 	cur_profile = features[6] << 8 | features[7];
+ 	if (cur_profile > 0) {
+ 		info(udev, "current profile 0x%02x\n", cur_profile);
+@@ -553,6 +528,56 @@ static int cd_profiles(struct udev *udev, int fd)
+ 		info(udev, "profile 0x%02x <ignored>\n", cur_profile);
+ 		break;
+ 	}
++
++
++	len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
++	info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len);
++
++	if (len > sizeof(features)) {
++		info(udev, "can not get features in a single query, truncating\n");
++		len = sizeof(features);
++	} else if (len <= 8) {
++		len = sizeof(features);
++	}
++
++	/* Now get the full feature buffer */
++	scsi_cmd_init(udev, &sc, features,  len);
++	scsi_cmd_set(udev, &sc, 0, 0x46);
++	scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff);
++	scsi_cmd_set(udev, &sc, 8, len & 0xff);
++	scsi_cmd_set(udev, &sc, 9, 0);
++	err = scsi_cmd_run(udev, &sc, fd, features, len);
++	if ((err != 0)) {
++		info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
++		return -1;
++	}
++
++	/* parse the length once more, in case the drive decided to have other features suddenly :) */
++	len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3];
++	info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len);
++
++	if (len > sizeof(features)) {
++		info(udev, "can not get features in a single query, truncating\n");
++		len = sizeof(features);
++	}
++
++	/* device features */
++	for (i = 8; i+4 < len; i += (4 + features[i+3])) {
++		unsigned int feature;
++
++		feature = features[i] << 8 | features[i+1];
++
++		switch (feature) {
++		case 0x00:
++			info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4);
++			feature_profiles(udev, &features[i]+4, features[i+3]);
++			break;
++		default:
++			info(udev, "GET CONFIGURATION: feature 0x%04x <ignored>, with 0x%02x bytes\n", feature, features[i+3]);
++			break;
++		}
++	}
++
+ 	return 0;
+ }
+ 
+-- 
+1.7.2.3
+
diff --git a/Makefile.git b/Makefile.git
index ea5486a..d14c2d2 100644
--- a/Makefile.git
+++ b/Makefile.git
@@ -1,6 +1,6 @@
 Patch:
-	@for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "Patch$$n: $$i";done
+	@for i in 0*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "Patch$$n: $$i";done
 
 patch:
-	@for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "%patch$$n -p1 -b .git$$n";done
+	@for i in 0*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "%patch$$n -p1 -b .git$$n";done
 
diff --git a/udev.spec b/udev.spec
index ade4df7..f51e786 100644
--- a/udev.spec
+++ b/udev.spec
@@ -7,7 +7,7 @@
 Summary: A rule-based device node and kernel event manager
 Name: udev
 Version: 161
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Provides: udev-persistent = %{version}-%{release}
@@ -17,9 +17,7 @@ Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.t
 Source1: start_udev
 Source2: udev-post.init
 
-Patch1: 0001-cdrom_id-Add-media-status-debugging.patch
 Patch2: 0002-Add-keymap-for-Lenovo-IdeaPad-S10-3.patch
-Patch3: 0003-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
 Patch4: 0004-init-update-systemd-service-files.patch
 Patch5: 0005-init-update-systemd-service-files.patch
 Patch6: 0006-udev-acl-do-not-mistake-all-SCSI-processor-devices-f.patch
@@ -35,12 +33,17 @@ Patch16: 0016-keymap-Fix-Sony-VAIO-VGN-SZ2HP-B.patch
 Patch17: 0017-udev-7-manpage-Fix-description-of-attr.patch
 Patch18: 0018-gudev-fix-crash-if-netlink-is-not-available.patch
 Patch19: 0019-keymap-Fix-Acer-TravelMate-4720.patch
-Patch20: 0020-cdrom_id-Fix-DVD-RW-media-detection.patch
-Patch21: 0021-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
 Patch22: 0022-set-SELinux-context-on-add-but-not-on-change-events.patch
 Patch23: 0023-do-not-create-persistent-name-rules-for-KVM-network-.patch
-
-Patch100: udev-161-cdrom-fallback.patch
+Patch101: 0101-cdrom_id-Add-media-status-debugging.patch
+Patch102: 0102-cdrom_id-Drop-MEDIA_SESSION_NEXT-for-DVD-RW-RO.patch
+Patch103: 0103-cdrom_id-Fix-DVD-RW-media-detection.patch
+Patch104: 0104-cdrom_id-Fix-DVD-blank-detection-for-sloppy-firmware.patch
+Patch105: 0105-cdrom_id-Try-reading-the-medium-if-all-MMC-commands-.patch
+Patch106: 0106-Revert-cdrom_id-Try-reading-the-medium-if-all-MMC-co.patch
+Patch107: 0107-cdrom_id-Fall-back-to-CDROM_DRIVE_STATUS-if-all-MMC-.patch
+Patch108: 0108-cdrom_id-Don-t-read-beyond-last-track-in-TOC.patch
+Patch109: 0109-cdrom_id-request-the-drive-profile-features-with-a-d.patch
 
 ExclusiveOS: Linux
 URL: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
@@ -138,9 +141,8 @@ glib-based applications using libudev functionality.
 
 %prep 
 %setup -q 
-%patch1 -p1 -b .git1
+
 %patch2 -p1 -b .git2
-%patch3 -p1 -b .git3
 %patch4 -p1 -b .git4
 %patch5 -p1 -b .git5
 %patch6 -p1 -b .git6
@@ -156,12 +158,17 @@ glib-based applications using libudev functionality.
 %patch17 -p1 -b .git17
 %patch18 -p1 -b .git18
 %patch19 -p1 -b .git19
-%patch20 -p1 -b .git20
-%patch21 -p1 -b .git21
 %patch22 -p1 -b .git22
 %patch23 -p1 -b .git23
-
-%patch100 -p1 
+%patch101 -p1 -b .git101
+%patch102 -p1 -b .git102
+%patch103 -p1 -b .git103
+%patch104 -p1 -b .git104
+%patch105 -p1 -b .git105
+%patch106 -p1 -b .git106
+%patch107 -p1 -b .git107
+%patch108 -p1 -b .git108
+%patch109 -p1 -b .git109
 
 %build
 libtoolize -f -c
@@ -398,7 +405,11 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0*
 
 %changelog
-* Tue Oct 05 2010 Harald Hoyer <harald at redhat.com> 161-2
+* Thu Oct 07 2010 Harald Hoyer <harald at redhat.com> 161-4
+- more cdrom_id patches
+Resolves: rhbz#637495
+
+* Tue Oct 05 2010 Harald Hoyer <harald at redhat.com> 161-3
 - add cdrom_id patch for pre-MMC2 drives, which do not report
   profiles
 Resolves: rhbz#637495


More information about the scm-commits mailing list