XT/AT/PS2/Terminal to USB Converter with NKRO

User avatar
Soarer

28 Jul 2013, 02:08

Hmm, no... which ifs do you want to else with your cunninglogicus?

User avatar
Muirium
µ

29 Jul 2013, 11:00

Something to do with a default case for PS/2 keyboards with generic ID. I needed either an if else or a way to if against !something.

Because I think in C and can't help it!

User avatar
Soarer

29 Jul 2013, 12:51

Well, it's an idea that might be useful. Particularly for ifselect, since that's the only one that will help you work with multiple PS/2 keyboards with the same ID! But you can probably use the fact that later remappings override earlier ones to achieve the same effect...

Code: Select all

remapblock
  F1 F2     # remap some keys
endblock
ifselect 1
remapblock
  F1 F1   # undo some remaps
  F2 F3   # remap some other keys
endblock

User avatar
Muirium
µ

29 Jul 2013, 12:55

Right. He who laughs last…

User avatar
Soarer

31 Jul 2013, 04:01

Minor doc update (v1.12) posted to the OP covering changes since v1.10, some polishing, updated thread contents pages, and search boxes for searching this thread and the GH thread.

User avatar
ماء

31 Jul 2013, 04:18

Sir Soarer,Whether you will make a USB to USB :?

User avatar
Soarer

31 Jul 2013, 04:29

I dunno. I have the hardware, but it keeps slipping down my todo list.
hasu and darkness have code already!

User avatar
j0hnn0

10 Aug 2013, 02:48

Hey Soarer, thanks for the good work. I'm awaiting a shipment of 12 old IBM's, which I believe is a mix of XT, AT and Model M's. Will definitely convert them using your code. Already bought the Teensy's - a whole pack. Can't wait!

I'm also considering ordering a 122 from Unicomp as a PS/2 model, so I can remap all the unused keys to something useful and convert it to USB. Do you think this will work? They sell a couple of different protocol versions, I believe, so I'll have to be careful to get the right one.

User avatar
Muirium
µ

10 Aug 2013, 13:44

So you're the one who bought up all the Teensies! Grrr…

User avatar
Soarer

10 Aug 2013, 15:05

Unicomp only seem to have one variant of PS/2 122-key now, and I'm not sure which it is! If it's the one which can have its behaviour modified by a jumper inside then that's fine. What you don't want is one that sends combos (e.g. shift + F1) instead of F13 to F24 and which doesn't have that jumper.

User avatar
lamune

11 Aug 2013, 23:15

Soarer, thanks for this. Hacked up a Model M 122 terminal keyboard and I'll probably spend a month or two trying to figure out the best way to remap all these function keys.

What do you think about the possibility of adding a rotary encoder to the Teensy to act as a volume knob that triggers the Media Vol +/- codes? I think it's the only thing I'm going to miss from the multimedia Dell keyboard that I was using previously.

User avatar
Soarer

14 Aug 2013, 01:52

Hmm, I dunno. It would be a lot easier to implement an absolute control driven by a potentiometer, if it would work well (HID supports absolute controls, but there might be niggles)! That's probably what I'd prefer to use, myself.

It should be possible though to use an external decoder circuit to drive a couple of the aux key inputs - not sure if that's available as a single chip solution, or if someone has code that does it using a very cheap PIC or TinyAVR.

User avatar
lamune

14 Aug 2013, 05:36

Soarer, I have on order a rotary encoder that's designed for arduino usage, so perhaps it'd be an easy retrofit. The analog pot is a pretty interesting idea though I tend to think the rotary's pulses would be much easier translated into HID keypresses, but I'd certainly be curious to try an analog volume control. The Teensy does have inputs that could potentially be used for such a purpose.

I'll take a look and see how this thing works when I get it and provide more info.

User avatar
Soarer

14 Aug 2013, 14:05

The good thing about a pot is that it wouldn't have to be translated into keypresses! The downside is that is takes over completely, and you can't set the volume any other way. Hmm.

Got a link to the encoder? The problem with them is debouncing - can't do that on an interrupt since it would swamp the CPU at times, and possibly miss edges. This one looks pretty neat and easy to use on an interrupt, since all the hard work is already done!

User avatar
Muirium
µ

14 Aug 2013, 14:45

From West Calder! I should pop down on my bike, if I had a need for these myself…

Say, Soarer, do you happen to know a little about USB MIDI? I've a 16x8 straight matrix PS/2 Tipro and I'm getting strange ideas…

User avatar
lamune

14 Aug 2013, 17:43

Hah, that encoder looks very similar to what I've ordered, so perhaps it's interfaced the same way. Are there enough inputs left on the Teensy 2.0 to go around?

User avatar
Soarer

15 Aug 2013, 01:51

Really? Does it have a PCB on it? There's a few pins left, but not many that can generate an interrupt.

User avatar
Soarer

15 Aug 2013, 01:52

Muirium wrote:From West Calder! I should pop down on my bike, if I had a need for these myself…

Say, Soarer, do you happen to know a little about USB MIDI? I've a 16x8 straight matrix PS/2 Tipro and I'm getting strange ideas…
Heh, neighbours! I don't know USB MIDI at all, sorry.

