Re: [linux-minidisc] Building himdformat against libscg on MacOSX


Am Freitag, den 21.05.2010, 10:04 +0200 schrieb Adrian Glaubitz:
> On Fri, May 21, 2010 at 12:46:38AM +0200, manner.moe@gmx.de wrote:
> > >glaubitz@z6:~> ./himdformat_scg 9,0,0
> > >?: Input/output error. himd_format: scsi sendcmd: no error
> > The scsi communication works fine: scsi sendcmd: no error.
> > 
> > >CDB:  C2 00 00 00 03 00 00 00 00 00 00 00
> > >status: 0x2 (CHECK CONDITION)
> > >Sense Bytes: 70 00 03 00 00 00 00 0A 00 00 00 00 30 00 00 00
> > >Sense Key: 0x3 Medium Error, Segment 0
> > >Sense Code: 0x30 Qual 0x00 (incompatible medium installed) Fru 0x0
> > Look at the sense output: incompatible medium installed
> > Are you shure you tried to format a standard MD in himd format? 
> > Formatting 1GB mediums doesn´t work with this command.
> > I think we need "C2/00 erase himd" instead.
> 
> Yes, Michael pointed me to that issue in the channel yesterday
> already. I checked our documentation in the wiki [1] and it seems to
> be wrong at this point unfortunately:
> 
> * C2/00: Erase HiMD
> * C2/01: Format HiMD
> 
> I tried 0x00 but that didn't work. And, puzzingly enough, the original
> himdformat which is in git/master as well, uses 0x03 to format and I'm
> pretty sure that it worked before with (well, ok, I'm not sure whether
> it was with a 235MB or a 1GB medium).

It's pretty convinced. The "3" is not the format subcommand, but a flags
byte. I will add the info to the wiki soon.

Erase HiMD as well as Format HiMD have the following syntax:

12 bytes total.
cmd[0] is 0xC2 - Sony Device Control (or however you call it)
cmd[3] is the subcommand. In himdformat.c, this is 0, so it's "Erase
HiMD"
cmd[4] is the flags byte. For Erase and Format:
  Bit 0: IMMED (probably as in
http://en.wikipedia.org/wiki/SCSI_Start_Stop_Unit_Command, so it means
not to wait until formatting is finished if set)
  Bit 1: FUA (probably: "force unit access" as in
http://en.wikipedia.org/wiki/SCSI_Write_Commands, so it means that the
formatting/erasing should be directly written to the medium, not just to
the cache)
  Bit 2: NOFS (only for Format HiMD, probably means that the medium
should be formatted but no new FS created).


Regards,
  Michael Karcher