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