Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Oct 2004 04:28:34 -0700
From:      Bruce M Simpson <bms@spc.org>
To:        freebsd-current@FreeBSD.org
Subject:   Re: Help wanted re formatting USB floppies.
Message-ID:  <20041006112834.GC1794@empiric.icir.org>
In-Reply-To: <20041006092156.GA690@empiric.icir.org>
References:  <20041006092156.GA690@empiric.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--L2Brqb15TUChFOBK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I realize this is a bit of a long post, but I believe I've found the answer.

Those of you who want to format a USB floppy on FreeBSD right at this
moment may have luck with the following uber sekret combination:

camcontrol cmd ${DEVNAME} \
	-c "04 17 00 00 00 00 00 00 00 00 00 00" \
	-o 12 "00 A0 00 08 00 00 0B 40 00 00 02 00"

This roughly means 'format everything on this disk with 2880 512-byte block=
s'
in USB-floppy-ese; where ${DEVNAME} is the device name of your USB floppy.

For those of you who were always told to show your working in school,
=66rom my notes:

%%%
 - Format track 0 with USB-FDU defaults.
 Looks like it's hanging. But there's additional data needed! It needs a=20
Format Parameter List
 on the Bulk endpoint (!!).
 Needs a parameter list as follows:

 4-byte Defect List Header:
00 reserved
     FOV | (0) | DCRT | (0) | (0) | (0) | (0) | (0)  --> A0
A0  format options valid, disable certification, not immediate, all tracks.
00
08 defect list length (must always be 8 bytes, length of the format descrip=
tor
which follows)

 8-byte Format Descriptor:
00 00 0B 40    -> 2880 blocks
00  reserved
00 02 00   -> 512 byte blocks

these values come from the format descriptor:
empiric# camcontrol cmd da0 -v -v -c "23 00 00 00 00 00 00 00 20 00 00 00" =
-i 0x
20 "{} *i3 {Len} i1 {Blocks} i4 {} *b6 {Code} b2 {Blocklen} i3"
32 2880 2 512
%%%

This is not an 'exact science' yet. A more user friendly USB/SCSI/ATAPI
removable disk formatting program should be forthcoming soon. A track by
track format is what I believe Windows does, though I haven't done any
USB reverse engineering to confirm this.  newfs_msdos(8) seems to like it:

empiric# newfs_msdos da0 auto
/dev/da0: 2840 sectors in 355 FAT12 clusters (4096 bytes/cluster)
bps=3D512 spc=3D8 res=3D1 nft=3D2 rde=3D512 sec=3D2880 mid=3D0xf0 spf=3D2 s=
pt=3D32 hds=3D64 hid=3D0

Hex dumps using vim's xxd(1) of /dev/da0 on my system seem to confirm that
the device did indeed format properly.

Blimey, all that for something ordinary people do every day on Windows
machines without a second thought.

Have fun, I'm off to bed.
BMS

--L2Brqb15TUChFOBK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Comment: ''

iD8DBQFBY9bhueUpAYYNtTsRAuGzAJ0apRznVxiPLa2RwMtp/cX0u2xPmACePoXN
oXDTut1C532y29X0PqvJPGs=
=LqYc
-----END PGP SIGNATURE-----

--L2Brqb15TUChFOBK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041006112834.GC1794>