alin23/Lunar

Apple Silicon (M1 GPU) support

lukerooneyio opened this issue Β· 269 comments

Hi, If you plan on beta testing it for Apple Silicon, I'd be happy to test and give feedback :)

Issue details

  • Mac device where Lunar is installed (Macbook Pro 2019, iMac, Mac Mini, Hackintosh etc.):
    Mac Mini M1

  • Monitor model (LG UltraFine 5K, DELL P2715Q etc.):
    BenQ 4K 27"

  • Monitor connection to the Mac device (HDMI-to-USB-C, USB-C-to-USB-C, miniDisplayPort-to-DisplayPort etc.):
    HDMI

  • Using an USB Docking Station or Hub:
    No

  • Lunar mode used (check it in the top-right corner of the Lunar interface)
    Manual

  • (only if you know how to compile a C program) Does this utility work for you? https://github.com/kfix/ddcctl
    optional response

Issue description:

Lunar loads fine, and I have no issues with using the interface, but adjusting the brightness/contrast has no effect on my monitor.

Hi @lukerooneyio !

I think the issue is not related to Apple Silicon as I have had reports of users using Lunar on M1 Macbooks without problems. It's probably happening because of the HDMI connection inside the Mac Mini. Try compiling ddcctl for M1 and see if that works. I'm pretty sure that won't work either because the DDC implementation is not something CPU specific.

I'm facing the same issue with Mac mini and Dell AW3420DW

  • Mac device where Lunar is installed (Macbook Pro 2019, iMac, Mac Mini, Hackintosh etc.):
    Mac Mini M1

  • Monitor model (LG UltraFine 5K, DELL P2715Q etc.):
    Dell AW3420DW

  • Monitor connection to the Mac device (HDMI-to-USB-C, USB-C-to-USB-C, miniDisplayPort-to-DisplayPort etc.):
    USB-C-to-DisplayPort

  • Lunar mode used (check it in the top-right corner of the Lunar interface)
    Manual

Issue description:

exactly same as above

I'll be getting an M1 Macbook Pro next month so I'll be able to do more tests then. Thank you for the reports!

Hi Alin, just another user here to say also not working on the Mac mini M1. Sure you didn't need to know but just wanted to say its not isolated. Using it with LG 49wl95c-w

Not working between M1 Mac Mini and Acer XV273K either.

Same as OP on MBP 13" M1. Lunar interface runs and looks like it should be working, but does not control my monitor which is connected directly via USB-C. Lunar previously worked with this monitor on a 16" MBP.

I've tried to fix this but for now it looks like macOS doesn't expose the I2C interface for the M1 GPU framebuffers.

All we can do is wait for a macOS update that will add this functionality back, although it's unlikely it's going to happen soon since it was never a publicly known feature.

So the earlier comment about reports that lunar works on M1 was a mistake? Lunar blanket does not work on any M1 device?

I misread a user's feedback which actually stated that for him Lunar worked on MBP 16" but not on the M1 MBP. Sorry for the confusion.

Any workarounds for M1 users? - maybe another utility temporarily? - I miss being able to control volume and brightness :)

The only thing I’ve found so far that works on M1 for volume (it does not attempt to handle brightness) is SoundSource (paid with trial): https://rogueamoeba.com/soundsource/

UPDATE 2021-01-03:

Works in the sense of affecting the volume with HDMI/ARC speakers but doesn’t actually set the volume on the TV but fakes it somehow. It’s been a little buggy for me.

What I’ve done instead now is write a little script to change the volume on my Sony Bravia TV via API, and triggering that from the volume keys. (Configured them to be function keys instead, then mapped them to scripts via Alfred.)

You can follow the progress (or rather lack of it) in this ddcctl issue: kfix/ddcctl#86

I've tried tirelessly to send DDC messages from my M1 Macbook Pro but the hard truth is that for now macOS doesn't provide a way to do this. For some reason the GPU driver doesn't send the DDC messages to the monitor.

All we can do is hope that this is temporary and an update will re-add the I2C functionality to the GPU driver.

same problem on M1 air. Yet I found that QuickShade in App Store can work normally. @alin23

same problem on M1 air. Yet I found that QuickShade in App Store can work normally. @alin23

Lunar changes the same brightness that you can change by using the physical controls on your monitor (buttons, touchpads etc).

QuickShade adds a software black overlay over the whole screen which, like @lukerooneyio mentioned, renders colors incorrectly, decreases contrast linearly instead of exponentially, and keeps the monitor LED backlight at the same strength which consumes more power and can heat up the monitor panel depending on how much time the monitor is kept on.

Of course, all this can be harder to notice for some users, so if you're happy with QuickShade, stick with that for now.

