geekhack

geekhack Community => Keyboards => Topic started by: JBert on Sun, 13 September 2009, 10:54:11

Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: JBert on Sun, 13 September 2009, 10:54:11
Well, there hasn't been a thread nor wiki article dedicated to this topic, but there should be a way of getting an XT keyboard to work in Linux.
This thread can be used to document process and gather feedback.


Let's start at the beginning:
A couple of years ago, Vojtech Pavlik coded up a Linux driver that could read the parallel or serial port and use it as keyboard input (http://atrey.karlin.mff.cuni.cz/~vojtech/input/).
For the XT protocol, he envisaged a simple adapter circuit to be plugged on the parallel port: (schematic can be found in the driver's source)
Code: [Select]
To connect an AT or XT keyboard to the parallel port, a fairly simple adapter can be made:
Parallel port            Keyboard port

    +5V --------------------- +5V (4)
 
                ______
    +5V -------|______|--.
                         |
    ACK (10) ------------|
                         |--- KBD CLOCK (5)
    STROBE (1) ---|<|----'
   
                ______
    +5V -------|______|--.
                         |
    BUSY (11) -----------|
                         |--- KBD DATA (1)
    AUTOFD (14) --|<|----'

    GND (18-25) ------------- GND (3)
   
The diodes can be fairly any type, and the resistors should be somewhere around 5 kOhm, but the adapter will likely work without the resistors, too.

The +5V source can be taken either from USB, from mouse or keyboard ports, or from a joystick port.
Unfortunately, the parallel port of a PC doesn't have a +5V pin, and feeding the keyboard from signal pins is out of question with 300 mA power requirement of a typical AT/XT keyboard.

The adapter needs a 5V Vcc, so check if you got an old power supply or a free USB port from which you can leech some power. Also, I think the resistors are necessary.

Anyway, in my case it didn't work. I don't know if my keyboard is bust, the circuit is wrong or there is some other compatibility problem. It just spew errors about "Unknown scan code 0xFF" and stuff like that - as if it read data from the clock line.
I do have to note though that my current circuit is a bit of ghetto work. I didn't have any perfboard, so I just cut some pieces of PCB with usable traces from some old appliances. As a power source, I cut a 5V voltage regulator from a busted PSU and feed it 6-9V to get the desired output.

Once I build a cleaner version, I'll try to post an update and a schematic.
Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: Rajagra on Sun, 13 September 2009, 11:01:17
That seems to be designed as a bidirectional connection. I thought XT keyboards could only transmit, so you should only need the Gnd, +5V, Ack and Busy connections.
Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: JBert on Sun, 13 September 2009, 11:17:39
AFAIK this isn't a problem as long as you don't write to the parallel port.
Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: microsoft windows on Sun, 13 September 2009, 17:37:17
If I did that on my computer, I'd have to switch off the keyboard to use the printer!
Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: ch_123 on Sun, 13 September 2009, 17:41:38
I almost forgot about those dark days where people actually had to connect their printer directly to their computer... =P
Title: Parkbd - Connecting XT keyboard to a PC in Linux
Post by: InSanCen on Mon, 14 September 2009, 07:16:38
Network Attached Printers rule...

As does Storage, and well, anything else I can thing of that I can bung on a GigE port.

Every PC/Seat has access to it (Given permissions/shares). Love it.

I will be interested in this project though, I was researching something similar myself, but my coding, well, BASIC and Z80 ASM (Sinclair Spectrum! Woohoo!) is where it's at, though I am trying to learn C++.