Reputation: 14281
I have looked at DADiskCopyDescription
and enumerating IOUSBDevice
from IOKit and neither provide me with the serial number of the USB hard drive. The latter provides a USB Serial number which is not equivalent to its hard drive serial number. How do I get that (in c/c++, NOT via the shell)?
Upvotes: 6
Views: 1726
Reputation: 10602
What you are basically asking is "How do I directly communicate with a hard drive over USB?"
The answer is: It depends on the USB controller. Not all controllers support your request.
The following conditions must exist:
Another factor arises: Some controllers support drive manufacturer-independent passthroughs, but some support different commands based on the hard drive they are controlling. This also depends on whether the attached drive is PATA, SATA/SAS, or SCSI.
Examples of controllers that support at least one of the above include Sunplus SPIF215/6, SPIF225/6; JMicron JM20329, JM20335-39; and Cypress CY7C68300B/C (AT2LP), CY7C68310 (ISD-300LP).
Wish I had happier news for you.
Upvotes: 5