Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

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

Open
antoniogermano opened this issue Feb 24, 2019 · 6 comments
Open

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

antoniogermano opened this issue Feb 24, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@antoniogermano
Copy link

antoniogermano commented Feb 24, 2019

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
Copy link
Owner

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)

@pouyakary pouyakary self-assigned this Feb 25, 2019
@pouyakary pouyakary added the bug Something isn't working label Feb 25, 2019
@antoniogermano
Copy link
Author

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:

  • Installing it as normal user (didn't work, can't copy binary because of no permissions)
  • Installing as root, ran as user. It didn't ask for permissions
  • Installing as root, ran as root. It didn't ask for permissions
  • Installing as root, opened the folder on Finder, double clicked starlight binary. It didn't ask for permissions

PS: installing = make install

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

@antoniogermano
Copy link
Author

image

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

@pouyakary
Copy link
Owner

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

@antoniogermano
Copy link
Author

antoniogermano commented Feb 28, 2019

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
Copy link

Starmel commented Mar 11, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants