Re: Help wanted re formatting USB floppies.

From: Bruce M Simpson <bms_at_spc.org>
Date: Wed, 6 Oct 2004 04:28:34 -0700
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 blocks'
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,
from my notes:

%%%
 - Format track 0 with USB-FDU defaults.
 Looks like it's hanging. But there's additional data needed! It needs a 
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 descriptor
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=512 spc=8 res=1 nft=2 rde=512 sec=2880 mid=0xf0 spf=2 spt=32 hds=64 hid=0

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

Received on Wed Oct 06 2004 - 09:28:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:15 UTC