List, Tomo Please find attached a patch for MMC. Basically, if an initiator asks for "READ TOC track==0" this is valid even if track 0 does not exist. For single session media such as TGTD emulated, track 0 does not exist, only track 1 exist, but asking for track 0 is still valid. The reason is that "READ TOC track==xyz" does NOT ask for "information for track xyz only" the CDB asks for "provide information for all tracks that exist, starting at track xyz". So for this case, we have to handle track==0 and track==1 the same. Either if initiator asks for track starting at 0, or if initiator asks for tracks starting at 1, both cases we should return the information for track #1 Recent Ubuntu fails to handle/detect the CD/DVD without this fix. Possibly other distros/applications might too. regards ronnie sahlberg
Attachment:
0001-MMC-READ-TOC-track-0-is-valid.patch.gz
Description: GNU Zip compressed data
From ca448fe919122770a7c10d7528a01acbbe1997c6 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> Date: Mon, 26 Dec 2011 09:46:06 +1100 Subject: [PATCH] MMC: READ TOC track==0 is valid READ TOC track==xyz means : return all tracks starting at number xyz. In case of single session disks, the only track that exists is track 1 in which case we still need to return the information for track 1 regardless of whether the initiator asks for track 0 or track 1. i.e. READ TOC track==0 is still a valid command even if track 0 does not exist Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/mmc.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr/mmc.c b/usr/mmc.c index dba7859..3279c3d 100644 --- a/usr/mmc.c +++ b/usr/mmc.c @@ -188,9 +188,15 @@ static int mmc_read_toc(int host_no, struct scsi_cmd *cmd) switch (toc_format) { case 0: /* formatted toc */ - if (toc_track != 1) { + if (toc_track != 0 && toc_track != 1) { /* we only do single session data disks so only - the first track (track 1) is valid */ + the first track (track 1) exists. + Since this command returns the data for all + tracks equal to toc_track or higher, + we must allow either track 0 or track 1 + as valid and both will return the data for + track 1. + */ scsi_set_in_resid_by_actual(cmd, 0); sense_data_build(cmd, NOT_READY, ASC_INVALID_FIELD_IN_CDB); -- 1.7.3.1