M2 MacBook Pro secret feature!

I’ll cut to the chase 🙂 I found out that the latest MacBook Pro’s (at least the one I bought) has Clamshell mode working! (Well, sorta…) I’m absolutely surprised that no one has mentioned this, so I hope this info will drive a bit to my blog, lol!

TLDR; The Details of ‘the find’…

First off, what is Clamshell mode, and why does ANYONE even care? Clamshell mode is a way to use a notebook computer without opening up the lid. Why would anyone want to do that, especially with how great looking the MacBook Pro screens are??? A variety of reasons, actually. My biggest problem is that the MacBook Pro’s screen is a different size than the external monitors I connect it to. For a specific program (*cough* Remote Desktop, Windows, etc… *cough*) having two screens that are different sizes disables using multiple monitors. I do two things that having multiple monitors *really* helps, software development and music production. Because I work in windows a lot, the weird windows would drive me a bit crazy. Plus, being able to put the notebook in a holder that allows it to take up a lot less desk space is awesome.

So… MacBook Pro’s have had a pretty decent implementation of Clamshell mode. The Intel-based MacBook Pros either had a setting or something built in to the hardware that would turn the computer on, if the plugged in power supply would get power. This worked great, all the way up through the last Intel-based i9 MacBook Pro.

Then the M1 chips happened.

The M1 Max MacBook Pro that I had before was awesome! Overkill for almost everything I was doing when I bought it. It certainly has dealt with anything I could throw at it. The one thing that did drive me a bit crazy was that the M1 chips did not support Clamshell mode. There have been some pretty crazy work arounds (such as scheduling when to turn the computer on… WTF!?!) but no real solution has ever come about. I ended up actually getting a Mac Studio as my desktop computer, just for the smaller space. I certainly wasn’t planning on replacing anything just for the one missing feature. One problem I *did* run into was that I bought ‘underspec’ed’ models of both my MacBook Pro, and MacStudio. Both were ‘base’ models, and a couple of things really started to trip me up. Memory was one, and storage space was another. I had found work arounds that did *ok*, but neither computer was ever going to be able to increase the memory, and I’ve been starting to work with large docker development and Kubernetes, which both eat processors, memory, and storage space. Plus, I was offered a bit of incentive to upgrade my systems for some better specs…

One of the strengths of the Apple Silicon Macs is that everything is on the chip… memory, processors, and storage space. This is also a huge weakness. NONE of it is upgradable. So, what I normally would have done would be grab some extra memory, and put a bigger drive in (and maybe upgrade the processor), but to get better specs, one has to get a new machine.

So an M2 Max MacBook Pro was purchased

This time around, I wanted to install everything ‘fresh’, and not just do a restore of my last machine. There was enough weirdness that I wanted a clean slate. In doing so, I was rebooting the computer, turning things off and one, etc… and I noticed something… I had the lid closed, but the computer would actually start up when I turned on the switch to the power supply. (I have a powerstrip that allows me to turn on and off sockets individually). I tried it several times, and it worked! Whoa! Clamshell mode worked on the new MacBook Pro! I did some installs, including going to the latest beta of macOS (the current public version of macOS screwed up the Continuity Camera, so moving forward is required, unfortunately). I tried again, and… Clamshell mode *didn’t* work. Before I did anything, I figured it would be a good idea to see what Apple themselves had to say about it. In speaking with the tech, it seems that Clamshell mode *should* work on the latest MacBook Pros. I didn’t get full details, but was very glad to hear that the hardware has been updated to make this work! So, I was going to try to go back to the public version of macOS (basically do a restore, as I haven’t *really* done much with the computer yet), and wildly enough… Clamshell mode worked! At this point, it’s been hit and miss, sometimes it works, sometimes it doesn’t. I’ve logged a bug with Apple, and from the tech learned that there is discussions in the tech side of the support, so it’s a know issue.

Hopefully next beta will get it straightened out!

UPDATE – With macOS 13.4 public release, Clamshell mode on the M2 Max MacBook Pro is working most of the time. If it doesn’t, I just power everything off, let it sit for a couple of moments, and then it seems to work.

Fix for stupid programmer error with Apple Continuity Camera as a WebCam (with some colorful commentary…)

Let’s get the problem and solution out of the way first, before I get on my high-horse… 🙂

