Based on information from various sources on the Internet, I've pieced together that the ISO9141-2 K-line interface transmits data frames over a single-wire, half-duplex, 10.4k baud serial protocol similar to RS232. The idle state is supposedly maintained by a 510Ω pull-up resistor to Vbat and the active/dominant state is implemented by an open collector driver. Sounds pretty straightforward to build a microcontroller interface for that.
One thing I couldn't figure out was if I'm supposed to provide the idle pullup or if the ECU provides it for me. I've seen some schematics on the Internet that include the pullup and others that don't. It feels kind of dangerous to install an open collector driver on a port where I don't know the properties of the pullup.
In order to figure that out, I devised a simple test: I installed a 460Ω resistor to ground on the K line and measured the voltage across it.
With the ignition turned on (but engine off) I measured 12.01V on Vbat, 10.39V on the K line when left floating and 231mV across my Rtest when installed. This leads to my conclusion that there is a weak (~20kΩ) pull-up in place and that it should be safe for me to put a small series resistor on my open collector line driver to protect against shorting.
Simplified, I think the line driver in the ECU looks something like this: