From nobody@FreeBSD.org  Mon Oct 31 09:50:18 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B39BD106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Oct 2011 09:50:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id A32578FC1E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Oct 2011 09:50:18 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9V9oImu002656
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Oct 2011 09:50:18 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p9V9oIeR002655;
	Mon, 31 Oct 2011 09:50:18 GMT
	(envelope-from nobody)
Message-Id: <201110310950.p9V9oIeR002655@red.freebsd.org>
Date: Mon, 31 Oct 2011 09:50:18 GMT
From: Claude Buisson <clbuisson@orange.fr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: multimedia/vlc cannot access an audio cd with atapicam or ATA_CAM
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         162190
>Category:       ports
>Synopsis:       multimedia/vlc cannot access an audio cd with atapicam or ATA_CAM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jsa
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 31 10:00:24 UTC 2011
>Closed-Date:    Wed Jan 04 02:02:37 UTC 2012
>Last-Modified:  Thu Jan 12 15:10:11 UTC 2012
>Originator:     Claude Buisson
>Release:        FreeBSD 7.4-STABLE, FreeBSD 8.2-STABLE
>Organization:
>Environment:
FreeBSD adele 7.4-STABLE FreeBSD 7.4-STABLE #0: Thu Sep 22 13:03:08 CEST 2011     toor@adele:/home/obj/home/src/sys/ADELE7X  i386
FreeBSD 8.2-STABLE #0: Tue Sep 20 15:15:27 CEST 2011
    toor@fidel:/home/obj/home/src/sys/ADELE8X i386

>Description:
VLC cannot play audio CDs when using /dev/cdN on a kernel built with atapicam or with ATA_CAM. One must use /dev/acdN and the "traditionnal" ata interface.

This may become a serious problem for 9.X where ATA_CAM is now the default.

Note that the problem is within VLC, as audio/cdparanoia is perfectly able to extract the cdda content (tested on 8.2 STABLE and 9.0 BETA3).
>How-To-Repeat:

>Fix:
As a workaround, use only kernels built without ATA_CAM.

My limited skills do not permit me to create a patch within a foreseeable future.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->jsa 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Oct 31 10:00:36 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162190 

From: "Joseph S. Atkinson" <jsa@FreeBSD.org>
To: bug-followup@FreeBSD.org, clbuisson@orange.fr
Cc:  
Subject: Re: ports/162190: multimedia/vlc cannot access an audio cd with atapicam
 or ATA_CAM
Date: Sun, 18 Dec 2011 19:21:38 -0500

 Multiple confirmations on this problem.
 
 I will be looking at this with upstream.
 -- 
 Joseph S. Atkinson
 Paellax Technology Group
 http://www.paellax.com/
 --
 Sent from my FreeBSD/GNOME laptop 'pazuzu'.

From: Claude Buisson <clbuisson@orange.fr>
To: bug-followup@FreeBSD.org, "Joseph S. Atkinson" <jsa@freebsd.org>,
 Alexander Motin <mav@FreeBSD.org>
Cc: Tijl Coosemans <tijl@coosemans.org>
Subject: Re: ports/162190: multimedia/vlc cannot access an audio cd with atapicam
 or ATA_CAM
