Hi All,
	The next set of 'scu' enhancements has been completed.  The
executable, help file, and tar file of sources are in:

	wasted:~rmiller/nscu.d/{scu,scu.hlp,nscu.tar.Z}

	What's New as of August 10, 1995
	--------------------------------
    o	Added ability to change density code, block length, capacity
	(number of blocks), and device specific parameters.

    o	"seek lba n" is now equivalent to "set position lba n" command.

    o	start/stop/eject commands now take optional "immediate" keyword.

    o	Added ability to set individual page fields.  A "show layout"
	command was also added to display the mode page field names.

    o	If undocumented BypassFlag is enabled, allow changing page
	fields marked as unchangeable (some firmware is incorrect).

    o	Finished rewrite of "show defects" functions, which also
	involved changing display format to be more user friendly.
	Also relaxed parsing restrictions on defect list/format args.

    o	Added hooks to allow addition of vendor unique mode pages,
	and added two RWZ52 pages (0x20 & 0x21 which are very useful).
	[ NOTE: the long range plan is to support vendor unique pages
	  from a data file, instead of modifying 'scu' program. ]

    o	Fixed problem with mode page related commands failing silently.
	[ i.e., "verify media recovery off" would do nothing if the
	  device did _not_ support a verify error recovery page. ]

    o	Add dynamic bad block replacment (auto-reassign) option and
	implement for media analysis commands (read/write/scan/verify).

    o	Add detection of screen width to control field dump size.
	[ struct winsize win; ioctl(fd, TIOCGWINSZ, &win), win.ws_col ]
	[ Also add signal handler to detect window change to recheck. ]

    o	Merged new dump_buffer code from 'dt' into 'scu', which gets
	used during data compare errors (more informative).

    o	Allow user to disable auto-sense via setting CAM_DIS_AUTOSENSE.
	Basically, you can disable auto-sense via "set cam flags 0x20".

    o	Add "zero sense" command to force request sense on "show sense".

    o	Added "set sense { brief | full }" to control sense reporting.

	That's it for now.  See 'scu' help file for additional information.
As always, send mail directly to me if you encounter any problems and/or
have questions.

	Test log attached below, show these new commands in action.

-Robin
================================================================================
Examples of Mode Page extensions:
--------------------------------------------------------------------------------

imfaster% scu
scu> set nexus pid 1 tid 0 lun 0
Device: RWZ52, Bus: 1, Target: 0, Lun: 0, Type: Optical
scu> show pages supported
Mode Pages Supported by Device [1/0/0] (RWZ52):

Read-Write Error Recovery Page (0x01), Page Length 10 (0x0a), Savable Yes
     Disconnect-Reconnect Page (0x02), Page Length 14 (0x0e), Savable Yes
      Rigid Disk Geometry Page (0x04), Page Length 22 (0x16), Savable No
           Optical Memory Page (0x06), Page Length  2 (0x02), Savable Yes
    Verify Error Recovery Page (0x07), Page Length 10 (0x0a), Savable Yes
            Cache Control Page (0x08), Page Length 10 (0x0a), Savable Yes
   Medium Types Supported Page (0x0b), Page Length  6 (0x06), Savable Yes
          Vendor Specific Page (0x20), Page Length 12 (0x0c), Savable Yes
          Vendor Specific Page (0x21), Page Length 10 (0x0a), Savable Yes

scu> show page vendor 0x21

Vendor Specific Parameters (Page 0x21 - Current Values):

Mode Parameter Header:

                  Mode Data Length: 23
                       Medium Type: 0x3 (Reversible or Erasable medium)
         Device Specific Parameter: 0x10 (Supports cache memory)
           Block Descriptor Length: 8

Mode Parameter Block Descriptor:

                      Density Code: 0xa
          Number of Logical Blocks: 1163337
              Logical Block Length: 512

