top | item 28011861

The journey to controlling external monitors on M1 Macs

364 points| 6a74 | 4 years ago |alinpanaitiu.com

181 comments

order

FireBeyond|4 years ago

Apple seems to be making a lot of display related things difficult lately. This, and Display Stream Compression are two.

Just as high refresh and HDR were becoming really mainstream, Big Sur completely broke what was working flawlessly in Catalina (and it has not been fixed as of either 11.5, or the Monterey betas so far - and by completely broke, I mean does not work, at all, for anybody, not just 'some edge case').

With Catalina, my Mac Pro happily drove 2 27" 4K monitors in 10 bit color at 144Hz.

With Big Sur? I can run those same screens at 60Hz 10 bit, or 95Hz 8 bit.

I guess I just need to get a Pro Display XDR...

Teknoman117|4 years ago

If your livelihood isn't dependent on that kind of a display, personally, I would try to avoid falling into their trap. I'd call it anti-competitive to have previously supported an industry standard, only to then remove that support and push their product as the only way to achieve an equivalent to that standard.

I'm not saying the ProDisplay XDR isn't a good screen, or even overpriced in the class of displays it lives in, but there is a major leap between "I write code/documents/etc. all day and like vibrant monitors" and "I do professional multimedia work and need hyper-accurate displays to do my job correctly."

Telling all the people who want HDR to go buy a $5,000 display they don't need is a bit of a mean spirited move.

vladvasiliu|4 years ago

> my Mac Pro happily drove 2 27" 4K monitors in 10 bit color at 144Hz.

It's a bit tangential, but I keep seeing people mentioning 4K monitors with high refresh rates on HN, but I've never seen any. Would you care mentioning what make / model those are?

seizethegdgap|4 years ago

I remember when I first started my previous job in 2017, I opted for a MacBook Pro with a Dell D3100 docking station. When 10.13.4 dropped, I lost the ability to use some of my monitors. In the future, I won't buy from Apple simply because I'm not willing to replace all of my computer components for ones that are compatible with a walled garden.

https://support.displaylink.com/knowledgebase/articles/11880... https://support.displaylink.com/knowledgebase/articles/18493...

jazzyjackson|4 years ago

Why not roll back to Catalina? Mac recovery menu has the option to reinstall the OS that shipped with the machine.

What I don’t know is if you’re allowed to selectively upgrade to, say, the latest version of Catalina. But you can pick and choose updates, so maybe?

rasz|4 years ago

I dont understand, you want high bitrate accurate display to the point of actually considering XDR, but simultaneously you really want LOSSY compression? The not so secret secret of Display Stream Compression is it degrades picture quality.

PragmaticPulp|4 years ago

Great write-up and a fun read.

I was caught off guard by this note:

> the delivery guy called me about a laptop: the custom configured M1 MacBook Pro that costed as much as 7 junior developer monthly salaries has arrived!

I tried the MacBook Pro configurator and could only get up to $2300 USD (excluding optional software like Logic Pro). I’m sure the price and taxation are higher in the author’s country, but I still don’t understand how that could cost the equivalent of 7 months of junior developer salary anywhere.

IggleSniggle|4 years ago

Dev says right at the top of the entry that they are writing from Romania. Quick Google shows an average software dev salary of 4800 USD per year. If that’s average, seems like 7x monthly of a junior salary checks out.

alin23|4 years ago

When I got my first job as a Junior Malware Researcher, I was earning $422 per month. That times 7 is exactly the cost of the MacBook Pro I got (1TB SSD, 16GB RAM)

Yes, I live in Romania, and salaries have been increasing a bit but they're still a joke for junior devs.

aiisjustanif|4 years ago

ITT: People learn than devs starting out in Eastern Europe can make under $500-1k a month net pay.

wil421|4 years ago

The resume on the blog says University of Lasi. Google returned something about Romania so is assume that’s where he is.

908B64B197|4 years ago

I can't get a Mac Pro high enough it's 7 months of junior developer salary.

Was it a typo?

CodeIsTheEnd|4 years ago

I haven't used Lunar (https://lunar.fyi/), the app the author built, but it looks fantastic! Clearly great effort has been put into it!

I really appreciate this class of application that exposes more hardware functionality to the end user. Flux (which may or may not be a direct competitor) is another great example, as is Halide, the pro camera app for iPhones. They're certainly not flashy, but they can be great quality-of-life improvements.

And they're difficult to write! They require using APIs that are often woefully under-documented, and terribly difficult to debug. I wanted to write an app that would slowly lower your device's volume over time (so you could raise the volume for a song that you like, but then not accidentally spend the next 30 minutes with the volume super loud), and even doing simple things like listing audio devices and getting their names was endlessly frustrating.

dividedbyzero|4 years ago

You probably could script that in Hammerspoon. I have a small script that resets the balance to center every few seconds (it sometimes wanders off-center for some weird readon), setting the volume should be possible too.

Synaesthesia|4 years ago

It's a great app, giving you iMac like control over your screen brightness. Love it.

planetafro|4 years ago

Amazing write-up! Your efforts are much appreciated. I have an Intel Mac Air with an external monitor and strongly feel that usability items like these are sorely underrated. Kudos for the great work in a seemingly closed ecosystem.

alin23|4 years ago

Thanks! Yes, it can be hard to let people know that an app like this actually exists.

Some people don't even feel the need for such a thing and just stare hours at a time into a blinding 100% brightness panel when working at night time.

I think that can cause macular degeneration much faster than just "not filtering blue light", but this is not as talked about so people don't think about its effects that much.

garyclarke27|4 years ago

Yes why can’t a mac control the volume of an external monitor on usb c/display port/thunderbolt. It’s completely ridiculous when you think about it, that such a fundamental and important requirement for so many users, is completely missing, in 2021!

aduitsis|4 years ago

Control the volume? How about having sound at all? :)

Intel mac, usb-c sound to an external 4k monitor used to work flawlessly in Mojave. Big Sur, stopped working.

salamandersauce|4 years ago

Yup. Not being able to easily mute my speakers connected to my monitor was something that annoyed me greatly with my Mac mini.

ammar_x|4 years ago

Although I'm not interested at all in brightness control and the different technologies you described, I really enjoyed reading your post. Your way of combining talking about technical issues with your personal life and challenges (your company job, having a side project along your day job, the winter cold near your house, etc.) made it possible for me to enjoy reading a post about something completely unrelated to me (DDC, etc.) Nice job.

alin23|4 years ago

Thanks a lot! I guess that validates a bit my choice of style. I was afraid it might sound too story-like for such a technical subject.

almostdigital|4 years ago

This seemed neat so I installed Lunar to try out on my M1 MacBook Air with a LG HDR display connected over HDMI.

After launching the app my system started freezing so bad I had a hard time closing the app, inputs unresponsive for 30 sec then active for 1 sec to become unresponsive again.

I figured I'd try to launch it with my monitor unplugged and worked fine, but after plugging in my monitor again it doesn't connect again.

I've tried closing the app, uninstalling it and rebooting my system. Nothing works and now I'm left with no external display. What the hell?!

EDIT: after unplugging my dongle from usb-c (i.e. un-powering it instead of just unplugging it from the laptop) everything works again! phew. I guess it put the dongle in some weird state?

alin23|4 years ago

I can’t say for sure what the problem is in your case, but it’s definitely not a problem in Lunar.

All the app does is call a macOS function called IOAVServiceWriteI2C to send a standard DDC message to the monitor (something like “set brightness to 30”)

In your case, either the dongle or the monitor reacts unexpectedly to that message. What should happen is that the dongle should simply forward that message as it is to the monitor and the monitor should have firmware logic to interpret it correctly and either set the brightness to the sent value, or not do anything.

That’s why Apple will never implement native brightness changing using DDC.

They can’t risk having users come with problems like this one in the press, because the monitor or hub/dock does something funny with the DDC message and crashes.

Lunar can also function in software mode using gamma by following the instructions here: https://lunar.fyi/faq#bad-ddc