Date: Fri, 30 Dec 2011 17:31:42 +0100

 I confirm that MFCing r228808 and r228847, and applying a small patch [1] to
 vlc, vlc can play audio CDs on a stable/9 system (svn r228043).
 
 [1] the patch author is Tijl Coosemans <tijl@coosemans.org>, in the message
 
 http://permalink.gmane.org/gmane.os.freebsd.current/138895
 
 Sorry, but this message cannot be retrieved correctly on lists.freebsd.org
 
 Claude Buisson

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/162190: commit references a PR
Date: Tue,  3 Jan 2012 17:04:19 +0000 (UTC)

 Author: mav
 Date: Tue Jan  3 17:04:09 2012
 New Revision: 229395
 URL: http://svn.freebsd.org/changeset/base/229395
 
 Log:
   Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
   sector size same as acd driver does. Together with r228808 and r228847 this
   allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
   
   PR:		ports/162190
   MFC after:	1 week
 
 Modified:
   head/sys/cam/scsi/scsi_cd.c
 
 Modified: head/sys/cam/scsi/scsi_cd.c
 ==============================================================================
 --- head/sys/cam/scsi/scsi_cd.c	Tue Jan  3 16:54:47 2012	(r229394)
 +++ head/sys/cam/scsi/scsi_cd.c	Tue Jan  3 17:04:09 2012	(r229395)
 @@ -2685,6 +2685,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
  		error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
  		cam_periph_unlock(periph);
  		break;
 +	case CDRIOCGETBLOCKSIZE:
 +		*(int *)addr = softc->params.blksize;
 +		break;
 +	case CDRIOCSETBLOCKSIZE:
 +		if (*(int *)addr <= 0) {
 +			error = EINVAL;
 +			break;
 +		}
 +		softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr;
 +		break;
  	case DVDIOCSENDKEY:
  	case DVDIOCREPORTKEY: {
  		struct dvd_authinfo *authinfo;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: "Joseph S. Atkinson" <jsa.bsd@gmail.com>
To: bug-followup@FreeBSD.org, clbuisson@orange.fr
Cc:  
Subject: Re: ports/162190: multimedia/vlc cannot access an audio cd with atapicam
 or ATA_CAM
Date: Tue, 03 Jan 2012 20:49:45 -0500

 This is a multi-part message in MIME format.
 --------------050907060006030901080901
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 I had a workaround pending mentor approval, but with r229395 all
 outstanding issues are now resolved. I have attached a rollup of
 r228808, r228847, and r229395 for the convenience of anyone who
 encounters this issue on 9.0-RELEASE.
 
 --------------050907060006030901080901
 Content-Type: text/plain;
  name="r228808+r228847+r229395.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="r228808+r228847+r229395.diff"
 
 Index: sys/cam/scsi/scsi_all.h
 ===================================================================
 --- sys/cam/scsi/scsi_all.h	(revision 229307)
 +++ sys/cam/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: sys/cam/scsi/scsi_cd.c
 ===================================================================
 --- sys/cam/scsi/scsi_cd.c	(revision 229307)
 +++ sys/cam/scsi/scsi_cd.c	(working copy)
 @@ -1482,6 +1482,14 @@
  					/* 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->csio.cdb_io.cdb_bytes[10] = 0;
 +				start_ccb->csio.cdb_io.cdb_bytes[11] = 0;
 +				start_ccb->csio.cdb_len = 12;
 +			}
  			start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
  
  			
 @@ -2676,6 +2684,16 @@
  		error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
  		cam_periph_unlock(periph);
  		break;
 +	case CDRIOCGETBLOCKSIZE:
 +		*(int *)addr = softc->params.blksize;
 +		break;
 +	case CDRIOCSETBLOCKSIZE:
 +		if (*(int *)addr <= 0) {
 +			error = EINVAL;
 +			break;
 +		}
 +		softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr;
 +		break;
  	case DVDIOCSENDKEY:
  	case DVDIOCREPORTKEY: {
  		struct dvd_authinfo *authinfo;
 @@ -2879,6 +2897,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:
  
  	/*
 
 --------------050907060006030901080901--
State-Changed-From-To: open->closed 
State-Changed-By: jsa 
State-Changed-When: Wed Jan 4 02:02:36 UTC 2012 
State-Changed-Why:  
Issue fixed in head. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162190 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/162190: commit references a PR
Date: Thu, 12 Jan 2012 14:53:18 +0000 (UTC)

 Author: mav
 Date: Thu Jan 12 14:53:08 2012
 New Revision: 230014
 URL: http://svn.freebsd.org/changeset/base/230014
 
 Log:
   MFC r228808, r228847, 229395:
   
   r228808, r228847:
   Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to
   GEOM and using READ CD command for reading data, same as acd driver does.
   Audio CDs identified by checking respective bit of the control field of
   the first track in TOC.
   
   229395:
   Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
   sector size same as acd driver does. Together with r228808 and r228847 this
   allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
   
   PR:             ports/162190
   Sponsored by:	iXsystems, Inc.
 
 Modified:
   stable/9/sys/cam/scsi/scsi_all.h
   stable/9/sys/cam/scsi/scsi_cd.c
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/amd64/include/xen/   (props changed)
   stable/9/sys/boot/   (props changed)
   stable/9/sys/boot/i386/efi/   (props changed)
   stable/9/sys/boot/ia64/efi/   (props changed)
   stable/9/sys/boot/ia64/ski/   (props changed)
   stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
   stable/9/sys/boot/powerpc/ofw/   (props changed)
   stable/9/sys/cddl/contrib/opensolaris/   (props changed)
   stable/9/sys/conf/   (props changed)
   stable/9/sys/contrib/dev/acpica/   (props changed)
   stable/9/sys/contrib/octeon-sdk/   (props changed)
   stable/9/sys/contrib/pf/   (props changed)
   stable/9/sys/contrib/x86emu/   (props changed)
 
 Modified: stable/9/sys/cam/scsi/scsi_all.h
 ==============================================================================
 --- stable/9/sys/cam/scsi/scsi_all.h	Thu Jan 12 14:44:14 2012	(r230013)
 +++ stable/9/sys/cam/scsi/scsi_all.h	Thu Jan 12 14:53:08 2012	(r230014)
 @@ -932,6 +932,7 @@ struct ata_pass_16 {
  #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
 
 Modified: stable/9/sys/cam/scsi/scsi_cd.c
 ==============================================================================
 --- stable/9/sys/cam/scsi/scsi_cd.c	Thu Jan 12 14:44:14 2012	(r230013)
 +++ stable/9/sys/cam/scsi/scsi_cd.c	Thu Jan 12 14:53:08 2012	(r230014)
 @@ -1482,6 +1482,14 @@ cdstart(struct cam_periph *periph, union
  					/* 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->csio.cdb_io.cdb_bytes[10] = 0;
 +				start_ccb->csio.cdb_io.cdb_bytes[11] = 0;
 +				start_ccb->csio.cdb_len = 12;
 +			}
  			start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
  
  			
 @@ -2676,6 +2684,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
  		error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
  		cam_periph_unlock(periph);
  		break;
 +	case CDRIOCGETBLOCKSIZE:
 +		*(int *)addr = softc->params.blksize;
 +		break;
 +	case CDRIOCSETBLOCKSIZE:
 +		if (*(int *)addr <= 0) {
 +			error = EINVAL;
 +			break;
 +		}
 +		softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr;
 +		break;
  	case DVDIOCSENDKEY:
  	case DVDIOCREPORTKEY: {
  		struct dvd_authinfo *authinfo;
 @@ -2879,6 +2897,13 @@ cdcheckmedia(struct cam_periph *periph)
  
  	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:
  
  	/*
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/162190: commit references a PR
Date: Thu, 12 Jan 2012 15:03:06 +0000 (UTC)

 Author: mav
 Date: Thu Jan 12 15:02:51 2012
 New Revision: 230015
 URL: http://svn.freebsd.org/changeset/base/230015
 
 Log:
   MFC r228808, r228847, 229395:
   
   r228808, r228847:
   Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to
   GEOM and using READ CD command for reading data, same as acd driver does.
   Audio CDs identified by checking respective bit of the control field of
   the first track in TOC.
   
   229395:
   Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
   sector size same as acd driver does. Together with r228808 and r228847 this
   allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
   
   PR:		ports/162190
   Sponsored by:	iXsystems, Inc.
 
 Modified:
   stable/8/sys/cam/scsi/scsi_all.h
   stable/8/sys/cam/scsi/scsi_cd.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/cam/scsi/scsi_all.h
 ==============================================================================
 --- stable/8/sys/cam/scsi/scsi_all.h	Thu Jan 12 14:53:08 2012	(r230014)
 +++ stable/8/sys/cam/scsi/scsi_all.h	Thu Jan 12 15:02:51 2012	(r230015)
 @@ -611,6 +611,7 @@ struct ata_pass_16 {
  #define	READ_12			0xA8
  #define	WRITE_12		0xAA
  #define	READ_ELEMENT_STATUS	0xB8
 +#define	READ_CD			0xBE
  
  /* Maintenance In Service Action Codes */
  #define	REPORT_IDENTIFYING_INFRMATION		0x05
 
 Modified: stable/8/sys/cam/scsi/scsi_cd.c
 ==============================================================================
 --- stable/8/sys/cam/scsi/scsi_cd.c	Thu Jan 12 14:53:08 2012	(r230014)
 +++ stable/8/sys/cam/scsi/scsi_cd.c	Thu Jan 12 15:02:51 2012	(r230015)
 @@ -1475,6 +1475,14 @@ cdstart(struct cam_periph *periph, union
  					/* 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->csio.cdb_io.cdb_bytes[10] = 0;
 +				start_ccb->csio.cdb_io.cdb_bytes[11] = 0;
 +				start_ccb->csio.cdb_len = 12;
 +			}
  			start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
  
  			
 @@ -2668,6 +2676,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
  		error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
  		cam_periph_unlock(periph);
  		break;
 +	case CDRIOCGETBLOCKSIZE:
 +		*(int *)addr = softc->params.blksize;
 +		break;
 +	case CDRIOCSETBLOCKSIZE:
 +		if (*(int *)addr <= 0) {
 +			error = EINVAL;
 +			break;
 +		}
 +		softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr;
 +		break;
  	case DVDIOCSENDKEY:
  	case DVDIOCREPORTKEY: {
  		struct dvd_authinfo *authinfo;
 @@ -2871,6 +2889,13 @@ cdcheckmedia(struct cam_periph *periph)
  
  	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:
  
  	/*
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
