xref: /freebsd/usr.sbin/fdcontrol/fdcontrol.8 (revision 8ccc0d235c226d84112561d453c49904398d085c)
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 November 16, 2025
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 DEPRECATION NOTICE
41.Nm
42is deprecated and may not be present in
43.Fx 16.0
44and later.
45.Sh DESCRIPTION
46The
47.Nm
48utility allows the modification of the run-time behavior of the
49.Xr fdc 4
50driver for the device specified by
51.Ar device .
52.Pp
53Commands are implemented to query the current device density settings
54as well as the underlying device hardware as registered with the
55driver, to manipulate debugging levels, and to adjust the device
56density settings.
57All the operations that manipulate the kernel
58settings are restricted to the superuser (by the device driver), while
59all inquiry requests only require read access to
60.Ar device .
61.Pp
62The
63.Ar device
64argument should always be given as a full path name, e.g.\&
65.Pa /dev/fd0 .
66.Ss Inquiry Commands
67Running the
68.Nm
69utility without any of the optional flags will report the drive type
70that is registered with the device driver.
71In the shortest form, a single string describing the drive type will
72be returned.
73Possible values are:
74.Dq Li 360K ,
75.Dq Li 1.2M ,
76.Dq Li 720K ,
77.Dq Li 1.44M ,
78.Dq Li 2.88M ,
79or
80.Dq Li unknown .
81This information is primarily intended to be easily parsable by
82scripts.
83.Pp
84In order to add some descriptive text that makes the output better
85human readable, the flag
86.Fl v
87can be added.
88.Pp
89Specifying flag
90.Fl F
91will report the device's density settings in a form that is suitable
92as input to the
93.Fl s Ar fmtstr
94option (see below).
95Again, together with
96.Fl v ,
97some more text will be returned, including the total capacity of the
98density settings in kilobytes.
99.Ss Debug Control
100The
101.Xr fdc 4
102control utilities support two different options how to specify device
103density settings.
104The first form uses
105.Fl f Ar fmt
106to specify the format of the medium in kilobytes.
107Depending on the
108underlying drive type, the value is compared against a table of known
109commonly used device density settings for that drive, and if a match
110is found, those settings will be used.
111Currently, the following
112values for the respective drive types are acceptable:
113.Bl -item
114.It
1152.88M and 1.44M drives:
116.Bd -ragged -offset indent -compact
117.TS
118lB lB lB lB lB lB lB
119r l l l l l l.
120KB	sectrac	secsize	ncyls	speed	heads	flags
1211721	21	2 (512)	82	500	2	MFM
1221476	18	2 (512)	82	500	2	MFM
1231440	18	2 (512)	80	500	2	MFM
1241200	15	2 (512)	80	500	2	MFM
125820	10	2 (512)	82	250	2	MFM
126800	10	2 (512)	80	250	2	MFM
127720	9	2 (512)	80	250	2	MFM
128.TE
129.Ed
130.It
1311.2M drives:
132.Bd -ragged -offset indent -compact
133.TS
134lB lB lB lB lB lB lB
135r l l l l l l.
136KB	sectrac	secsize	ncyls	speed	heads	flags
1371200	15	2 (512)	80	500	2	MFM
1381232	8	3 (1024)	77	500	2	MFM
1391476	18	2 (512)	82	500	2	MFM
1401440	18	2 (512)	80	500	2	MFM
1411200	15	2 (512)	80	500	2	MFM
142820	10	2 (512)	82	300	2	MFM
143800	10	2 (512)	80	300	2	MFM
144720	9	2 (512)	80	300	2	MFM
145360	9	2 (512)	40	300	2	MFM,2STEP
146640	8	2 (512)	80	300	2	MFM
147.TE
148.Ed
149.It
150720K drives:
151.Bd -ragged -offset indent -compact
152.TS
153lB lB lB lB lB lB lB
154r l l l l l l.
155KB	sectrac	secsize	ncyls	speed	heads	flags
156720	9	2 (512)	80	250	2	MFM
157.TE
158.Ed
159.It
160360K drives:
161.Bd -ragged -offset indent -compact
162.TS
163lB lB lB lB lB lB lB
164r l l l l l l.
165KB	sectrac	secsize	ncyls	speed	heads	flags
166360	9	2 (512)	40	250	2	MFM
167.TE
168.Ed
169.El
170.Pp
171The second form to specify a device density uses
172.Fl s Ar fmtstr
173to explicitly specify each parameter in detail.
174The argument
175.Ar fmtstr
176is a comma-separated list of values of the form:
177.Pp
178.Sm off
179.Ar sectrac , secsize , datalen , gap , ncyls , speed ,
180.Ar heads , f_gap , f_inter , offs2 , flags
181.Sm on
182.Pp
183The meaning of the parameters is:
184.Bl -tag -width ".Ar secsize"
185.It Ar sectrac
186The number of sectors per track.
187.It Ar secsize
188The sector size code, 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512
189bytes, 3 = 1024 bytes.
190.It Ar datalen
191The actual sector size if the size code is 0, or the (ignored) value
1920xFF for larger size codes.
193.It Ar gap
194The length of the gap 3 parameter for read/write operations.
195.It Ar ncyls
196The number of cylinders.
197.It Ar speed
198The transfer speed in kilobytes per second.
199Can be 250, 300, 500, or
2001000, but each drive type only supports a subset of these values.
201.It Ar heads
202The number of heads.
203.It Ar f_gap
204The length of the gap 3 when formatting media.
205.It Ar f_inter
206The sector interleave to be applied when formatting.
2070 means no
208interleave, 1 means 1:1 etc.
209.It Ar offs2
210The offset of the sector numbers on side 2 (i.e., head number 1).
211Normally, sector numbering on both sides starts with 1.
212.It Ar flags
213A list from one of the following flag values:
214.Pp
215.Bl -tag -width ".Cm +perpend" -compact
216.It Cm +mfm
217Use MFM encoding.
218.It Cm -mfm
219Use FM (single-density) encoding.
220.It Cm +2step
221Use 2 steps per each cylinder (for accessing 40-cylinder media in
22280-cylinder drives).
223.It Cm -2step
224Do not use 2 steps per cylinder, i.e., access each physical cylinder
225of the drive.
226.It Cm +perpend
227Use perpendicular recording (for 2.88 MB media, currently not
228supported).
229.It Cm -perpend
230Use longitudinal recording.
231.El
232.El
233.Pp
234For any missing parameter, the current value will be used, so only
235actual changes need to be specified.
236Thus to turn off a flag bit
237(like
238.Cm +mfm
239which is the default for all drive types), the form with a leading
240minus sign must explicitly be used.
241.Sh EXAMPLES
242A simple inquiry about the drive type:
243.Bd -literal -offset indent
244$ fdcontrol /dev/fd0
2451.44M
246.Ed
247.Pp
248Same as above, but with verbose output.
249Note that the result is about
250the
251.Em "drive type" ,
252as opposed to a
253.Em "device density" ,
254so it is independent from the actual subdevice being used for
255.Ar device .
256.Bd -literal -offset indent
257$ fdcontrol -v /dev/fd0
258/dev/fd0: 1.44M drive (3.5" high-density)
259.Ed
260.Pp
261Inquiry about the density settings:
262.Bd -literal -offset indent
263$ fdcontrol -F /dev/fd0
26418,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm
265.Ed
266.Pp
267The verbose flag makes this human readable:
268.Bd -literal -offset indent
269/dev/fd0: 1440 KB media type
270        Format:         18,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm
271        Sector size:    512
272        Sectors/track:  18
273        Heads/cylinder: 2
274        Cylinders/disk: 80
275        Transfer rate:  500 kbps
276        Sector gap:     27
277        Format gap:     108
278        Interleave:     1
279        Side offset:    0
280        Flags           <MFM>
281.Ed
282.Pp
283As indicated, trailing commas in the parameter list may be omitted.
284.Pp
285In order to access archaic 160 KB single-density (FM encoded) 5.25
286media in a modern 1.2M drive, something like the following definition
287would be needed.
288(Note that not all controller hardware is actually
289capable of handling FM encoding at all.)
290.Bd -literal
291# fdcontrol -s 16,128,0x80,0x2,40,300,,0x10,,,-mfm,+2step /dev/fd1.1
292.Ed
293.Pp
294It is still possible to hook up 8" drives to most modern floppy
295controllers, given the right cable magic.
296(On PC hardware, tell the BIOS that it is a 5.25" drive.)
297The classical 128/26/2/77 format can be read with this entry
298.Bd -literal -offset indent
299fdcontrol -s  26,128,0x80,0x2,77,500,2,0x10,,,-mfm /dev/fd0
300.Ed
301.Sh SEE ALSO
302.Xr fdc 4
303.Sh HISTORY
304The
305.Nm
306utility appeared in
307.Fx 2.0 ,
308and was vastly overhauled in
309.Fx 5.0 .
310.Sh AUTHORS
311The program and this man page was contributed by
312.An J\(:org Wunsch ,
313Dresden.
314