Doesn't sync brightness with 1st gen UltraFine on MacBook Pro M1
exchgr opened this issue Β· 31 comments
System:
MacBook Pro (13-inch, M1, 2020)
macOS Big Sur, Version 11.0.1 (20B29)
Brightness Sync v2.3.1
External display:
LG UltraFine (RB22MD4KA-B)
With this setup, changing the brightness on the MacBook Pro (using βπ/π
) doesn't change the brightness on the LG UltraFine. Brightness Sync shows as "Activated" in the menu bar:
Are you still able to control the Ultrafineβs brightness with the normal system controls? The only thing that I can think of right now that might explain this is that your Mac lost the USB connection that controls the display. This happened to me twice, I had to restart my Mac to fix it.
Another thing you might try is selecting the app -> Get Info -> select Open using Rosetta, then rerun the app. I built a universal app without ever testing it on Apple Silicon, because I didn't expect any problems, but you never know.
I'm able to control the UltraFine's brightness with the regular brightness controls (without pressing β). Running it in Rosetta (confirmed showing "Intel" in Activity Monitor under the Architecture tab) didn't seem to make a difference.
I'm wondering if there's some low-level difference between Apple Silicon and Intel CPUs that makes this kind of functionality incompatible? I sure hope not.
I have no idea why it wouldn't work on M1, but it's the only clue so far, nothing like this has been reported before.
I also can't test it because I don't have access to an M1 machine and I probably won't have access anytime soon.
I'll put a message on the home page to see if there are other people with an M1 who have the same problem.
In the meantime, maybe Console can provide any clues about what is happening?
Not sure if its related but the slider control also seems to be unpredictable. For example, you drag it to a new location and it often twitches as you drag, or snaps back to the middle position when you release the drag.
Edit: MBA M1
@rsaid99 But is brightness sync working in general on your MBA or also not at all?
Now that you mention it, no. I've tried a few things and it doesn't seem to be working. Tests that failed:
- Manually moved offset slider: No effect (expect dimming/brightening)
- Turn brightness up to full with bluetooth keyboard and then cover the light sensor on laptop monitor: No effect on Ultrafine (expect dimming), but laptop monitor dims.
Seems like it just doesn't work on the new Macs.
I am seeing video's on Twitter about the new Macs being able to do way faster and seamless display reconfiguration, so something definitely changed in the display department. At least that kind of explains why there could be an incompatibility.
Anyway, this might be fixable, but unfortunately, like I said, I don't have access to an M1 Mac. So all I can do is tag this as "help wanted".
When I start the app, i see a ton of these types of messages in Console:
error 21:07:44.278764-0500 Brightness Sync [ERROR] - Unable to create and lookup port "com.apple.CoreDisplay.master" => 1102
0 0x1a5745c14 CoreDisplay::Mach::Port::Port(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, CoreDisplay::Mach::Port::PortLookup) + 396
1 0x1a5701f38 CoreDisplay_Display_GetLinearBrightness + 112
2 0x100f6ddac 3 Brightness Sync 0x0000000100f6ddac Brightness Sync + 23980
3 0x100f737ac 4 Brightness Sync 0x0000000100f737ac Brightness Sync + 47020
4 0x1b1b0a994 $s7Combine10PublishersO3MapV5Inner33_5A6CD15A64659A6248DAF677D4BB6188LLV7receiveyAA11SubscribersO6DemandV6OutputQzF + 228
5 0x1b1a76e08 $s7Combine10PublishersO11AutoconnectC5Inner020_B451114B79538BBB7C2H11CC5250993E8LLV7receiveyAA11SubscribersO6DemandV6OutputQzF + 48
6 0x1b3a916c8 $sSo7NSTimerC10FoundationE14TimerPublisherC5InnerC4sendyyAC4DateVF + 560
7 0x1b3a939f4 $sSo7NSTimerC10FoundationE14TimerPublisherC4SideVyAgE5InnerCy__xGc7Combine10SubscriberRzs5NeverO7FailureRtzAC4DateV5InputRtzlufcyARcAJcfu_yARcfu0_TA + 32
8 0x1b3a93774 $sSo7NSTimerC10FoundationE14TimerPublisherC4fireyyABFTf4dn_n + 204
9 0x1b3a3b24c $sSo7NSTimerCIegg_ABIeyBy_TR + 44
10 0x1a52db148 __NSFireTimer + 68
11 0x1a452e058 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
12 0x1a452dc58 __CFRunLoopDoTimer + 1064
13 0x1a452d6ec __CFRunLoopDoTimers + 392
14 0x1a451262c __CFRunLoopRun + 1936
15 0x1a4511730 CFRunLoopRunSpecific + 600
16 0x1ac01af0c RunCurrentEventLoopInMode + 292
17 0x1ac01ad3c ReceiveNextEventCommon + 688
18 0x1ac01aa6c _BlockUntilNextEventMatchingListInModeWithFilter + 76
19 0x1a6ce6db0 _DPSNextEvent + 868
20 0x1a6ce5730 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312
21 0x1a6cd758c -[NSApplication run] + 600
22 0x100f69d48 23 Brightness Sync 0x0000000100f69d48 Brightness Sync + 7496
23 0x1a4434f54 start + 4
I'm shooting in the dark here, but could you check if this version works:
Brightness Sync.app.zip
If it doesn't work, are the Console errors still the same?
That version doesn't behave any differently for me. Also I've searched my Console and can't find any error messages related to Brightness Sync before or after launching (both versions).
Ah well, that would have been too easy. I'm really going to force myself to stop working on this, trying to solve this without an M1 machine is just wasting time, I think.
I've got the project open in Xcode if there is something you want me to try. It's failing/spamming with the console message mentioned above.
You could try disabling Hardened Runtime completely and see if that makes a difference.
I checked all the boxes in Hardened Runtime section and no change.
I then tried disabling code to see if I could narrow it down at least. I found that commenting out the two statusPublishers at lines 190-235 in AppDelegate.swift will stop the crash/spamming (slider is stable as well). I then tried un-commenting out one or the other of the two statusPublishers there, but either one un-commented will cause it to crash again.
No need to narrow it down really, the stack trace above reveals it fails in the CoreDisplay_Display_GetLinearBrightness / CoreDisplay_Display_SetLinearBrightness functions. These are the main two functions on which the app relies, they are part of a private framework so Apple never gave any guarantees about them in the first place.
To turn off Hardened Runtime, you shouldn't use the checkboxes, but click the x in the top right corner to remove it completely. Try that, and if it doesn't work, I'm out of ideas for now.
Hi,
Do you think it could be possible tu use USB path to control the display ? like https://github.com/unknownzerx/lguf-brightness
Same issue with a similar config here (M1 Air, 1st-gen UltraFine 5k).
There are some very interesting developments in Hammerspoon/hammerspoon#2668.
I got a version working using the DisplayServices framework on my machine. Again, I can't test it on M1 (frustrating!), but these functions from DisplayServices are reported to work on M1.
Here is a build using the new framework, anyone with an M1 laptop please try it out:
Brightness Sync.app.zip
The changes I made are on the m1-support branch. Someone could experiment with it if it doesn't work.
Some additional interesting observations about the DisplayServices framework:
- Changing the brightness using these functions updates the Touch Bar slider in real time, where previously it did not until you reopened the slider view.
- There are symbols in the framework relating to brightness change notifications. Seems like I could potentially build a version of Brightness Sync that doesn't rely on polling.
There are some very interesting developments in Hammerspoon/hammerspoon#2668.
I got a version working using the DisplayServices framework on my machine. Again, I can't test it on M1 (frustrating!), but these functions from DisplayServices are reported to work on M1.
Here is a build using the new framework, anyone with an M1 laptop please try it out:
Brightness Sync.app.zipThe changes I made are on the m1-support branch. Someone could experiment with it if it doesn't work.
On an M1 MacBook Air with the old LG 22 Ultrifine 4k, this worked for me! I'm new to this project, just happened to look this project up right after you posted and figured I'd give it a try. Hope this feedback helps. The display is now locked to my MacBooks brightness level, and if I change the displays brightness directly it reverts back to the lock based on my MacBook.
Related, my Magic Keyboard brightness keys were previously only adjusting brightness on the external display, but now they do nothing at all (because they still try to adjust external display but it is locked). Is it possible to switch those to adjust the MacBooks brightness instead?
π
Seems like everything works as expected.
Regarding the keyboard brightness keys, try holding control. I'm not sure if/how you can switch them, for me holding control adjusts my LG and not holding control adjusts the built-in display, but I'm using a Touch Bar which might work differently.
Would be nice to be able to swap that, I'll look into it, but holding CTRL does adjust brightness on my MacBook, thanks!
There are some very interesting developments in Hammerspoon/hammerspoon#2668.
I got a version working using the DisplayServices framework on my machine. Again, I can't test it on M1 (frustrating!), but these functions from DisplayServices are reported to work on M1.
Here is a build using the new framework, anyone with an M1 laptop please try it out:
Brightness Sync.app.zipThe changes I made are on the m1-support branch. Someone could experiment with it if it doesn't work.
Very excited to try this later!
Working great so far. M1 MBA + 2nd gen Ultrafine 5K.
Woohoo!
It works!
hi,
do you think it can work with LG ultra fine 32UN880 ? the USB VID is 0x043e and PID is 0x9a39
I released the M1 support as a new beta. We can finally close this issue.
I hope this continues to work, it's nice to know I can upgrade to Apple Silicon in the future and still be able to enjoy my monitor. I can't imagine using it without automatic brightness anymore.
@glefand I'm sorry, this app never did and won't support any other monitors. Seems like it's up to the rest of monitor-GitHub to figure out how to make that work. You can follow for example MonitorControl/MonitorControl#323 or https://github.com/alin23/Lunar/issues/210.
thank you very much!
Just here to report success for 2.4.0b1 on two configs: M1 on 11.2.1 with a 1st-gen 5K, and on a 2019 16" (Intel) MBP on Catalina (10.15.7) with that same 1st-gen 5K display. (Happy to test additional releases or build from source if you need any help!)