Contribute
Register

ALS not working

Status
Not open for further replies.
Joined
Mar 8, 2017
Messages
758
Motherboard
Dell XPS 9700 4K (OpenCore)
CPU
i7-10875H
Graphics
UHD 630, 3840x2400
Mobile Phone
  1. Android
Hey!

What I've tried so far:

* Install VirtualSMC.efi (helper file in Clover UEFI drivers)
* Install VirtualSMC.kext
* Install SMCLightSensor.kext
* Install SMCProcessor.kext
* Install SMCBatteryManager.kext
* Removed the ALSD patch from DSDT (so the ALS values don't get suppressed with 0)
* Added Clover patch: Rename ALSD to ALS0 (used string to hex converter for that)

Am I missing anything? ALS is not showing up in IOReg and the Pref. Pane does not show this option either. Everything else (processor, battery management) is working 100%.

PR files attached, thank you for your help! :)
 

Attachments

  • debug_1726.zip
    1.9 MB · Views: 209
Update:

Found a important SYSLOG debug message: kernel: (Lilu) SMCLightSensor: alsd @ No iterator

This debug stems from this class: https://github.com/acidanthera/VirtualSMC/blob/master/Sensors/SMCLightSensor/SMCLightSensor.cpp

Since I am not at all familiar with the Mac OS environment and thus with kext programming I dont really know what to make of this. As I see it tries to find all Devices named "ACPI0008" and get all matching services from IOService. Then this probably returns some kind of collection which is iteratable and the first item likely is my ALSD.

Only issue is that this iterator is null... :(

Maybe I'll download the code and do some further debugging myself, if I find the time. If someone else has any ideas why this occurs, I'd be happy to hear them! :)
 
The ALSD defined in your DSDT is likely not compatible with macOS drivers.
This is why it is not shown up in ioreg and the option is not available in the display pref pane.
You can try disable it (edit the _STA method so it returns zero) or make a fake ambient light sensor just for saving the brightness value (remove the rename ALSD to ALS0 from your clover patch - not needed in that case)
Fake will not make the light sensor works, just helps for saving the brightness value when reboot - an exemple is attached
 

Attachments

  • SSDT-ALS0.aml
    158 bytes · Views: 357
@favoriti

Thank you for your answer! I already disabled it a number of times in the past, i know the process. It's just that I'd like to see it working so much... :(

I don't really see a reason why it should be incompatible other than some methods or other values in DSDT regarding ALSD are missing...

I have to ask a friend with a real macbook and extract his IOREG and DSDT to do some comparison...

Would be so happy if this could be made working :D

//Edit: Oh, and thank you for your idea! Because ALSD is currently incompatible it does not show in IOREG, thats why the iterator is null. Its empty, no results, thats a valid API response.
 
Update:

I extracted the IOReg and DSDT of a friend of mine today and could gather some further informations for this problem.
There is a method called _STA in my ALSD (which you need to rename to ALS0) which returns a status of this device.

Mine was completely different from the MBP one:

Mine:
Code:
Method (_STA, 0, NotSerialized)  // _STA: Status
{
    If (LEqual (ALSE, 0x02))
    {
        Return (0x0B)
    }
     Return (Zero)
}

His:
Code:
Method (_STA, 0, NotSerialized)  // _STA: Status
{
    If (LGreaterEqual (OSYS, 0x07D9))
    {
        Return (0x0F)
    }
    Else
    {
        Return (Zero)
    }
}

I think that 0x0 (Zero) is off, 0x0F is on. Thus I hardcoded 0x0F into my ALS0 device and it popped up in IOReg, the kext also loaded it.

Only problem: The sensor does not change the brightness value of my screen. BUT - old values get saved over reboot (which did not work without spoofing ALS0, which I don't need anymore now). That means it somewhat works xD.

I need to investigate this further, would be so cool if I could get it working! :)
Attached the IOReg and DSDT of the original MBP, also my PR files. Maybe someone could look into this :)
 

Attachments

  • DSDT_Georg.aml
    33.5 KB · Views: 111
  • IOREG_Georg.ioreg
    5.9 MB · Views: 126
  • debug_19994.zip
    2.2 MB · Views: 92
I extracted the IOReg and DSDT of a friend of mine today and could gather some further informations for this problem.
There is a method called _STA in my ALSD (which you need to rename to ALS0) which returns a status of this device.

Mine was completely different from the MBP one:
Thanks for providing the real MBP IOreg and DSDT !
When having more time will also try to patch my _STA and check if brightness values are saved on my laptop
 
@favoriti

No problem! It could really help one out in understanding how apple does all of this... Just want to get as much as possible working, maybe we can do it together :)
 
@favoriti

No problem! It could really help one out in understanding how apple does all of this... Just want to get as much as possible working, maybe we can do it together :)

I did a quick clover hot patch for making _STA of ALSD (not renamed to ALSO) always returns Return (0x0F)
After doing that :
- ALSD is showing up in Ioreg
- brightness value is well saved and restored after reboot
- checkbox for "automatically adjust brightness" appears in the display pref pane with no need of fake ALS
- however I confirm the sensor still do not work ...going further for understanding why is out of my knowledge ....
1576518349833.png
 
@favoriti

I don't know if it has much impact, but I'd still rename ALSD to ALS0. SMCLightSensor uses the name ACPI0008 to reference it from IOReg, so the name does not really matter in that sense at all. But since we now know what Apple calls it, I'd stick with that.

As far as I can judge the VirtualSMC is not starting the polling routine on the light sensor, which is why nothing changes. But the no iterator message definately dissapeared :)

I am getting some errors like:
Code:
2019-12-16 18:55:28.924463+0100 0x821      Default     0x0                  0      0    kernel: (AppleSMCLMU) AppleLMUController::smcReadKey Error: received error 0x87 when reading key 'ALV0'
2019-12-16 18:55:29.373598+0100 0x107      Default     0x0                  0      0    kernel: (AppleSMCLMU) AppleLMUController::smcReadKey Error: received error 0x87 when reading key 'ALV0'

or:
Code:
2019-12-16 18:55:23.774785+0100 0x47c      Default     0x0                  0      0    kernel: (AppleSMCLMU) AppleLMUController::smcGetKeyInfo Error: received error 0x84 when getting key info for 'ALRV'
2019-12-16 18:55:23.759608+0100 0x47c      Default     0x0                  0      0    kernel: (Lilu) VirtualSMC:  kstore @ key [ALRV] not found for info
2019-12-16 18:55:23.774793+0100 0x47a      Default     0x0                  0      0    kernel: (Lilu) VirtualSMC:  kstore @ key [QENA] not found for info

which probably has something to do with it. The AppleLMUController seems to be responsible for actually changing brightness (AFAIK) and if that receives errors, the polling can't work...

My knowledge is sadly very limited, but I'll still try to get this working and keep you updated :)
 
Status
Not open for further replies.
Back
Top