SCSI-3 specification has effectively removed LUN address from command data block (it was moved to lower transport layer so to say). Therefore assigning of cdb.g5_cdb.lun [as commonly performed by cdrecord] is *formally* inappropriate, inappropriate in SCSI-3 context that is. Indeed, the field specified as LUN by SCSI-2 is declared "reserved" in *all* SCSI-3 drafts. Where "reserved" per definition is
"A keyword referring to bits, bytes, words, fields and code values that are set aside for future standardization. A reserved bit, byte, word or field *shall* be set to zero, or in accordance with a future extension to this standard." Where "shall" is defined as "A keyword indicating a mandatory requirement. Designers are required to implement all such mandatory requirements to ensure interoperability with other standard conforming products." So that *formally* application program such as cdrecord should basically figure out SCSI level implemented by the targer and abstain from assigning the cdb.g5_cdb.lun, if level was found to be larger than 2. As fast-acting "relief" I would suggest to reimplement 'scg_lun(scgp)' macro as '(scsi_level>2?0:(scgp)->addr.lun)'. But *formally* it is assignment operator as a whole, which should be made conditional, i.e. 'if (scsi_level>2) cdb.g5_cdb.lun=scg_lun(scgp);' in SCSI level "neutral" code pathes, and it should be simply removed in SCSI-3 specific code such as MMC driver(s) (MMC was initially formed as part of SCSI-3 specifications family). This naturally implies that scsi_level variable is declared and assigned a sane value. Unfortunately there is no apparent *reliable* way to establish target's SCSI level compliance, at least because version fields in INQUIRY result don't match between SCSI and ATAPI specifications. So we either have to be creative or require user to manually identify at least ATAPI units by specifying ATAPI:/dev/xxx or similar. Thoughts? As for "being creative." At the very least one should be able to *reliably* use GET CONFIGURATION command to identify MMC compliant units (MMC implies scsi_level=3!), as well as to identify ATAPI units (physical interface is returned as part of feature code 1, but it might be unreliable(?)). A.

