26 - Send and sniff commands to/from your USB device (and see what your BIOS would see!)
Note: It seems this utility is no longer available from Logix4u!
Please scroll down for alternatives...
USB Flash drives are attached by Windows as a virtual SCSI device. The USB command set is a lot like the SCSI/SAS/SATA/iSCSI and ATAPI command sets and you can access your USB device via Windows SCSI pass-through commands. However, there is a very useful utility that lets you interrogate your USB Storage Device just as if it is was a SCSI or ATAPI Storage device using these pass-through commands. You can download it here and it is called simply Logix4u SCSI Utility. I have tested this on Windows 7 64-bit systems and it works! Don't forget to Run as Administrator!
Logix4u SCSI Utility is a simple application that enumerates all SCSI devices (including SAS, SATA, ATAPI, iSCSI and USB storage devices) on the host machine and can send custom or predefined CDBs to any enumerated device. Many CDBs including Inquiry, Read Capacity, Log Sense, Request Sense are already defined in the application and can be invoked by a single click from a menu of preset commands. The custom CDB feature allows the user to build custom CDBs and send it to any device and see the results (note: I have not yet tested this function!).
The Logix4u SCSI utility will enumerate all SCSI/SAS/SATA/ATAPI/iSCSI devices on the host and will display it as a tree.
The following commands are implemented in the SCSI Utility
Supported VPD Pages
Device Identification VPD Page
Unit Serial Number VPD Page
VPD Page by Code (Any VPD page can be retrieved by specifying the page code)
Test Unit Ready
Start Stop Unit (Start,Stop,Load,Eject)
Supported Log Pages
Temperature Log Page
Application Client Log Page
Custom CDB (Build a custom CDB and execute)
However, not all of these seem to work (may depend on your hard disk or Windows IDE/SATA/SCSI disk driver).
Right click a target from the device tree on the left side and select Inquiry and then standard. SCSI Utility displays the inquiry information in the format specified by SPC. Optionally, the raw binary data can be displayed by selecting the "View Binary" check box.
Note: A hard disk Inquiry Command - note RMB=0 means it is classed as a Fixed Disk not a Removable Disk.
The screenshot below shows the results of a Standard Inquiry command to a USB card reader which contains a 4GB SD card (click on it to enlarge).
Lets have a look at my Patriot XT Rage 32GB USB Flash drive which has a 27MB/s Read and Write speed (cool - eh?):
Standard SCSI Inquiry command - note byte 1 bit 7 shows RMB = 1 which indicates this is classed as a Removable Device
Note also that the Peripheral Device Type is 0h which means SBC Direct Access Device. Type 0, 0x7 and 0xE must also support the Mode Sense and Read Capacity commands.
Many of the commands return this data - I suspect that the SCSI utility or Windows
is not correctly passing on or returning the commands correctly on USB drives
as it is always the same data returned for different commands!
Inquiry - supported VPD pages for a SATA hard disk (non-USB) - 0003 entries in table (no of entries at 3rd/4th byte) so pages 00, 80 and 83 supported. 00h= supported VPD page, 80h (Unit Serial Number), 83h (Device Identification)
Response after a Request Sense command - not much info here!
Here is a Request Sense response from an SD Card Reader see here for meaning of these bytes.
Response after a Read Capacity command (note that the data returned is defined by the spec. as the last logical block number and NOT the Capacity!
So (3BA3FFF+1)*200h = 32019316736 bytes (and not 32019316224 as incorrectly shown by the app!).
Here are the commands that a USB Mass Storage device should support:
However, the USB Mass Storage Specification for Bootability only specifies Inquiry, Read, Test Unit Ready, Request Sense, Mode Sense and Read Capacity for type 0 USB Mass Storage Bootable Devices.
More USB developers info can be found on this page which has lots of useful links and specifications.
The windows version of hdparm.exe can be found here. You can unlock a drive or use the secure erase command to erase a hard disk using this software. Try the -I /dev/sda command to return drive info.
Another utility is StorInfo from Bus Trace Technologies - it can be downloaded from here. For Flash Drives you can get the Device Inquiry data as shown below:
This is for an 8GiB TakeMS Flash memory stick.
USB Sniffer/Data Logger
Want to see what USB commands and data are actually being sent and received? Try the Advanced USB Port Monitor from here. The download is free (for a trial version which is almost fully functional). You can see all the USB traffic to any device.
Simple USB Logger (free) - captures live USB traffic to/from a USB device under Windows from Incentives Pro
Click File - New Session to start logging. To view raw data, select a transaction and then click on Window - 2 usblog.
WHAT PROBLEMS CAN BE SOLVED WITH ADVANCED USB PORT MONITOR?
The Advanced USB Port Monitor software allows you to display the packets sent, decode the descriptors, detect errors in peripherals or drivers, and measure device and driver performance. When capturing the packets, the real-time statistical display permits you to check the bus status, even before you look at the packets that have been read. These are displayed in a chronological list together with the peripheral's address and the endpoint number. To make it easier to identify the packets you are interested in, the software provides filtering and packet color coding functions. It also gives the user the choice of several levels of detail, and the information taken from the traffic contains references to the USB specification. It will help you to develop USB devices and analyze their traffic on all stages of a development process.
If you select Tools - Open the waiting monitor window and then insert a FAT32 USB drive, you will be amazed at how much data Windows will read from the USB drive! First the MBR is read about 10 times (!) and then the entire FAT table is read.