bugCompact Disc Input and Control Library - Bugs: bug #38202, Unable to play audio CD from USB...


bug #38202: Unable to play audio CD from USB connected optical drive

Submitter:  None
Submitted:  Wed 30 Jan 2013 12:57:25 PM UTC
Category:  None Severity:  5 - Average
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 05 Jul 2019 12:44:31 AM UTC, comment #16: 

Thanks for the cd-drive information.

From that, the drive is clearly marked as being able to read CD-DA.

Here is a suggested plan of attack for addressing. Add another access mode which is SCSI/MMC centric. In the various "read" routines the SCSI/MMC way would be used instead of ioctl.

If you look at the Windows drivers for example, you'll see api32.c (which is SCSI/MMC centric) as well as win32_ioctl.c

(The "32" comes from the days when MS 16-bit was normal so 32 was a big deal.)

What was the right thing to do back when this was written, circa 2000, was to use ioctl as the default. But as you suggest, things have changed so that's often no longer the right thing to do.

But we might be able to use the CDROM_GET_CAPABILITY command to steer which way to access the CD-ROM.

Rocky Bernstein <rocky>
Group administrator
Thu 04 Jul 2019 07:20:37 PM UTC, comment #15: 

OK, here is the complete output of cd-drive:

pi@autoradio:~ $ cd-drive
cd-drive version 0.92 armv7l-unknown-linux-gnueabihf
Copyright (c) 2003-2005, 2007-2008, 2011-2013 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
The driver selected is GNU/Linux
The default device for this driver is /dev/cdrom

Drivers available...
  GNU/Linux ioctl and MMC driver    
  cdrdao (TOC) disk image driver    
  bin/cuesheet disk image driver    
  Nero NRG disk image driver        

CD-ROM drive supports MMC 3

                       Drive: /dev/cdrom
Vendor                      : MATSHITA
Model                       : CD-RW  CW-8124 
Revision                    : DA0D
Profile List Feature
        Read only DVD
        Read only Compact Disc capable - on
        Write once Compact Disc capable

Core Feature
        ATAPI interface

Morphing Feature
        Operational Change Request/Notification not supported
        Synchronous GET EVENT/STATUS NOTIFICATION supported

Removable Medium Feature
        Caddy/Slot type loading mechanism
        can eject the medium or magazine via the normal START/STOP command
        can be locked into the Logical Unit

Random Readable Feature

Multi-Read Feature

CD Read Feature
        C2 Error pointers are supported
        CD-Text is supported

DVD Read Feature

Incremental Streaming Writable Feature

Formattable Feature

Restricted Overwrite Feature

CD Track at Once Feature

CD Mastering (Session at Once) Feature

Initiator- and Device-directed Power Management Feature

CD Audio External Play Feature
        SCAN command is supported
        audio channels can be muted separately
        audio channels can have separate volume levels
        256 volume levels can be set

Ability to respond to all commands within a specific time Feature

Ability to perform DVD CSS/CPPM authentication via RPC Feature
        CSS version 1

Ability to read and write using Initiator requested performance parameters Feature

Vendor-specific code 10b Feature

Hardware                                  : CD-ROM or DVD
Can eject                                 : Yes
Can close tray                            : Yes
Can disable manual eject                  : Yes
Can select juke-box disc                  : No

Can set drive speed                       : No
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device                     : Yes

  Can read Mode 2 Form 1                  : Yes
  Can read Mode 2 Form 2                  : Yes
  Can read (S)VCD (i.e. Mode 2 Form 1/2)  : Yes
  Can read C2 Errors                      : Yes
  Can read IRSC                           : Yes
  Can read Media Channel Number (or UPC)  : Yes
  Can play audio                          : Yes
  Can read CD-DA                          : Yes
  Can read CD-R                           : Yes
  Can read CD-RW                          : Yes
  Can read DVD-ROM                        : Yes

  Can write CD-RW                         : Yes
  Can write DVD-R                         : No
  Can write DVD-RAM                       : No
  Can write DVD-RW                        : No
  Can write DVD+RW                        : No

The problem with the ioctl play commands (there are a handful of them) is that they don't tell the drive how to deliver the (digital) audio data to the host computer: Old drives had their own decoders and sound card links, so that one single command was absolutely sufficient. Nowadays, a more complicated solution like cd-paranoia is necessary: cd-paranoia writes the audio data into a WAV file. If you replace the output file with a fifo and use the fifo as an input for, say, aplay, you'll have an audio CD player in software.

Jacek Rużyczka <professor_fate>
Wed 03 Jul 2019 07:54:50 PM UTC, comment #14: 

comment #13

In the big picture, if you are willing to work on this and submit a patch, this can get fixed in libcdio.

However to focus things more on getting information which might be used to fix...

Is there another ioctl for GNU/Linux that can be used in this situation?

Also, what does the command cd-drive show as the cdrom capabilities? This command issues the SCSCI MMC command CDROM_GET_CAPABILITY and tries to show the results it gets back.

Perhaps this can be used to steer thing to the right GNU/Linux ioctl to use?

Rocky Bernstein <rocky>
Group administrator
Wed 03 Jul 2019 07:23:17 PM UTC, comment #13: 

As someone who's run into exactly the same problem (on a Raspi 3B) and at least has a clue about its cause, may I hereby join this discussion:

Apparently, CDIO is using the ioctl commands CDROMPLAYMSF. See lib/driver/gnu_linux.c, line 262. This command will only work for drives with on-board audio decoder hardware and a corresponding audio output connector, which is then attached to the sound card. Nowadays, CD-ROM drives / CD recorders are no longer equipped with such hardware and simply ignore the ioctl command (without even issuing an error message).

This means: audio_play_msf_linux () won't work anymore. The only workaround I see rising above the horizon is to use cd-paranoia and to redirect its output to a command-line player like aplay.

Any suggestions?

Jacek Rużyczka <professor_fate>
Wed 03 Jul 2019 07:08:55 PM UTC, comment #12: 

comment #11:

> Do you use XBMC or any other software to play CD?

Jacek Rużyczka <professor_fate>
Thu 19 Dec 2013 08:51:12 AM UTC, comment #11: 

Do you use XBMC or any other software to play CD?

Hubert Miś <bearh>
Thu 19 Dec 2013 01:13:31 AM UTC, comment #10: 

When you say Win32, do you mean via cygwin, mingw, or Visual C?

Does running cd-info with the or without drive name show information?

Rocky Bernstein <rocky>
Group administrator
Wed 18 Dec 2013 11:06:50 PM UTC, comment #9: 

Hi, I am trying to get this work on Win32 but it doesn't seem to work for audio CDs on external USB player.

Any suggestions?

Jeffrey Travis <altarama>
Wed 17 Apr 2013 02:25:11 PM UTC, comment #8: 

Thanks for the information. Please submit a patch.

Rocky Bernstein <rocky>
Group administrator
Wed 17 Apr 2013 02:00:54 PM UTC, comment #7: 

The bug in xbmc is fixed now for GNU/Linux x86 and RaspberryPi. Both of them use driver GNU/Linux, access mode: IOCTL. Nobody reported yet if the patch works on win32 also.
I think you could apply patch to libcdio to prevent similar problem in any other program using the library.

Hubert Miś <bearh>
Mon 15 Apr 2013 12:34:47 AM UTC, comment #6: 

I'm okay with moving the looping by 10 sectors from XMBC into the libcdio driver code. We do something like that for mode2 sectors in the GNU/Linux driver. See lib/driver/gnu_linux.c around line 958 http://git.savannah.gnu.org/cgit/libcdio.git/tree/lib/driver/gnu_linux.c#n958

In order to do this though, we'd need to know which access mode is used. For windows there is seems to be 3: win/nt, ASPI and ioctl. I think ioctl is the most used, but cd-info reports this information. For example on GNU/Linux:

CD location   : /dev/sr0
CD driver name: GNU/Linux
   access mode: IOCTL

Care to send a patch?

Rocky Bernstein <rocky>
Group administrator
Mon 08 Apr 2013 07:51:13 PM UTC, comment #5: 

There is a problem with "cdio_read_audio_sectors" function. When it reads more than about 10 sectors at once with USB drive it returns an error. When XBMC is modified to read less than 10 sectors at once it reads audio CD with USB drive. I'm not sure if bug is in libcdio.

Hubert Miś <bearh>
Sat 23 Mar 2013 05:02:03 PM UTC, comment #4: 

I got the same problem on with an Asus SBC-06D2X-U USB drive in XBMC 12.1 on Windows Server 2012 - and actually I lack the expertise to compile the dll :( Would it be possible to receive an compiled dll to test? Kind regards and thank you for your time!

Jens <jeho>
Fri 01 Feb 2013 11:25:56 AM UTC, comment #3: 

Get the libcdio source code. Look at examples/drives.c.
Compile it and run it with a CD-DA disk in the drive.

Save and send that output. Also giving some other evidence using some other command that indicates it finds a CD-ROM drive with a CD-DA disk.

That's the basic idea. But to be more helpful, in examples/drives.c change the subroutine log_hander() to print all debug and info messages. Also you can remove the last to C statements and from main() before the final "return 0" since those look for kinds of drives other than CD-DA which isn't necessary here..

Rocky Bernstein <rocky>
Group administrator
Fri 01 Feb 2013 10:08:31 AM UTC, comment #2: 

Hi, I'm the guy who opened the error on the XBMC bug tracker.
What can I do to help you? What kind of logs do you need?

Patrice <patatra>
Thu 31 Jan 2013 02:17:55 AM UTC, comment #1: 

Okay, I have lookeda thte XMBC error report. But I can't go with something as vague as:

    The word around is that libcdio is the culprit as it doesn't handle USB optical drives correctly (Audio CDs at least).

I suggest writing some short piece of code give more concrete evidence. For example compile examples/drives.c change log_hander to print all debug and info messages and probably removing the last to statement of main before return 0.

Rocky Bernstein <rocky>
Group administrator
Wed 30 Jan 2013 12:57:25 PM UTC, original submission:  

On XBMC bug tracker there is az error report: http://trac.xbmc.org/ticket/13415 XBMC developers said this occurs because a bug in libcdio. Please take a look at this!



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by professor_fate (Posted a comment)
  • -email is unavailable- added by altarama (Posted a comment)
  • -email is unavailable- added by bearh (Posted a comment)
  • -email is unavailable- added by jeho (Posted a comment)
  • -email is unavailable- added by jeho
  • -email is unavailable- added by patatra (Posted a comment)
  • -email is unavailable- added by rocky (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-03-23 jeho Carbon-Copy- Added jeho

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code