8

I'm using the ioreg command line tool to try and read sensor information available on my computer (iMac). Particularly, I'd like to read the current value of the ambient light sensor. So far, I have been able to retrieve some general information regarding the sensor via ioreg -f -b -r -c 'AppleLMUController'. But the value is not there:

+-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"
}

I know that there are tools that can use IOKit to access this value using C, ObjC, etc - but I explicitly would like to use a bash one-liner to try and grab the value.

Has anyone been able to successfully do this via the command line and if so, how?

2

Read the current setting

defaults read com.apple.BezelServices dAuto

Write

defaults write com.apple.BezelServices dAuto -boolean true/false

  • 2
    Doesn't work for me: The domain/default pair of (.../com.apple.BezelServices, dAuto) does not exist – mbeasley Sep 10 '14 at 12:46
  • com.apple.BezelServices exists but dAuto does not. dAuto being boolean suggests that this setting is to turn automatic light sensing off or on rather than to read the value of the sensor. – Freiheit Jul 27 '16 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .