[HN Gopher] The journey to controlling external monitors on M1 Macs
       ___________________________________________________________________
        
       The journey to controlling external monitors on M1 Macs
        
       Author : 6a74
       Score  : 114 points
       Date   : 2021-07-30 20:10 UTC (2 hours ago)
        
 (HTM) web link (alinpanaitiu.com)
 (TXT) w3m dump (alinpanaitiu.com)
        
       | jareklupinski wrote:
       | 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 wrote:
         | 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.
        
           | mypalmike wrote:
           | It's it actually I2C over the Thunderbolt cable? I had
           | assumed it was I2C just between the CPU and video hardware on
           | the motherboard.
        
       | FireBeyond wrote:
       | 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 wrote:
         | 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.
        
           | stefan_ wrote:
           | The M1 still does DDC, it just doesn't end up exposing _the
           | raw bus_ to software. Which is a perfectly reasonable
           | decision.
        
             | DaiPlusPlus wrote:
             | > Which is a perfectly reasonable decision
             | 
             | Why is that "reasonable"?
             | 
             | How does it ultimately benefit end-users when they can no-
             | longer use userland software to control their monitor via
             | DDC?
        
               | breakfastduck wrote:
               | They can. This entire article is about how they
               | implemented it on M1 macs. Did you read it?
        
           | [deleted]
        
       | superkuh wrote:
       | 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.
        
         | dcow wrote:
         | Couldn't you say the same for any SoC? Or any non-free system?
        
         | PragmaticPulp wrote:
         | 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.
        
       | almostdigital wrote:
       | 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?
        
       | bellyfullofbac wrote:
       | 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...
        
       | [deleted]
        
       | 6a74 wrote:
       | alin23 is the creator of Lunar and the author of this blog post.
       | I'm just a fan of the program.
        
       | post_break wrote:
       | Between this and sound over hdmi I've had to use a bunch of
       | program hacks to get what I need.
        
       | CodeIsTheEnd wrote:
       | 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.
        
         | alin23 wrote:
         | Thanks! Your idea sounds awesome!
         | 
         | I had a great experience using SimplyCoreAudio for that task, I
         | assume you probably already know about it:
         | https://github.com/rnine/SimplyCoreAudio
        
       | PragmaticPulp wrote:
       | 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.
        
         | wil421 wrote:
         | The resume on the blog says University of Lasi. Google returned
         | something about Romania so is assume that's where he is.
        
         | [deleted]
        
         | 908B64B197 wrote:
         | I can't get a Mac Pro high enough it's 7 months of junior
         | developer salary.
         | 
         | Was it a typo?
        
         | IggleSniggle wrote:
         | 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.
        
           | [deleted]
        
         | alin23 wrote:
         | 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.
        
       | colordrops wrote:
       | Funny, I just started playing with DDC. I've got a work (Mac) nd
       | a personal laptop (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 service 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 connected to. It's fast and works
       | great.
        
       | planetafro wrote:
       | 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 wrote:
         | 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.
        
       | nathancahill wrote:
       | Well that's just stellar. I've been using
       | https://github.com/fnesveda/ExternalDisplayBrightness on my Intel
       | and sorely missing it for M1.
        
       | unicornporn wrote:
       | Very cool, had no idea this was even possible. Is there anything
       | like this for Linux?
        
         | alufers wrote:
         | 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.
        
         | Nextgrid wrote:
         | I've successfully used DDCControl:
         | http://ddccontrol.sourceforge.net in the past.
        
         | alin23 wrote:
         | On Linux, there is a very comprehensive CLI utility called
         | ddcutil: https://github.com/rockowitz/ddcutil
         | 
         | The same author also made some kind of UI for it but I haven't
         | used it so I don't know how it looks or performs:
         | https://github.com/rockowitz/ddcui
        
       | olivierlacan wrote:
       | 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
        
       | nixpulvis wrote:
       | 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 wrote:
         | 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...
        
           | nixpulvis wrote:
           | Yep, that sounds a lot like Apple. Thanks for the thorough
           | and interesting writeup on this. I didn't even know I wanted
           | this so badly until now... luckily I still stand a chance I
           | guess.
        
       | smoldesu wrote:
       | 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).
        
       | digitallyfree wrote:
       | 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 wrote:
         | 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).
        
       | IfOnlyYouKnew wrote:
       | 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 wrote:
         | 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.
        
       | superlopuh wrote:
       | 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.
        
       | augstein wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2021-07-30 23:00 UTC)