Top
Best
New

Posted by leephillips 5 days ago

The MacBook has a sensor that knows the exact angle of the screen hinge(twitter.com)
Alts: https://hachyderm.io/@samhenrigold/115159295473019599, https://bsky.app/profile/samhenri.gold/post/3ly7252lx422d

Theremin Mode: https://twitter.com/samhenrigold/status/1964464940049453153

Github: https://github.com/samhenrigold/LidAngleSensor

1014 points | 487 commentspage 2
thisOtterBeGood 5 days ago|
You could use that to display some kind of billboard affect, so that an image is always in a correct aspect ration to the observer in front :D Please could someone with a macbook do this and post a video here? :D
ritcgab 5 days ago||
And this little thingy makes a lot of M2 MacBook Airs fail.
katmannthree 5 days ago||
I'd like to hear more, do you have an article or something you could link?
ritcgab 5 days ago|||
There is no official statement about this issue but you can search for user reports like "M2 MacBook Air black screen" or something similar. It is not uncommon.

In older versions of macOS you can simply try two things:

* Press Esc in locking screen, or * Press "Sleep" from the menu bar icon and then press Esc immediately

If the machine crashes/reboots, the sensor is bad and it needs to be replaced. Apple Store replaces the whole display assembly.

15 inch and M3/M4 models are not affected, AFAIK.

wiredpancake 4 days ago|||
[dead]
emmelaich 5 days ago||
I was wondering this myself. I've had three mac air/books that simply failed to turn the display on. I've heard (from a third party repairer) that it is not uncommon.
Svoka 5 days ago||
Confused why it says that 'this API is not exposed' while it's a simple HID device.

Author can submit this to the AppStore.

latexr 5 days ago||
> Confused why it says that 'this API is not exposed'

What it says is (emphasis mine) “it’s not exposed as a public API”. In other words, Apple doesn’t provide official documentation and hooks for you to interact with the feature, like they do e.g. with Bluetooth. Even then, while they provide public APIs to interact with paired devices, interacting with the Bluetooth controller itself (e.g. turning it completely off or on) requires private APIs.

WhyNotHugo 5 days ago||
If it’s a simple HID device, can we likewise have support for this on Linux?
whitehexagon 5 days ago||
Great! so they already know that I've been squinting at a 42deg gap trying to use my old MBP. The year with the faulty designed screen connector which was only covered for replacement on certain models, not mine. I wonder if that is why they added this, to check for 'holding the lid wrong'. If I open it any further I need a reboot to get the display back, oh and that angle decreases over time.

I wouldnt mind but I was 95% of the time clamshell, and still the keyboard made from butterflies wings lasted next to no time, and the battery put on too much weight after only 30 something cycles. After all these years I never understand how they produce such lemon models some years, just trying to save a few cents here and there. The one before was thermal paste nvidia meltdown.

floydnoel 5 days ago|
I think clamshell mode was a killer of those models especially. I never ran mine closed and still use them for gaming to this day (since they still run Wintel). Not even a single key failed yet
biosboiii 4 days ago||
The most interesting takeaway from this project and the Mac touchpad actually measuring it's pressure in grams[1] is how Apple seems to prioritise it's ability to deliver new features in later software releases rather than their BOM.

I work in the automotive industry, and for volume products the price-cutting is really brutal. If you can save a cent somewhere you will, because that cent multiplied by 8 million cars a year is a sizeable amount of money.

This seems to be generally true for most OEMs of hardware products, but not for Apple. Apple could have cut costs by just using a magnet and a reed switch/hall effect sensor, because it is not using the exact angle of the screen anyway (afaik?), but they chose not to.

They could have implemented their "3d Touch" by using a simpler circuit which just indicates if the press was really hard or soft. But again they chose not too.

And they sell over 20 million Macs per year, so they really sacrifice a sizeable amount of profit

[1] https://news.ycombinator.com/item?id=44635808

whitej125 4 days ago||
I learned of the lid angle sensor due to my MBP draining its battery. Whenever I flew across the country I'd always end up with a dead battery. Originally thought it was some process preventing sleep but was spinning circles hunting it down until one night, I closed the laptop... the screen turned off as it was closing and just as it shut.. you could see the faint glow of the screen turning back on again. If I cracked the lid open 1/8th of an inch it would turn off again.

I had thought that the MBP (an Intel one) had used magnets to detect lid closure but alas that's when I learned of the lid angle sensor and all the symptoms I was experiencing made sense. Basically the laptop would wake up when shut and the screen would stay on the entire time thus draining the battery.

Ended up getting the LAS replaced which was not DIY'able unfortunately... but was a relatively cheap fix (~$90).

nostrademons 5 days ago||
A lot of foldables have a hinge angle sensor - it's actually a public API in Android, and robust enough that we use it to detect whether a device is a foldable:

https://source.android.com/docs/core/interaction/sensors/sen...

caseyohara 5 days ago|
> we use it to detect whether a device is a foldable

I’m curious what you do with this information. Can you share?

xdkyx 5 days ago||
The first thing that comes to mind is simplifying the identification of a device type, without the necessity of looking up a device list name or updating the list with each new device that gets released.
robertoandred 5 days ago||
Yeah but why do you need to know?
nostrademons 5 days ago||
Foldables have a different UI which often requires different requests to the backend. They need to support both narrow-screen and large-screen formats for content, and you usually want to avoid having critical UI elements fall on the hinge for fairly obvious usability reasons.
robertoandred 5 days ago||
That should all be abstracted out to the operating system, not dependent on checking for specific devices. Any app should be able to accommodate different screen/window sizes and safe areas.
danaris 5 days ago||
...And does the Android OS provide this information?

'Cause if not, it makes perfect sense for nostrademons to be doing it themselves.

nostrademons 5 days ago||
The Android OS does provide screen width/height information and safe areas. We use them when appropriate, which is fairly often, but not universally. Safe area support for foldables is pretty weak, though, because it's a relatively new device category that imposes fairly different constraints on devices.

The bigger issue is that there's always a long-tail of product considerations that need to be different on foldables and aren't covered by just feature-detecting the available screen resolution. Logging is one: PMs are very interested in how the category as a whole is performing, if only to direct future hardware plans, and that requires that it actually be categorized as a separate category. Backend requests are another: you can (and should) optimize your bandwidth usage on phones by not shipping to the client information that is only going to be displayed on large screens, and you can (and should) optimize your screen usage on large screens by displaying more information that is not available on phones, but foldables represent the union of the two, and you usually don't want the latency of additional backend requests when the user fold/unfolds the device.

(The irony is that the app in question is Google Play, and I personally know most of the PMs and several of the engineers on Android SysUI.)

thenthenthen 5 days ago||
In case you do not have this sensor, you can use the ambient light sensor to achieve a similar effect: https://youtu.be/pzJwDs6KRXA?feature=shared
djtriptych 5 days ago||
I clicked around and the README links to this python lib: https://github.com/tcsenpai/pybooklid

Probably a nicer interface for anyone who wants to play with this :)

pimlottc 5 days ago|
That’s a downstream project, the author’s original project is here [0], with much more information on the actual sensor.

0: https://github.com/samhenrigold/LidAngleSensor

mproud 5 days ago|
Does anyone remember the slapbooks?

There was a sensor where it would detect when you slapped the side of the screen, and a guy wired it up so when you did that it shifted to the next space (virtual desktop).

moshib 5 days ago|
If I remember correctly, it was originally meant to detect if the laptop was falling, so that it could turn off HDDs to mitigate damage. Hitting the side of the screen could also trigger that sensor.
More comments...