chacham15
chacham15

Reputation: 14281

How do I get the Hard Drive serial number of a USB drive on OS X?

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

Answers (1)

Charles Burns
Charles Burns

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:

  1. The USB bridge must support ATA pass-through (if ATA)
  2. SCSI must be supported on the host OS
  3. The OS must provide a SCSI pass-through API (Yes on Windows and Linux, No on MacOS X)

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

Related Questions