That mode will never crash a monitor because it doesn’t send any data to it.

correct_horse|4 years ago

Display Data Channel generally doesn't work through dongles. I'm not really sure how usb-c dongles work (block diagram, etc.), so I don't know why this is the case.

olivierlacan|4 years ago

Quite literally an insta-buy for me. Tried with an LG HDR 5K Display and it worked perfectly in trial mode.

Location mode is everything I've ever wanted from non-Apple monitors with a Mac mini. https://lunar.fyi/#location

alin23|4 years ago

Thanks! If you ever notice Location mode is not enough for you, Lunar also supports external light sensors that you can very easily make yourself with the instructions here: https://lunar.fyi/sensor

rfolstad|4 years ago

Is it a big secret that m1 macs don’t work with external monitors?? The problem has been getting worse with each new forced update.

Using my monitor via HDMI and apples 100$ dongle it constantly turns off randomly and will not come back on without unplug and plug back in.

Everything else is great but after like 5 updates that claim to fix the issue but still having issues maybe apple should make some notification about the problem so people don’t buy this if they have serious work they need to get done.

spockz|4 years ago

My M1 works flawlessly with my usb c LG monitors except for HDR leading to washed out colours.

On the other hand, both my fullspec 2016 and 2019 MBP have days where the displays and usb and Bluetooth hubs freeze every few minutes and I’m watching a the screens go blank and the windows being retiled while I can’t type. The only thing that continues is audio over the 3.5mm port.

So for me, things improved with M1.

polishdude20|4 years ago

Are you using some sort of website builder / pre-made styles for your writeups? I really like the layout and color/ stlye.

alin23|4 years ago

I’m using Hugo as the static site generator (it really helps with blogs but I wouldn’t use it for simple presentation webpages).

I started with the Blogophonic theme but I have heavily edited it since then: https://github.com/formspree/blogophonic-hugo

Unfortunately I don’t have some pre-made theme that I can share, I mostly improvised with colours and styles that I noticed look good on other websites, then settled on some colour scheme and style using Sass variables that I use all over the place.

digitallyfree|4 years ago

DDC is great - I remember saving a Samsung 193P monitor (no buttons and controlled by a proprietary driver that only worked on WinXP) that had its brightness set unusably low by its prior owner. I also remember someone using DDC scripts as a KVM solution by switching the monitor inputs programmatically.

kadoban|4 years ago

Ya I use DDC as part of a KVM, it works pretty well.

I have a usb switcher with a button, and then my desktop I have coded up to switch the input on my monitor when the keyboard appears/disappears (udev rules trigger that).

jmarcher|4 years ago

I had 2x 173P back then. Even to this day, the build quality and design is amazing. The panel not so much, but hey, it was 2004.

Toutouxc|4 years ago

Great work, Alin. I will continue with the trial version for a while, but ten minutes in, it looks like everything is working.

Brightness actually wasn't my biggest gripe, it was my monitor's stupid volume controls (three menu levels deep). And Lunar takes care of both!

colordrops|4 years ago

Funny, I just started playing with DDC a few days ago. I've got a work (Mac) and a personal laptop (Dell XPS with Linux) that I like switching between. I had a thunderbolt hub, but was getting tired of moving the cable back and forth, and it was also unreliable on the Mac, causing it to heat up and slow down on occasion.

I ended up just buying a pure USB hub with a switch, and running a persistent polling bash script on the Mac and the Linux machines that calls the appropriate DDC commands to switch the monitor input based on which machine the USB hub is switched to. It's fast and works great.

watertom|4 years ago

I just want my 2 external monitors to work, 1 in portrait, the other in landscape in my M1 MacBook Pro.

I bought a Pluggable doc, for $300, of course it wasn’t until after I couldn’t get it to work did Pluggable team tell me it wouldn’t work, “a known problem”, which they didn’t disclose. This was 7-8 months ago.

I needed the extra ports so I kept the dock, and used both monitors in landscape mode, it killed my productivity.

About 2 months ago I needed to reboot my machine, Zoom couldn’t find audio.

