#macos #system-info #sys

mac_expert_device

通过 ioreg 获取 MacOS 硬件信息

1 个不稳定版本

0.1.8 2022年5月9日
0.1.7 2022年5月9日

#819硬件支持

MIT/Apache

22KB
366 代码行

获取 Mac 硬件概览

  • IOPlatformUUID

用法

要使用此库,请在您的 Cargo.toml 中添加以下内容:


[dependencies]
mac_expert_device = "0.1"

有关如何使用此库的详细信息,请参阅我们的文档

简单

fn main() {
   let platform_expert_device =  mac_expert_device::os::IOPlatformExpertDevice::new().unwrap();
   //
   println!("name:{}",platform_expert_device.name());
   println!("version:{}",platform_expert_device.version());
   println!("SerialNumber:{}",platform_expert_device.serial_number());
   println!("Manufacturer:{}",platform_expert_device.manufacturer());
   println!("IOBusyInterest:{}",platform_expert_device.io_busy_interest());
   println!("IOInterruptControllers:{}",platform_expert_device.io_interrupt_controllers());
   // println!("IOPlatformSystemSleepPolicy:{}",platform_expert_device.io_platform_system_sleep_policy());
   println!("IOPolledInterface:{}",platform_expert_device.io_polled_interface());
   println!("IOPlatformUuid:{}",platform_expert_device.io_platform_uuid());
}


IOPlatformExpertDevice

     +-o Root  <class IORegistryEntry, id xxxxxx, retain 17>
     +-o xxxxxx  <class IOPlatformExpertDevice, id xxxxxx, registered, matched, active, busy 0 (13368 ms), retain 44>
         {
           "IOInterruptSpecifiers" = (<xxxxx>)
           "IOPolledInterface" = "SMCPolledInterface is not serializable"
           "IOPlatformUUID" = "xxxxxx"
           "serial-number" = <xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
           "platform-feature" = <xxxxxx>
           "IOPlatformSystemSleepPolicy" = <xxxxxx>
           "IOBusyInterest" = "IOCommand is not serializable"
           "target-type" = <"Mac">
           "IOInterruptControllers" = ("xxxxxx")
           "name" = <"/">
           "version" = <"xxxxxx">
           "manufacturer" = <"Apple Inc.">
           "compatible" = <"xxxxxx">
           "product-name" = <"xxxxxx">
           "IOPlatformSerialNumber" = "xxxxxx"
           "IOConsoleSecurityInterest" = "IOCommand is not serializable"
           "clock-frequency" = <xxxxx>
           "model" = <"xx">
           "board-id" = <"xxxxxx">
           "system-type" = <02>
         }

无运行时依赖