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