Lunar is dependent on having access to low level GPU controls which M1 doesn't provide yet. QuickShade is simply renderring a non-opaque black full screen window which is why it can work no matter the GPU used.

Looking forward to seeing if you get access to the controls on the M1. For now, QuickShade is not a bad alternative. Any suggestions for users to file a radar with Apple for this feature?

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though πŸ˜‚

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though πŸ˜‚

Yes, Apple vendored displays might still work as there is an alternative method implemented in Lunar that doesn't use DDC.

Looking forward to seeing if you get access to the controls on the M1. For now, QuickShade is not a bad alternative. Any suggestions for users to file a radar with Apple for this feature?

This is not a bug, it's simply the fact that M1 shares a big part of its architecture with the iPad A14 chip and Apple developers borrowed part of the GPU driver code from the iPad kernel which doesn't expose an I2C controller (which Lunar needs for DDC requests) and probably never will.

I tried some workarounds like a Raspberry Pi connected to a secondary HDMI input of the monitor that could send the DDC messages, or an Arduino type of board that could send raw DDC requests through the I2C pins of the HDMI connector. None of them worked unfortunately, most monitors only accept DDC requests from the currently selected input.

I guess we'll just have to wait for now.

@alin23 Would you need an FPGA to inject DDC requests into an active HDMI signal or is it just not possible at all?

@alin23 Would you need an FPGA to inject DDC requests into an active HDMI signal or is it just not possible at all?

I didn't consider injecting DDC into an active HDMI signal as that would mean some cable cutting and modifying and this isn't really something that everyday users could do.

Maybe some HDMI splitter cable could work but not everyone uses HDMI. I use USB-C for example, other people use DisplayPort or HDMI-To-USB-C. It would be a nightmare to create a hardware solution for all these cables.

All I wanted to do is have an affordable board like a Pi, send DDC on a not used HDMI input, because I noticed that my Intel Macbook Pro 15" can very well control my monitor with Lunar through HDMI, even though the selected monitor input is USB-C where my M1 Macbook Pro is connected.

It doesn't always work, but it's bearable for now. The Pi though, it keeps saying there's no monitor connected until I switch the input to the Pi HDMI and then ddcutil functions without any problems.

You can follow the progress (or rather lack of it) in this ddcctl issue: kfix/ddcctl#86

I've tried tirelessly to send DDC messages from my M1 Macbook Pro but the hard truth is that for now macOS doesn't provide a way to do this. For some reason the GPU driver doesn't send the DDC messages to the monitor.

All we can do is hope that this is temporary and an update will re-add the I2C functionality to the GPU driver.

How can we let Apple know this issue?

@lihk11 you can try Feedback Assistant: https://feedbackassistant.apple.com/

The problem is that there is no way to send arbitrary DDC messages through I2C because there is no I2C Controller exposed anymore. So maybe ask for that and let them know that your favorite apps don't work anymore because of this limitation.

@alin23 Thanks, I have raised a feedback on that page. And I HOPE everyone seeing this could send a feedback to Apple.

All I wanted to do is have an affordable board like a Pi, send DDC on a not used HDMI input, because I noticed that my Intel Macbook Pro 15" can very well control my monitor with Lunar through HDMI, even though the selected monitor input is USB-C where my M1 Macbook Pro is connected.

It doesn't always work, but it's bearable for now. The Pi though, it keeps saying there's no monitor connected until I switch the input to the Pi HDMI and then ddcutil functions without any problems.

Thinking about declining your approach by wiring an arduino-like board (got spare pro micros) directly into HDMI, that should work, isn't? The only tricky part I guess will be writing the code. Then I'm thinking about wiring a couple rotary encoder to control brightness and contrast... Or maybe even a light sensor...

I would not be surprised such things already exist? Anyway sounds like a fun week-end project.

@carbncl I've got an nRF dev board, very tempted to try and write a BLE-based solution but I don't really want to sacrifice a HDMI cable haha

It would definitely work, that's how the first DDC implementation for macOS was done actually. Someone man-in-the-middled an HDMI cable and listened to the communication on the DDC pin. Sending messages after that is trivial through any I2C library.

The big problem is actually having to modify a cable which would probably remove some of the shielding and add possible interference. Also, it is not a solution for everyone.

@carbncl

wiring an arduino-like board (got spare pro micros) directly into HDMI

The Raspberry Pi Pico state machine would be a great fit for this as it would leave the CPU free for running the light sensor/rotary encoder logic

Same problem here.

Issue details

  • Mac device where Lunar is installed
    Mac mini M1

  • Monitor model (LG UltraFine 5K, DELL P2715Q etc.):
    LG 27UN850-W

  • Monitor connection to the Mac device
    USB-C-to-USB-C (Thunderbolt)

  • Using an USB Docking Station or Hub:
    No

  • Lunar mode used (check it in the top-right corner of the Lunar interface)
    Tried Sync, Manual, and Location

