Provided by: sg3-utils_1.17-2_i386 bug


       sg_modes - reads SCSI MODE SENSE pages


       sg_modes  [-a]  [-A]  [-c=<page_control>] [-d] [-D] [-f] [-h] [-H] [-l]
       [-L]     [-p=<page_code>]     [-p=<page_code>,<sub_page_code>]     [-r]
       [-subp=<sub_page_code>] [-v] [-V] [-6] [-?] [<scsi_device>]


       This  utility  sends  a MODE SENSE SCSI command (the 10 byte variant by
       default) to the given device and then outputs the response. There is no
       facility  to  change the page or descriptor data with this utility.  If
       no page is given (and ’-l’ is not selected) then ’-a’ is assumed.

       -a     output all the mode pages supported by the given device.

       -A     output all the mode pages and subpages supported by the  device.

              up  to  four  different  versions  of  each page are held by the
              device: the  current  values  [0]  (i.e.  those  active  at  the
              moment),  the  changeable  values  [1]  (bit  mask showing which
              sections could be changed with a MODE  SELECT),  default  values
              [2]  (the  manufacturer’s  settings)  and  saved values [3] (the
              values that will be re-instated the  next  time  the  device  is
              power  cycled).  If this option is not given then current values
              [0] are assumed.

       -d     disable  block  descriptors.  By  default,   block   descriptors
              (usually  one  or  none)  are returned in a MODE SENSE response.
              This option sets the "disable block descriptors"  (DBD)  bit  in
              the  cdb  which  instructs  the  device  not to return any block
              descriptors in its response. Older devices may not support  this
              setting   and   should   return  an  "illegal  request"  status;
              alternatively they may ignore it.

       -D     disable outputting block descriptors.  Irrespective  of  whether
              block  descriptors  are present in the response or not, they are
              not output.

       -f     Be "flexible". Some  devices,  bridges  and/or  drivers  attempt
              crude switches between mode sense 6 and 10 byte commands without
              correcting the response. This will cause the response to be mis-
              interpreted  (usually  with  an  error  saying  the  response is
              malformed). With this option, the  length  of  the  response  is
              checked,  and if it looks wrong, the response is then decoded as
              if the other mode sense (cdb length) was sent.

       -h     The default action is to decode known  mode  page  numbers  (and
              subpage  numbers)  into text. With this option mode page numbers
              (and subpage numbers) are output in hexadecimal.

       -H     same action as the ’-h’ option.

       -l     lists all common page and subpage codes and their names that are
              found in the command set that matches the peripheral type of the
              given device.  If no device and no page_code is given  then  the
              common  page  and  subpage  codes  and  their names for the disk
              command set are listed.  If no device is given and  a  page_code
              is  given then the common page and subpage codes and their names
              for the command set whose peripheral  device  type  matches  the
              value  given  to  page_code  are listed. For example ’sg_mode -l
              -p=1’ lists  the  command  mode  pages  and  subpages  for  tape
              devices.  Additionally  if  a  sub_page_code is given then it is
              interpreted as a  transport  identifier  and  command  transport
              specific  mode  page  codes and their names are listed following
              the main mode page list.  Other options are ignored.

       -L     set the Long LBA Accepted (LLBAA) bit in  the  MODE  SENSE  (10)
              cdb.  This  bit  is  not  defined  in  the MODE SENSE (6) cdb so
              setting the ’-L’ and ’-6’ options is reported as an error.  When
              set  the given device may respond with 16 byte block descriptors
              as indicated by the ’LongLBA’ field in the response.  In  almost
              all cases setting this option is not needed.

              page code to fetch. Should be a hexadecimal number between 0 and
              3f inclusive (0 to 63 decimal). The default value is 0.

              page code and subpage code values to fetch. The page code should
              be  a hexadecimal number between 0 and 3f inclusive. The subpage
              code should be a hexadecimal number between 0 and ff  inclusive.
              The default value of both is 0.

       -r     output  the  selected  mode page to stdout a byte per line. Each
              line contains two hexadecimal  digits  (e.g.  "0a").  Useful  as
              input (after editing) to the sg_wr_mode utility.

              sub page code to fetch. Should be a hexadecimal number between 0
              and 0xff inclusive. The default value is 0.

       -v     verbose: output cdbs in hex before  executing  them.  ’-vv’  and
              ’-vvv’ are also accepted yielding greater verbosity.

       -V     print out version string

       -6     by  default this utility sends out a 10 byte MODE SENSE command.
              However some  SCSI  devices  only  support  6  byte  MODE  SENSE
              commands  (e.g.  SCSI-2  tape drives). This parameter forces the
              use of 6 byte MODE SENSE commands.

       -?     output usage message. Ignore all other parameters.

       If the normal sg_modes utility fails with  "illegal  command  operation
       code" then try the "-6" parameter.

       Mode  pages  cannot  be  modified  with  this  utility. Mode pages (and
       subpages) can be modified with the sg_wr_mode and sginfo  utilities  in
       the  sg3_utils  package.  See  this  sdparm  utility  and  those  other
       utilities that are listed in the "SEE ALSO" section below.

       This  utility  performs  a  SCSI  INQUIRY  command  to  determine   the
       peripheral  type  of the device (e.g. 0 -> Direct Access Device (disk))
       prior to sending a MODE SENSE command. This helps in decoding the block
       descriptor and mode pages.

       In  the  2.4  series  of  Linux kernels the given device must be a SCSI
       generic (sg) device. In the 2.6 series block devices  (e.g.  disks  and
       SCSI  DVDs)  can  also be specified. For example "sg_modes -a /dev/sda"
       will work in the 2.6 series kernels.


       Written by Doug Gilbert


       Report bugs to <dgilbert at interlog dot com>.


       Copyright © 2000-2005 Douglas Gilbert
       This software is distributed under the  GPL  version  2.  There  is  NO
       warranty;  not  even  for  MERCHANTABILITY  or FITNESS FOR A PARTICULAR


       sdparm(net),         sg_wr_mode(sg3_utils),          sginfo(sg3_utils),
       sgmode(scsirastools), scsiinfo(net), scu(net), seatools(seagate)

       All  these  utilities offer some facility to change mode page (or block
       descriptor) parameters.