Page Header / Data:
                         Page Code: 0x21
                Parameters Savable: Yes
                       Page Length: 10
 Direct Access Inquiry Resp (DAIR): No
 Disable Tgt Initiated Sync (DTIS): Yes
         Disable Auto Spinup (DAS): No
       Reset Configuration (Reset): Off (hard reset)
   Correction Manager Log (CM Log): Disabled
        Drive Manager Log (DM Log): Disabled
 Digital Signal Proc Log (DSP Log): Disabled
 Extended Recovery Reporting (ERR): No
 Timestamps for Q Log and Task Log: Disabled
Task Log Change Logging (Task Log): Disabled
    Priority Queue Logging (Q Log): Disabled
  Disable Log Thresold Warn (DLTW): Yes
        Force Verify on ALL Writes: Yes
       Reserved (byte 3, bits 5:7): 0x2
            Maximum Buffer Latency: 1000ms
                 Drive Retry Count: 2
        Autochanger Eject Distance: 150 (1.5 millimeters)
      SCSI Phase Retry Error Count: 5

scu>

================================================================================
Examples of "show layout" command and setting individual page fields:
--------------------------------------------------------------------------------

scu> set nexus pid 1 tid 0 lun 0
Device: RWZ52, Bus: 1, Target: 0, Lun: 0, Type: Optical
scu> show layout cache

                     Cache Control Page Layout (Page 0x8)

    Field Description & Offset/Bit Information        Set Name
    ------------------------------------------        --------
          Read Cache Disable (RCD) (byte 2, bit 0) -> rcd
        Multiplication Factor (MF) (byte 2, bit 1) -> mf
          Write Cache Enable (WCE) (byte 2, bit 2) -> wce
                       Reserved (byte 2, bits 3:7) -> 
       Write Retention Priority (byte 3, bits 0:3) -> write_retention_pri
 Demand Read Retention Priority (byte 3, bits 4:7) -> demand_read_ret_pri
      Disable Prefetch Transfer Length (bytes 4-5) -> prefetch_xfer_len
                      Minimum Prefetch (bytes 6-7) -> minimum_prefetch
                      Maximum Prefetch (bytes 8-9) -> maximum_prefetch
            Maximum Prefetch Ceiling (bytes 10-11) -> max_prefetch_ceiling

scu> show page cache

Cache Control Parameters (Page 0x8 - Current Values):

Mode Parameter Header:

                  Mode Data Length: 23
                       Medium Type: 0x3 (Reversible or Erasable medium)
         Device Specific Parameter: 0x10 (Supports cache memory)
           Block Descriptor Length: 8

Mode Parameter Block Descriptor:

                      Density Code: 0xa
          Number of Logical Blocks: 1163337
              Logical Block Length: 512

Page Header / Data:
                         Page Code: 0x8
                Parameters Savable: Yes
                       Page Length: 10
          Read Cache Disable (RCD): No
        Multiplication Factor (MF): Off
          Write Cache Enable (WCE): No
          Write Retention Priority: 0 (Not distiguished)
    Demand Read Retention Priority: 0 (Not distiguished)
  Disable Prefetch Transfer Length: 65535 blocks
                  Minimum Prefetch: 4 blocks
                  Maximum Prefetch: 8 blocks
          Maximum Prefetch Ceiling: 0 blocks

scu> set default savable off
scu> set page cache rcd yes wce on
Setting Cache Control Parameters (Page 0x8 - Current Values):
scu> show page cache

Cache Control Parameters (Page 0x8 - Current Values):

Mode Parameter Header:

                  Mode Data Length: 23
                       Medium Type: 0x3 (Reversible or Erasable medium)
         Device Specific Parameter: 0x10 (Supports cache memory)
           Block Descriptor Length: 8

Mode Parameter Block Descriptor:

                      Density Code: 0xa
          Number of Logical Blocks: 1163337
              Logical Block Length: 512

Page Header / Data:
                         Page Code: 0x8
                Parameters Savable: Yes
                       Page Length: 10
          Read Cache Disable (RCD): Yes
        Multiplication Factor (MF): Off
          Write Cache Enable (WCE): Yes
          Write Retention Priority: 0 (Not distiguished)
    Demand Read Retention Priority: 0 (Not distiguished)
  Disable Prefetch Transfer Length: 65535 blocks
                  Minimum Prefetch: 4 blocks
                  Maximum Prefetch: 8 blocks
          Maximum Prefetch Ceiling: 0 blocks

scu>

================================================================================
Example of switch RWZ52 Optical to Direct-Access mode:
--------------------------------------------------------------------------------

scu> set nexus pid 1 tid 0 lun 0
Device: RWZ52, Bus: 1, Target: 0, Lun: 0, Type: Optical
scu> show inquiry
Inquiry Information:

            Peripheral Device Type: 0x7 (Optical)
              Peripheral Qualifier: 0 (Peripheral Device Connected)
              Device Type Modifier: 0
                   Removable Media: Yes
                      ANSI Version: 2 (Complies to ANSI X3.131-1994, SCSI-2)
                      ECMA Version: 0
                       ISO Version: 0
              Response Data Format: 2 (SCSI-2)
             Terminate I/O Process: 0
         Asynchronous Notification: 0
                 Additional Length: 51
                Soft Reset Support: No
           Command Queuing Support: No
           Target Transfer Disable: No
            Linked Command Support: No
        Synchronous Data Transfers: Yes
      Support for 16 Bit Transfers: No
      Support for 32 Bit Transfers: No
       Relative Addressing Support: No
             Vendor Identification: DEC     
            Product Identification: RWZ52     (C)DEC
           Firmware Revision Level: 3404
              Vendor Specific Data: 33 33 35 31 00 0a 02 00 00 00 00 00 00 00 "3351          "
                                    00 00 00 00 00 00                         "      "
scu> show layout vendor 0x21

                    Vendor Specific Page Layout (Page 0x21)

    Field Description & Offset/Bit Information        Set Name
    ------------------------------------------        --------
 Direct Access Inquiry Resp (DAIR) (byte 2, bit 0) -> dair
 Disable Tgt Initiated Sync (DTIS) (byte 2, bit 1) -> dtis
         Disable Auto Spinup (DAS) (byte 2, bit 2) -> das
       Reset Configuration (Reset) (byte 2, bit 3) -> reset
   Correction Manager Log (CM Log) (byte 2, bit 4) -> cmlog
        Drive Manager Log (DM Log) (byte 2, bit 5) -> dmlog
 Digital Signal Proc Log (DSP Log) (byte 2, bit 6) -> dsplog
 Extended Recovery Reporting (ERR) (byte 2, bit 7) -> err
 Timestamps for Q Log and Task Log (byte 3, bit 0) -> timestamp
Task Log Change Logging (Task Log) (byte 3, bit 1) -> tasklog
    Priority Queue Logging (Q Log) (byte 3, bit 2) -> qlog
  Disable Log Thresold Warn (DLTW) (byte 3, bit 3) -> dltw
        Force Verify on ALL Writes (byte 3, bit 4) -> force_verify
                       Reserved (byte 3, bits 5:7) -> 
                Maximum Buffer Latency (bytes 4-7) -> buffer_latency
                        Drive Retry Count (byte 8) -> drive_retrys
               Autochanger Eject Distance (byte 9) -> eject_distance
            SCSI Phase Retry Error Count (byte 10) -> phase_retrys
                                Reserved (byte 11) -> 

scu> 
scu> set page vendor 0x21 dair on
Setting & Saving Vendor Specific Parameters (Page 0x21 - Current Values):
scu> show inquiry
Inquiry Information:

            Peripheral Device Type: 0 (Direct Access)
              Peripheral Qualifier: 0 (Peripheral Device Connected)
              Device Type Modifier: 0
                   Removable Media: Yes
                      ANSI Version: 2 (Complies to ANSI X3.131-1994, SCSI-2)
                      ECMA Version: 0
                       ISO Version: 0
              Response Data Format: 2 (SCSI-2)
             Terminate I/O Process: 0
         Asynchronous Notification: 0
                 Additional Length: 51
                Soft Reset Support: No
           Command Queuing Support: No
           Target Transfer Disable: No
            Linked Command Support: No
        Synchronous Data Transfers: Yes
      Support for 16 Bit Transfers: No
      Support for 32 Bit Transfers: No
       Relative Addressing Support: No
             Vendor Identification: DEC     
            Product Identification: RWZ52     (C)DEC
           Firmware Revision Level: 3404
              Vendor Specific Data: 33 33 35 31 00 0a 02 00 00 00 00 00 00 00 "3351          "
                                    00 00 00 00 00 00                         "      "
