pouyakary / Starlight

Automatic macOS Dark/Light shift based on surrounding ambient light.
27 stars 2 forks source link

Can't read ambient light sensor on 2018 MBP 15" #2

Open antoniogermano opened 5 years ago

antoniogermano commented 5 years ago

Hi, I was testing the app and I absolutely loved it! Thank you very much for it, I'm very happily using it on my 2013 MBP 15" (Mojave 10.14.3 (18D109)).

However, when I tried it on my 2018 MBP 15" (Mojave 10.14.3 (18D109)), it couldn't read the ambient light.

Do you think this might be related to System Integrity Protection? (Just guessing). I had it disabled on the other Mac (but enabled it now). I've never disabled it on the 2018 MBP. Or maybe the T2 chip has something to do with it?

log:

 •• Settings loaded successfully
 •• Settings decoded successfully
 •• Settings checked
 • Rule of sunset to sunrise is: off. Sunrise: 06:01, Sunset: 18:41
" ••• Coult not read ambient light sensor (1)"
 ••• Failed to change the theme of Visual Studio Code
The file “settings.json” couldn’t be opened because there is no such file.

~/.starlight.json (location hidden for privacy)

{
        "intervals":            10,
        "minimumLux":           75000,
        "sunset":               "auto",
        "sunrise":              "auto",
        "location": {
                "latitude":         XX.XXXX,
                "longitude":        -XX.XXXX
        },
        "vscode": {
                "light":            "Light Theme",
                "dark":             "Dark Theme"
        }
}

~/.settings.json

{
        "vscode": {
                "light":            "Light Theme",
                "dark":             "Dark Theme"
        }
}
pouyakary commented 5 years ago

Hi @Velociround! Happy that you liked it :D

Truth is, access to the ambient light sensor needs signed packages, which is not that much happy with the open source way of thinking, so this tool has a bit of problems regarding there (check out #1 for example)

The only thing I know is that you should run it for the first time from the terminal to have the Mac, asking for your permission and then it's daemon will work. (I've added the first time run to the Makefile, but just to make sure, run it from the terminal by hand once)

antoniogermano commented 5 years ago

I tried compiling it straight from Xcode with my Apple ID but it didn't work, either. I also tried manually running it but it doesn't ask for any permissions.

I tried:

PS: installing = make install

In none of the cases it is able to read the ambient sensor.

antoniogermano commented 5 years ago
image

Maybe It didn't ask for permissions because I had already given it.

pouyakary commented 5 years ago

That seems really strange. I'll try to look it up soon

antoniogermano commented 5 years ago

Apparently, this no longer works on MacBooks with Touch Bar (I suppose it's because of the T2 chip). https://forums.developer.apple.com/message/294756#294756

This is what I've got so far: http://iphonedevwiki.net/index.php/AppleISL29003 http://iphonedevwiki.net/index.php/IOKit.framework

Also seems very useful: https://stackoverflow.com/questions/4628547/any-sample-code-on-getting-data-from-sensors-on-mac

https://stackoverflow.com/questions/17625495/how-do-you-programmatically-access-the-ambient-light-sensor-on-mac-os-x-10-5

https://stackoverflow.com/questions/6309643/reading-the-iphones-ambient-light-sensor

Unfortunately I don't have time to try implementing these changes any time soon. But I will gladly help you test any changes you make (and try to do it myself when I have some free time).

Thank you very much! This is definitely a must-have app/service for macOS. The ambient light, in my opinion, is also the best way to use Light mode and Dark mode, which is why I am very fond of your project.

Starmel commented 5 years ago

Yo, i have same issue on MBP 15 2017 os 10.14.3 (18D109)