home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 10 / Fresh_Fish_10_2352.bin / useful / disk / cdrom / scsiutil / scsiutil.doc < prev    next >
Text File  |  1994-01-04  |  13KB  |  347 lines

  1. SCSIUtil V2.0 - an utility for doing SCSI low level operations
  2.  
  3.  
  4. SCSIUtil (c) 1991,92,93,94 by Gary Duncan and Heiko Rath
  5.  
  6.  
  7.     Gary Duncan
  8.     Philips PTS
  9.     23 Lakeside Dr
  10.     Tally-Ho Technology Park
  11.     Burwood East Vic 3151
  12.     Australia
  13.  
  14.     EMail: gduncan@philips.oz.au
  15.  
  16.  
  17.     The Software Brewery
  18.     Dipl. Inform. (FH) Heiko Rath
  19.     Raiffeisenstr.10a
  20.     D-64331 Weiterstadt
  21.     Germany
  22.  
  23.     EMail: hr@brewhr.swb.de
  24.  
  25.  
  26.  BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  27.  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT
  28.  WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
  29.  PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
  30.  EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  31.  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  32.  PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  33.  PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
  34.  THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  35.  
  36.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  37.  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  38.  REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  39.  DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
  40.  DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
  41.  (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
  42.  INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE
  43.  OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
  44.  HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  45.  DAMAGES.
  46.  
  47.  When redistributing this program ALWAYS redistribute the WHOLE
  48.  archive consisting of:
  49.  
  50.  - DMakefile
  51.  - HISTORY
  52.  - o/SCSIutil.o
  53.  - SCSI_priv.h
  54.  - SCSIutil.c
  55.  - TODO
  56.  - SCSIutil.doc
  57.  - smakefile
  58.  
  59.  The source is provided, therefore you can make changes yourself. The
  60.  only thing I'm asking is that if you do make changes, please get in
  61.  touch with me (hr@brewhr.swb.de), so that we can coordinate any
  62.  further development.
  63.  
  64.  
  65. What is SCSIUtil?
  66. =================
  67.  
  68.  It is a little utility to do some low level stuff with SCSI devices.
  69.  As I currently don't have too much time to work on it (I finished my
  70.  thesis and am now wasting most of my time with a full time job)
  71.  I release it to the public as it is. It is far from being perfect,
  72.  but it is useful to me. In it's current incarnation it has
  73.  the following features:
  74.  
  75.   - read the capacity of a SCSI device
  76.   - read 16 bit raw digital audio off an audio CD (works with Sony CDU
  77.     561 & 8003 & Toshiba 3401) (left/right channel and stereo
  78.     reading supported)
  79.   - read 16 bit raw digital audio off an audio CD and convert to 8 bit
  80.     (left/right channel supported)
  81.   - eject/insert a medium via software control
  82.   - display the Inquiry data of a SCSI device
  83.   - read & interpret a CD-ROM data block address header
  84.   - start/stop the motor on a device
  85.   - read pages via MODE SENSE
  86.   - play audio on a CD-ROM drive (tested with Sony CDU 561 = Apple CD-300
  87.     and Tosiba 3401)
  88.   - read sectors
  89.   - seek to a specified sector
  90.   - display table of contents (TOC) of a CD
  91.   - read subchannel information of a CD (tested with Sony CDU 561)
  92.   - allow/prevent medium removal
  93.   - change the output channel volume of a CD-ROM drive
  94.  
  95.  
  96. Why SCSIUtil?
  97. =============
  98.  
  99.  I needed some software to explore my new CD-ROM drive.
  100.  
  101.  Here is what SCSIUtil displays, if you invoke it without parameters:
  102.  
  103. SCSIutil V2.0 [Jan  4 1994 : 16:59:03] - written by Gary Duncan
  104.          (gduncan@philips.oz.au) and Heiko Rath (hr@brewhr.swb.de)
  105. Usage: SCSIutil [-dscsi_dev] <scsi_id> <command>
  106.  -c[r]                 : Read capacity [raw]
  107.  -d<l|r|s> sec blks sc : Read 16 bit digital audio(start sector/# blocks)(2)
  108.  -D<l|r> sec blks      : Read  8 bit digital audio(left or right channel)(3)
  109.  -e <0|1>              : Change medium (0=eject, 1=load)
  110.  -i[r]                 : Inquiry [raw]
  111.  -h[r] blk             : Read CD-ROM data block address header
  112.  -l <0|1>              : Allow/Prevent medium removal
  113.  -m <0|1>              : Stop/Start motor {0=stop, 1=start}
  114.  -o[r] contr page      : Mode sense (contr = 0-3))
  115.  -p st si et ei        : Play audio CD track (1-99), index (1-99)
  116.  -r[t] sec_no          : Read sectors [use trackdisk.device]
  117.  -s sec_no             : Seek to sector (5)
  118.  -t[r|l]               : Display TOC of an audio CD [raw|long]
  119.  -u[r] chan fmt track  : Read CD sub-channel information [raw] (6)
  120.  -v [vl0 vl1 vl2 vl3]  : Set output volume channels 0-3 (7)
  121.  
  122. Note 1: usually scsi_id = (BOARD * 100) + (LUN * 10) + SCSI_TARGET_ID
  123.      2: with 's' returns LRLRLR pairs of stereo audio, 2352 bytes per block
  124.         sc = Apple subcode (0=2352, 1=2368, 2=2448, 3=96 byte/block)
  125.      3: converted to 8 bit audio (-d and -D work with Sony CDU 561 & 8003)
  126.      4: contr 0: current, 1: changeable, 2: default, 3: saved values
  127.      5: to park heads, try sec_no of -1
  128.      6: Q-channel = 64, fmt: 0=Sub-Q Channel data,1=current CD-ROM pos.,
  129.         2=Media Catalog Number (UPC/Bar Code),3=Track ISRC
  130.      7: use -1 to leave volume of channel as it is, without argument shows
  131.         current volume settings
  132.  
  133. Documentation on the options of SCSIUtil:
  134. =========================================
  135.  
  136.  -c[r]               : Read capacity [raw]
  137.  
  138.     This will issue a READ CAPACITY to the device to get the
  139.     highest sector available, the sector size and the capacity
  140.     (= sector size * max sector). With the 'r' option SCSIUtil
  141.     will not try to interpret the returned data.
  142.  
  143.     BTW, the Apple CD-300 returns different sector sizes,
  144.     depending on the last read size (that means sometimes it is
  145.     96, 2048 or 2352).
  146.  
  147.  -d<l|r|s> sec blks sc : Read 16 bit digital audio(start sector/# blocks)(2)
  148.  
  149.     This will read data directly from the specified CD-ROM drive,
  150.     interpreting the information as raw digital input. A value for
  151.     the sector to start reading from is required as well as the
  152.     number of sectors to read. The data will be in 16-bit format
  153.     e.g.  SCSIutil 2 -ds 2 100 0 reads the first 100 blocks
  154.     starting from sector 2 as Stereo 16 bit data. One sector
  155.     corresponds to 1/75 of a second.  The data will be output to
  156.     stdout.  This works with the Sony CDU-8003/541/561 (Apple uses
  157.     the CDU-561 in their Apple CD-300).
  158.  
  159.     The sc parameter was tested with the Apple CD-300 and tells
  160.     the drive to return 2352/2368/2448/96 bytes/block. If you're
  161.     only interested in digital audio use sc=0 which just delivers
  162.     588 * 16 bit stereo samples per block = 2352 bytes. If you use
  163.     sc=1 the last 16 bytes contain information about the current
  164.     track/index and timeposition of the sample. Sc = 2 adds 96
  165.     bytes to the raw samples which supposedly contain all the
  166.     subchannels except the Q-subchannel. Usually there won't be
  167.     any useful data in these 96 bytes, but on CD+Graphics and
  168.     CD+Midi CDs (pretty rare) the graphics/midi information is
  169.     encoded. If anybody has some information regarding the
  170.     encoding of CD+G / CD+Midi please get in touch with me!
  171.  
  172.     The digital audio data sent to stdout looks like this (in case
  173.     of sc = 0):
  174.  
  175.     struct cdda_sector {
  176.       struct cdda_sample {
  177.         char left_channel_lsb;
  178.         char left_channel_msb;
  179.         char right_channel_lsb;
  180.         char right_channel_msb;
  181.       } samples[588];
  182.     };
  183.  
  184.     With mono, either the left or right channel is skipped.
  185.  
  186.     BEWARE: sometimes I get SCSI bus lockups while using this
  187.     command. I'm pretty sure that it's not SCSIUtil's fault, but
  188.     either a problem of the WD SCSI chip 33C93A 00-04-PROTO in my
  189.     Amiga 3000 or a firmware bug in the Apple CD-300 (my firmware
  190.     is release 1.8d). The lockups usually occur only if I read
  191.     more than about 150 sectors. When a lockup occurs, don't
  192.     panic! I usually power cycle the Apple CD-300 and everything
  193.     reverts to normal.  BTW, the Apple CD-300 sometimes returns
  194.     the following MODE SENSE errors for no obvious reason:
  195.  
  196.     SENSE_DATA: 70 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00
  197.     Error : err=45 , No error
  198.  
  199.     Since V1.905b SCSIUtil reschedules the failed SCSI command and
  200.     tries to reread the missing sectors, thus you shouldn't lose
  201.     any data. (When this happens you might notice a little glitch
  202.     in the digital data, this is caused by the CD-ROM drive's
  203.     i