From owner-freebsd-scsi@FreeBSD.ORG Wed Dec 21 05:53:28 2011 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB3C106564A for ; Wed, 21 Dec 2011 05:53:28 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 621808FC13 for ; Wed, 21 Dec 2011 05:53:28 +0000 (UTC) Received: by eekc50 with SMTP id c50so8529112eek.13 for ; Tue, 20 Dec 2011 21:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=2MZkV/LWp2jrTIK3S0kCzCLST5L6CfPC8eqyCDhauTo=; b=txoHC5Rs+FSxjgYrAmiVcSDNf2i1zbbw6SV+1+wKjaAP0cInAVKEDa3dsW3shOKcTo GqJ7PIka6UqgvcNcQhWEEnBkxCup4maRxcuw9DwsGTcLttRD1oZda8x8h88UbIQVRhJX 06u7QzaYL7k8NzwMDvMLtwmgr/HYhFcz7P/Wo= Received: by 10.14.32.145 with SMTP id o17mr2125653eea.52.1324446807407; Tue, 20 Dec 2011 21:53:27 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id z43sm16500759eef.7.2011.12.20.21.53.25 (version=SSLv3 cipher=OTHER); Tue, 20 Dec 2011 21:53:26 -0800 (PST) Sender: Alexander Motin Message-ID: <4EF1744A.9070703@FreeBSD.org> Date: Wed, 21 Dec 2011 07:53:14 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: freebsd-scsi Content-Type: multipart/mixed; boundary="------------080900040203040002060006" Subject: Reading audio CD X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2011 05:53:29 -0000 This is a multi-part message in MIME format. --------------080900040203040002060006 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Hi. Comparing cd and acd drivers I've found that acd driver handles reading of full 2352 bytes audio sectors via READ CD command, while cd driver doesn't. In particular that causes error messages about wrong access mode during boot/taste if audio CD inserted. Experimenting with it I've made a small patch for the cd driver (attached) to allow reading 2352 bytes sectors. As positive result those errors gone now. But looking for some real consumer of this I've found that at least both cdparanoia and libcdio are working with device directly with SCSI commands not using kernel drivers. So the question is: are there applications that reading audio cd via /dev/cdX device as previously they could do via /dev/acdX? Is this functionality used/needed? -- Alexander Motin --------------080900040203040002060006 Content-Type: text/plain; name="cdda.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cdda.patch" Index: scsi/scsi_all.h =================================================================== --- scsi/scsi_all.h (revision 228743) +++ scsi/scsi_all.h (working copy) @@ -932,6 +932,7 @@ #define WRITE_12 0xAA #define WRITE_VERIFY_12 0xAE #define READ_ELEMENT_STATUS 0xB8 +#define READ_CD 0xBE /* Maintenance In Service Action Codes */ #define REPORT_IDENTIFYING_INFRMATION 0x05 Index: scsi/scsi_cd.c =================================================================== --- scsi/scsi_cd.c (revision 228743) +++ scsi/scsi_cd.c (working copy) @@ -1483,6 +1483,11 @@ /* dxfer_len */ bp->bio_bcount, /* sense_len */ SSD_FULL_SIZE, /* timeout */ 30000); + /* Use READ CD command for audio tracks. */ + if (softc->params.blksize == 2352) { + start_ccb->csio.cdb_io.cdb_bytes[0] = READ_CD; + start_ccb->csio.cdb_io.cdb_bytes[9] = 0xf8; + } start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO; @@ -2880,6 +2885,13 @@ softc->flags |= CD_FLAG_VALID_TOC; + /* If the first track is audio, correct sector size. */ + if ((softc->toc.entries[0].control & 4) == 0) { + softc->disk->d_sectorsize = softc->params.blksize = 2352; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * softc->params.disksize; + } + bailout: /* --------------080900040203040002060006--