When the machine restarted one of the monitors was in portrait mode, it hadn’t been configured in portrait mode, but it was in portrait mode. I hadn’t done any updates, automatic updates are turned off. Then machine started with 1 monitor in portrait mode.

Everyone tells me it can’t work, Pluggable, Apple, Apple support forums.

This experience tells me the M1 release was half baked at least on the OS side.

The product was rushed to market maybe to capture market segment, maybe because component parts were already allocated, and shipping the M1 devices would help Apple to offset lost sales due to parts availability for the Intel Mac’s.

Hard to say, but I would have also expected something as trivial as rotating the display to be available without the need to buy a 3rd party $300 device, that isn’t supposed to work.

mthoms|4 years ago

I was able to use one landscape, and one portrait 4k monitor just fine on my M1 mini. One is connected via HDMI and the other via USB-C. Have you tried it without the dock?

augstein|4 years ago

Lunar is godsent.

Without automatic brightness control for my external display, I had the exact same problems the author of Lunar describes in his article, constantly and manually adjusting the brightness of my display throughout the day, with its awful on screen menu.

Before I got my Mac with an M1, I‘ve used Brightness Menulet, which also worked quite ok, but not nearly as polished and functional.

londons_explore|4 years ago

> reading brightness, contrast or volume from the monitor fails about 30% of the time

There is a good chance this is because the read is done too fast. If it gets less reliable with a super long HDMI cable then it's almost certainly the clock speed.

I2C is a clocked protocol where the host (the laptop) decides the clock speed. It isn't designed as a high speed data transfer mechanism, and requires that all the signals get to the other end of the wire and back all within every clock cycle. Since there is very little data to send, a clock speed of 10kHz should do the job just fine. But I bet the hardware is set to something silly like 10 MHz by default, since it probably uses the same I2C drivers and hardware blocks as used for communicating with other things on-chip and within the system.

superlopuh|4 years ago

The Paddle mention is very interesting, I'd never heard of it before. I really hope they make the Sketch-like model an integrated part of the platform, I wish more apps used that revenue model, and I'd like to use it myself for some productivity utilities in the future.

6a74|4 years ago

alin23 is the creator of Lunar and the author of this blog post. I'm just a fan of the program.

bellyfullofbac|4 years ago

The article got a bit confusing around halfway the post. If I didn't google the software it reads like I would need a configured Raspberry Pi in addition to this software...

fartcannon|4 years ago

It's appalling that something like this necessary.

throwanem|4 years ago

Controlling external displays via DDC was never supported, and only works even on Intel Macs via a "private," undocumented API. It's neither appalling nor even surprising that this wasn't prioritized for the M1 kernel, and it is likewise reasonable that some more reverse engineering would be required.

bredren|4 years ago

It would be nice if it just worked, however I’d rather MacOs folks work to fill out the complete functionality if Spaces.

Spaces, the multiple desktops, single monitor feature of MacOs has been neglected for too long.

nixpulvis|4 years ago

Does the gamma solution lower the power use like a proper brightness reduction? And if so, by the same amount?

Did you ever attempt to reach out to Apple about how this should be implemented on the new kernel? I would hope there's some forum for this kind of question still.

alin23|4 years ago

Unfortunately no, Gamma doesnt reduce the power consumption of the LED backlight of the monitor.

It may in fact increase power use a bit because rendering black pixels needs more energy to excite the crystals.

I haven't contacted Apple because I don't think they are interested in implementing such a thing really. I've written more about why I think that here: https://lobste.rs/s/2zajeu/journey_controlling_external_moni...

nuker|4 years ago

> I went with Paddle for Lunar

Curious why he did not use Mac App Store to sell his app?

ec109685|4 years ago

He's using undocumented API's.

brokenmachine|4 years ago

It's just ridiculous that you need to go through all this palava and reverse engineering to use standard methods to control something as basic as a monitor.

I enjoyed the article though.

jareklupinski|4 years ago

great work!

> reading brightness, contrast or volume from the monitor fails about 30% of the time

