Discussion:
Issuing ATA commands to a disk connected by USB interface
(too old to reply)
Prageeth KS
2005-07-15 04:15:52 UTC
Permalink
Hi/

I am describing a customer requirement and one proposed solution for
the same. Please check out and suggest any better methods if it exists.

Problem:
-A ATA harddisk drive accepts ATA commands to lock/unlock the drive
using passwords
-The requirement is to unlock the drive when it is connected to a Win2K
PC to the USB port, using an USB-to-ATA adaptor, for maintenenece
purposes

Proposed Solution:
-From my understanding, an USB storage device accepts SCSI commands
only
-There is an interface IOCTL_SCSI_PASS_THROUGH, by which it is possible
to give a SCSI command directly to the device
-There is a SCSI command ATA COMMAND PASS THROUGH by which an ATA
command can be wrapped up in a SCSI command
-Hence, the planned solution is to send an IOCTL_SCSI_PASS_THROUGH to
the drive with SCSI command ATA COMMAND PASS THROUGH with data as the
ATA command to lock/unlock the drive

Please let me know your comments.

Regards,
Prageeth
Gary G. Little
2005-07-15 23:06:02 UTC
Permalink
Since ATA pass through is only for Windows XP SP2 or Server 2003, wrapping
such a command with SCSI pass through to send to a USB port to then send it
to a device at the other end of the USB cable is kind of silly, unless that
other device is expecting an ATA pass thorugh command which it most likely
isn't since it most likely is expecting a TFR. <gasp> The big question here
is if the USB Storage stack will handle SCSI Pass through properly to send
the TFR command to the device. If not ... it won't work.
--
Gary G. Little
Post by Prageeth KS
Hi/
I am describing a customer requirement and one proposed solution for
the same. Please check out and suggest any better methods if it exists.
-A ATA harddisk drive accepts ATA commands to lock/unlock the drive
using passwords
-The requirement is to unlock the drive when it is connected to a Win2K
PC to the USB port, using an USB-to-ATA adaptor, for maintenenece
purposes
-From my understanding, an USB storage device accepts SCSI commands
only
-There is an interface IOCTL_SCSI_PASS_THROUGH, by which it is possible
to give a SCSI command directly to the device
-There is a SCSI command ATA COMMAND PASS THROUGH by which an ATA
command can be wrapped up in a SCSI command
-Hence, the planned solution is to send an IOCTL_SCSI_PASS_THROUGH to
the drive with SCSI command ATA COMMAND PASS THROUGH with data as the
ATA command to lock/unlock the drive
Please let me know your comments.
Regards,
Prageeth
Prageeth KS
2005-07-21 00:44:27 UTC
Permalink
Post by Gary G. Little
The big question here
is if the USB Storage stack will handle SCSI Pass through properly to send
the TFR command to the device. If not ... it won't work.
From Microsoft USB storage FAQ, it is possible to use SCSI pass
through. http://www.microsoft.com/whdc/device/storage/usbfaq.mspx


Regards,
Prageeth
heinz
2005-07-16 04:04:23 UTC
Permalink
Post by Prageeth KS
There is a SCSI command ATA COMMAND PASS THROUGH by
which an ATA command can be wrapped up in a SCSI command
Can you provide more details about this? Is it a vendor unique command
supported by your particular device? If so, that should work. The
problems start to happen when you try to use the Windows IDE/ATA pass
through IOCTL's which it sounds like you are not considering.

A purist solution to this problem is to implement real SCSI commands
incorporating the desired ATA command functionality (eg: mode sense /
mode select) so you don't need to do any sort of ATA tunneling. If you
want to experiment sending your pass through command and monitoring,
you can try this tool if desired: http://www.perisoft.net/bushound
Prageeth KS
2005-07-21 00:45:48 UTC
Permalink
Thanks for the tool. Looks cool..
Maxim S. Shatskih
2005-07-19 22:26:22 UTC
Permalink
Post by Prageeth KS
-The requirement is to unlock the drive when it is connected to a Win2K
PC to the USB port, using an USB-to-ATA adaptor, for maintenenece
The adapter does some translation from USB storage commands (subset of SCSI) to
ATA commands. If the ATA lock/unlock commands are not translated by the
hardware - then the task is impossible.

The task is impossible for a general case, and can only be done for some known
USB-ATA adapters.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Prageeth KS
2005-07-20 04:30:46 UTC
Permalink
Sorry if my post was not clear enough. I was planning to send the SCSI
command ATA COMMAND PASS THROUGH (0xCC), and package the ATA command to
unlock the drive inside the same, so that no SCSI->ATA command
translation by the hardware is necessary if it supports the SCSI
command ATA COMMAND PASS THROUGH.

