文章摘要
该项目通过IOKit HID接口读取苹果M1芯片MacBook上未公开的MEMS加速度计数据,提供了访问这些隐藏传感器的方法。
文章总结
GitHub项目:通过IOKit HID读取Apple Silicon MacBook未公开的MEMS加速度计数据
项目地址:https://github.com/olvvier/apple-silicon-accelerometer
项目简介: 这个开源项目实现了通过IOKit HID接口读取Apple Silicon芯片(M1/M2/M3/M4)MacBook中未公开的MEMS加速度计数据。该传感器由传感器处理单元(SPU)管理,不通过任何公开API暴露。
技术细节: - 通过IOHIDDeviceCreate和IOHIDDeviceRegisterInputReportCallback注册异步回调 - 原始三轴加速度数据采样率约800Hz - 数据格式为22字节HID报告,x/y/z轴数据位于6/10/14字节偏移量(小端int32) - 需要将原始值除以65536转换为重力加速度单位(g)
使用说明: 1. 克隆仓库并安装依赖 2. 需要root权限运行(因IOKit HID设备访问需要特权) 3. 包含核心模块spusensor.py和演示程序motionlive.py
演示功能: - 实时显示加速度数据 - 心跳检测功能(通过手腕接触笔记本机身检测机械振动)
注意事项: - 实验性项目,可能随macOS更新失效 - 仅测试过M3 Pro版MacBook Pro(macOS 15.6.1) - 不可用于医疗用途
项目状态: - 103星标 | 6次分叉 | MIT许可 - 主要开发者:Olivier Bourbonnais
更多技术细节可参考作者在Medium上的文章。
评论总结
以下是评论内容的总结:
关于Mac加速计的存在与用途
- 用户质疑如何发现Mac中存在加速计(评论3:"How did OP even know that an accelerometer exists in the first place?")
- 用户确认M4 MacBook Pro中存在两个Bosch BMI286加速计(评论9:"On my M4 14-inch MacBook Pro, it looks like there are two accelerometers")
潜在应用场景
- 用作随机数生成器(评论5:"Could this be used as 'shake your mac for highly random seed' bits?")
- 用于屏幕锁定或TouchID禁用(评论10:"I would like an app to lock my screen on sudden movement")
- 可能用于Vision Pro显示镜像(评论7:"I wonder if this sensor is used for Vision Pro display mirroring")
相关历史项目
- 用户分享2008年开发的Newton Virus项目(评论4:"Way back in ~2008 I wrote the Newton Virus")
担忧与质疑
- 担心可能导致保修问题(评论2:"Your warranty claim was denied because we determined that the laptop was subjected to a sudden shock")
- 对隐藏API的潜在用途表示好奇(评论6:"If it can read your heartbeat...maybe it can use that as a user satisfaction signal")
正面反馈
- 用户对能够访问该功能表示高兴(评论8:"I've been wondering about this for a while, glad someone's finally managed to access it")
- 用户表示感谢(评论11:"This is so cool thank you!")