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)?
To find the serial number, insert the flash drive into your computer. Once recognized, display the properties of the USB device using the Device Manager within Windows. Under Properties is a Details tab with a drop-down menu. Select to display the serial number of your USB drive.
We have often started in the USBSTOR key, and then drilled down to identify the USB device. After identifying the device Vendor and Product, we proceed to the subkey of that key, and we see the values as shown in the diagram below. It has long been held (and reported) that this value is the serial number of the device.
In the Finder on your Mac, choose Finder > Preferences. Click General, then select the items you want to see on the desktop. For example, if you select “Hard disks,” icons for your hard disks appear on your desktop.
Hard Drive Serial Number The hard drive serial number or the SSD serial number is different from the volume serial number. To find the hard drive serial number or the solid-state drive serial number, enter the following command in the Command Prompt. wmic diskdrive get serialnumber
Open Start. Search for Command Prompt and click the top result to open the app. Type the following command to check the name, brand, model, and serial number information and press Enter: wmic diskdrive get model,serialNumber,size,mediaType
How to Find a Drive's Volume Label or Serial Number From the Command Prompt. Open Command Prompt. In Windows 10 and Windows 8, you can find Command Prompt by right-clicking the Start button. In older versions of Windows, either search the Start menu for cmd or find Command Prompt in the Accessories folder of the Start menu.
To determine some basic information about the hard drive installed on your device, use these steps: Open Start. Search for Command Prompt and click the top result to open the app. Type the following command to check the name, brand, model, and serial number information and press Enter: wmic diskdrive get model,serialNumber,size,mediaType.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With