I recently (around a month ago) stumbled upon an IBM 3161 terminal:

It was made on October 4, 1985. I found it at a HAMfest in my city, labeled at "$20 (Make offer!)". I offered $18, and he said it was "More than fair". I wish I'd just offered $8!
Anyway, this keyboard is the first Model M ever made. (not the first off the assembly line, but the first part number and the first year, and the first with the modern layout almost all PC's use today). Unfortunately, however, it's a terminal keyboard.
I was initially planning to convert it with a teensy or similar and one of the software converters out there, but I don't have the correct 270 degree DIN-5 connector. I took it apart (a few broken off rivets sadly), and I pulled the controller from my 1993 59G7980 (My only other Model M, which I picked up free while volunteering at a 'rummage sale' thing), placing it in the 1386303 and connecting the ribbon (the LED pins have no connections in this setup).
It worked, to my surprise. But I don't want to destroy a perfectly good Model M for the sake of another. And I definitely don't want to just order a 270 degree DIN-5 from digikey like a sensible person!
So I'm going to ask if anyone even knows what the protocol of this keyboard is. Did terminals use the XT interface? Is this 3161 actually using AT over a nonstandard connector? Is it something totally different?
The cable is attached permanently from the outside, but inside there is a weird little connector that appears to be like whatever the floppy drive/IDE HDD connector is, but with only 6 pins. I might just connect to this, but I still would like to know what protocol it uses. I never see ANY explanation as to what protocol the terminal keyboards actually use, and all the guides out there don't mention the 316x terminals, only 317x and higher.
What have I got here?
The keyboard feels nice, by the way. Different from my 1993 one, but nice.