[stgt] [PATCH 2/2] mmc: Properly handle READ TOC command

Andy Grover agrover at redhat.com
Thu Mar 31 19:36:13 CEST 2011


From: David Zeuthen <davidz at redhat.com>

CD tracks starts at one, not zero.

This bug caused /lib/udev/cdrom_id to fail to identify the disc
contents and as a result, the desktop ignores the disc. With this
bug-fix, this no longer happens.

Also fix the TOC returned so it conforms with 6.25.3.2.4 of MMC-6 (the
returned length was wrong).

https://bugzilla.redhat.com/show_bug.cgi?id=690181

Signed-off-by: David Zeuthen <davidz at redhat.com>
Signed-off-by: Andy Grover <agrover at redhat.com>
---
 usr/mmc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr/mmc.c b/usr/mmc.c
index 5ce94d4..4712ec5 100644
--- a/usr/mmc.c
+++ b/usr/mmc.c
@@ -190,9 +190,9 @@ static int mmc_read_toc(int host_no, struct scsi_cmd *cmd)
 
 	switch (toc_format) {
 	case 0:	/* formatted toc */
-		if (toc_track) {
+		if (toc_track != 1) {
 			/* we only do single session data disks so only
-			   track 0 is valid */
+			   the first track (track 1) is valid */
 			scsi_set_in_resid_by_actual(cmd, 0);
 			sense_data_build(cmd, NOT_READY,
 					 ASC_INVALID_FIELD_IN_CDB);
@@ -206,7 +206,7 @@ static int mmc_read_toc(int host_no, struct scsi_cmd *cmd)
 
 		/* size of return data */
 		data[0] = 0;
-		data[1] = 0x1a;
+		data[1] = 0x12;
 
 		data[2] = 1;	/* first track */
 		data[3] = 1;	/* last track */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list