Issue description:

Lunar loads fine, and I have no issues with using the interface, but adjusting the brightness/contrast has no effect on my monitor.

Looks like this app found a workaround. Might be worth exploring:
OCJvanDijk/Brightness-Sync#24

Looks like this app found a workaround. Might be worth exploring:

OCJvanDijk/Brightness-Sync#24

That only refers to changing the brightness on Apple vendored displays, which can be done without DDC. This is already implemented in Lunar and has been reported to work on Ultrafines by some users.

This method keeps working because it uses code from the CoreDisplay framework which has its own protocol over USB.

Every other monitor doesn't know about this protocol and still needs DDC support which is not possible on the M1.

Edit: looks like in Brightness Sync, the developer found a different private framework (DisplayServices) that seems to be more stable on the M1 when using Ultrafine monitors. I'll take a look at its assembly and then add it in Lunar 4 if it actually does something different. Although I suspect it just calls the CoreDisplay functions, it doesn't make any sense why Apple would implement two ways of changing the brightness in two different frameworks.

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though πŸ˜‚

Yes, Apple vendored displays might still work as there is an alternative method implemented in Lunar that doesn't use DDC.

Looking forward to seeing if you get access to the controls on the M1. For now, QuickShade is not a bad alternative. Any suggestions for users to file a radar with Apple for this feature?

This is not a bug, it's simply the fact that M1 shares a big part of its architecture with the iPad A14 chip and Apple developers borrowed part of the GPU driver code from the iPad kernel which doesn't expose an I2C controller (which Lunar needs for DDC requests) and probably never will.

I tried some workarounds like a Raspberry Pi connected to a secondary HDMI input of the monitor that could send the DDC messages, or an Arduino type of board that could send raw DDC requests through the I2C pins of the HDMI connector. None of them worked unfortunately, most monitors only accept DDC requests from the currently selected input.

I guess we'll just have to wait for now.

I just wanted to add, that on the Dell U2720Q actually accepts DDC inputs from different sources. I tried this myself, I had my M1 MBA plugged in via USB C, and used my other windows pc plugged in via HDMI. While on the USB input (MBA display), I used my keyboard and mouse for my other PC to change the brightness and to my surprise it worked perfectly!. If apple never manages to support DDC there is still hope! although it would be specific to this particular monitor. I unfortunately don't know how to write code (very basic)... so when it is confirmed that there will never be DDC support, someone please teach me how to code a Adruino or something.

I purchased a thunderbolt 2 display from a decade ago, that works nicely and has brightness control on the M1 - does need a thunderbolt 2 to usb-c adapter though πŸ˜‚

@rgaufman -- what is the thunderbolt 2 display that you use? I'd like to buy one to use with my M1 :)

Ah, thanks! But its resolution is only 2560 × 1440! Think I'll stick with my 4K display + QuickShade app :)

I just wanted to add, that on the Dell U2720Q actually accepts DDC inputs from different sources. I tried this myself, I had my M1 MBA plugged in via USB C, and used my other windows pc plugged in via HDMI. While on the USB input (MBA display), I used my keyboard and mouse for my other PC to change the brightness and to my surprise it worked perfectly!. If apple never manages to support DDC there is still hope! although it would be specific to this particular monitor. I unfortunately don't know how to write code (very basic)... so when it is confirmed that there will never be DDC support, someone please teach me how to code a Adruino or something.

Yes, I noticed this works on my monitor as well, with a Raspberry Pi updated to the latest version of the kernel. The reason this works is that the latest kernel has a new GPU driver that can keep the I2C connection open even without sending HDMI video data.

I am almost done with implementing a solution in Lunar which will connect to a Raspberry Pi device living on the same network to control the monitor. The Pi will be connected through HDMI to your monitor(s) and run a server that can receive DDC commands through HTTP and relay them to the monitor.

Just a glimpse into what's coming:
image
image
image

@alin23 that’s pretty amazing. Can I help you test it? Pleases? ;)

@imajes sure! I'll post a development version here as soon as I have something usable.

Will a pi zero work? I’m sure that would be fine. Just update it ?

Would be interested, too. The problem is annoying.

Will a pi zero work? I’m sure that would be fine. Just update it ?

Yes, in fact that's exactly what I'm using. Any Pi with a HDMI connector would work.

More than happy to test this, have a few pi model 3's and using the LG 49wl95c-w. Let me know how i can help.

@alin23 Oh nice! would it be possible to send the signals though USB instead of a network since the pi would be near a USB hub anyways. That would keep the latency down to provide a near seamless solution.

chshl commented

Will a pi zero work? I’m sure that would be fine. Just update it ?

Yes, in fact that's exactly what I'm using. Any Pi with a HDMI connector would work.

I am using a script to sync my m1 mba brightness data to my idle windows laptop, and then the windows laptop controls the s2721qs monitor brightness via "monitorian"

I made an arduino based ddc/I2C controller a while back. If you don't mind tinkering: https://github.com/acoomans/esp8266_ddc

I made an arduino based ddc/I2C controller a while back. If you don't mind tinkering: https://github.com/acoomans/esp8266_ddc

Have tried your solution with a M1 setup? Is there any information how to set this up?

I was looking around trying to find something helpful in private frameworks using Hopper app and found some interesting part in PrivateFrameworks/DisplayTransportServices.framework:

Screenshot 2021-03-28 at 22 27 17

Looks like we can use this framework to send i2c data.

I've also found header file for it here: https://github.com/LeoNatan/Apple-Runtime-Headers/blob/5e50ad05dfd7d7b69fc2e0e685765fc054166b3c/macOS/PrivateFrameworks/DisplayTransportServices.framework/DTSDPDeviceProxy.h

Sounds quite promising, doesn't it?

@alin23

I found those as well but couldn't use them because there is no way to get access to the port of the monitor's I2C controller.

I know that the I2C address should be 0x50 but we still need to instantiate a DTSDPDeviceProxy somehow.

We can try to instantiate a DTSDPDeviceProxy with display description DTSDisplayPortDeviceInfo and DTSDPDeviceDescription:

id description = [DTSDPDeviceDescription initWithRegistryEntryID:(unsigned long long)arg1 port:(unsigned int)arg2 framebufferIndex:(unsigned int)arg3 info:(DTSDisplayPortDeviceInfo)arg4];
id proxy = [DTSDPDeviceProxy initWithDescription:description];

But I have no idea where to find values for DTSDPDeviceDescription, may be someone more experienced can help with it.

Lunar was working until very recently, not sure what changed. Anyone else having issues with the 2020 Mac Mini?

Was the diagnostics process able to change the brightness on your external monitor(s)?
no

Mac device where Lunar is installed (Macbook Pro 2019, iMac, Mac Mini, Hackintosh etc.):
2020 mac mini

Monitor connection to the Mac device (HDMI-to-USB-C, USB-C-to-USB-C, miniDisplayPort-to-DisplayPort etc.):
AOC U34G2G4R3 HDMI-to-HDMI

Using an USB Docking Station or Hub:
yes

Lunar mode used (check it in the top-right corner of the Lunar interface)
Manual

I'm a programmer, not a hardware, or even Pi, guy. I have a spare HDMI port on my monitor and really, really, really miss using Lunar. Would one of you smart people please explain what you mean when you say you use a Raspberry Pi for this? How you set it up? Whet it means at all. Thanks.

@tqwhite Right now this isn't released yet but I'll be sending some beta versions to a few users this week and hopefully release it soon.

