From shamrock@cheesy.dhs.org  Sat Oct 19 21:04:58 2002
Return-Path: <shamrock@cheesy.dhs.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F196437B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 19 Oct 2002 21:04:57 -0700 (PDT)
Received: from cheesy.dhs.org (d160.nas2.sr2.sonic.net [208.201.229.160])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 05CDC43E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 19 Oct 2002 21:04:57 -0700 (PDT)
	(envelope-from shamrock@cheesy.dhs.org)
Received: by cheesy.dhs.org (Postfix, from userid 1000)
	id DFE93100DC; Sat, 19 Oct 2002 21:09:11 -0700 (PDT)
Message-Id: <20021020040911.DFE93100DC@cheesy.dhs.org>
Date: Sat, 19 Oct 2002 21:09:11 -0700 (PDT)
From: Lucky@cheesy.dhs.org, Green@cheesy.dhs.org,
	shamrock@cypherpunks.to
Reply-To: Lucky@cheesy.dhs.org, Green@cheesy.dhs.org,
	shamrock@cypherpunks.to
To: FreeBSD-gnats-submit@freebsd.org
Cc: shamrock@cypherpunks.to
Subject: Unable to access audio CD under Linux emulation/ATAPICAM
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         44293
>Category:       kern
>Synopsis:       [atapicam] Unable to access audio CD under Linux emulation/ATAPICAM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    thomas
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 19 21:10:01 PDT 2002
>Closed-Date:    Tue Apr 24 06:02:06 GMT 2007
>Last-Modified:  Mon Feb  8 12:30:06 UTC 2010
>Originator:     Lucky Green
>Release:        FreeBSD 4.6.2-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD cheesy.dhs.org 4.6.2-RELEASE-p2 FreeBSD 4.6.2-RELEASE-p2 #4: Sat Oct 19 16:57:15 PDT 2002 shamrock@cheesy.dhs.org:/usr/obj/usr/src/sys/CHEESY-20021009 i386

CD-ROM: YAMAHA CRW4416E (ATAPI, CDRW)

Software:linux_base-7.1_1

	atapicam-20020820 kernel patches
	(from http://www.cuivre.fr.eu.org/~thomas/atapicam/patches/)

	cdparanoia III release 9.7 (Red Hat RPM)

>Description:

	cdparanoia is unable to read data from an audio CD via the Linux 
emulation layer, aborting with	"Unable to read any data; drive probably not CDDA capable."

	The CDROM drive has been tested using cdda2wav, which experienced 
no problems ripping the CD both via /dev/acd0c (ATAPI) and 0,0,0 (CAM).

	/var/log/messages shows unimplemented ioctl's. marcel@FreeBSD.org 
kindly provided a patch implementing the CDROMREADAUDIO ioctl, which 
removed the "/kernel: linux: 'ioctl' fd=3, cmd=0x530e ('S',14) not 
implemented" error. The "/kernel: linux: 'ioctl' fd=3, cmd=0x5310 ('S',16)
not implemented" error remains.

However, cdparanoia is still unable to read audio data from the CDROM 
drive and continues to abort with "Unable to read any data; drive probably 
not CDDA capable."

Detailed info follows:
su-2.05b# ./cdparanoia -vsQ
cdparanoia III release 9.7 (December 13, 1999)
(C) 1999 Monty <monty@xiph.org> and Xiphophorus

Report bugs to paranoia@xiph.org
http://www.xiph.org/paranoia/

Checking /dev/cdrom for cdrom...
        Testing /dev/cdrom for cooked ioctl() interface
                CDROM sensed: Sony CDU31A or compatible


        TOC entry claims an overly large start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims a negative start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims a negative start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims a negative start offset: massaging.

        TOC entry claims an overly large start offset: massaging.

        TOC entry claims a negative start offset: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging.

        TOC entries claim non-increasing offsets: massaging. Verifying
drive can read CDDA...

        Unable to read any data; drive probably not CDDA capable.
006: Could not read any data from drive

Cdparanoia could not find a way to read audio from this drive.

su-2.05b# cdrecord -scanbus
Cdrecord 1.11a28 (i386-unknown-freebsd4.6.2) Copyright (C) 1995-2002
Jrg 
Schilling
Using libscg version 'schily-0.6'
scsibus0:
        0,0,0     0) 'YAMAHA  ' 'CRW4416E        ' '1.0j' Removable
CD-ROM
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) *
        0,7,0     7) *
su-2.05b#
[...]
/var/log/messages shows the following errors:

From /var/log/messages:
Oct  9 14:31:43 cheesy /kernel: linux: 'ioctl' fd=3, cmd=0x5310 ('S',16)
not implemented
Oct  9 14:31:43 cheesy /kernel: linux: 'ioctl' fd=3, cmd=0x530e ('S',14)
not implemented

>How-To-Repeat:

On FreeBSD STABLE prior to MFC of the ATAPICAM patches:
	Recompile your kernel with the ATAPICAM patches first.

On both STABLE and CURRENT:
	- Install cdparanoia Red Hat 7.1 RPM from 
ftp://ftp.rpmfind.net/linux/redhat/7.1/en/os/i386/RedHat/RPMS/cdparanoia-alpha9.7-7.i386.rpm
(should install without errors)
	- Link /dev/cd0c to /dev/cdrom
	- Insert an audio CD into the CDROM drive	
	- Run ./cdparanoia -vsQ

	
>Fix:

	

--- dmesg.boot begins here ---
Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD 4.6.2-RELEASE-p2 #4: Sat Oct 19 16:57:15 PDT 2002
    shamrock@cheesy.dhs.org:/usr/obj/usr/src/sys/CHEESY-20021009
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium II/Pentium II Xeon/Celeron (400.91-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x653  Stepping = 3
  Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
real memory  = 134205440 (131060K bytes)
avail memory = 126078976 (123124K bytes)
Preloaded elf kernel "kernel" at 0xc046e000.
Pentium Pro MTRR support enabled
md0: Malloc disk
Using $PIR table, 7 entries at 0xc00f0d10
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Intel 82443BX (440 BX) host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
pcib1: <Intel 82443BX (440 BX) PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pci1: <ATI Mach64-GB graphics accelerator> at 0.0 irq 11
isab0: <Intel 82371AB PCI to ISA bridge> at device 4.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX4 ATA33 controller> port 0xb800-0xb80f at device 4.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xb400-0xb41f irq 9 at device 4.2 on pci0
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
chip1: <Intel 82371AB Power management controller> port 0xe800-0xe80f at device 4.3 on pci0
rl0: <D-Link DFE-530TX+ 10/100BaseTX> port 0xb000-0xb0ff mem 0xe1800000-0xe18000ff irq 5 at device 10.0 on pci0
rl0: Ethernet address: 00:05:5d:34:81:33
miibus0: <MII bus> on rl0
rlphy0: <RealTek internal media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
xl0: <3Com 3c905B-TX Fast Etherlink XL> port 0xa800-0xa87f mem 0xe1000000-0xe100007f irq 10 at device 11.0 on pci0
xl0: Ethernet address: 00:50:04:d1:8a:4a
miibus1: <MII bus> on xl0
xlphy0: <3Com internal media interface> on miibus1
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
pcm0: <CMedia CMI8738> port 0xa400-0xa4ff irq 11 at device 12.0 on pci0
orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: failed to get data.
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model IntelliMouse, device ID 3
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/9 bytes threshold
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
IPsec: Initialized Security Association Processing.
ad0: 29314MB <IBM-DTLA-307030> [59560/16/63] at ata0-master UDMA33
ad3: 2441MB <WDC AC32500H> [4960/16/63] at ata1-slave WDMA2
acd0: CD-RW <YAMAHA CRW4416E> at ata1-master PIO4
Mounting root from ufs:/dev/ad0s1a
cd0 at ata1 bus 0 target 0 lun 0
cd0: <YAMAHA CRW4416E 1.0j> Removable CD-ROM SCSI-0 device 
cd0: 16.000MB/s transfers
cd0: cd present [324683 x 2048 byte records]
--- dmesg.boot ends here ---


>Release-Note:
>Audit-Trail:

From: "Lucky Green" <shamrock@cypherpunks.to>
To: <freebsd-gnats-submit@FreeBSD.org>
Cc:  
Subject: Re: kern/44293: Unable to access audio CD under Linux emulation/ATAPICAM
Date: Thu, 24 Oct 2002 01:15:53 -0700

 Correction: my contact email address is shamrock@cypherpunks.to
 
Responsible-Changed-From-To: freebsd-bugs->thomas 
Responsible-Changed-By: thomas 
Responsible-Changed-When: Thu Nov 7 12:16:24 PST 2002 
Responsible-Changed-Why:  
Looks like this one is for me. 

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

From: Thomas Quinot <thomas@cuivre.fr.eu.org>
To: shamrock@cypherpunks.to
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/44293: Unable to access audio CD under Linux emulation/ATAPICAM
Date: Thu, 7 Nov 2002 23:24:33 +0100

 Le 2002-10-20, Lucky@cheesy.dhs.org crivait :
 
 > 	/var/log/messages shows unimplemented ioctl's. marcel@FreeBSD.org 
 > kindly provided a patch implementing the CDROMREADAUDIO ioctl, which 
 > removed the "/kernel: linux: 'ioctl' fd=3, cmd=0x530e ('S',14) not 
 > implemented" error. The "/kernel: linux: 'ioctl' fd=3, cmd=0x5310 ('S',16)
 > not implemented" error remains.
 
 0x5310 is CDROMMULTISESSION. Please try the following patch (it is a
 work-around, not a fix, but it would be interesting to know whether it
 resolves your problem in the case of single-session discs).
 
 Note: the diff is against -CURRENT, you might have to apply it manually
 for -STABLE.
 
 Thomas.
 
 Index: linux_ioctl.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/compat/linux/linux_ioctl.c,v
 retrieving revision 1.95
 diff -u -r1.95 linux_ioctl.c
 --- linux_ioctl.c	19 Oct 2002 21:11:43 -0000	1.95
 +++ linux_ioctl.c	7 Nov 2002 22:17:39 -0000
 @@ -939,6 +939,12 @@
  	u_char		*buf;
  };
  
 +struct l_cdrom_multisession {
 +	union linux_cdrom_addr addr;
 +	u_char		xa_flag;
 +	u_char		addr_format;
 +}
 +
  struct l_dvd_layer {
  	u_char		book_version:4;
  	u_char		book_type:4;
 @@ -1415,7 +1421,14 @@
  	}
  
  	/* LINUX_CDROMEJECT_SW */
 -	/* LINUX_CDROMMULTISESSION */
 +
 +	case LINUX_CDROMMULTISESSION: {
 +		struct linux_cdrom_multisession msinfo = {0, 0, 0};
 +		error = copyout(&msinfo, (caddr_t)args->arg,
 +				sizeof(struct linux_cdrom_multisession));
 +		break;
 +	}
 +
  	/* LINUX_CDROM_GET_UPC */
  
  	case LINUX_CDROMRESET:
 
 -- 
     Thomas.Quinot@Cuivre.FR.EU.ORG
 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Thu Apr 19 01:11:09 UTC 2007 
State-Changed-Why:  
Is this still a problem with modern versions of FreeBSD? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44293 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Apr 24 06:01:49 UTC 2007 
State-Changed-Why:  
Submitter's email address bounces. 

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

From: Alexander Best <alexbestms@math.uni-muenster.de>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/44293: [atapicam] Unable to access audio CD under Linux
 emulation/ATAPICAM
Date: Wed, 16 Sep 2009 02:32:11 +0200 (CEST)

 please re-open the PR since the problem still exists in 9.0-CURRENT.
 
 running:
 
 - linux_base-f10-10_2
 - compat.linux.osrelease: 2.6.16
 - cdparanoia-III-10.2.i386-linux-elf
 
 under FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r197234: Wed Sep 16
 01:10:00 CEST 2009     root@otaku:/usr/obj/usr/src/sys/ARUNDEL  i386
 
 i get the following results when running `./cdparanoia-III-10.2.i386-linux-elf
 -vsQ`:
 
 cdparanoia III release 10.2 (September 11, 2008)
 
 Using cdda library version: 10.2
 Using paranoia library version: 10.2
 Checking /dev/cdrom for cdrom...
         Testing /dev/cdrom for SCSI/MMC interface
                 no SG_IO support for device: /dev/acd0
                 Device /dev/acd0 could not perform ioctl(): Inappropriate
                 ioctl for device
         Testing /dev/cdrom for cooked ioctl() interface
                 /dev/acd0 is not a cooked ioctl CDROM.
 
 dmesg reports:
 
 acd0: FAILURE - READ_CD MEDIUM ERROR asc=0x10 ascq=0x00
 
 truss reports:
 
 Checking /dev/cdrom for cdrom...
 write(2,"Checking /dev/cdrom for cdrom..."...,33) = 33 (0x21)
 linux_stat64(0x80c3418,0xbfbfdc20,0xbfbfdc20,0x3,0x1,0x6) = 0 (0x0)
         Testing /dev/cdrom for SCSI/MMC interface
 write(2,"\tTesting /dev/cdrom for SCSI/MM"...,43) = 43 (0x2b)
 linux_stat64(0x80c3418,0xbfbfda00,0xbfbfda00,0x3,0x80c3418,0x6) = 0 (0x0)
 linux_lstat64(0x80c3418,0xbfbfc980,0xbfbfc980,0x3,0x1,0x6) = 0 (0x0)
 linux_lstat64(0xbfbfca08,0xbfbfc97c,0xbfbfca09,0x80c3418,0x3,0x6) = 0 (0x0)
 linux_lstat64(0xbfbfca08,0xbfbfc97c,0xbfbfca0d,0x80c3418,0x5,0x6) = 0 (0x0)
 linux_readlink(0xbfbfca08,0xbfbfb960,0x1000,0xbfbfb960,0x5,0x6) = 4 (0x4)
 linux_lstat64(0xbfbfca08,0xbfbfc97c,0xbfbfca0d,0xbfbfb960,0x4,0x6) = 0 (0x0)
 linux_open("/dev/acd0",0x802,0120755)            = 3 (0x3)
 linux_ioctl(0x3,0x2285,0xbfbfda20,0x1,0xbfbfda60,0x6) ERR#25 'Inappropriate
 ioctl for device'
 close(3)                                         = 0 (0x0)
                 no SG_IO support for device: /dev/acd0
 write(2,"\t\tno SG_IO support for device:"...,41) = 41 (0x29)
 linux_open("/dev/acd0",0x800,00)                 = 3 (0x3)
 linux_ioctl(0x3,0x5382,0xbfbfda4c,0x1,0x80f3fd0,0x6) ERR#25 'Inappropriate
 ioctl for device'
                 Device /dev/acd0 could not perform ioctl()write(2,"\t\tDevice
                 /dev/acd0 could not p"...,44) = 44 (0x2c)
 : write(2,": ",2)                                        = 2 (0x2)
 Inappropriate ioctl for devicewrite(2,"Inappropriate ioctl for device",30)
 = 30 (0x1e)
 
 write(2,"\n",1)                                  = 1 (0x1)
 close(3)                                         = 0 (0x0)
         Testing /dev/cdrom for cooked ioctl() interface
 write(2,"\tTesting /dev/cdrom for cooked "...,49) = 49 (0x31)
 linux_lstat64(0x80c3418,0xbfbfcb10,0xbfbfcb10,0x3,0x1,0x6) = 0 (0x0)
 linux_lstat64(0xbfbfcb98,0xbfbfcb0c,0xbfbfcb99,0x80c3418,0x3,0x6) = 0 (0x0)
 linux_lstat64(0xbfbfcb98,0xbfbfcb0c,0xbfbfcb9d,0x80c3418,0x5,0x6) = 0 (0x0)
 linux_readlink(0xbfbfcb98,0xbfbfbaf0,0x1000,0xbfbfbaf0,0x5,0x6) = 4 (0x4)
 linux_lstat64(0xbfbfcb98,0xbfbfcb0c,0xbfbfcb9d,0xbfbfbaf0,0x4,0x6) = 0 (0x0)
 linux_stat64(0x80f3fd0,0xbfbfdb90,0xbfbfdb90,0x3,0x1,0x6) = 0 (0x0)
                 /dev/acd0 is not a cooked ioctl CDROM.
 write(2,"\t\t/dev/acd0 is not a cooked io"...,41) = 41 (0x29)
 write(2,0x80daab3,0)                             = 0 (0x0)
 
 write(2,"\n",1)                                  = 1 (0x1)
 
 cheers.
 alex

From: Alexander Best <alexbestms@math.uni-muenster.de>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/44293: [atapicam] Unable to access audio CD under Linux
 emulation/ATAPICAM
Date: Thu, 22 Oct 2009 18:32:03 +0200 (CEST)

 as discussed with gavin on #freebsd-bugbusters this PR should remain closed.
 the problem described by Lucky Green has been fixed at some stage. the "not
 implemented" warnings can no longer be observed.
 
 yet cdparanoia still doesn't work. please see the error output in my previous
 feedback.
 
 this problem however will be handled by a new PR which i'll submit shortly
 since it is not related to this PR.
 
 cheers.
 alex

From: Alexander Best <alexbestms@wwu.de>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/44293: [atapicam] Unable to access audio CD under Linux
 emulation/ATAPICAM
Date: Mon, 08 Feb 2010 13:22:17 +0100 (CET)

 the new pr i referred to in my previous followup has been filed under
 kern/140156.
 
 cheers.
 alex
>Unformatted:
