SCUZZ(8)                                                 SCUZZ(8)

     NAME
          scuzz - SCSI target control

     SYNOPSIS
          scuzz [ -q ] [ target-id ]

     DESCRIPTION
          Scuzz is an interactive program for exercising raw SCSI
          devices.  It reads commands from standard input and applies
          them to a SCSI target.  If target-id is given on the command
          line, an open (see below) is immediately applied to the tar-
          get.  On successful completion of a command, ok n is
          printed, where n is the number of bytes transferred to/from
          the target; the -q command line option suppresses the ok
          message.

        Commands
          help command
               Help is rudimentary and prints a one line synopsis for
               the named command, or for all commands if no argument
               is given.

          probe
               Probe attempts an inquiry command on all SCSI target
               ids, and prints the result preceded by the id of those
               targets which respond.

          The help and probe commands may be given at any time.

          open target-id
               Open must be given before any of the remaining commands
               will be accepted.  Internally, open issues ready then
               inquiry, followed by a device class-specific command to
               determine the logical block size of the target.

          close
               Close need only be given if another target is to be
               opened in the current session.

          The remaining commands are in two groups, generic SCSI com-
          mands, and those specific to the Philips CDD521 Compact Disc
          Recorder (flushcache onwards).  With the exception of the
          read, write, space, and wtrack commands, all arguments are
          in the style of ANSI-C integer constants.

          ready
               Test Unit Ready checks if the unit is powered up and
               ready to do read and write commands.

          rezero

     SCUZZ(8)                                                 SCUZZ(8)

               Rezero Unit requests that a disc be brought to a known
               state, usually by seeking to track zero.

          rewind
               Rewind positions a tape at the beginning of current
               partition (there is usually only one partition, the
               beginning of tape).

          reqsense
               Request Sense retrieves Sense Data concerning an error
               or other condition and is usually issued following the
               completion of a command that had check-condition sta-
               tus.  Scuzz automatically issues a reqsense in response
               to a check-condition status and prints the result.

          format
               Format Unit performs a ``low level'' format of a disc.

          rblimits
               Read Block Limits reports the possible block lengths
               for the logical unit. Tapes only.

          read file nbytes
               Read transfers data from the target to the host.  A
               missing nbytes causes the entire device to be read.

          write file nbytes
               Write transfers data from the host to the target.  A
               missing nbytes causes the entire input file to be
               transferred.

               The first argument to the read, write, and wtrack
               (q.v.)  commands specifies a source (write and wtrack)
               or destination (read) for the I/O.  The argument is
               either a plain file name or | followed by a command to
               be executed by rc(1). The argument may be quoted in the
               style of rc(1).

          seek offset whence
               Seek requests the target to seek to a position on a
               disc, arguments being in the style of seek(2); whence
               is 0 by default.

               Scuzz maintains an internal notion of where the current
               target is positioned.  The seek, read, write, rewind,
               rezero, and wtrack commands all manipulate the internal
               offset.

          filemark howmany
               Write Filemarks writes one (default) or more filemarks
               on a tape.

     SCUZZ(8)                                                 SCUZZ(8)

          space [-b] [-f] [[--]howmany]
               Space positions a tape forwards or backwards.  The
               arguments specify logical block (-b) or filemark (-f)
               spacing; default is -b.  If howmany is negative it
               specifies spacing backwards, and should be preceded by
               -- to turn off any further option processing.  Default
               is 1.

          inquiry
               Inquiry is issued to determine the device type of a
               particular target, and to determine some basic informa-
               tion about the implemented options and the product
               name.

          modeselect bytes...
               Mode Select is issued to set variable parameters in the
               target.  Bytes given as arguments comprise all the data
               for the target; see an appropriate manual for the for-
               mat.

          modesense [page [nbytes]]
               Mode Sense reports variable and fixed parameters from
               the target.  If no page is given, all pages are
               returned.  Nbytes specifies how many bytes should be
               returned.

          start code

          stop code

          eject code
               Start, stop, and eject are synonyms for Start/Stop Unit
               with different default values of code. Start/Stop Unit
               is typically used to spin up and spin down a rotating
               disk drive.  Code is 0 to stop, 1 to start and 3 to
               eject (if the device supports ejection of the medium).

          capacity
               Read Capacity reports the number of blocks and the
               block size of a disc.

          The remaining commands are specific to the CDD521 Compact
          Disc Recorder.  A brief description of each is given; see
          the manual for details of arguments.

          flushcache
               The Flush Cache command forces data in the cache memory
               of the CDD521 to be written to the physical medium.

          rdiscinfo [track/session-number[ses]]
               The Read TOC/PMA command transfers data from one of the
               tables of contents (TOC or PMA) on the CD medium.

     SCUZZ(8)                                                 SCUZZ(8)

          fwaddr [track[mode[npa]]]
               The First Writable Address command reports the next
               logical writable address for the next write command.

          treserve nbytes
               The Reserve Track command reserves one track on the
               disc.  Tracks can only be reserved in successive order.

          trackinfo track
               Read Track Info reports the starting address, the
               length of a given track on the disc and the number of
               free blocks in that track.

          wtrack file [nbytes [track [mode]]]
               Write Track sets up for track-writing if nbytes is 0
               (default), or writes a complete track.  See write
               above.

          load

          unload
               Load and Unload open or close the tray.

          fixation [toc-type]
               Fixation writes table of contents (TOC) and LEADOUT
               information to the disc to complete a session.

     FILES
          #S/scsi-target-id/cmd   raw SCSI interface for command and
                                  status.
          #S/scsi-target-id/data  raw SCSI interface for I/O.

     SOURCE
          /sys/src/cmd/scuzz

     SEE ALSO
          scsi(3)
          Small Computer System Interface - 2 (X3T9.2/86-109), .}f
          Global Engineering Documents
          SCSI Command Set CDD521/10, Philips IMS
          SCSI Bench Reference, ENDL Publications

     BUGS
          Only a limited subset of SCSI commands has been implemented
          (as needed).

          Only one target can be open at a time.

          LUNs other than 0 are not supported.

          No way to force 6- or 10- byte commands.