Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse engineering the "Target Display Mode" on an iMac

I have a computer lab with a couple of old-ish iMacs (around 2011). Most people now just want to use them as displays for their laptops, and with Target Display Mode in MacOS, this (mostly) works fine.

However, I'd also like to support this under Linux, which is installed on all the iMacs in parallel to MacOS. I'm fairly experienced with the Linux kernel (I already wrote kernel drivers), but I have basically no idea about MacOS - therefore, I'm looking for pointers regarding how to figure out how TDM is actually triggered (i.e. what happens after Cmd-F2 is pressed).

I'm guessing this mostly involves writing some Intel GPU registers, but I have no idea which bit of MacOS is actually responsible for that. Any hints?

like image 349
Florian Echtler Avatar asked Apr 19 '17 09:04

Florian Echtler


1 Answers

So I figured it out on my own after all. After looking at libsmc, SMCKit, smc_util and the applesmc driver, I found that writing 0x02 to SMC key "MVMR" will cause the display to switch to DisplayPort input.

For details, see my short blog post: https://floe.butterbrot.org/matrix/hacking/tdm/

Tools are on Github: https://github.com/floe/smc_util

like image 135
Florian Echtler Avatar answered Sep 24 '22 06:09

Florian Echtler