xref: /freebsd/usr.sbin/fdcontrol/fdcontrol.8 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1.\" Copyright (C) 1994, 2001 by Joerg Wunsch, Dresden
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
14.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
19.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
20.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
24.\" DAMAGE.
25.\"
26.Dd April 7, 2017
27.Dt FDCONTROL 8
28.Os
29.Sh NAME
30.Nm fdcontrol
31.Nd display and modify floppy disk parameters
32.Sh SYNOPSIS
33.Nm
34.Op Fl F
35.Op Fl d Ar dbg
36.Op Fl f Ar fmt
37.Op Fl s Ar fmtstr
38.Op Fl v
39.Ar device
40.Sh DESCRIPTION
41The
42.Nm
43utility allows the modification of the run-time behavior of the
44.Xr fdc 4
45driver for the device specified by
46.Ar device .
47.Pp
48Commands are implemented to query the current device density settings
49as well as the underlying device hardware as registered with the
50driver, to manipulate debugging levels, and to adjust the device
51density settings.
52All the operations that manipulate the kernel
53settings are restricted to the superuser (by the device driver), while
54all inquiry requests only require read access to
55.Ar device .
56.Pp
57The
58.Ar device
59argument should always be given as a full path name, e.g.\&
60.Pa /dev/fd0 .
61.Ss Inquiry Commands
62Running the
63.Nm
64utility without any of the optional flags will report the drive type
65that is registered with the device driver.
66In the shortest form, a single string describing the drive type will
67be returned.
68Possible values are:
69.Dq Li 360K ,
70.Dq Li 1.2M ,
71.Dq Li 720K ,
72.Dq Li 1.44M ,
73.Dq Li 2.88M ,
74or
75.Dq Li unknown .
76This information is primarily intended to be easily parsable by
77scripts.
78.Pp
79In order to add some descriptive text that makes the output better
80human readable, the flag
81.Fl v
82can be added.
83.Pp
84Specifying flag
85.Fl F
86will report the device's density settings in a form that is suitable
87as input to the
88.Fl s Ar fmtstr
89option (see below).
90Again, together with
91.Fl v ,
92some more text will be returned, including the total capacity of the
93density settings in kilobytes.
94.Ss Debug Control
95The
96.Xr fdc 4
97control utilities support two different options how to specify device
98density settings.
99The first form uses
100.Fl f Ar fmt
101to specify the format of the medium in kilobytes.
102Depending on the
103underlying drive type, the value is compared against a table of known
104commonly used device density settings for that drive, and if a match
105is found, those settings will be used.
106Currently, the following
107values for the respective drive types are acceptable:
108.Bl -item
109.It
1102.88M and 1.44M drives:
111.Bd -ragged -offset indent -compact
112.TS
113lB lB lB lB lB lB lB
114r l l l l l l.
115KB	sectrac	secsize	ncyls	speed	heads	flags
1161721	21	2 (512)	82	500	2	MFM
1171476	18	2 (512)	82	500	2	MFM
1181440	18	2 (512)	80	500	2	MFM
1191200	15	2 (512)	80	500	2	MFM
120820	10	2 (512)	82	250	2	MFM
121800	10	2 (512)	80	250	2	MFM
122720	9	2 (512)	80	250	2	MFM
123.TE
124.Ed
125.It
1261.2M drives:
127.Bd -ragged -offset indent -compact
128.TS
129lB lB lB lB lB lB lB
130r l l l l l l.
131KB	sectrac	secsize	ncyls	speed	heads	flags
1321200	15	2 (512)	80	500	2	MFM
1331232	8	3 (1024)	77	500	2	MFM
1341476	18	2 (512)	82	500	2	MFM
1351440	18	2 (512)	80	500	2	MFM
1361200	15	2 (512)	80	500	2	MFM
137820	10	2 (512)	82	300	2	MFM
138800	10	2 (512)	80	300	2	MFM
139720	9	2 (512)	80	300	2	MFM
140360	9	2 (512)	40	300	2	MFM,2STEP
141640	8	2 (512)	80	300	2	MFM
142.TE
143.Ed
144.It
145720K drives:
146.Bd -ragged -offset indent -compact
147.TS
148lB lB lB lB lB lB lB
149r l l l l l l.
150KB	sectrac	secsize	ncyls	speed	heads	flags
151720	9	2 (512)	80	250	2	MFM
152.TE
153.Ed
154.It
155360K drives:
156.Bd -ragged -offset indent -compact
157.TS
158lB lB lB lB lB lB lB
159r l l l l l l.
160KB	sectrac	secsize	ncyls	speed	heads	flags
161360	9	2 (512)	40	250	2	MFM
162.TE
163.Ed
164.El
165.Pp
166The second form to specify a device density uses
167.Fl s Ar fmtstr
168to explicitly specify each parameter in detail.
169The argument
170.Ar fmtstr
171is a comma-separated list of values of the form:
172.Pp
173.Sm off
174.Ar sectrac , secsize , datalen , gap , ncyls , speed ,
175.Ar heads , f_gap , f_inter , offs2 , flags
176.Sm on
177.Pp
178The meaning of the parameters is:
179.Bl -tag -width ".Ar secsize"
180.It Ar sectrac
181The number of sectors per track.
182.It Ar secsize
183The sector size code, 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512
184bytes, 3 = 1024 bytes.
185.It Ar datalen
186The actual sector size if the size code is 0, or the (ignored) value
1870xFF for larger size codes.
188.It Ar gap
189The length of the gap 3 parameter for read/write operations.
190.It Ar ncyls
191The number of cylinders.
192.It Ar speed
193The transfer speed in kilobytes per second.
194Can be 250, 300, 500, or
1951000, but each drive type only supports a subset of these values.
196.It Ar heads
197The number of heads.
198.It Ar f_gap
199The length of the gap 3 when formatting media.
200.It Ar f_inter
201The sector interleave to be applied when formatting.
2020 means no
203interleave, 1 means 1:1 etc.
204.It Ar offs2
205The offset of the sector numbers on side 2 (i.e., head number 1).
206Normally, sector numbering on both sides starts with 1.
207.It Ar flags
208A list from one of the following flag values:
209.Pp
210.Bl -tag -width ".Cm +perpend" -compact
211.It Cm +mfm
212Use MFM encoding.
213.It Cm -mfm
214Use FM (single-density) encoding.
215.It Cm +2step
216Use 2 steps per each cylinder (for accessing 40-cylinder media in
21780-cylinder drives).
218.It Cm -2step
219Do not use 2 steps per cylinder, i.e., access each physical cylinder
220of the drive.
221.It Cm +perpend
222Use perpendicular recording (for 2.88 MB media, currently not
223supported).
224.It Cm -perpend
225Use longitudinal recording.
226.El
227.El
228.Pp
229For any missing parameter, the current value will be used, so only
230actual changes need to be specified.
231Thus to turn off a flag bit
232(like
233.Cm +mfm
234which is the default for all drive types), the form with a leading
235minus sign must explicitly be used.
236.Sh EXAMPLES
237A simple inquiry about the drive type:
238.Bd -literal -offset indent
239$ fdcontrol /dev/fd0
2401.44M
241.Ed
242.Pp
243Same as above, but with verbose output.
244Note that the result is about
245the
246.Em "drive type" ,
247as opposed to a
248.Em "device density" ,
249so it is independent from the actual subdevice being used for
250.Ar device .
251.Bd -literal -offset indent
252$ fdcontrol -v /dev/fd0
253/dev/fd0: 1.44M drive (3.5" high-density)
254.Ed
255.Pp
256Inquiry about the density settings:
257.Bd -literal -offset indent
258$ fdcontrol -F /dev/fd0
25918,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm
260.Ed
261.Pp
262The verbose flag makes this human readable:
263.Bd -literal -offset indent
264/dev/fd0: 1440 KB media type
265        Format:         18,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm
266        Sector size:    512
267        Sectors/track:  18
268        Heads/cylinder: 2
269        Cylinders/disk: 80
270        Transfer rate:  500 kbps
271        Sector gap:     27
272        Format gap:     108
273        Interleave:     1
274        Side offset:    0
275        Flags           <MFM>
276.Ed
277.Pp
278As indicated, trailing commas in the parameter list may be omitted.
279.Pp
280In order to access archaic 160 KB single-density (FM encoded) 5.25
281media in a modern 1.2M drive, something like the following definition
282would be needed.
283(Note that not all controller hardware is actually
284capable of handling FM encoding at all.)
285.Bd -literal
286# fdcontrol -s 16,128,0x80,0x2,40,300,,0x10,,,-mfm,+2step /dev/fd1.1
287.Ed
288.Pp
289It is still possible to hook up 8" drives to most modern floppy
290controllers, given the right cable magic.
291(On PC hardware, tell the BIOS that it is a 5.25" drive.)
292The classical 128/26/2/77 format can be read with this entry
293.Bd -literal -offset indent
294fdcontrol -s  26,128,0x80,0x2,77,500,2,0x10,,,-mfm /dev/fd0
295.Ed
296.Sh SEE ALSO
297.Xr fdc 4
298.Sh HISTORY
299The
300.Nm
301utility appeared in
302.Fx 2.0 ,
303and was vastly overhauled in
304.Fx 5.0 .
305.Sh AUTHORS
306The program and this man page was contributed by
307.An J\(:org Wunsch ,
308Dresden.
309