User avatar
lamune

15 Aug 2013, 08:40

It does have a PCB. It's not clear if it's a "smart" or "dumb" controller. Looks like you'd need two interrupts to decode/debounce a bare encoder from the code I've been looking at. I think the encoder you've pointed out is the better way to go. Here's what I think makes sense: you need 8 inputs to implement a full dedicated set of media keys. We have AUX1-AUX5, so we need 3 more.

Using three inputs would do it in two ways- as 3 more standard key inputs that map directly to VOL+, Mute, VOL-, or as 3 inputs from the smart encoder: direction and step decode to VOL+/VOL- and one "button" input for Mute.

Seems simple enough, in theory anyway. :)

User avatar
lamune

17 Aug 2013, 18:52

Incidentally, I tried a Soarer-enhanced keyboard on a KVM (Avocent switchview DVI) and the keyboard won't initialize. If I use one of the "hub" ports, it works but no response via the keyboard console input. The LEDs light up and then go out, and that's all I see happen. Other keyboards work fine, so I wonder what may be going on here.

User avatar
Soarer

18 Aug 2013, 00:45

KVMs are fickle... at best they read the 6KRO report, and I guess many are only tested with low-speed USB keyboards (and mice). They certainly only ever present a 6KRO keyboard to the attached computers, and are unlikely to have media key support. They might get startled if the keyboard is swapped while they're on. Etc! I've got an Aten which works with my converter at least for basic 6KRO functionality, but macros can fox it since they replay at 1000Hz and it's only expecting 125Hz.

User avatar
lamune

19 Aug 2013, 06:20

I figured as much. I really don't need the KVM, but it was an interesting test. By the way, do you have the source for the converter up somewhere? I've done some AVR work in the past and I wouldn't mind taking a stab at the rotary encoder work.

User avatar
Soarer

21 Aug 2013, 13:44

I want to rewrite some of my USB descriptor handling to be more flexible, so perhaps I'll add a low-speed 6KRO mode at some point. Shame, because apart from KVMs and PS3s the current setup is very compatible with the main OSs. I haven't opened the source yet.

User avatar
lamune

22 Aug 2013, 09:21

Thanks, I'll keep an eye on the thread. :)

User avatar
lamune

25 Aug 2013, 22:20

I got the rotary encoder - it looks to have the same outputs as the one posted here. It has +5, Gnd, Dir, Clock, Switch. I haven't tested it yet, but it looks promising. :)

User avatar
Soarer

26 Aug 2013, 00:24

Oh cool, that one sounds really easy to handle! It doesn't even really need an interrupt if it's scanned at 1kHz, I think.

randku

27 Aug 2013, 06:30

Been using this converter for about a year now, thanks for all your hard work.
You've made something fantastic and easy to use, and provided it for free.

I'm using this to supplement a keyboard that already supports USB(Leopold Tenkeyless), my interest is in the NKRO over USB, macros, and keymap layers.

After struggling with hasu's converter for hours (probably my fault, but still frustrating), I tried yours and had it working and configured in about 20 minutes.

I even went so far as to hook up the teensy output to the internal USB connector, and it looks completely stock on the outside. :D

Thanks again, this is perfect for using multiple layouts without changing any OS settings, media keys, and throwing in a numpad layout for my tenkeyless board, on the off chance I actually need the specific numpad keycodes for a program.(it happens)

User avatar
Muirium
µ

27 Aug 2013, 09:40

Yes, this converter is essential. So glad Soarer made it for us all!

I'm finally drilling holes in aluminium for my external multi-input converter box. (Complete with a rotary input switch with vintage knob.) Perhaps I'll put in the trio of lock LEDs. But here's a thought: I've found the Teensy's own light quite informative (for hitting low rollover limits on some boards, and for telling me my data line had failed one time too). Could all three LEDs shine at once as an external version of that handy indicator? I seldom use caps, num or scroll locks myself anyway. A separate LED would be just fine too.

By the way: I have a sweet looking vintage on/off switch too. I'd love to empower my laziness and put that in the box so I can flip the switch and turn the knob to change between keyboards, no plug pulling required. The switch is two pole. Which of the four USB lines do you suggest putting through it or am I just nuts?

User avatar
Soarer

27 Aug 2013, 23:29

Thanks randku, glad you like it! Sounds like a really neat build :D

Muirium, everyone already knows you're nuts :P

You can wire an extra LED to the PD6 pin if you want, in the same way as the lock LEDs, to make an external copy of the onboard LED.

Switching needs to disconnect at least 3 USB wires, and the data lines must disconnect first, before power (and vice versa when reconnecting). So not really practical, I'm afraid. I'll try and look into what I could do in code... perhaps so you can have a button that resets the converter (without jumping to the bootloader).

User avatar
Muirium
µ

27 Aug 2013, 23:38

Ah, of course! I vaguely remember one of the Teensy's pins being the oddball LED pin. Thanks for reminding me.

An instantaneous (ie. push) button sounds like a good idea. I'll try to find a vintage one of those!

Post Reply

Return to “Workshop”