Using Photo-CDs with Toshiba SCSI CD-ROM drives.

Date: 94/06/06

In the last months every now and then people reported problems using Photo-CDs
with their Toshiba SCSI CD-ROM drives under Linux.
I also had these problems when I first tried to mount a Photo-CD with my
XM-3401TA drive and after some hacking I finally found the reason. As a
result I wrote a small "work around" program which can be used as long as
there is no better general solution.


Using the program:
In order to access Photo-CDs on a Toshiba SCSI CD-ROM drive under Linux
you have to do the following:

 1) Make sure your kernel includes the ISO9660 filesystem support.

 2) Check for the appropriate device-file. On my system, it looks like

    brw-rw-r--   1 root     root      11,   0 Jan 21 23:49 /dev/scd0

    for the first SCSI CD-ROM drive.


 3) Create the program "set_density". Just execute "make" in the directory
    you found the file you are reading at the moment and it should compile
    without errors.


 4) Execute the following command (as root):

    # set_density -i -f <device-file> -d <density>

    <device-file> is the name of your CD-ROM device file (see (2))

    <density> is a vendor-specific value the drive's Density Code parameter
              has to be set to.
	      For the XM3301, XM3401 and XM4101 drives a value of 0x83 should
              work for both traditional CD-ROMs and CD-XA discs.
              I have no information if this works for other devices than the
              few listed above.

    This command also gives you some information about the SCSI device you
    are using.

    NOTE: This program directly accesses the device's SCSI interface.
          Be careful when specifying the device-file! 
          NEVER use this program on devices other than SCSI CD-ROM drives!!
	  DON'T install this program "suid root"!!!


 5) Now mount the Photo-CD with the following command (as root):

    # mount -tiso9660 <device-file> <mount-point>

    <device-file> is the name of your CD-ROM device file (see (2))

    <mount-point> ist the name of an empty directory (e.g. "/cdrom")

    
 6) You should now be able to access the Photo-CD's file structure as
    directory tree under your mount point. Use whatever program you like
    to work with the images.
   
    Here's a short list of useful programs:

    *) ImageMagick by John Cristy (cristy@dupont.com)

    *) XV by John Bradley (bradley@cis.upenn.edu) with the PCD patches
          David Clunie (dclunie@flash.us.com) posted to alt.sources.

    *) hpcdtoppm by Hadmut Danisch (danisch@ira.uka.de)


If you still have problems, feel free to contact me under one of the addresses
below (preferably via E-Mail).


Technical information:
According to the SCSI-2 specification, a parameter called "Density Code" is
responsible for the way the CD-ROM drive handles the data-blocks on a CD.
As there are different CD standards ("traditional" CD-ROM, CD-XA for multi-
media, CD-DA for digital audio, ...), there are different formats the data
is stored on the disc and delivered to the computer.
In default mode, the Toshiba SCSI CD-ROM drives deliver each CD-XA data-block
(e.g. Photo-CD data-blocks) with an offset of 8 bytes, so the Linux filesystem
code can't handle them.
By setting the Density Code parameter to a distinct (vendor specific!) value
one can bring the drive into a "Linux compatible" mode even for Photo-CDs.

The Toshiba "SCSI-2 Interface Specifications" say (excerpt):

	The definition of density code is as follows.
	00h: Default density code for the CD-ROM.

	81h: CD-ROM XA support mode.

	82h: CD-DA transfer over SCSI support mode.

	83h: CD-ROM Mode-1 and CD-ROM XA Form-1 support mode.


So, density code values of 0x81 and 0x83 work for Photo-CDs, where a value
of 0x83 work for both traditional _and_ Photo-CDs!

For more information, please read the program's source code.


Author: Andreas Haumer

Snail Mail: Andreas Haumer
	    Buchengasse 67/8
            A-1100 Vienna
	    Austria

Phone: +43-1-6256583

E-Mail: andreas@vlsivie.tuwien.ac.at

