Re: Q: how to send ATA cmds to USB drive?

Jeff Garzik
2006-05-24T23:33:35Z

Robert Hancock wrote:
> Herbert Rosmanith wrote:
>> good day,
>>
>> I have a question concerning sending arbitrary ATA commands to an USB
>> drive.
>>
>> Currently, I have a particular application which sends special ATA
>> commands
>> to an IDE drive using IDE_TASKFILE. So far, this works pretty well.
>>
>> But now I also have to support USB harddisks from the same company.
>> The USB harddisk uses the same set of ATA commands as the IDE harddisk,
>> well, at least that's what I suppose.
>>
>> How do I send ATA commands to this USB drive? I suppose this would be
>> done via SG_IO (the drive is recognised by linux as usb-storage, of
>> course), but how exactly does this have to be done? I have already
>> used SG_IO before to send some MMC commands to cdvd-drives, but I
>> don't know how to send ATA (such as those from T13) commands with this
>> interface.
>
> Short answer is you likely can't. The USB-to-IDE bridge pretty much
> entirely hides the fact that it's an IDE drive behind it, from the
> host's viewpoint it looks pretty much like SCSI. Maybe if you sent SCSI
> commands to the device it would translate them into the correct ATA
> commands, depending on what exactly you're doing, but that's entirely
> dependent on the bridge chip in question and I would guess most of them
> don't support such fancy operations.

AFAIK most are not really pure bridges, but really microcontrollers
running a tiny firmware. So there is a non-zero chance of there being
an 'ata passthrough' SCSI command.

I would try to the official ATA_12 and ATA_16 SCSI commands first, to
see if they do something useful.

Jeff