scu> 

================================================================================
Examples of displaying all page control fields (tty width was 100 columns):
--------------------------------------------------------------------------------

scu> show pages pcf all
Mode Page Parameters for Device [1/0/0] (RWZ52):

Current Pages:

    Mode Header & Block Descriptor: 00 80 03 10 00 00 00 08 0a 11 c0 49 00 00 02 00 
    Read-Write Error Recovery Page: 81 0a a0 05 00 00 00 00 02 00 00 00 
         Disconnect-Reconnect Page: 82 0e 80 00 00 00 00 00 00 00 00 20 00 00 00 00 
          Rigid Disk Geometry Page: 04 16 00 92 96 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    09 60 00 00 
               Optical Memory Page: 86 02 00 00 
        Verify Error Recovery Page: 87 0a 00 05 00 00 00 00 00 00 00 00 
                Cache Control Page: 88 0a 05 00 ff ff 00 04 00 08 00 00 
       Medium Types Supported Page: 8b 06 00 00 02 03 00 00 
              Vendor Specific Page: a0 0c 00 00 01 00 00 00 00 00 00 1f 00 00 
              Vendor Specific Page: a1 0a 02 58 00 00 03 e8 02 96 05 00 

Changeable Pages:

    Mode Header & Block Descriptor: 00 80 00 00 00 00 00 08 00 00 00 00 00 00 00 00 
    Read-Write Error Recovery Page: 81 0a a7 ff 00 00 00 00 ff 00 00 00 
         Disconnect-Reconnect Page: 82 0e ff 00 00 00 00 00 00 00 ff ff 00 00 00 00 
          Rigid Disk Geometry Page: 04 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    00 00 00 00 
               Optical Memory Page: 86 02 00 00 
        Verify Error Recovery Page: 87 0a 05 ff 00 00 00 00 00 00 00 00 
                Cache Control Page: 88 0a 05 00 ff ff ff ff ff ff 00 00 
       Medium Types Supported Page: 8b 06 00 00 00 00 00 00 
              Vendor Specific Page: a0 0c 00 ff ff ff ff ff ff ff ff 00 00 00 
              Vendor Specific Page: a1 0a ff ff ff ff ff ff ff ff ff 00 

Default Pages:

    Mode Header & Block Descriptor: 00 80 03 10 00 00 00 08 0a 11 c0 49 00 00 02 00 
    Read-Write Error Recovery Page: 81 0a 80 08 00 00 00 00 02 00 00 00 
         Disconnect-Reconnect Page: 82 0e 80 00 00 00 00 00 00 00 00 20 00 00 00 00 
          Rigid Disk Geometry Page: 04 16 00 92 96 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    09 60 00 00 
               Optical Memory Page: 86 02 00 00 
        Verify Error Recovery Page: 87 0a 00 05 00 00 00 00 00 00 00 00 
                Cache Control Page: 88 0a 04 00 ff ff 00 08 00 08 00 00 
       Medium Types Supported Page: 8b 06 00 00 02 03 00 00 
              Vendor Specific Page: a0 0c 00 00 00 00 00 00 00 00 00 1f 00 00 
              Vendor Specific Page: a1 0a 02 08 00 00 03 e8 02 96 05 00 

