According to Mass Storage spec, the SCSI command INQUIRY can distinguish USB HDD from USB flash memory.
After INQUIRY is send, data format of device returns is asbelow:
The field RMB (bit7 of byte 1)can tell this device is a HDD ornot .
If RMB=0b it means this is a HDD device.
If RMB=1b it means this is not a HDD device .