Trying to write keyboard SPI drivers for MacBook Pro (15-inch, 2017) MacBookPro14,3

Nathan Whoa

New Member

Messages: 8

I have a MacBook Pro (15-inch, 2017) and I want to run FreeBSD on it natively. But the built-in keyboard, trackpad and Touch Bar do not work. External keyboards and mice attached via USB work.

So I want to write a driver for the keyboard first; I will write the drivers for the rest afterwards. Linux kernel 5.3 has drivers for newer keyboards and trackpads but not for the Touch Bar.
kernel/git/torvalds/linux.git - Linux kernel source tree

I am reading Part II. Device Drivers from FreeBSD Architecture Handbook. I have listed the hardware with ioreg command from macOS.

The result of ioreg -flir -n SPI1 is attached.

I want to know if writing a driver for the hardware without documentation could damage the hardware, as I am using my work computer. Also please suggest me what I should read further to write FreeBSD drivers.


  • apple-ioreg-spi.txt
    978 KB · Views: 9


Son of Beastie

Reaction score: 1,660
Messages: 2,594

Ask yourself this question: What persistent state does a keyboard have which would survive power cycling? For example, if it were a disk drive, you could overwrite data with a defective driver (been there, done that).

So the likely chances are: firmware downloads, and persistent configuration changes. Mac's famously have PRAM (parameter RAM), which holds persistent configuration information, and when it gets scrozzled, the machine won't boot. So look at the documentation for that kind of thing. Just as an example: Maybe the keyboard can be remapped? If you remap all keys to be the letter X, then the machine will boot, but you'll never enter a password again (unless your password was XXXX). The end ...