Saved Pages:

    Mode Header & Block Descriptor: 00 80 03 10 00 00 00 08 0a 11 c0 49 00 00 02 00 
    Read-Write Error Recovery Page: 81 0a a0 05 00 00 00 00 02 00 00 00 
         Disconnect-Reconnect Page: 82 0e 80 00 00 00 00 00 00 00 00 20 00 00 00 00 
          Rigid Disk Geometry Page: 04 16 00 92 96 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    09 60 00 00 
               Optical Memory Page: 86 02 00 00 
        Verify Error Recovery Page: 87 0a 00 05 00 00 00 00 00 00 00 00 
                Cache Control Page: 88 0a 00 00 ff ff 00 04 00 08 00 00 
       Medium Types Supported Page: 8b 06 00 00 02 03 00 00 
              Vendor Specific Page: a0 0c 00 00 00 00 00 00 00 00 00 1f 00 00 
              Vendor Specific Page: a1 0a 02 58 00 00 03 e8 02 96 05 00 
scu> 
scu> show page cache pcf all
Mode Page Parameters for Device [1/0/0] (RWZ52):

Cache Control Page (0x08):

      Headers: 17 03 10 08 0a 11 c0 49 00 00 02 00 
      Current: 88 0a 05 00 ff ff 00 04 00 08 00 00 
   Changeable: 88 0a 05 00 ff ff ff ff ff ff 00 00 
      Default: 88 0a 04 00 ff ff 00 08 00 08 00 00 
        Saved: 88 0a 00 00 ff ff 00 04 00 08 00 00 
scu> 

================================================================================
Example of Dynamic Bad Block Replacement enhancement & "show defects" display:
--------------------------------------------------------------------------------

scu> show capacity
Disk Capacity Information:

                  Maximum Capacity: 409792 (200.094 megabytes)
                      Block Length: 512
scu> 
scu> verify media starting 409700 dbbr on
Verifying 92 blocks (409700 - 409791) on /dev/rrz0c (RZ24), please be patient...
Verifying blocks [ 409700 through 409791 ]...
scu: Verify error at logical block number 409725 (0x6407d).
scu: Sense Key = 0x3 = MEDIUM ERROR - Nonrecoverable medium error,
     Sense Code/Qualifier = (0x11, 0) = Unrecovered read error
Attempting to reassign logical block 409725 on /dev/rrz0c (RZ24)...
WARNING: Unable to read data, but continuing with reassign...
scu: Verify error at logical block number 409750 (0x64096).
scu: Sense Key = 0x3 = MEDIUM ERROR - Nonrecoverable medium error,
     Sense Code/Qualifier = (0x11, 0) = Unrecovered read error
Attempting to reassign logical block 409750 on /dev/rrz0c (RZ24)...
scu> show defects grown

Displaying Grown Defect List in Physical Sector Format
   ( Defect list length is 24 bytes, containing 3 defects )

	Cylinder    742,  Head  5,  Sector   28
	Cylinder   1355,  Head  1,  Sector    9
	Cylinder   1355,  Head  1,  Sector   34
scu> 

================================================================================
Example of controlling auto-sense and requesting sense information:
--------------------------------------------------------------------------------

scu> set cam flags 0x400|0x20
scu> eject
scu> tur
scu: 'test unit ready' failed, EIO (5) - I/O error
scu> zero sense
scu> show sense
Request Sense Information:

                        Error Code: 0x70 (Current Error)
                         Valid Bit: 0
                    Segment Number: 0
                         Sense Key: 0x2 (NOT READY - Logical unit is NOT ready)
                    Illegal Length: 0
                      End Of Media: 0
                         File Mark: 0
                 Information Field: 0
           Additional Sense Length: 0xa
      Command Specific Information: 0
   Additional Sense Code/Qualifier: (0x3a, 0) = Medium not present
       Field Replaceable Unit Code: 0
              Sense Specific Bytes: 00 00 00 
scu> 

================================================================================
Example of changing device block length:
--------------------------------------------------------------------------------

% scu -f /dev/rrz4c
scu> show nexus
Device: RRD43, Bus: 0, Target: 4, Lun: 0, Type: Read-Only Direct Access
scu> show capacity
Disk Capacity Information:

                  Maximum Capacity: 400200 (195.410 megabytes)
                      Block Length: 512
scu> set device length 2048
scu> show capacity
Disk Capacity Information:

                  Maximum Capacity: 100050 (195.410 megabytes)
                      Block Length: 2048
scu> 
