Date: Wed, 21 Dec 2011 07:53:14 +0200 From: Alexander Motin <mav@FreeBSD.org> To: freebsd-scsi <freebsd-scsi@freebsd.org> Subject: Reading audio CD Message-ID: <4EF1744A.9070703@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EF1744A.9070703>