The way this feature will work will be kind of the following:

  1. Buy the minimum required hardware (if you don't already have it)
  2. Insert the Micro SD card into the Pi, connect the HDMI cable to your monitor and power the Pi using the Micro USB cable and adapter
  3. Click on Install DDC server on Raspberry Pi in the Lunar menu
    • image
  4. You'll be presented with the following screen where the default SSH credentials for the Pi are already set, just click Install
    • image
  5. Lunar will run an install script on your Pi through SSH
    • image
  6. After the installation and reboot of the Pi, Lunar should find the Pi on the network and see that it is connected to the same monitor, and will ask if you want to control the monitor through the Pi.
  7. If you accept:
    • You'll see the Network Controls tag under the monitor name
    • A Sending message will flash under the Brightness and Contrast values whenever a value is being sent through the network to the Pi (this is helpful because the network adds a bit of latency and the brightness changes aren't as responsive as before)
    • Lunar will be able to control the monitor hardware brightness/contrast/volume/input exactly as before
    • image

@alin23 It was so kind of you to include the links to the equipment. Thank you very much. The stuff is ordered. I will add a note if I learn anything that might help someone else.

@alin23 wow, great to hear that we are close now. i have a pi 4 lying around and would also be happy to beta test it. so if you need (more) testing on the pi 4, i am happy to help.

Also got the requirements (pi zero) for testing and even could help debugging with Xcode if needed ;)

Thanks for everyone who wants to help me test this! I'll let you know when the test build is ready.

Until then, I'm also trying to find a fair price for Lunar Pro, so if you'd like to help me with this, here's a form where you can send your opinion: https://forms.gle/5gx53jLRA4HnShwx5

Thanks for everyone who wants to help me test this! I'll let you know when the test build is ready.

Until then, I'm also trying to find a fair price for Lunar Pro, so if you'd like to help me with this, here's a form where you can send your opinion: https://forms.gle/5gx53jLRA4HnShwx5

Done, and - i've had a pi zero command-stripped to the back of my display since you first mentioned this. i really miss my lunar!

Will this only work on a few specific monitor models?

@mrmachine

Will this only work on a few specific monitor models?

It will work with all monitors that have DDC support (which is about every monitor in existence since 2001).

@aheinecke

And will it work with Lunar for a setup with 2 external displays? I guess we will need 2 pi zero w?

Yes, 2 Pi Zero W or a Pi4 which has two HDMI outputs.

Of course, this feature will be buggy at first as there a ton of setups I can't account for in advance. But hopefully we can make it good enough as it seems Apple doesn't want to bring back DDC access for the M1

Using shading like QuickShade does but in a scheduled way will be enough for a lot of people I think – that is still going to be part of the release, right? I remember you mentioning it somewhere... Tried QuickShade last week and although it is obviously inferior to controlling the monitor properly, it would still be good enough for me if I would be scared of setting up some Pi stuff or my monitor only had one HDMI input or something like that.

EDIT: was referring to the Gamma Table approach you mentioned in your first sneak peak in this thread.

@PaulAmosKreiner

Yes, the Gamma Tables method will still be included as a catch-all fallback. So if none of the hardware controls are detected as working (DDC, CoreDisplay or Network through Pi), then Lunar will fallback to Software Controls automatically.
The biggest disadvantage is that you have to remember to manually set the monitor brightness and contrast to its highest possible values without blowing up the whites.

Using gamma tables is still better than what Quickshade does, and I found a way to enhance contrast in low brightness to help alleviate the washed colors problem.

But using a Pi to control the hardware brightness is still miles better, especially on those high-contrast/HDR monitors, as the LED backlight is quite blinding even with a completely black screen.

Do we know anything about how many monitors support getting DDC/CI controlled from the non-active computer? You mentioned that DDC/CI is everywhere, even in old monitors, but I am wondering if it is as usual for them to support being controlled by any of the connected devices and not only by the active one.

Do we know anything about how many monitors support getting DDC/CI controlled from the non-active computer? You mentioned that DDC/CI is everywhere, even in old monitors, but I am wondering if it is as usual for them to support being controlled by any of the connected devices and not only by the active one.

Unfortunately, that's impossible to tell.

The new Raspberry Pi OS kernel contains new GPU drivers that keep the HDMI input active even when the monitor input is set to my Macbook's Thunderbolt input (which is what made this feature possible in the first place, and I have to thank Lukas Daumer for bringing this to my attention).

But even on my monitor, this fails sometimes (very rarely, but annoying when it happens), and I have no idea yet on how to get the HDMI input active again other than rebooting the Pi and powering off and on the monitor.

Yeah, my gut feeling tells me that we might not be able to get it reliable - depending on how the monitor handles his inputs... which probably would make the gamma table approach – although for sure a sad one – even more important. but let's hope for the best, I guess... :)

should probably start with a list of monitors and how well they seem to behave at some later point.

@imajes @mrmachine @aheinecke @PaulAmosKreiner @vguerci @tqwhite @radioactive76 @lukerooneyio

The beta build for Lunar is ready. Please send me a message here (https://alinpanaitiu.com/contact/) so I can send you the download link and the license code.

I don't want to share the build or the license code publicly as the licensing part is not completely done and someone with reverse engineering abilities could easily find a way to crack the app.

There will be a ton of information below.
Please choose only the features that you would like to test.
And please send even the slightest bit of feedback as it would be very helpful for me ^_^

Things you can test

Input switching

image

  1. Choose a known connected input from the dropdown to switch to it
  2. Click on the button next to the dropdown to choose:
    • A hotkey for switching the input fast
    • The input to switch to when you press the hotkey
    • The brightness/contrast values to be set when you switch

Self-adapting brightness curve (for users of adaptive modes: Sync, Location, Sensor)

  1. Whenever the brightness for a monitor isn’t quite right for you, adjust it manually using Lunar (both keyboard and UI controls work)
  2. Lunar should learn from that and adjust the algorithm curve so that it better matches your perception of light

Automatic mode detection

  1. Sensor Mode: automatically chosen if you have an USB Ambient Light Sensor connected with Lunar's firmware installed
  2. Sync Mode: if you use a MacBook with the lid open, or an iMac
  3. Location Mode: if you use a Mac that doesn’t have a built in display
    • Mac Mini
    • MacBook with lid closed (and Clamshell Mode disabled)
    • Hackintosh PC
  4. Manual Mode: if none of the above apply

Improvements on changing values

  1. Any value that can be changed by scrolling, now you can click on it to input any value via keyboard
  2. Scroll sensitivity can be adjusted on the fly:
    • Holding Option key while scrolling should increase/decrease the value faster
    • Holding Command key while scrolling should allow for more fine tuned adjustments

Menubar icon hiding

  1. Swipe right (or press Shift+Left) to go to the settings page
  2. Click on Advanced under the Lunar logo
  3. Check Hide menubar icon

Launch at login

I really hope it's working this time...


Controlling monitors through Gamma Tables on M1

Unfortunately, you have to quit apps that also change the gamma tables (like f.lux)
Night Shift from macOS is a good alternative to f.lux and works alright in combination with Lunar Gamma controls

  • Lunar can now fallback to simulating a brightness change in software when no hardware controls are available.

  • This feature works by adjusting the Gamma values of the monitor so that the colours are rendered darker when you lower the brightness.

  • For this to work properly, you have to first set the monitor brightness and contrast to their maximum values through the monitor physical buttons/controls.

    • Careful though, setting the contrast to 100 (or whatever the highest value) could make colours look very washed and render the lighter shades of gray as white
    • Try to find the highest value that still keeps all the colours/grays visible
    • image
  • Lunar should automatically detect if DDC is not available and switch to Software Controls

    • If this doesn't happen, you can force it by disabling all other controls by clicking on the Settings icon near the Reset button
    • image

Controlling monitors through Raspberry Pi on M1

  1. Minimum required hardware
  2. Click on Install DDC server on Raspberry Pi in the Lunar menu
    • image
  3. You'll be presented with the following screen where the default SSH credentials for the Pi are already set. Adjust credentials as needed and click Install
    • image
  4. Lunar will run an install script on your Pi through SSH
    • image
  5. After the installation and reboot of the Pi, Lunar should find the Pi on the network and see that it is connected to the same monitor, and will ask if you want to control the monitor through the Pi.
  6. If you accept:
    • You'll see the Network Controls tag under the monitor name
    • A Sending message will flash under the Brightness and Contrast values whenever a value is being sent through the network to the Pi (this is helpful because the network adds a bit of latency and the brightness changes aren't as responsive as before)
    • Lunar will be able to control the monitor hardware brightness/contrast/volume/input exactly as before
    • image

Hi, please send me the beta! :) email: @.***

I can't see your email in the Github comment, could you please send me a message through this contact form?

https://alinpanaitiu.com/contact/

Hi, please send me the beta! :) email: @.***

I can't see your email in the Github comment, could you please send me a message through this contact form?

https://alinpanaitiu.com/contact/

Hi, I'm also interested in the beta to try out the new Network control with a Pi. I tried contacting you through the link you provided but received an error from FormSpree that This form isn't set up yet

Hi, please send me the beta! :) email: @.***