I2C over long lengths of wire isn't the sturdiest physical layer... I would expect the low level I2C handlers to retry a few times on no ACK received, but a retry_count of 5 might resolve most of the issues around a bit flipping on its way through the wire :)

alin23|4 years ago

Yes, retrying always fixes the problem. And for the purpose of getting the latest monitor values from time to time to keep the UI in sync, this suffices.

I'm more surprised that I2C works at all over the long, thin Thunderbolt cable of my LG. Huge bandwidth going through it for video and the USB hub, lots of current passing through for charging the MacBook at the same time, I'm amazed it works so well.

post_break|4 years ago

Between this and sound over hdmi I’ve had to use a bunch of program hacks to get what I need.

unicornporn|4 years ago

Very cool, had no idea this was even possible. Is there anything like this for Linux?

alufers|4 years ago

There is https://www.ddcutil.com/ It has a command line utility and a qt GUI. Unfortunately the GUI is a bit convoluted, because it exposes every option that you can change on the monitor. I once almost bricked my LG monitor, because I accidentally locked the hardware buttons on my monitor, via an undocumented manufacturer specific option.

For gnome there is https://extensions.gnome.org/extension/2645/brightness-contr... This addon adds brightness sliders in the power menu for your external monitors.

fartcannon|4 years ago

I wouldn't be surprised if Apples ultimate goal was to control the monitor playback ecosystem and implement DRM such that they could get a cut of any medimedia you consume through your Mac. They'd 'curate' the content to prevent you know piracy, or whatever.

howolduis|4 years ago

$99 to receive an update? sounds like a scam...

6a74|4 years ago

That $99 price is for the Sketch program. The creator (Alin) just wanted a subscription model similar to it. The pro version of Lunar is $23 for a year of updates and support.

hindsightbias|4 years ago

IMO, this is just proof that WFH productivity is a failure.

No company with a pulse could be this incompetent.

IfOnlyYouKnew|4 years ago

The XDR works quite well on the MacBook Air, no journey required. Only annoyance is that it has specific ideas which side is up or down when used vertically, and I always turn it the wrong way, first.

alin23|4 years ago

Yes, I should have probably written something about that as well.

Apple vendored displays have a proprietary protocol implemented over USB so that macOS can natively change the brightness and volume.

Lunar can take advantage of that as well as you can see here at `Apple DisplayServices`: https://lunar.fyi/faq#ddc

So if you want to Sync the Macbook brightness to the XDR, or sync from one XDR to another, or just get more hotkeys to control presets and contrast, Lunar can still bring something over XDR's features.

smoldesu|4 years ago

Bit of a non-sequitur, but I always laugh whenever I read a blog where someone finally discloses all of the gripes they had with their last Mac while transitioning to the new one. Of course, this new Mac is better than the old one, and won't be susceptible to the same issues they had last time.

Frankly, it all just makes me happier to be out of the ecosystem. I love the fact that there are people like you willing to write beautiful, functional and native system apps, but it also hits me with a pang of sadness when I hear that you spent 7 months salary on a device that will merely give you the ability to package and distribute apps to a certain platform. It's frankly dystopian, and I get the feeling that Apple will continue to edge out "lower-level" software like this in their bid to "increase userland security" (see: gimping MacOS APIs).

superkuh|4 years ago

It's too bad people keep trying to use the M1 for power user tasks. The hardware shortcuts and proprietary implementations make using the machine in anything but factory use cases tedious if not infeasible. Being able to change the backlight intensity shouldn't have to be a major accomplishment with unfixable sporadic hardware bugs.

PragmaticPulp|4 years ago

It’s actually been a great experience for the most part. I certainly wouldn’t call it “tedious if not infeasible”.

It’s a new platform so I don’t expect every single feature of every piece of software to work on day 1, but I haven’t encountered anything show-stopping.

Not being able to adjust monitor brightness using a 3rd party tool for a few months until the developer adds the new hardware isn’t really the end of the world.

dcow|4 years ago

Couldn't you say the same for any SoC? Or any non-free system?