{"id":38338,"date":"2023-01-31T16:17:35","date_gmt":"2023-01-31T21:17:35","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=38338"},"modified":"2024-02-02T16:28:17","modified_gmt":"2024-02-02T21:28:17","slug":"reverse-engineering-the-macbook-clamshell-mode","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/01\/31\/reverse-engineering-the-macbook-clamshell-mode\/","title":{"rendered":"Reverse Engineering the MacBook Clamshell Mode"},"content":{"rendered":"<p><a href=\"https:\/\/alinpanaitiu.com\/blog\/turn-off-macbook-display-clamshell\/\">Alin Panaitiu<\/a>:<\/p>\n<blockquote cite=\"https:\/\/alinpanaitiu.com\/blog\/turn-off-macbook-display-clamshell\/\"><p>You notice you never use the MacBook built-in display anymore, and it nags you to have it in your lower peripheral vision.<\/p><p>Closing the lid is not an option because you still use the keyboard and trackpad, maybe even the webcam and TouchID from time to time.<\/p><p>[&#8230;]<\/p><p>Why isn&rsquo;t there a way to actually disable this screen?<\/p><p>[&#8230;]<\/p><p>In the pre-chunky-MacBook-Pro-with-notch era, the lid was detected as being closed using magnets in the lid, and some <a href=\"https:\/\/guide-images.cdn.ifixit.com\/igi\/TWIoJgROcI65mq4A.full\">hall effect sensors<\/a>. So you were able to trick macOS into thinking the lid was closed by simply placing two powerful magnets at its sides.<\/p><p>[&#8230;]<\/p><p>I usually search for code on <a href=\"https:\/\/sourcegraph.com\">SourceGraph<\/a> as it has indexed some large macOS repos with dyld dumps. Looking for <code>RequestClamshellState<\/code> gives us <a href=\"https:\/\/sourcegraph.com\/github.com\/apple-oss-distributions\/PowerManagement\/-\/blob\/pmconfigd\/PMDisplay.m?L527:6&amp;subtree=true\">something far more interesting<\/a> though[&#8230;]<\/p><\/blockquote>\n<p>But to call the private API he needed private entitlements, which must be signed by Apple, unless that check is disabled after turning off System Integrity Protection. Even then he ran into a blocker. Still, it&rsquo;s an interesting tour through how to dig into macOS.<\/p>","protected":false},"excerpt":{"rendered":"<p>Alin Panaitiu: You notice you never use the MacBook built-in display anymore, and it nags you to have it in your lower peripheral vision.Closing the lid is not an option because you still use the keyboard and trackpad, maybe even the webcam and TouchID from time to time.[&#8230;]Why isn&rsquo;t there a way to actually disable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-01-31T21:17:38Z","apple_news_api_id":"0baa1119-4de7-4ee9-aa90-caf3d3cc008a","apple_news_api_modified_at":"2023-12-06T19:20:12Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/AC6oRGU3nTumqkMrz08wAig","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[466,2518,763,30,1155,100,2223,74,280,1013,71,2062,901,573,1473],"class_list":["post-38338","post","type-post","status-publish","format-standard","hentry","category-technology","tag-codesigning","tag-entitlements","tag-hopper","tag-mac","tag-macbook","tag-macbookpro","tag-macos-13-ventura","tag-opensource","tag-power","tag-private-api","tag-programming","tag-sleep-mode","tag-swift-programming-language","tag-touch-id","tag-xpc"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=38338"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38338\/revisions"}],"predecessor-version":[{"id":38339,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38338\/revisions\/38339"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=38338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=38338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=38338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}