Show HN: C++ library for reading MacBook lid angle sensor data
2 days ago
- #HID
- #MacBook
- #C++
- A C++ library for reading MacBook lid angle sensor data, reverse-engineered from HID device specifications.
- Features direct access to MacBook's built-in lid angle sensor with real-time precise angle measurements (0-360 degree range).
- High-performance C++14 implementation with comprehensive exception handling and a clean, easy-to-use API.
- Supports CMake build system and includes example programs for basic and continuous angle monitoring.
- Compatible with MacBook Pro 16-inch (2019) and newer models, including M2/M3/M4 series, with some restrictions on M1 MacBook Air/Pro.
- Device identification via Apple VID=0x05AC, PID=0x8104, using HID usage: Sensor page (0x0020), Orientation usage (0x008A).
- Data format includes a 16-bit angle value with 0.01-degree precision.
- Requires macOS 10.15 or later, Xcode Command Line Tools, and CMake 3.15 or later.
- Includes troubleshooting tips for common issues like device compatibility, sensor unavailability, and system permissions.
- Based on the original Lid Angle Sensor project by Sam Gold, extending functionality to C++ developers.