Reading the undocumented MEMS accelerometer on Apple Silicon MacBooks via iokit
A GitHub project unearths an undocumented MEMS accelerometer hidden within Apple Silicon MacBooks, accessible only through low-level IOKit HID callbacks. This technical feat of reverse engineering captivates HN, as it reveals a hidden hardware component and its surprisingly versatile applications. The discussion revolves around the sensor's original purpose, the challenge of its discovery, and the inherent risks of playing with undocumented APIs.
The Lowdown
The olvvier/apple-silicon-accelerometer project has peeled back a layer of Apple's proprietary hardware, exposing an accelerometer that's not meant for public consumption. This technical deep dive showcases how to interface with a hidden sensor on Apple Silicon MacBooks, revealing its presence and potential uses.
- Apple Silicon chips (M1/M2/M3/M4) contain a MEMS accelerometer managed by a Sensor Processing Unit (SPU).
- It is not exposed via public APIs; this project accesses it through undocumented IOKit HID callbacks, specifically through
AppleSPUHIDDevicein the IOKit registry. - The project provides raw 3-axis acceleration data at approximately 800Hz.
- Access requires root privileges (
sudo) due to the low-level nature of IOKit HID device interaction. - The code includes
spu_sensor.pyfor core sensor reading andmotion_live.pyfor a demo featuring vibration detection and experimental ballistocardiography (heartbeat detection). - It's explicitly noted as experimental, potentially unstable with macOS updates, and used at one's own risk.
This ingenious piece of reverse engineering highlights the hardware capabilities hidden beneath Apple's software layers, offering a glimpse into what's possible when intrepid developers venture into undocumented territory, albeit with warnings attached.
The Gossip
Undocumented Discoveries
Users expressed curiosity about how the author managed to discover and interface with a completely undocumented sensor. The discussion clarified that while the sensor's *presence* (for its historical role in Sudden Motion Sensor) was generally known, the *method of accessing* it on modern Apple Silicon was the novel, undocumented revelation.
Accelerometer's Ancestral Aim
Many commenters recalled the accelerometer's original purpose in older Macs: protecting hard drives by parking read/write heads upon sudden movement. They speculated whether its continued inclusion in modern Macs with SSDs is simply a 'relic' of past designs, if Apple has other unrevealed plans for it, or if it's merely a cheap, standard component integrated during manufacturing.
Warranty Woes and Risky Revelations
The use of an undocumented feature, especially one related to physical shocks, raised concerns among commenters about potential warranty invalidation. Users pondered Apple's detection methods for 'sudden shock' and the broader implications of directly accessing such a sensitive, low-level sensor.
Creative Calibrations & Fun Functionality
Beyond the technical details, some users reminisced about classic fun applications of accelerometers in Macs, like the 'MacSaber' app, and appreciated the novel heartbeat detection demo. This highlighted the broader creative possibilities unlocked by achieving low-level access to the sensor.