In testing macOS Ventura and iOS 16.1’s WebCamera feature (https://9to5mac.com/2022/08/01/iphone-as-mac-webcam-continuity-camera), I hit an interesting bug. On my Mac Studio, the camera was showing up, but then recently, the camera would not show up in the camera list. To cut to the chase, the phone will only show up in the list of cameras if there is another camera in the list. So, quick solution is to plug another web camera in, then the phone shows up.

Camera displaying with the workaround

Ok, simple problem, simple solution… except, it’s taken me almost 3 weeks to figure out what is going on.

<RANT>

Maybe this is why I’ll always be a hacker (hacker being defined as a person who tries lots of different things to get something to work, not a cracker, which is someone who tries things to break them… don’t get me on another rant about how ‘hacker’ is a GOOD thing, not a bad one)

At one point, the iPhone as a camera was showing up perfectly. In the past, I’ve been using Reincubate’s brilliant Camo (https://reincubate.com/camo/) for using my iPhone as a web camera. The quality is amazing, and truly helped during the COVID pandemic of 2020, since good web cameras were VERY difficult to find. I was very happy to use that software, but it had 3 limitations… One, the phone had to be plugged into the computer; Two, you needed to be running the software on both the phone and the computer at the same time; Three, you couldn’t use the phone while the camera app was going. Not necessarily deal breakers, but certainly not ideal.

With iOS 16 and macOS Ventura, Apple basically came along and sherlocked Camo. And, because Apple has a LOT more resources, they were able to get the phone to work wirelessly, build the software into both OSes, and allowed for dealing with phone calls. I’m not going to comment on whether I’m happy with Apple doing the Sherlock, but the resulting feature certainly is impressive. I’m still paying Camo for a license because, frankly, they did a great job, and deserve a bit of support.

So, on to the fun part. With the initial betas / public previews, on my Mac Studio, the camera showed up correctly over wifi. Everything worked great. Then, a couple of beta’s ago, the camera disappeared. “Ok, maybe it was a simple bug that will get fixed with the next build”, I thought. So, I gave it a couple of builds… no dice. Ok, time to hack a bit… tested on my MacBook Pro… f— it works. WTH? Ok, start trying to figure out the differences. Even logged out of iCloud on my phone and computer (don’t do this except as a last resort!). Nadda, nothing changed it…

Finally, I had a light bulb go off… let’s just try plugging another camera in… lo and behold… that @#$%@# worked… the plugged in camera and the wifi iPhone camera both show up… unplug the camera, and no camera’s show up… *sigh* wonderful, somewhere in the code there is a really stupid bug where someone probably starts looking for cameras at array point 1 instead of 0, and it’s in the OS code. Fortunately, I put in a bug report to Apple. Hopefully they will be able to get it fixed.

It’s funny, it probably works for the developers because I imagine almost everyone is using a MacBook Pro laptop which has a camera, so they won’t ever see the bug… lol

At least I have it working now, and a good bug report filed with Apple

</RANT>

Checking the obvious…

Even master trouble shooters can fall prey to the basics every now and then.  Today, I just learned one of the great lessons in debugging all over again.  Fixing bugs is VERY, VERY, VERY simple.  It’s FINDING the damn things that is the hard part.  That’s not the lesson I learned, though.  The lesson learned follows…
 
Case in point.  Friday, I was running an expression based upon a date and a parameter in my program.  For some weird reason, the expression was returning no values.  I took the expression, parameter and all, and tried running it in SQL Server.  Boom, it worked.  I tried a bunch of different code changes, but NOTHING fixed the problem.  The program still gave back the empty results.  Next step, break out the smallest bit of code into a test program, then make single changes to go from non-working to working.  I did EVERY step I could think of.  No go.  I made as many changes as I could think of, and still no result.  I finally broke out the failing part of the expression.  Still no luck.  Finally, I went REALLY back to the basics… I started checking my assumptions.  Lo and behold, the value I *thought* I was using when running in SQL Server turned out to be wrong (darned date conversions!). 
 
 What was the ultimate problem?  I was using ‘greater than’ rather than ‘less than’ inside of my expression.  SQL Server ran fine, because the value I thought was being used was actually something completely different.  Oh well, 5 hours of debugging for an origianl 5 minute change…
 
As for the lesson that I relearned… Never trust assumptions.  ALWAYS make sure the value you are using is the one the system is getting… Especially when it comes to working with SQL Server’s query window!