1.\" 2.\" Copyright (c) 1998, 1999, 2000, 2002 Kenneth D. Merry. 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. The name of the author may not be used to endorse or promote products 14.\" derived from this software without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" $FreeBSD$ 29.\" 30.Dd September 14, 1998 31.Dt CAMCONTROL 8 32.Os 33.Sh NAME 34.Nm camcontrol 35.Nd CAM control program 36.Sh SYNOPSIS 37.Nm 38.Aq Ar command 39.Op device id 40.Op generic args 41.Op command args 42.Nm 43.Ic devlist 44.Op Fl v 45.Nm 46.Ic periphlist 47.Op device id 48.Op Fl n Ar dev_name 49.Op Fl u Ar unit_number 50.Nm 51.Ic tur 52.Op device id 53.Op generic args 54.Nm 55.Ic inquiry 56.Op device id 57.Op generic args 58.Op Fl D 59.Op Fl S 60.Op Fl R 61.Nm 62.Ic start 63.Op device id 64.Op generic args 65.Nm 66.Ic stop 67.Op device id 68.Op generic args 69.Nm 70.Ic load 71.Op device id 72.Op generic args 73.Nm 74.Ic eject 75.Op device id 76.Op generic args 77.Nm 78.Ic rescan 79.Aq all | bus Ns Op :target:lun 80.Nm 81.Ic reset 82.Aq all | bus Ns Op :target:lun 83.Nm 84.Ic defects 85.Op device id 86.Op generic args 87.Aq Fl f Ar format 88.Op Fl P 89.Op Fl G 90.Nm 91.Ic modepage 92.Op device id 93.Op generic args 94.Aq Fl m Ar page | Fl l 95.Op Fl P Ar pgctl 96.Op Fl b | Fl e 97.Op Fl d 98.Nm 99.Ic cmd 100.Op device id 101.Op generic args 102.Aq Fl c Ar cmd Op args 103.Op Fl i Ar len Ar fmt 104.Bk -words 105.Op Fl o Ar len Ar fmt Op args 106.Ek 107.Nm 108.Ic debug 109.Op Fl I 110.Op Fl P 111.Op Fl T 112.Op Fl S 113.Op Fl X 114.Op Fl c 115.Aq all|off|bus Ns Op :target Ns Op :lun 116.Nm 117.Ic tags 118.Op device id 119.Op generic args 120.Op Fl N Ar tags 121.Op Fl q 122.Op Fl v 123.Nm 124.Ic negotiate 125.Op device id 126.Op generic args 127.Op Fl c 128.Op Fl D Ar enable|disable 129.Op Fl O Ar offset 130.Op Fl q 131.Op Fl R Ar syncrate 132.Op Fl T Ar enable|disable 133.Op Fl U 134.Op Fl W Ar bus_width 135.Op Fl v 136.Nm 137.Ic format 138.Op device id 139.Op generic args 140.Op Fl q 141.Op Fl w 142.Op Fl y 143.Nm 144.Ic help 145.Sh DESCRIPTION 146The 147.Nm 148utility is designed to provide a way for users to access and control the 149.Fx 150CAM subsystem. 151.Pp 152The 153.Nm 154utility 155can cause a loss of data and/or system crashes if used improperly. Even 156expert users are encouraged to exercise caution when using this command. 157Novice users should stay away from this utility. 158.Pp 159The 160.Nm 161utility has a number of primary functions, many of which support an optional 162device identifier. A device identifier can take one of three forms: 163.Bl -tag -width 14n 164.It deviceUNIT 165Specify a device name and unit number combination, like "da5" or "cd3". 166Note that character device node names (e.g. /dev/da0) are 167.Em not 168allowed here. 169.It bus:target 170Specify a bus number and target id. The bus number can be determined from 171the output of 172.Dq camcontrol devlist . 173The lun defaults to 0. 174.It bus:target:lun 175Specify the bus, target and lun for a device. (e.g. 1:2:0) 176.El 177.Pp 178The device identifier, if it is specified, 179.Em must 180come immediately after the function name, and before any generic or 181function-specific arguments. Note that the 182.Fl n 183and 184.Fl u 185arguments described below will override any device name or unit number 186specified beforehand. The 187.Fl n 188and 189.Fl u 190arguments will 191.Em not 192override a specified bus:target or bus:target:lun, however. 193.Pp 194Most of the 195.Nm 196primary functions support these generic arguments: 197.Bl -tag -width 14n 198.It Fl C Ar count 199SCSI command retry count. In order for this to work, error recovery 200.Pq Fl E 201must be turned on. 202.It Fl E 203Instruct the kernel to perform generic SCSI error recovery for the given 204command. This is needed in order for the retry count 205.Pq Fl C 206to be honored. Other than retrying commands, the generic error recovery in 207the code will generally attempt to spin up drives that are not spinning. 208It may take some other actions, depending upon the sense code returned from 209the command. 210.It Fl n Ar dev_name 211Specify the device type to operate on, e.g. "da", "cd". 212.It Fl t Ar timeout 213SCSI command timeout in seconds. This overrides the default timeout for 214any given command. 215.It Fl u Ar unit_number 216Specify the device unit number, e.g. "1", "5". 217.It Fl v 218Be verbose, print out sense information for failed SCSI commands. 219.El 220.Pp 221Primary command functions: 222.Bl -tag -width periphlist 223.It Ic devlist 224List all physical devices (logical units) attached to the CAM subsystem. 225This also includes a list of peripheral drivers attached to each device. 226With the 227.Fl v 228argument, SCSI bus number, adapter name and unit numbers are printed as 229well. 230.It Ic periphlist 231List all peripheral drivers attached to a given physical device (logical 232unit). 233.It Ic tur 234Send the SCSI test unit ready (0x00) command to the given device. 235The 236.Nm 237utility will report whether the device is ready or not. 238.It Ic inquiry 239Send a SCSI inquiry command (0x12) to a device. By default, 240.Nm 241will print out the standard inquiry data, device serial number, and 242transfer rate information. The user can specify that only certain types of 243inquiry data be printed: 244.Bl -tag -width 4n 245.It Fl D 246Get the standard inquiry data. 247.It Fl S 248Print out the serial number. If this flag is the only one specified, 249.Nm 250will not print out "Serial Number" before the value returned by the drive. 251This is to aid in script writing. 252.It Fl R 253Print out transfer rate information. 254.El 255.It Ic start 256Send the SCSI Start/Stop Unit (0x1B) command to the given device with the 257start bit set. 258.It Ic stop 259Send the SCSI Start/Stop Unit (0x1B) command to the given device with the 260start bit cleared. 261.It Ic load 262Send the SCSI Start/Stop Unit (0x1B) command to the given device with the 263start bit set and the load/eject bit set. 264.It Ic eject 265Send the SCSI Start/Stop Unit (0x1B) command to the given device with the 266start bit cleared and the load/eject bit set. 267.It Ic rescan 268Tell the kernel to scan all busses in the system (with the 269.Ar all 270argument), the given bus (XPT_SCAN_BUS), or bus:target:lun 271(XPT_SCAN_LUN) for new devices or devices that have gone away. The user 272may specify a scan of all busses, a single bus, or a lun. Scanning all luns 273on a target isn't supported. 274.It Ic reset 275Tell the kernel to reset all busses in the system (with the 276.Ar all 277argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus 278reset for that bus, or to reset the given bus:target:lun 279(XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after 280connecting to that device. 281Note that this can have a destructive impact 282on the system. 283.It Ic defects 284Send the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and 285print out any combination of: the total number of defects, the primary 286defect list (PLIST), and the grown defect list (GLIST). 287.Bl -tag -width 11n 288.It Fl f Ar format 289The three format options are: 290.Em block , 291to print out the list as logical blocks, 292.Em bfi , 293to print out the list in bytes from index format, and 294.Em phys , 295to print out the list in physical sector format. The format argument is 296required. Most drives support the physical sector format. Some drives 297support the logical block format. Many drives, if they don't support the 298requested format, return the data in an alternate format, along with sense 299information indicating that the requested data format isn't supported. 300The 301.Nm 302utility 303attempts to detect this, and print out whatever format the drive returns. 304If the drive uses a non-standard sense code to report that it doesn't 305support the requested format, 306.Nm 307will probably see the error as a failure to complete the request. 308.It Fl G 309Print out the grown defect list. This is a list of bad blocks that have 310been remapped since the disk left the factory. 311.It Fl P 312Print out the primary defect list. 313.El 314.Pp 315If neither 316.Fl P 317nor 318.Fl G 319is specified, 320.Nm 321will print out the number of defects given in the READ DEFECT DATA header 322returned from the drive. 323.It Ic modepage 324Allows the user to display and optionally edit a SCSI mode page. The mode 325page formats are located in 326.Pa /usr/share/misc/scsi_modes . 327This can be overridden by specifying a different file in the 328.Ev SCSI_MODES 329environment variable. 330The 331.Ic modepage 332command takes several arguments: 333.Bl -tag -width 12n 334.It Fl d 335Disable block descriptors for mode sense. 336.It Fl b 337Displays mode page data in binary format. 338.It Fl e 339This flag allows the user to edit values in the mode page. The user may 340either edit mode page values with the text editor pointed to by his 341.Ev EDITOR 342environment variable, or supply mode page values via standard input, using 343the same format that 344.Nm 345uses to display mode page values. The editor will be invoked if 346.Nm 347detects that standard input is terminal. 348.It Fl l 349Lists all available mode pages. 350.It Fl m Ar mode_page 351This specifies the number of the mode page the user would like to view 352and/or edit. This argument is mandatory unless 353.Fl l 354is specified. 355.It Fl P Ar pgctl 356This allows the user to specify the page control field. Possible values are: 357.Bl -tag -width xxx -compact 358.It 0 359Current values 360.It 1 361Changeable values 362.It 2 363Default values 364.It 3 365Saved values 366.El 367.El 368.It Ic cmd 369Allows the user to send an arbitrary SCSI CDB to any device. 370The 371.Ic cmd 372function requires the 373.Fl c 374argument to specify the CDB. Other arguments are optional, depending on 375the command type. The command and data specification syntax is documented 376in 377.Xr cam_cdbparse 3 . 378NOTE: If the CDB specified causes data to be transfered to or from the 379SCSI device in question, you MUST specify either 380.Fl i 381or 382.Fl o . 383.Bl -tag -width 17n 384.It Fl c Ar cmd Op args 385This specifies the SCSI CDB. CDBs may be 6, 10, 12 or 16 bytes. 386.It Fl i Ar len Ar fmt 387This specifies the amount of data to read, and how it should be displayed. 388If the format is 389.Sq - , 390.Ar len 391bytes of data will be read from the device and written to standard output. 392.It Fl o Ar len Ar fmt Op args 393This specifies the amount of data to be written to a device, and the data 394that is to be written. If the format is 395.Sq - , 396.Ar len 397bytes of data will be read from standard input and written to the device. 398.El 399.It Ic debug 400Turn on CAM debugging printfs in the kernel. This requires options CAMDEBUG 401in your kernel config file. WARNING: enabling debugging printfs currently 402causes an EXTREME number of kernel printfs. You may have difficulty 403turning off the debugging printfs once they start, since the kernel will be 404busy printing messages and unable to service other requests quickly. 405The 406.Ic debug 407function takes a number of arguments: 408.Bl -tag -width 18n 409.It Fl I 410Enable CAM_DEBUG_INFO printfs. 411.It Fl P 412Enable CAM_DEBUG_PERIPH printfs. 413.It Fl T 414Enable CAM_DEBUG_TRACE printfs. 415.It Fl S 416Enable CAM_DEBUG_SUBTRACE printfs. 417.It Fl X 418Enable CAM_DEBUG_XPT printfs. 419.It Fl c 420Enable CAM_DEBUG_CDB printfs. This will cause the kernel to print out the 421SCSI CDBs sent to the specified device(s). 422.It all 423Enable debugging for all devices. 424.It off 425Turn off debugging for all devices 426.It bus Ns Op :target Ns Op :lun 427Turn on debugging for the given bus, target or lun. If the lun or target 428and lun are not specified, they are wildcarded. (i.e., just specifying a 429bus turns on debugging printfs for all devices on that bus.) 430.El 431.It Ic tags 432Show or set the number of "tagged openings" or simultaneous transactions 433we attempt to queue to a particular device. By default, the 434.Ic tags 435command, with no command-specific arguments (i.e. only generic arguments) 436prints out the "soft" maximum number of transactions that can be queued to 437the device in question. For more detailed information, use the 438.Fl v 439argument described below. 440.Bl -tag -width 7n 441.It Fl N Ar tags 442Set the number of tags for the given device. This must be between the 443minimum and maximum number set in the kernel quirk table. The default for 444most devices that support tagged queueing is a minimum of 2 and a maximum 445of 255. The minimum and maximum values for a given device may be 446determined by using the 447.Fl v 448switch. The meaning of the 449.Fl v 450switch for this 451.Nm 452subcommand is described below. 453.It Fl q 454Be quiet, and don't report the number of tags. This is generally used when 455setting the number of tags. 456.It Fl v 457The verbose flag has special functionality for the 458.Em tags 459argument. It causes 460.Nm 461to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB: 462.Bl -tag -width 13n 463.It dev_openings 464This is the amount of capacity for transactions queued to a given device. 465.It dev_active 466This is the number of transactions currently queued to a device. 467.It devq_openings 468This is the kernel queue space for transactions. This count usually mirrors 469dev_openings except during error recovery operations when 470the device queue is frozen (device is not allowed to receive 471commands), the number of dev_openings is reduced, or transaction 472replay is occurring. 473.It devq_queued 474This is the number of transactions waiting in the kernel queue for capacity 475on the device. This number is usually zero unless error recovery is in 476progress. 477.It held 478The held count is the number of CCBs held by peripheral drivers that have 479either just been completed or are about to be released to the transport 480layer for service by a device. Held CCBs reserve capacity on a given 481device. 482.It mintags 483This is the current "hard" minimum number of transactions that can be 484queued to a device at once. The 485.Ar dev_openings 486value above cannot go below this number. The default value for 487.Ar mintags 488is 2, although it may be set higher or lower for various devices. 489.It maxtags 490This is the "hard" maximum number of transactions that can be queued to a 491device at one time. The 492.Ar dev_openings 493value cannot go above this number. The default value for 494.Ar maxtags 495is 255, although it may be set higher or lower for various devices. 496.El 497.El 498.It Ic negotiate 499Show or negotiate various communication parameters. Some controllers may 500not support setting or changing some of these values. For instance, the 501Adaptec 174x controllers do not support changing a device's sync rate or 502offset. 503The 504.Nm 505utility 506will not attempt to set the parameter if the controller indicates that it 507does not support setting the parameter. To find out what the controller 508supports, use the 509.Fl v 510flag. The meaning of the 511.Fl v 512flag for the 513.Ic negotiate 514command is described below. Also, some controller drivers don't support 515setting negotiation parameters, even if the underlying controller supports 516negotiation changes. Some controllers, such as the Advansys wide 517controllers, support enabling and disabling synchronous negotiation for 518a device, but do not support setting the synchronous negotiation rate. 519.Bl -tag -width 17n 520.It Fl a 521Attempt to make the negotiation settings take effect immediately by sending 522a Test Unit Ready command to the device. 523.It Fl c 524Show or set current negotiation settings. This is the default. 525.It Fl D Ar enable|disable 526Enable or disable disconnection. 527.It Fl O Ar offset 528Set the command delay offset. 529.It Fl q 530Be quiet, don't print anything. This is generally useful when you want to 531set a parameter, but don't want any status information. 532.It Fl R Ar syncrate 533Change the synchronization rate for a device. The sync rate is a floating 534point value specified in MHz. So, for instance, 535.Sq 20.000 536is a legal value, as is 537.Sq 20 . 538.It Fl T Ar enable|disable 539Enable or disable tagged queueing for a device. 540.It Fl U 541Show or set user negotiation settings. The default is to show or set 542current negotiation settings. 543.It Fl v 544The verbose switch has special meaning for the 545.Ic negotiate 546subcommand. It causes 547.Nm 548to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the 549controller driver. 550.It Fl W Ar bus_width 551Specify the bus width to negotiate with a device. The bus width is 552specified in bits. The only useful values to specify are 8, 16, and 32 553bits. The controller must support the bus width in question in order for 554the setting to take effect. 555.El 556.Pp 557In general, sync rate and offset settings will not take effect for a 558device until a command has been sent to the device. The 559.Fl a 560switch above will automatically send a Test Unit Ready to the device so 561negotiation parameters will take effect. 562.It Ic format 563Issue the 564.Tn SCSI 565FORMAT UNIT command to the named device. 566.Pp 567.Em WARNING! WARNING! WARNING! 568.Pp 569Low level formatting a disk will destroy ALL data on the disk. Use 570extreme caution when issuing this command. Many users low-level format 571disks that do not really need to be low-level formatted. There are 572relatively few scenarios that call for low-level formatting a disk. 573One reason for 574low-level formatting a disk is to initialize the disk after changing 575its physical sector size. Another reason for low-level formatting a disk 576is to revive the disk if you are getting "medium format corrupted" errors 577from the disk in response to read and write requests. 578.Pp 579Some disks take longer than others to format. Users should specify a 580timeout long enough to allow the format to complete. The default format 581timeout is 3 hours, which should be long enough for most disks. Some hard 582disks will complete a format operation in a very short period of time 583(on the order of 5 minutes or less). This is often because the drive 584doesn't really support the FORMAT UNIT command -- it just accepts the 585command, waits a few minutes and then returns it. 586.Pp 587The 588.Sq format 589subcommand takes several arguments that modify its default behavior. The 590.Fl q 591and 592.Fl y 593arguments can be useful for scripts. 594.Pp 595.Bl -tag -width 6n 596.It Fl q 597Be quiet, don't print any status messages. This option will not disable 598the questions, however. To disable questions, use the 599.Fl y 600argument, below. 601.It Fl w 602Issue a non-immediate format command. By default, 603.Nm 604issues the FORMAT UNIT command with the immediate bit set. This tells the 605device to immediately return the format command, before the format has 606actually completed. Then, 607.Nm 608gathers 609.Tn SCSI 610sense information from the device every second to determine how far along 611in the format process it is. If the 612.Fl w 613argument is specified, 614.Nm 615will issue a non-immediate format command, and will be unable to print any 616information to let the user know what percentage of the disk has been 617formatted. 618.It Fl y 619Don't ask any questions. By default, 620.Nm 621will ask the user if he/she really wants to format the disk in question, 622and also if the default format command timeout is acceptable. The user 623will not be asked about the timeout if a timeout is specified on the 624command line. 625.El 626.It Ic help 627Print out verbose usage information. 628.El 629.Sh ENVIRONMENT 630The 631.Ev SCSI_MODES 632variable allows the user to specify an alternate mode page format file. 633.Pp 634The 635.Ev EDITOR 636variable determines which text editor 637.Nm 638starts when editing mode pages. 639.Sh FILES 640.Bl -tag -width /usr/share/misc/scsi_modes -compact 641.It Pa /usr/share/misc/scsi_modes 642is the SCSI mode format database. 643.It Pa /dev/xpt0 644is the transport layer device. 645.It Pa /dev/pass* 646are the CAM application passthrough devices. 647.El 648.Sh EXAMPLES 649.Dl camcontrol eject -n cd -u 1 -v 650.Pp 651Eject the CD from cd1, and print SCSI sense information if the command 652fails. 653.Pp 654.Dl camcontrol tur da0 655.Pp 656Send the SCSI test unit ready command to da0. 657The 658.Nm 659utility will report whether the disk is ready, but will not display sense 660information if the command fails since the 661.Fl v 662switch was not specified. 663.Pp 664.Bd -literal -offset indent 665camcontrol tur da1 -E -C 4 -t 50 -v 666.Ed 667.Pp 668Send a test unit ready command to da1. Enable kernel error recovery. 669Specify a retry count of 4, and a timeout of 50 seconds. Enable sense 670printing (with the 671.Fl v 672flag) if the command fails. Since error recovery is turned on, the 673disk will be spun up if it is not currently spinning. 674The 675.Nm 676utility will report whether the disk is ready. 677.Bd -literal -offset indent 678camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e 679 -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1" 680.Ed 681.Pp 682Issue a READ BUFFER command (0x3C) to cd1. Display the buffer size of cd1, 683and display the first 10 bytes from the cache on cd1. Display SCSI sense 684information if the command fails. 685.Pp 686.Bd -literal -offset indent 687camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e 688 -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8 689.Ed 690.Pp 691Issue a WRITE BUFFER (0x3B) command to cd1. Write out 10 bytes of data, 692not including the (reserved) 4 byte header. Print out sense information if 693the command fails. Be very careful with this command, improper use may 694cause data corruption. 695.Pp 696.Bd -literal -offset indent 697camcontrol modepage da3 -m 1 -e -P 3 698.Ed 699.Pp 700Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the 701settings on the drive. Mode page 1 contains a disk drive's auto read and 702write reallocation settings, among other things. 703.Pp 704.Dl camcontrol rescan all 705.Pp 706Rescan all SCSI busses in the system for devices that have been added, 707removed or changed. 708.Pp 709.Dl camcontrol rescan 0 710.Pp 711Rescan SCSI bus 0 for devices that have been added, removed or changed. 712.Pp 713.Dl camcontrol rescan 0:1:0 714.Pp 715Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or 716changed. 717.Pp 718.Dl camcontrol tags da5 -N 24 719.Pp 720Set the number of concurrent transactions for da5 to 24. 721.Pp 722.Bd -literal -offset indent 723camcontrol negotiate -n da -u 4 -T disable 724.Ed 725.Pp 726Disable tagged queueing for da4. 727.Pp 728.Bd -literal -offset indent 729camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a 730.Ed 731.Pp 732Negotiate a sync rate of 20MHz and an offset of 15 with da3. Then send a 733Test Unit Ready command to make the settings take effect. 734.Sh SEE ALSO 735.Xr cam 3 , 736.Xr cam_cdbparse 3 , 737.Xr cam 4 , 738.Xr pass 4 , 739.Xr xpt 4 740.Sh HISTORY 741The 742.Nm 743utility first appeared in 744.Fx 3.0 . 745.Pp 746The mode page editing code and arbitrary SCSI command code are based upon 747code in the old 748.Xr scsi 8 749utility and 750.Xr scsi 3 751library, written by Julian Elischer and Peter Dufault. The 752.Xr scsi 8 753program first appeared in 754.Bx 386 0.1.2.4 , 755and first appeared in 756.Fx 757in 758.Fx 2.0.5 . 759.Sh AUTHORS 760.An Kenneth Merry Aq ken@FreeBSD.org 761.Sh BUGS 762The code that parses the generic command line arguments doesn't know that 763some of the subcommands take multiple arguments. So if, for instance, you 764tried something like this: 765.Bd -literal -offset indent 766camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v 767.Ed 768.Pp 769The sense information from the test unit ready command would not get 770printed out, since the first 771.Xr getopt 3 772call in 773.Nm 774bails out when it sees the second argument to 775.Fl c 776(0x00), 777above. Fixing this behavior would take some gross code, or changes to the 778.Xr getopt 3 779interface. The best way to circumvent this problem is to always make sure 780to specify generic 781.Nm 782arguments before any command-specific arguments. 783