On macOS, certain software features are only present when enabled by hardware. In particular, APFS’ default volume encryption is only present when the the hardware is either Apple Silicon, or Intel with a T2 controller. Thus, every now and then, I’ve noodled on how to detect the Apple T2 Controller via relevance.
-
It’s possible to find it in the ioregistry, but that whole key/value/leaf structure is beyond my ken. I might be able to suss it out, but it just makes me mad.
-
Spelunking about with IORegsistryExplorer.app, I discovered the much simpler IOUSB plane. This find enables a very simple registry query:
exists ((usb plane of iokit registry) whose (exists node "Apple T2 Controller" of it))
This works, mostly. Except when it doesn’t, on machines that definitely have a T2 controller. Why? God knows. It just makes me mad again.
- Finally, I went to Wikipedia and grabbed machine names to brute force it.
if (exist strings ("iMac20,1";"iMac20,2";"iMacPro1,1";"MacBookAir8,1";"MacBookAir8,2";"MacBookAir9,1";"MacBookPro15,1";"MacBookPro15,2";"MacBookPro15,3";"MacBookPro15,3 ";"MacBookPro15,4";"MacBookPro16,1";"MacBookPro16,2";"MacBookPro16,3";"Macmini8,1";"MacPro7,1") whose (it is machine name)) then ("T2" as string) else ("n/a" as string)
Is it elegant? Not really. But job done.
Hopefully someone else can use it.