在命令行上,您可以使用该ioreg
工具来探索 IO Kit 注册表。对于 Lion 或 Older,您还可以使用 Apple 硬件 IO 工具包中方便的 IORegistryExplorer GUI 工具。(它在山狮上崩溃)
对于查看内部硬盘驱动器属性,这是一个很好的开始:
ioreg -irc IOAHCIBlockStorageDevice -w 0
在我的 MacBook Air 上产生:
+-o IOAHCIBlockStorageDevice <class IORegistryEntry:IOService:IOBlockStorageDevice:IOAHCIBlockStorageDevice, id 0x100000216, registered, matched, active, busy 0 (472 ms), retain 7>
| {
| "IOCFPlugInTypes" = {"24514B7A-2804-11D6-8A02-003065704866"="SMARTLib.plugin"}
| "device-type" = "Generic"
| "IOStorageFeatures" = {"Unmap"=Yes}
| "Device Characteristics" = {"Logical Block Size"=512,"Product Name"="APPLE SSD TS256C ","Medium Type"="Solid State","Physical Block Size"=512,"SATA Features"=23,"Serial Number"=" X06S10H7THRZ","Product Revision Level"="CJAA0201"}
| "Protocol Characteristics" = {"Physical Interconnect"="SATA","Physical Interconnect Location"="Internal"}
| "SMART Capable" = Yes
| "IOMinimumSegmentAlignmentByteCount" = 4
| }
|
+-o IOBlockStorageDriver <class IORegistryEntry:IOService:IOStorage:IOBlockStorageDriver, id 0x100000219, registered, matched, active, busy 0 (471 ms), retain 8>
+-o APPLE SSD TS256C Media <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x10000021a, registered, matched, active, busy 0 (471 ms), retain 11>
+-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x10000021b, registered, matched, active, busy 0 (0 ms), retain 6>
+-o IOGUIDPartitionScheme <class IORegistryEntry:IOService:IOStorage:IOPartitionScheme:IOGUIDPartitionScheme, id 0x10000021d, !registered, !matched, active, busy 0 (3 ms), retain 8>
+-o EFI system partition@1 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000263, registered, matched, active, busy 0 (0 ms), retain 9>
| +-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000266, registered, matched, active, busy 0 (0 ms), retain 6>
+-o Customer@2 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000264, registered, matched, active, busy 0 (2 ms), retain 11>
| +-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000267, registered, matched, active, busy 0 (0 ms), retain 7>
+-o Recovery HD@3 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000265, registered, matched, active, busy 0 (3 ms), retain 9>
+-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000268, registered, matched, active, busy 0 (0 ms), retain 6>
您可以通过 IOKit 用户库以编程方式获取这些属性,正如您已经为 USB 发现的那样。
在更高的层次上,一些信息也可以通过磁盘仲裁框架,通过DADiskCopyDescription
函数获得。通过此函数公开的设备属性似乎没有记录在DADisk.h
头文件之外,但它们是不言自明的,例如:
extern const CFStringRef kDADiskDescriptionDeviceGUIDKey; /* ( CFData ) */
extern const CFStringRef kDADiskDescriptionDeviceInternalKey; /* ( CFBoolean ) */
extern const CFStringRef kDADiskDescriptionDeviceModelKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDevicePathKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceProtocolKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceRevisionKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceUnitKey; /* ( CFNumber ) */
extern const CFStringRef kDADiskDescriptionDeviceVendorKey; /* ( CFString ) */