I can't see your email in the Github comment, could you please send me a message through this contact form?

https://alinpanaitiu.com/contact/

Hi, I'm also interested in the beta to try out the new Network control with a Pi. I tried contacting you through the link you provided but received an error from FormSpree that This form isn't set up yet

Thanks for letting me know about the contact form! It should be fixed now

Please do note that Apple has sent a survey for M1 Mac users on May 5 via Feedback Assistant (it's preinstalled in macOS betas). I have mentioned inaccessible DDC there.

I think we can make the difference, should enough people chime in with the problem.

sfdye commented

@alin23 Just got a M1 Mac Mini yesterday and found out this issue. Could you send me a beta to test as well?

Gonna order some Pi now ;) Finally I have a reason

@sfdye please send me a message at https://alinpanaitiu.com/contact/ as I'm trying to keep the beta version private at the moment

Please do note that Apple has sent a survey for M1 Mac users on May 5 via Feedback Assistant (it's preinstalled in macOS betas). I have mentioned inaccessible DDC there.

I think we can make the difference, should enough people chime in with the problem.

Good idea! I've sent my response. I'm encouraging everyone with an M1 to do the same.

Just launch the Feedback Assistant app (it should be installed on all M1 Macs and you can find it using Spotlight).

I'm also leaving here a generic message if you want to copy/paste it in the first text field:
image

I would like to see support for sending commands to external monitors through the DDC protocol.

I am an user of Lunar (https://lunar.fyi, https://github.com/alin23/Lunar), a macOS app that can control the brightness/contrast/volume of external monitors through DDC.

Previously on Intel/AMD GPUs, the app was able to send commands to an external monitor by finding its framebuffer through the IOKit framework, then using the functions `IOI2CInterfaceOpen -> IOI2CSendRequest -> IOI2CInterfaceClose` to send a DDC message through I2C.

On M1, the I2C controller for the GPU is not accessible anymore. 
It would be very helpful if the functionality of sending arbitrary data through I2C would be implemented in some way.

The rest of the text fields can contain whatever you want, they are not related to this functionality.

Fyi, apparently there's a direct link to the survey (I haven't tested this myself, so feel free to let me know if it doesn't work), @Smallmedium sent this to me on Twitter.

https://feedbackassistant.apple.com/survey-feedback/225051

Fyi, apparently there's a direct link to the survey (I haven't tested this myself, so feel free to let me know if it doesn't work), @Smallmedium sent this to me on Twitter.

https://feedbackassistant.apple.com/survey-feedback/225051

Nice! Thanks for the link and for encouraging your users to do the same!

Fyi, apparently there's a direct link to the survey (I haven't tested this myself, so feel free to let me know if it doesn't work), @Smallmedium sent this to me on Twitter.

https://feedbackassistant.apple.com/survey-feedback/225051

I've tried the link and it doesn't work for me :( . It prompts me to use touch ID, then I get a message saying join the apple beta software program which I press okay. Then the whole process starts again and I'm stuck in that loop. I can't login to the preinstalled feedback assistant either because when I log in it just says I haven't enrolled into any beta programs. So it seems like average users can't leave any feedback at all :(

I've tried the link and it doesn't work for me :( . It prompts me to use touch ID, then I get a message saying join the apple beta software program which I press okay. Then the whole process starts again and I'm stuck in that loop. I can't login to the preinstalled feedback assistant either because when I log in it just says I haven't enrolled into any beta programs. So it seems like average users can't leave any feedback at all :(

Unable to send feedback too. Link doesn't work. Is the only option to submit this on macOS Beta? The Feedback Assistant just shows up blank with "Survey Feedback Not Found"

@fancymans @Jseeca
I'm not on beta. I thought the only requirement is to use an M1

I've submitted my feedback via the Feedback Assistant (from my non-beta macOS Big Sur Intel 16" MBP). I just launched the Feedback Assistant app, logged in, clicked on the M1 survey in the inbox, and answered their questions.

@fancymans @Jseeca
I'm not on beta. I thought the only requirement is to use an M1

I see. I was able to find the M1 survey through the installed app, but the link still doesn't have access to "M1 Mac User Survey"

For anyone having trouble finding it, open Feedback Assistant on your Mac (not browser) and you'll find it in the requests area.

Screenshot 2021-05-11 at 23 50 08

Hi everybody...I am thinking about this issue, and I was thinking that lg ultra fine 5k monitors works with M1 without problems. Does anybody knows how they are communicating? Would it be possible to use the same protocol somehow?
I am on a MacBook m1 with a LG 27UL850-W (4k monitor without m1 compatibility) but on system report it is seen as an ultra fine 5k and Automatically Adjust Brightness: Yes.
Could this flaw being used? Or what would be the limitations?
Screenshot 2021-05-20 at 10 21 25

@porcherie Apple vendored displays like (Pro Display XDR, LG Ultrafine, Thunderbolt, LED Cinema) have logic implemented in their firmware that allows them to receive brightness controls via USB. Lunar already takes advantage of that by using the private CoreDisplay framework from macOS to control these displays.

Other monitors don't have that logic implemented, and without a USB connection (Thunderbolt in case of Ultrafines, simple USB3 in case of LED Cinema) that logic would be useless anyway.

In conclusion, we can't use this for other monitors.

@porcherie Apple vendored displays like (Pro Display XDR, LG Ultrafine, Thunderbolt, LED Cinema) have logic implemented in their firmware that allows them to receive brightness controls via USB. Lunar already takes advantage of that by using the private CoreDisplay framework from macOS to control these displays.

Other monitors don't have that logic implemented, and without a USB connection (Thunderbolt in case of Ultrafines, simple USB3 in case of LED Cinema) that logic would be useless anyway.

In conclusion, we can't use this for other monitors.

Thanks for explaining so nicely! I wish it would have been so simple! 😁

@porcherie it's odd though that your monitor is seen as an Ultrafine.
Does this app work for you? : https://github.com/OCJvanDijk/Brightness-Sync/releases/tag/v2.4.0-beta.1

I also have an LG 4K which has Automatically Adjust Brightness: Yes but can't be controlled through the CoreDisplay framework. I have no idea what that Yes is supposed to mean.

Apple M1:
  Chipset Model:            Apple M1
  Type:                     GPU
  Bus:                      Built-In
  Total Number of Cores:    8
  Vendor:                   Apple (0x106b)
  Metal Family:             Supported, Metal GPUFamily Apple 7
  Displays:                             
    Colour LCD:                         
      Resolution:                       3360 x 2100
      UI Looks like:                    1680 x 1050 @ 60.00Hz
      Main Display:                     Yes
      Mirror:                           Off
      Online:                           Yes
      Automatically Adjust Brightness:  No
      Connection Type:                  Internal
    LG Ultra HD:                        
      Resolution:                       3384 x 6016
      UI Looks like:                    1692 x 3008 @ 60.00Hz
      Mirror:                           Off
      Online:                           Yes
      Rotation:                         90
      Automatically Adjust Brightness:  Yes

I really had a hope that as my monitor is seen as a 5k ultra fine even if it is not, to have some possibility to control it.
Maybe this function is there but disabled on the firmware (pure speculation, don't know enough)

So the Brightness-Sync beta doesn't work for you? Because if that doesn't work, then that function clearly doesn't exist in the firmware (disabled or non-existent, doesn't matter, we can't modify the monitor firmware)

is v3.2.3 the last one? Can't find a betaπŸ˜…

Thanks for the link. I tried, I am connected with usb-c cable but the control seems not working πŸ₯². worth a try.
Thanks a lot

sfdye commented

It looks like Lunar 4 (m1 support, together with lunar pro paid upgrade) is released?
https://lunar.fyi/

downloaded and trying out on my m1 mac mini. the gamma adjustment works quite nicely.

Yes, Lunar 4 has just been released! Check out the details about M1 here: https://lunar.fyi/#m1

@alin23 A followup: have you tried macOS Monterey? Anything new regarding DDC?

Yes, I'm on Monterey now and Lunar is Monterey ready since v4.1.4. DDC is still unavailable

Have anyone tried the IOAVServiceReadI2C/IOAVServiceWriteI2C private APIs on M1 Macs?

I tested this on an Apple Silicon Mac Mini running macOS 12 beta 1 and it seems to be able to read EDID using the I2C API: https://gist.github.com/zhuowei/bf37b110152aeb61383a3885cb465cc5

but I wasn't able to test if this would work with DDI since my cloud Mac Mini is attached to a capture card without DDI support

@zhuowei I have to try this! Thanks for the details!

I noticed those functions while searching for I2C in the dyld cache but the IOAV prefix made it seem like it didn't have anything to do with monitors.

This is odd though. How does this work with more than one external monitor?

  IOAVServiceRef avService = IOAVServiceCreate(kCFAllocatorDefault);
  if (!avService) {
    NSLog(@"Can't open IOAVService: do you have an external monitor? Are you root?");
    return 1;
  }

Edit: maybe one of these will help:

extern IOAVServiceRef IOAVServiceCreateWithLocation(CFAllocatorRef allocator, uint32_t location);
extern IOAVServiceRef IOAVServiceCreateWithService(CFAllocatorRef allocator, io_service_t service);

I just tried the simplest I2C write (setting brightnes to 10%) but the monitor doesn't seem to get the command:

@import Darwin;
@import Foundation;
@import IOKit;

// clang -fmodules -o i2cwrite i2cwrite.m && ./i2cwrite

typedef CFTypeRef IOAVServiceRef;
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator);
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2);
// outputBufferSize must be less than (1 << 12) (4096 bytes)
extern IOReturn IOAVServiceReadI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t offset, void* outputBuffer,
                                   uint32_t outputBufferSize);
// This didn't work for me (returned no error, but EDID not written)
extern IOReturn IOAVServiceWriteI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t dataAddress, void* inputBuffer,
                                    uint32_t inputBufferSize);

#define BRIGHTNESS 0x10
#define CONTRAST 0x12
#define AUDIO_SPEAKER_VOLUME 0x62
#define AUDIO_MUTE 0x8D

struct DDCWriteCommand
{
    UInt8 control_id;
    UInt8 new_value;
};


int main(int argc, char** argv) {
  IOAVServiceRef avService = IOAVServiceCreate(kCFAllocatorDefault);
  if (!avService) {
    NSLog(@"Can't open IOAVService: do you have an external monitor? Are you root?");
    return 1;
  }

  struct DDCWriteCommand command;
  command.control_id = BRIGHTNESS;
  command.new_value = 10;

  UInt8 data[256];
  data[0] = 0x51;
  data[1] = 0x84;
  data[2] = 0x03;
  data[3] = command.control_id;
  data[4] = (command.new_value) >> 8;
  data[5] = command.new_value & 255;
  data[6] = 0x6E ^ data[0] ^ data[1] ^ data[2] ^ data[3] ^ data[4] ^ data[5];


  IOReturn err = IOAVServiceWriteI2C(avService, 0x50, 0, data, 7);
  if (err) {
      NSLog(@"Nope i2c: %s", mach_error_string(err));
      return 1;
  }

  NSData *nsdata = [NSData dataWithBytes:(const void *)data length:(NSUInteger)7];
  NSLog(@"Written to i2c: %@", nsdata);

  return 0;
}

I'm curios, how did you get that 0x50 chipAddress ?