从ioreg获取环境光传感器值


8

我正在使用ioreg命令行工具尝试读取计算机(iMac)上可用的传感器信息。特别是,我想读取环境光传感器的当前值。到目前为止,我已经能够通过检索有关传感器的一些常规信息ioreg -f -b -r -c 'AppleLMUController'。但是值不存在:

+-o AppleLMUController  <class AppleLMUController, id 0x1000002d8, registered, matched, active, busy 0 (0 ms), retain 7>
{
  "IOProbeScore" = 0
  "CFBundleIdentifier" = "com.apple.driver.AppleSMCLMU"
  "IOProviderClass" = "IOService"
  "IOClass" = "AppleLMUController"
  "IOMatchCategory" = "IODefaultMatchCategory"
  "IOCFPlugInTypes" = {"0516B563-B15B-11DA-96EB-0014519758EF"="AppleSMCLMU.kext/Contents/PlugIns/AmbientLightSensorHID.plugin"}
  "IOGeneralInterest" = "IOCommand is not serializable"
  "IONameMatch" = "ACPI0008"
  "IOPowerManagement" = {"MaxPowerState"=1,"CurrentPowerState"=1}
  "HIDServiceSupport" = Yes
  "IONameMatched" = "ACPI0008"
}

我知道有一些工具可以使用IOKit使用C,ObjC等访问此值-但我明确希望使用bash单行代码尝试获取该值。

有没有人能够通过命令行成功完成此操作,如果可以,怎么办?

Answers:


2

读取当前设置

默认读取com.apple.BezelServices dAuto

默认写入com.apple.BezelServices dAuto -boolean true / false


2
对我不起作用:The domain/default pair of (.../com.apple.BezelServices, dAuto) does not exist
mbeasley

com.apple.BezelServices存在但dAuto不存在。dAuto布尔值表示此设置是关闭或打开自动光感测功能,而不是读取传感器的值。
Freiheit
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.