From owner-freebsd-current@FreeBSD.ORG Wed Oct 6 11:28:41 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC09916A4CE for ; Wed, 6 Oct 2004 11:28:40 +0000 (GMT) Received: from arginine.spc.org (arginine.spc.org [195.206.69.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85EC643D2D for ; Wed, 6 Oct 2004 11:28:40 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id 783F965213 for ; Wed, 6 Oct 2004 12:28:39 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 95061-04-2 for ; Wed, 6 Oct 2004 12:28:38 +0100 (BST) Received: from empiric.dek.spc.org (adsl-67-121-93-86.dsl.snfc21.pacbell.net [67.121.93.86]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id 5297A65211 for ; Wed, 6 Oct 2004 12:28:38 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 7645564B3; Wed, 6 Oct 2004 04:28:34 -0700 (PDT) Date: Wed, 6 Oct 2004 04:28:34 -0700 From: Bruce M Simpson To: freebsd-current@FreeBSD.org Message-ID: <20041006112834.GC1794@empiric.icir.org> Mail-Followup-To: freebsd-current@FreeBSD.org References: <20041006092156.GA690@empiric.icir.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="L2Brqb15TUChFOBK" Content-Disposition: inline In-Reply-To: <20041006092156.GA690@empiric.icir.org> Subject: Re: Help wanted re formatting USB floppies. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2004 11:28:41 -0000 --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--