I got the cue from:
http://www.osronline.com/showThread.cfm?link=31328 and
ftp://ftp.heise.de/pub/ct/listings/0207-218.zip

Will that work out?

Rgds,
Prageeth
Post by Maxim S. Shatskih
Post by Prageeth KS
-The requirement is to unlock the drive when it is connected to a Win2K
PC to the USB port, using an USB-to-ATA adaptor, for maintenenece
The adapter does some translation from USB storage commands (subset of SCSI) to
ATA commands. If the ATA lock/unlock commands are not translated by the
hardware - then the task is impossible.
The task is impossible for a general case, and can only be done for some known
USB-ATA adapters.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
http://www.storagecraft.com
Maxim S. Shatskih
2005-07-20 11:52:06 UTC
Permalink
Depends on particular USB->ATA adapter.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Post by Prageeth KS
Sorry if my post was not clear enough. I was planning to send the SCSI
command ATA COMMAND PASS THROUGH (0xCC), and package the ATA command to
unlock the drive inside the same, so that no SCSI->ATA command
translation by the hardware is necessary if it supports the SCSI
command ATA COMMAND PASS THROUGH.
http://www.osronline.com/showThread.cfm?link=31328 and
ftp://ftp.heise.de/pub/ct/listings/0207-218.zip
Will that work out?
Rgds,
Prageeth
Post by Maxim S. Shatskih
Post by Prageeth KS
-The requirement is to unlock the drive when it is connected to a Win2K
PC to the USB port, using an USB-to-ATA adaptor, for maintenenece
The adapter does some translation from USB storage commands (subset of SCSI) to
ATA commands. If the ATA lock/unlock commands are not translated by the
hardware - then the task is impossible.
The task is impossible for a general case, and can only be done for some known
USB-ATA adapters.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
http://www.storagecraft.com
heinz
2005-07-22 04:53:44 UTC
Permalink
Post by Prageeth KS
Sorry if my post was not clear enough. I was planning to send the SCSI
command ATA COMMAND PASS THROUGH (0xCC), and package the ATA command to
unlock the drive inside the same, so that no SCSI->ATA command
translation by the hardware is necessary if it supports the SCSI
command ATA COMMAND PASS THROUGH.
http://www.osronline.com/showThread.cfm?link=31328 and
ftp://ftp.heise.de/pub/ct/listings/0207-218.zip
Will that work out?
What you are looking at is a pass through API that was only implemented
in NT 4 SP5 and only for devices attached to the IDE bus. It is nothing
more than a legacy piece of wreckage in Windows chaotic ATA pass
through history. There have been numerous API schemes (both documented
and not) in various Windows operating systems to send ATA commands over
the years. The one you are looking at had the shortest life span of all
of them. Because your device is attached via USB, you can forget about
using any of the Windows ATA pass through mechanisms. Your only hope is
that the firmware on your particular device has a special CDB that
allows you to package an ATA command inside. That way, you can secretly
send the ATA command inside a scsi pass through unbeknownst to Windows.
But again, this will require a special, vendor unique firmware
extension in the device and will not work with any other devices.
Prageeth KS
2005-07-26 01:48:25 UTC
Permalink
This post might be inappropriate. Click to display it.
heinz
2005-07-26 05:22:25 UTC
Permalink
Post by Prageeth KS
Hence, i am concluding that sending the specific ATA command is not
possible over USB. Any alternative solution is welcome but i do not
have control over the device firmware to implement a custom CDB.
Ok, in that case there is a little known back door to get your command
through, but it is going to require some work. First find out what USB
bridge chip is used and get the technical specification for it. USB
storage devices like yours are likely just a native ATA drive with a
converter chip in front of it that translates USB to ATA. The tailgate
chip is one popular example. All such chips accept SCSI commands inside
USB requests which the chip translates to ATA commands and sends to the
device. What you want to do is search this specification for a way to
send ATA commands (not SCSI commands) inside USB requests. Windows
provides no API to access this functionality, but you can build it
yourself. This will likely involve a series of USB bulk transfers over
pipes 2 & 82 for command, data payload, and status.

The caveats are you will need a driver (not an app) in order to submit
USB requests via URB's and you might need to serialize your activity
to the device with the Windows USB drivers. But if you REALLY need it,
that is the recipe.
Maxim S. Shatskih
2005-07-26 07:00:19 UTC
Permalink
Post by Prageeth KS
Hence, i am concluding that sending the specific ATA command is not
possible over USB. Any alternative solution is welcome but i do not
Yes, at least till all device vendors will support this SCSI command in their
firmware.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Loading...