geekhack

geekhack Projects => Making Stuff Together! => Topic started by: hasu on Sat, 22 January 2011, 13:37:27

Title: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 22 January 2011, 13:37:27

This is a PS/2 to USB keyboard converter with some nice features.


Preassembled TMK PS/2-USB converter is available here (https://geekhack.org/index.php?topic=72052.msg1751398#msg1751398)!

HISTORY
FEATURES
BUILD CONVERTER
You can build your own converter.
Connect CLOCK line to PD1 pin and DATA line to PD0 pin. You need pull-up resistors on both signal lines.
Needless to say, you need to wire Vcc and GND line too. You can change pin configuration by editing config.h.

And consult with README file.
https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb


BUILD FIRMWARE
Check this first.
https://github.com/tmk/tmk_keyboard/wiki#build-firmware

Get source code from here and go to converter/ps2_usb directory.
https://github.com/tmk/tmk_keyboard

For TMK converter Rev.2:
Quote

$ make -f Makefile.rev2 clean
$ make -f Makefile.rev2 KEYMAP=plain
$ make -f Makefile.rev2 KEYMAP=plain dfu

If your use your own DIY converter with ATMega32u4 you can use Makefile.32u4 instead, but note that progarmming with 'dfu' may not work for your converter.

Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Sat, 22 January 2011, 14:43:14
So with this, we could implement any minor changes in key layout we've done, prior to it even getting to the controller?

This is genius!

I've got a bolt modded model M that I split the backspace into 2 keys, and rearranged others (see link in sig, if you're curious).

If I'm reading this correctly, I could use this project to modify the keymap in the converter, thereby obviating the necessity of registry hacks or xmodmap or whatever. Is this correct?

If so, I might need to finally order a teensy.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Sat, 22 January 2011, 15:48:25
I like the github 404 :-p

(https://github.com/tmk/tmk_keyboard/ps2_usb/ should be https://github.com/tmk/tmk_keyboard/tree/master/ps2_usb, I think).

Nice work, again, hasu :-)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 22 January 2011, 20:08:07
Quote from: theferenc;282963

I've got a bolt modded model M that I split the backspace into 2 keys, and rearranged others (see link in sig, if you're curious).

If I'm reading this correctly, I could use this project to modify the keymap in the converter, thereby obviating the necessity of registry hacks or xmodmap or whatever. Is this correct?


I think so.
This converter allows you to remap scan code from PS/2 keyboard to any USB code. If your split 2 keys have different PS/2 scan code each, you can rearrange those keys as you like.
Using this converter, I think you will not need registry hacks and AHK for rearrangement of keys.

Get a Teensy and try this!
I need feedback, suggestions and advices to improve my project.




Quote from: Soarer;282999
I like the github 404 :-p

(https://github.com/tmk/tmk_keyboard/ps2_usb/ should be https://github.com/tmk/tmk_keyboard/tree/master/ps2_usb, I think).

Nice work, again, hasu :-)


Thank you, Soarer.
I fixed it.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Sat, 22 January 2011, 20:21:31
Just to check, will this work with a teensy++, or just a teensy? I ask because the teensy is currently out of stock. I assume teensy only, so I guess I will just have to wait, which is a shame.

I'm definitely interested in trying this out and providing feedback. Especially since right now, the registry hack thing is only a viable solution for windows. This will make the keyboard work properly, regardless of physical system it is connected to.

Also, the split backspace does send distinct scan codes, so it theoretically should work.

Thanks, Hasu!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 23 January 2011, 00:37:36
theferenc,

I believe it should work on Teensy++. Though I didn't confirm that.
My Teensy++ is located inside my HHKB and is not available for testing now.


Quote from: theferenc;283088
Just to check, will this work with a teensy++, or just a teensy? I ask because the teensy is currently out of stock. I assume teensy only, so I guess I will just have to wait, which is a shame.

I'm definitely interested in trying this out and providing feedback. Especially since right now, the registry hack thing is only a viable solution for windows. This will make the keyboard work properly, regardless of physical system it is connected to.

Also, the split backspace does send distinct scan codes, so it theoretically should work.

Thanks, Hasu!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: symphonic1985 on Sun, 23 January 2011, 04:22:12
I really love this idea. I have to work on Ubuntu at work where I have much less experience with Autohotkey type things. I'd much rather do things in hardware than have to learn lots of different remapping and hotkey systems.

Once the guilt from all my keyboard purchases has worn off I think that I'll probably grab a teensy to play with this kind of awesomeness.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: sixty on Sun, 23 January 2011, 04:58:17
Great work! I would love to try it, sadly Teensy is entirely sold out everywhere in Germany since everyone uses it for PS3 piracy.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Sun, 23 January 2011, 08:29:21
Quote from: sixty;283223
Great work! I would love to try it, sadly Teensy is entirely sold out everywhere in Germany since everyone uses it for PS3 piracy.


You could try one of these: http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=280606391720&ssPageName=STRK:MEWAX:IT (http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=280606391720&ssPageName=STRK:MEWAX:IT)

It's one of the few Teensy alternatives that actually looks OK Many of them are copies of the original Teensy, not the 2.0 version with atmega32u4 chip. I've just ordered one to test it out... we'll see...
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Sun, 23 January 2011, 08:51:53
Hasu, the PrintScreen shouldn't be handled as a sequence, but the fix is easy...

code E0 12 should be ignored
code E0 7C should map to PrtSc HID code

The E0 12 is a fake shift for when E0 is not handled, e.g. a computer that thinks it has an 84 key keyboard attached. Since you handle E0, you don't need to handle the PrtSc sequence specifically. In fact, it makes a bug when PrtSc is held down and repeats! (also maybe when shift is held?)

Basically, this means it can be handled the same as any other normal key :-)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 24 January 2011, 10:40:59
Soarer, thank you for your feedback!

I have fixed the problem you described.

It took some time to check out complex behavior of PS/2 keyboard.
The PS/2 scan code(set 2) is chaos :( I am not sure why they do like that even though they needed backward compatibility.



This is my result of research.
Code: [Select]
/*
 * PS/2 Scan Code Set 2: Exceptional Handling
 *
 * There are several keys to be handled exceptionally.
 * The scan code for these keys are varied or prefix/postfix'd
 * depending on modifier key state.
 *
 * References:
 *     http://www.microsoft.com/whdc/archive/scancode.mspx
 *     http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc
 *
 *
 * Insert, Delete, Home, End, PageUp, PageDown, Up, Down, Right, Left:
 *     Num Lock: off
 *     modifiers | make                      | break
 *     ----------+---------------------------+----------------------
 *     Ohter     |                    <make> | <break>
 *     LShift    | E0 F0 12           <make> | <break>  E0 12
 *     RShift    | E0 F0 59           <make> | <break>  E0 59
 *     L+RShift  | E0 F0 12  E0 F0 59 <make> | <break>  E0 59 E0 12
 *
 *     Num Lock: on
 *     modifiers | make                      | break
 *     ----------+---------------------------+----------------------
 *     Other     | E0 12              <make> | <break>  E0 F0 12
 *     Shift'd   |                    <make> | <break>
 *
 *     Handling: ignore these prefix/postfix codes
 *
 *
 * Keypad-/:
 *     modifiers | make                      | break
 *     ----------+---------------------------+----------------------
 *     Ohter     |                    <make> | <break>
 *     LShift    | E0 F0 12           <make> | <break>  E0 12
 *     RShift    | E0 F0 59           <make> | <break>  E0 59
 *     L+RShift  | E0 F0 12  E0 F0 59 <make> | <break>  E0 59 E0 12
 *
 *     Handling: ignore these prefix/postfix codes
 *
 *
 * PrintScreen:
 *     With hoding down modifiers, the scan code is sent as following:
 *
 *     modifiers | make         | break
 *     ----------+--------------+-----------------------------------
 *     Other     | E0 12  E0 7C | E0 F0 7C  E0 F0 12
 *     Shift'd   |        E0 7C | E0 F0 7C
 *     Control'd |        E0 7C | E0 F0 7C
 *     Alt'd     |           84 | F0 84
 *
 *     Handling: ignore prefix/postfix codes and treat both scan code
 *               E0 7C and 84 as PrintScreen.
 *
 * Pause:
 *     With hoding down modifiers, the scan code is sent as following:
 *
 *     modifiers | make(no break code)
 *     ----------+--------------------------------------------------
 *     no mods   | E1 14 77 E1 F0 14 F0 77
 *     Control'd | E0 7E E0 F0 7E
 *
 *     Handling: treat these two code sequence as Pause
 *
 */
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Mon, 24 January 2011, 13:17:11
Yes, that's how I handle all of those, in fact the only one that actually needs special code is Pause. (As far as I know so far, anyway!)

All very convoluted, and tedious to check them all, but mostly ignoring them seems to be the right thing to do!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 24 January 2011, 14:45:47
Quote from: sixty;283223
Great work! I would love to try it, sadly Teensy is entirely sold out everywhere in Germany since everyone uses it for PS3 piracy.

Quote from: Soarer;283263
You could try one of these: http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=280606391720&ssPageName=STRK:MEWAX:IT

It's one of the few Teensy alternatives that actually looks OK Many of them are copies of the original Teensy, not the 2.0 version with atmega32u4 chip. I've just ordered one to test it out... we'll see...


Teensy is a great platform for easy & rapid development.
But I need more option for hardware. I mean my next target will be V-USB stack with ATmega, tiny is too tight for my firmware.

This is my testbed of V-USB using arduino I setup today.
(http://img833.imageshack.us/img833/6753/201101251945.jpg)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Tue, 08 February 2011, 19:58:47
hasu, is it possible, using this method, to map the extra keys on a terminal emulator that are usually just ignored by converters? Looking at your keymap layers, it appears that I would just have to add in the extra keys by hand, but that's no big deal for me.

Honestly, I don't really care what the keys are supposed to do, as long as they send unique scan codes from the teensy to the workstation.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 08 February 2011, 21:09:43
theferenc,

I don't know the "terminal emulator" keyboard at all, in particular its scan codes.

My converter supports PS/2(AT) signaling and scan code set 2, if the keyboard uses these you can map easily by just editing keymap.c.
But if scan codes for the extra keys are very different from PS/2 scan code set 2, you will have to write some codes in C to decode them.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Tue, 08 February 2011, 21:11:45
It's the 122 key IBM keyboards. Hopefully it won't be too complicated to decode them. Low level C is sort of my area (I'm a systems coder), so that part, at least, won't be an issue.

If I get it working, I will definitely pass it along.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: kishy on Tue, 08 February 2011, 23:09:17
122 emulator, yeah? There are two varieties AFAIK: ones that send modifier+another key, and ones that send mostly unique codes.

The latter is what sounds like it could be made to work with this doohicky. The first is probably not worth bothering with.

The real terminal keyboards are all Set 3, of course.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Wed, 09 February 2011, 01:12:00
I've got a Teensy++ on the way. So we'll also see if it would be a straight load on that, or if any modifications will be necessary. Based on specs, it should just work, since I don't need many inputs.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Wed, 09 February 2011, 03:17:35
How hard would it be to change the firmware to accept an arbitrary input protocol (like terminal or XT for example)?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 09 February 2011, 04:59:29
kishy,
I have read "USB converter" page in your signature, is dfj's converter firmware available to public? I couldn't found it by my quick search.
It must be very useful to us if its source code is also available.

REVENGE,
I think it depends on whether you could find enough documentation to implement the protocol.
In my case, PS/2 and ADB have many good resources on the net. Thanks to this I could write initial code and see scan codes from keyboard in first several hours, though
I used several days to research and understand the protocol.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 09 February 2011, 23:25:46
Quote from: hasu;292169
kishy,
I have read "USB converter" page in your signature, is dfj's converter firmware available to public? I couldn't found it by my quick search.
It must be very useful to us if its source code is also available.

I found the answer in dfj's recent post (http://geekhack.org/showpost.php?p=291453&postcount=27).
Quote
Both teensy implementations are not-quite released as open-source yet,  but can be had from the folks on the IRC channel #geekhack if you can  stand it there. :P
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Sun, 13 February 2011, 12:18:02
hasu,

Based on the code and the layout of the KEYMAP macro, it would appear there is a specific ordering to the keys. I assume this 8x22 map comes from the normal matrix of a keyboard somehow.

Basically, if I'm adding a key (I use a 102 key keyboard, as backspace has been split from a single key to 2 keys), do I have to put it in a very specific location, or can I simply replace one of the KB_NO locations, so long as I pick an appropriate name?

Any help would be appreciated!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 13 February 2011, 21:58:55
theferenc,
At first , You need to know scan code for the key. once you know that, just replace KB_NO with matrix position of the code as you said.
Probably You can see the scan code in debug console if your keyboard sends scan code Set2. Run PJRC's hid_listen.exe then press LControl+RShift+d in your target keyboard.


Following is how the converter maps PS/2 codes to USB codes.

This converter stores a scan code from keyboard as a bit in matrix(uin8_t[32] array) in following rule.
For example 'A'(0x1C) is stored like: matrix[0x1C>>3] |= 1<<(0x1C&0x07);
0xE0 prefix code like'PG UP'(0xE0, 0x7D): matrix[(0x7D|0x80)>>3] |= 1<<(0x7D&0x07);
See matrix.c for details.

Then the matrix is mapped to USB code in keymap.c.
'A' is identify as 'K1C' and 'PG UP' as 'KFD'(0x7D|0x80=0XFD) in KEYMAP macro.

PS/2 scan code Set2
http://www.computer-engineering.org/ps2keyboard/scancodes2.html
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: intealls on Wed, 16 February 2011, 17:21:39
Awesome work hasu!

I just wanted to quickly describe how to add support for the Europe 2 key (right of the shift key), in case people have trouble understanding shift operations and the like. Add 'K61,' next to 'K12,' on line 24. Change the second 'KB_NO,' on line 39 to  'KB_##61,'.

Then configure your keymaps to use NONUS_BSLASH where the Europe 2 key is located. If you want, you could add an extra #define in usb_keycodes.h like '#define KB_NUBS KB_NONUS_BSLASH', to keep everything nice and tidy in your keymap configuration.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 16 February 2011, 22:36:38
intealls,

Thank you for your nice feedback!
I added short name you suggested and push it to github.


And I'd like to added useful resources for people want to define their own keymaps.

USB HID to PS/2 Translation Table:
You can see PS/2 scan codes and how to handle it in Windows.
http://www.microsoft.com/whdc/archive/scancode.mspx

HID usage table:
You can see all HID Usage IDs(USB keycodes).
http://www.usb.org/developers/hidpage#HID_Usage
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 25 February 2011, 08:30:58
V-USB is supported now.
Currently the converter on V-USB lacks some features: USB NKRO and System/Media control.

(http://i.imgur.com/8jJCZl.jpg)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Mon, 28 February 2011, 13:44:37
Hasu,

This is very impressive.  What about designing a PCB on http://batchpcb.com and then keeping a list of parts from a distributor so people could build their own?

The advantage would be that you could have female ps/2 soldered right to the board, and we could size it to matchup with a plastic housing of some sort. ^_^
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Mon, 28 February 2011, 13:58:12
Something like this guy:

http://www.pactecenclosures.com/product-detail.php?classid=31&seriesid=64

They have different sizes, etc.  Mouser is franchise for that company.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: intealls on Fri, 04 March 2011, 22:22:36
I've been using this for a couple of weeks now and I have to say it works great! The only problem I have encountered is that the adapter didn't work properly with my Model M's, after adding the 1K pull-up resistor to the data line (as described in the ADB-USB adapter thread) it works perfect! Typing on one now, feels kind of awesome having a fully programmable M without any hardware modifications. Thanks hasu! :)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 05 March 2011, 00:18:55
intealls,
Thanks for your feedback! In particular, I'm happy to hear positive one :)
It seems we had better have pull-up resistors in case. Internal pull-up is not enough :(


doublethink,
I have not an experience on PCB design, but I'm planning to learn it using Kicad.
Thanks for suggestion.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Tue, 08 March 2011, 15:38:00
hasu,

I have only played with an arduino twice with a breadboard, I know the basics but am no expert.

If we could get this running on lets say 30$ worth of hardware from mouser, and it could be programmed using your firmware to give colemack or workman guys a hardware based interface, with NKRO that would be quite an accomplishment for the community. :)

of course it would probably piss off those qwerty -> dvorak usb key guys or whatever.  as long as we didn't blatantly monetize it they have no recourse though.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Tue, 08 March 2011, 18:07:26
PJRC continues to be out of stock on those regular Teensys, any reason this wouldn't work on a DX copy?

http://www.dealextreme.com/p/designer-s-teensy-usb-development-board-for-ps3-47609
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Tue, 08 March 2011, 18:24:34
Quote from: ripster;308065
Whoah - lookee that.  I coulda bought that along with my HHKB Killer.

I only found it because PJRC has a big post against buying counterfeit Teensys (http://www.pjrc.com/teensy/counterfeit.html). Go figure. :rolleyes:
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 08 March 2011, 18:34:22
A better deal is this one on ebay from noogroove: http://cgi.ebay.com/NooGroove-USB-Board-ATMEGA32-AT90USB162-AVR-Stick-DFU-/150568104102?pt=LH_DefaultDomain_2&hash=item230e8ef0a6

The ATMEGA32U2 has twice the RAM (1KB) of the dealextreme one (AT90USB162), but still less than the 2.5KB of a real PJRC Teensy 2.0 (ATMEGA32U4).

And you'll probably get it a lot quicker!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Tue, 08 March 2011, 18:40:08
Quote from: Soarer;308072
A better deal is this one on ebay from noogroove: http://cgi.ebay.com/NooGroove-USB-Board-ATMEGA32-AT90USB162-AVR-Stick-DFU-/150568104102?pt=LH_DefaultDomain_2&hash=item230e8ef0a6

The ATMEGA32U2 has twice the RAM (1KB) of the dealextreme one (AT90USB162), but still less than the 2.5KB of a real PJRC Teensy 2.0 (ATMEGA32U4).

And you'll probably get it a lot quicker!

Thanks! Nice find.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 08 March 2011, 18:56:32
No worries! I bought a couple of them, they got here (UK) in about a week which is pretty good. Not done a lot with them yet though, because I've got Teensy 2.0 and Teensy++ 2.0 boards to play with as well :-)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Tue, 08 March 2011, 19:00:04
Quote from: Soarer;308083
No worries! I bought a couple of them, they got here (UK) in about a week which is pretty good. Not done a lot with them yet though, because I've got Teensy 2.0 and Teensy++ 2.0 boards to play with as well :-)

There's an ATMEGA32U4 based board (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=280606391720&ssPageName=STRK:MEWAX:IT#ht_1271wt_905) on eBay as well, have you checked it out?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 08 March 2011, 19:21:30
Yup - it's big! Drop shipped from India. Seems to work fine, but I keep going back to the Teensy for development because the loader is nicer.

Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: kps on Tue, 08 March 2011, 20:25:34
Quote from: Soarer;308072
A better deal is this one on ebay from noogroove: http://cgi.ebay.com/NooGroove-USB-Board-ATMEGA32-AT90USB162-AVR-Stick-DFU-/150568104102?pt=LH_DefaultDomain_2&hash=item230e8ef0a6


Nice find, thank you! My last adapter I built using a $9 PS3 dongle, but I don't enjoy soldering wires onto TQFP pins.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Tue, 08 March 2011, 23:39:19
Quote from: Soarer;308107
Yup - it's big! Drop shipped from India. Seems to work fine, but I keep going back to the Teensy for development because the loader is nicer.


Haha, guess I need to find a bigger project box for that hes board.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: woody on Wed, 09 March 2011, 07:21:31
http://www.mattairtech.com/index.php/featured/atmega32u2-development-board.html (http://www.mattairtech.com/index.php/featured/atmega32u2-development-board.html)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Thu, 10 March 2011, 09:15:25
hasu,

I'm pulling the data sheets to see whats going with Atmel at the moment.

The Teensy is based on the ATMEGA32U4-MU:

http://www.atmel.com/dyn/products/packagecard.asp?category_id=163&family_id=607&subfamily_id=760&part_id=4317&package_id=952&green=1

Basically 7x7mm footprint.  That chip is nowhere to be found because of the PS3 bull**** at the moment. 20 week lead time, and I wouldn't be surprised if it gets pushed out again.

However, the ATMEGA32U4-AU can be had, the spec is here:

http://www.atmel.com/dyn/products/packagecard.asp?category_id=163&family_id=607&subfamily_id=760&part_id=4317&package_id=616&green=1

TQFP package, which is 10x10mm. Slightly bigger but honestly who cares.

I am trying to figure out how we could make a design that would allow all the keyboard layouts with the 4 key rollover that usb supports, using your firmware.

So basically, what would you consider your ideal chip for this, perhaps something that could hold both the ADB and the layout swap in one.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 10 March 2011, 10:54:43
I uses ATmega168p for this converter without problem now.
This means it works on 16KB flash and 1KB memory though I don't know real memory usage.

I think 32KB flash is needed for your purpose. ATmega32u(2|4) seems to be suitable.
Atmel has very small variety of USB AVR, we have no choice but it.

I think plain ATmega + V-USB is another choice.
But ATtiny is challenging in terms of size of this firmware.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itisnt on Sat, 19 March 2011, 11:24:42
Hi Guys,

First of all thanks for that code, it gives me the change to reuse my old IBM-M Keyboard AND hopefully solve the problem i have with it (with a normal PS2/USB converter).
 
I am using an keyboard with US-layout, but with the German(Swiss) keyboard-layout on Linux and Windows-7. This works great, because i am able to use it in the "10-finger" system without looking on the keys. So i am not confused when other characters appear then i am hitting on :biggrin:

The problem i have is the fact that i am missing a key on my keyboard. On a European 102-key keyboard, there is a key between the LSHIFT and "Z" with "<", ">" and "\" on it.
So with the SwissGerman-Layout, there is no proper way to produce this three keys.  

I've found the way with replacing for example KB_VOLD with KB_NONUS_BSLASH. But i don't like that, because i have to use a lot of fingers to reach "\". FN1 + ALT + X

What i would like to do is catching the following key-sequences and replace them:

KB_RALT + Z -- replace with --> KB_RALT + KB_NONUS_BSLASH      --> "\"
KB_RALT + X -- replace with --> KB_NONUS_BSLASH                        --> "<"
KB_RALT + C -- replace with --> KB_RSHIFT + KB_NONUS_BSLASH --> ">"

I have a partial solution, but i does not work as expected, and i am not sure if i used the right place in the code to make my modifications.

keyboard.h:
Code: [Select]

#include <stdbool.h>
bool ralt_rec;


keyboard.c
Code: [Select]

            if (code == KB_RALT) {
               ralt_rec = true;
            }

            if (code == KB_NO) {
                // do nothing
            } else if (IS_MOD(code)) {
                host_add_mod_bit(MOD_BIT(code));
            } else if (IS_FN(code)) {
                fn_bits |= FN_BIT(code);
            }

            // Ugly hack to simulate the missing 102-european-key on IBM-M Keyboard

            // ">" on key "C"
            else if (( code == KB_C) && ( ralt_rec == true )) {
                host_add_key(KB_RSHIFT);
                host_add_key(KB_NONUS_BSLASH);
                _delay_ms(200);
                ralt_rec = false;
            // "<" on key "X"
            } else if (( code == KB_X) && ( ralt_rec == true )) {
                host_add_key(KB_NONUS_BSLASH);
                _delay_ms(200);
                ralt_rec = false;
            // "\" on key "Z"
            } else if (( code == KB_Z) && ( ralt_rec == true )) {
                host_add_key(KB_RALT);
                host_add_key(KB_NONUS_BSLASH);
                _delay_ms(200);
                ralt_rec = false;
            }
            else if (IS_KEY(code)) {
                host_add_key(code);
            }
#ifdef MOUSEKEY_ENABLE
            else if (IS_MOUSEKEY(code)) {
                mousekey_decode(code);
            }


It works, but only when i release the RightAlt key before i press one of the other keys. Together with RALT it always gives me "\".

I think, i didn't choose the proper way to do that, but i am a little bit lost in the code and don't know how to solve it.

I am using a original Teensy++
 
Thanks for any help.

Daniel
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Sat, 19 March 2011, 17:03:41
You can easily handle this in linux by using xmodmap. Just remap your modeswitch to something handy, like right alt, then add something like
keycode 52 = z Z less greater
That would make the Z key send z by itself, Z if you press shift, < if you press modeswitch, and > if you press shift + modeswitch.

Alternatively, just do the international mod, since it's a Model M. Where are you located?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itisnt on Sat, 19 March 2011, 17:18:47
I,am located in Switzerland. I know xmodmap and other mechanisems, but i work on different machines and don't wanna redo the configuration all the time.

But wath about this international mod ? I'll google that.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itisnt on Sat, 19 March 2011, 17:51:25
Ok, i think you mean the article of ripster right ? That's not what i want, i like my keyboard as it is.
The only thing i need is an easy way to get the three characters "<", ">" and "\".

I think i am on the right way, but didn't find the proper solution.

But thanks anyway
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Sat, 19 March 2011, 23:26:41
Fair enough. It just seems that if you are going to use a different logical layout that has a different physical layout, it makes sense to use the other physical layout.

But that still leaves you with the problem of mapping it on each computer you use it with, so this adapter is still the better option.

And yes, I did mean ripster's mod.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: intealls on Sat, 19 March 2011, 23:37:59
I can spot a number of problems, I think the first and most significant one (that would account for it working when RALT is released) is that the RALT modifier is registered even when you don't want it to.

Code: [Select]

            } else if (IS_MOD(code)) {
                host_add_mod_bit(MOD_BIT(code));


So, when you just want to do this
Code: [Select]

                host_add_key(KB_RSHIFT);
                host_add_key(KB_NONUS_BSLASH);

or this
Code: [Select]

                host_add_key(KB_NONUS_BSLASH);

you're actually doing this in beforehand
Code: [Select]

                host_add_mod_bit(MOD_BIT(code));

which won't generate what you want. Since you appear to reset the ralt_rec var when you've gotten Z, X, or C, this would account for the expected behaviour when RALT is released (and thus no longer being registered as a modifier).
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 20 March 2011, 04:53:32
Hi Daniel,

Try this dirty patch. I think you will get some success with this code.
But this is not straight solution for your problem, I can't come up with smart way now :(


Code: [Select]
diff --git a/keyboard.c b/keyboard.c
index 03db325..3e2a11c 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -33,6 +33,7 @@ void keyboard_init(void)
 void keyboard_proc(void)
 {
     uint8_t fn_bits = 0;
+    static bool remove_ralt = false;
 
     matrix_scan();
 
@@ -89,7 +90,37 @@ void keyboard_proc(void)
             }
 #endif
             else if (IS_KEY(code)) {
-                host_add_key(code);
+                if (keyboard_report_prev->mods & MOD_BIT(KB_RALT) || remove_ralt) {
+                    if (code == KB_Z) {
+                        // '\' on Swiss keyboard
+                        host_add_key(KB_NONUS_BSLASH);
+                        remove_ralt = false;            // keep RAlt
+                        // for test. You can remove this.
+                        //host_add_key(KB_TAB);         // Alt + Tab (for test)
+                        //remove_ralt = false;            // keep RAlt
+                    } else if (code == KB_X) {
+                        // '<' on Swiss keyboard
+                        host_add_key(KB_NONUS_BSLASH);
+                        remove_ralt = true;
+                        // for test. You can remove this.
+                        //host_add_mod_bit(MOD_BIT(KB_LSHIFT)); // LShfit + 2 (for test)
+                        //host_add_key(KB_2);
+                        //remove_ralt = true;
+                    } else if (code == KB_C) {
+                        // '>' on Swiss keyboard
+                        host_add_mod_bit(MOD_BIT(KB_LSHIFT));
+                        host_add_key(KB_NONUS_BSLASH);
+                        remove_ralt = true;
+                        // for test. You can remove this.
+                        //host_add_mod_bit(MOD_BIT(KB_RSHIFT)); // RShfit + 3
+                        //host_add_key(KB_3);
+                        //remove_ralt = true;
+                    } else {
+                        host_add_key(code);
+                    }
+                } else {
+                    host_add_key(code);
+                }
             }
 #ifdef MOUSEKEY_ENABLE
             else if (IS_MOUSEKEY(code)) {
@@ -101,6 +132,13 @@ void keyboard_proc(void)
             }
         }
     }
+    if (remove_ralt) {
+        if (keyboard_report->mods & MOD_BIT(KB_RALT)) {
+            host_set_mods(keyboard_report->mods & ~MOD_BIT(KB_RALT));
+        } else {
+            remove_ralt = false;
+        }
+    }
 
     layer_switching(fn_bits);
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itisnt on Sun, 20 March 2011, 05:15:15
Hey, thanks for the answer, we are quite close ;-)

Now when i press RALT + x, i get: "x<"

But i will  play around with your code.

Daniel
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itisnt on Sun, 20 March 2011, 05:18:42
Got it, idiot i am, forgot to remove the "host_add_key" ;-)

Works great !!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Tue, 29 March 2011, 00:15:18
(http://doublethink.cspromod.com/rev1.1.bmp)

I am working off of this:

(http://doublethink.cspromod.com/schematic21.gif)

EDIT

nevermind I just failed to READ the site. >_<

"A 3.3 volt MCP1825 voltage regulator (shown in gray, full part number MCP1825S-3302E/DB) may be soldered to the bottom side. Three pads allow a solder bridge to configure for 5 volt or 3.3 volt power. The 5 volt pads are linked when the board is shipped."

So its straight 5volt.

Did I miss anything mandatory?  Is there anything there still not needed? :]
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Hak Foo on Tue, 29 March 2011, 00:33:21
I've been pondering a new approach to layering:

Chorded keys versus normal modifier keys:

Store the time of the previous keystroke down.  If you get two keystrokes almost instantly, it's probably a chord.

This would allow for 1) keyboards which send chords for special keys (the Wang boards' extra keys, many diagonal arrow keys) and 2) provide a different approach for if you wanted another shift.  Standard Alt applies if you wait 100ms, Special Alt if you pound them at the exact second.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: doublethink on Tue, 29 March 2011, 02:50:04
(http://doublethink.cspromod.com/rev1.2.bmp)

This is just the visual one, I need to redo it with all the pins in the real positions with them all numbered properly before it can go to pcb phase.

edit:

I'm thinking I should diode isolate the ps/2 power so its impossible for someone to put the ps/2 as the computer side, since that would probably have undesirable effects.
Title: Multimedia key support Added
Post by: hasu on Wed, 01 June 2011, 01:50:02
I added PS/2 multimedia key support to my converter now.
This works on both Teensy and V-USB.

See this for detail.
https://github.com/tmk/tmk_keyboard/issues/1

Thanks,
Title: Bluetooth support is comming!
Post by: hasu on Thu, 07 July 2011, 22:33:24
I am testing a PS/2 to Bluetooth converter now. At this time I can type keys on by air without major problem.
This is a by-product of my main project, My goal is a Bluetooth HHKB pro :)

Any suggestions and advices are welcome!


This is on initial stage of development now, and I have lots of things to be done.
- mouse key support
- media key support
- nice pairing sequence
- management for multiple paring
- 3.7V Li-po battery charging/DC-DC step-up converter(5V)
- I/O voltage(some keyboard including HHKB needs 5V while 3.3V BT module.)
- power saving
- push them into HHKB case


This picture shows Realforce 101, Arduino, Bluetooth module with voltage converter and 5V USB battery pack.
[ATTACH=CONFIG]20184[/ATTACH]

The Bluetooth module is a Bluegiga WT12 which can interface with UART. WT12 firmware iWRAP offers high level functions like HID profile, pairing and auth by various ASCII commands and responses on the serial line. It is easy to use for hobbyists, I think.
[ATTACH=CONFIG]20185[/ATTACH]

If you are curious about it, visit their site. (To get technical documentation you may need to register.)
http://techforum.bluegiga.com/home

I got info about the module via a nice article of Jeff from keyglove.net, and bought mine from him at inmojo.com. And his keyglove project is very intriguing too.
http://www.keyglove.net/2011/03/24/bluegiga-wt12-bluetooth-module-connection/
http://www.keyglove.net/2011/06/25/wt12-custom-breakout-board-take-2/
http://www.inmojo.com/store/jeff-rowberg/


PS: Code for the Bluetooth is not push to gitihub repositry yet.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Arcanius on Tue, 12 July 2011, 20:20:36
Out of curiosity, would one be able to hook up a USB board to the Clock and Data lines, making a USB-USB "converter"?
My real intention may be to put a Noppoo Choc Mini onto it, stripping it of its ridiculous NKRO, and possibly making it work on Mac OS X.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 12 July 2011, 20:37:54
My converter supports only PS/2 keyboard, not a USB keyboard unfortunately.
I think it is not possible or very difficult to support USB on Teensy without extra hardware.
You can still replace the Noppoo controller itself with Teensy, but this will need a lot mod work.

As for a USB-USB converter, very initial attempt exists on this thread.
http://geekhack.org/showthread.php?19458-QWERTY-to-Colemak-via-hardware.-USB-key-or-built-in-hardware-firmware
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Arcanius on Tue, 12 July 2011, 21:09:24
Weird, it seems that Soarer's adapter can take USB input?
http://geekhack.org/showwiki.php?title=Island:17458&viewfull=1&page=7&do=comments#post343781
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 12 July 2011, 21:42:15
Quote from: Arcanius;379196
Weird, it seems that Soarer's adapter can take USB input?
http://geekhack.org/showwiki.php?title=Island:17458&viewfull=1&page=7&do=comments#post343781


Only when the keyboard is dual mode - as in, works with a passive USB to PS2 adapter to put it in PS2 mode.

(http://upload.wikimedia.org/wikipedia/commons/thumb/8/80/USB_PS2_Adapters.JPG/225px-USB_PS2_Adapters.JPG)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Tue, 12 July 2011, 21:50:05
Which by definition leaves out the Noppoo and it's brethren
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Tue, 12 July 2011, 21:51:05
And the Unicomps, Realforces, and HHKB. Likely others, as well.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 12 July 2011, 21:56:07
Quote from: alaricljs;379211
Which by definition leaves out the Noppoo and it's brethren

Quote from: theferenc;379215
And the Unicomps, Realforces, and HHKB. Likely others, as well.

And your point is...?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Tue, 12 July 2011, 21:58:12
I wasn't knocking you Soarer, I was simply pointing out it isn't just the NKRO via USB keyboards that are USB only. Lots of other keyboards that don't have the weirdness are also USB only.

But then, if you have USB, why are you worried about a USB converter that is just a converter, and not a remapper, exactly? That's the question I haven't been able to answer.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Arcanius on Tue, 12 July 2011, 22:07:49
In one of the Noppoo threads, somebody claimed to run a Noppoo Choc Mini with a PS/2 adapter and some extra .kexts on his Hackintosh... so then this inputted into a teensy, back out to USB, should be able to work on a Mac....?
The only reason I want any of this is to get a Noppoo Mini or Ducky 9008G2 to run on a Mac.
So these two won't work with a USB-PS/2 passive adapter?
If they would, then one would hope something even simpler like this passive adapter followed by a blue cube would sever the NKRO capabilities...
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Tue, 12 July 2011, 22:10:11
Arcanius just got the wrong end of the stick as to what was being asked in the post he linked to, Mr Perfect was...

Quote
... thinking of all the Filcos, Leopolds, Decks, etc that achieve NKRO when plugged into a PS/2 port with one of those USB to PS/2 adapters.

Otherwise, USB-USB would be useful to add functionality, like the hardware Colemak remapping dongle hasu linked to a few posts ago. But the feasibility of it is only just being assessed - them fancy noppoos etc probably still wouldn't work with it :/

(edit: I don't know about choc mini working with ps2 adapter, what I just said was assuming it didn't).
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Arcanius on Tue, 12 July 2011, 22:44:15
Alright, thanks a lot for your help. :)
I'm thinking of getting a Choc Mini, and although I don't use Mac, I'm curious as to how to make it work with one.
Linux for the win. :)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: theferenc on Tue, 12 July 2011, 22:46:01
You know, I wonder if this issue will disappear when 10.7 is released, or not. I'm betting not, because the Apple supplied keyboards work fine, so they aren't likely to change anything. After all, no other keyboard is actually listed as supported.

But we'll see, I suppose.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: kohan69 on Tue, 12 July 2011, 22:49:13
So can this be used to make RCtrl, MenuKey, RWin, RAlt into like volume up, volume down, volume mute, play/pause         keys?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 13 July 2011, 01:58:34
Sure, it is possible. No problem.
You can edit layout in keymap.c with keycodes defined in usb_keycodes.h.
Use keycodes VOLU, VOLD, MUTE, MPLY. See source codes for detail.

Ask in this thread if you have any problem.
Get Teensy(or build your board with V-USB) and try it!!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 09:16:39
Total noob question:

If I get the teensy controller, how do I have to program it to deliver specific scan codes.

How do I connect the keys to it?

Which model number is the one I would need?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 09:57:26
There's no way to unify it all... There are multiple firmware available and they are all written differently and have different features.  There are some that are available as source, and some that aren't (yet).  Examples and instructions are generally found in the wikis pertaining to the different firmware.  There are no truly clear instructions because there is no one way to do this sort of thing.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 10:05:18
Quote from: alaricljs;384008
There's no way to unify it all... There are multiple firmware available and they are all written differently and have different features.  There are some that are available as source, and some that aren't (yet).  Examples and instructions are generally found in the wikis pertaining to the different firmware.  There are no truly clear instructions because there is no one way to do this sort of thing.

 
Just wanted to know:
- which controller I really need
- how is it programmed (regardless of program). Do I stick it into USB, run one of these C-programs and I'm done?
- If I have some switches, where do I solder them to the teensy controller?
- The 'wiki'-post just shows how to connect a PS/2 connector to the controller, but is it possible to use it as the controller itself?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 10:08:34
Depends on if you want to do a PCB conversion or PS/2.   Sometimes teensy++ required for PCB conversion since it has more IO lines, otherwise teensy is fine.   teensy firmware is written with a simple program over USB on most any desktop platform.

If you are doing a custom PCB or wire-wrap job like it sounds 7bit, it's usually done as a matrix of switches and PrinsValium's wiki (http://geekhack.org/showwiki.php?title=Design+your+own+Teensy+keyboard+in+KiCAD+how-to+guide) is most helpful there.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 10:22:50
Quote from: alaricljs;384018
Depends on if you want to do a PCB conversion or PS/2.   Sometimes teensy++ required for PCB conversion since it has more IO lines, otherwise teensy is fine.   teensy firmware is written with a simple program over USB on most any desktop platform.

If you are doing a custom PCB or wire-wrap job like it sounds 7bit, it's usually done as a matrix of switches and PrinsValium's wiki (http://geekhack.org/showwiki.php?title=Design+your+own+Teensy+keyboard+in+KiCAD+how-to+guide) is most helpful there.

 
OK thanks. Seems you have never done this yourself.

edit:

I've found this:
Using The Teensy Loader on Ubuntu Linux (http://pjrc.com/teensy/loader_linux.html)
Still not clear how it will really work...

******** teensy.64bit: Not a text file ********
:-(

Has anybody the source code?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 10:29:24
I'm in the middle of doing it.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 10:58:38
Quote from: alaricljs;384034
I'm in the middle of doing it.

 
OK, sorry for being that harsh!

I've found lots of modifications involving a teensy controller, but never seen any information on actually doning it from scratch for total noobs like me!

Heres a much more helpful likt how to get started:

http://www.pjrc.com/teensy/loader_cli.html
And here is the source for a commandline version:
Teensy Loader Command Line, Source Code, Version 2.0 (http://www.pjrc.com/teensy/teensy_loader_cli.2.0.tar.gz)

teensy_loader_cli.c is only 840 lines.


Leaves the question open on how to solder single switches to it....


edit: LOL! The programmer must be a perl junkie:
Code: [Select]

   die(&quot;Unknown MCU type\n&quot;);
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 11:07:15
How many switches?  the pjrc code does something like 8 switches with one common leg so 9 pins.  If you want a complete keyboard you're going to have to do a matrix and it'd be best to include the diodes.  Prins' wiki has a numpad matrix, you just expand that to however many keys you want and keep the columns+rows count beneath the number of IO pins you have.  I did a 87key matrix with a teensy and pins to spare,  10x9 matrix, so I could even throw 3 more switches somewhere.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 11:15:57
I was admittedly vague on the whole firmware thing... had meant to go back and flesh that out, but I'm working.

There's a small app for writing the firmware to the teensy over USB.  That's what I had referred to, but of course this requires a firmware.  There are several available, they all differ and some do not yet have source available.  I started by playing with the HumbleHacker FW, he used some crazy framework to make it really user friendly but I can't even begin to understand how the code works without learning the framework.  It's nice in that you can just hook up a matrix to some pins, tell the firmware what pins and then the FW helps you map your matrix.  It's perfect for a controller replacement if you can live with its features.

I then moved on to looking at how Hasu and HaaTa did their firmwares to try and learn how to scratch build one with the features I want.  This means knowing more about the matrix up front, no problem since I created it.  Hasu's is not ready for a newb to put together a PCB/matrix version, it's very ready as a dongle for PS/2 tho.  HaaTa's is more ready for a PCB/matrix job.  Either way both will require modifying the code, not just plugging in some pin names/numbers and running with it.  

Soarer's sounds awesome... but there's no code so you can only do (so far) the dongle.


As for compiling (and coding) the firmware.  You can go with Win-AVR as the compiler, and of course use whatever editor you want.  If you're on unix you can set up a cross-compiling gcc for avr.  There is AVRStudio which comes with a compiler or can use Win-AVR as its compiler.  It has a pile of features I know nothing about including a simulator.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 12:19:22
Quote from: alaricljs;384059
I was admittedly vague on the whole firmware thing... had meant to go back and flesh that out, but I'm working.

There's a small app for writing the firmware to the teensy over USB.  That's what I had referred to, but of course this requires a firmware.  There are several available, they all differ and some do not yet have source available.  I started by playing with the HumbleHacker FW, he used some crazy framework to make it really user friendly but I can't even begin to understand how the code works without learning the framework.  It's nice in that you can just hook up a matrix to some pins, tell the firmware what pins and then the FW helps you map your matrix.  It's perfect for a controller replacement if you can live with its features.

I then moved on to looking at how Hasu and HaaTa did their firmwares to try and learn how to scratch build one with the features I want.  This means knowing more about the matrix up front, no problem since I created it.  Hasu's is not ready for a newb to put together a PCB/matrix version, it's very ready as a dongle for PS/2 tho.  HaaTa's is more ready for a PCB/matrix job.  Either way both will require modifying the code, not just plugging in some pin names/numbers and running with it.  

Soarer's sounds awesome... but there's no code so you can only do (so far) the dongle.


As for compiling (and coding) the firmware.  You can go with Win-AVR as the compiler, and of course use whatever editor you want.  If you're on unix you can set up a cross-compiling gcc for avr.  There is AVRStudio which comes with a compiler or can use Win-AVR as its compiler.  It has a pile of features I know nothing about including a simulator.

 
Thanks. For once, I've found the program whith which to upload the machine code to the controller. The next step is to find the compiler to make those files.

It surely will not be Win-AVR, because I'm running GNU/Linux. Open source commandline tools are mandatory. I don't like to fumble with an unreliable GUI.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Wed, 20 July 2011, 12:22:44
avrfreaks.net has a nice quick build script (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631) that I hacked to get rid of some unwanted pieces.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: 7bit on Wed, 20 July 2011, 12:35:07
Quote from: alaricljs;384100
avrfreaks.net has a nice quick build script (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631) that I hacked to get rid of some unwanted pieces.

 
Installing the AVR stuff ...

done.

I really love Debian!

Where can I download the controller;-)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Dox on Fri, 02 December 2011, 18:34:42
Hey hasu, I sent you a pm but I think this could be useful for some other members so I'll post it here.
I'm currently using your converter with my IBM SSK and it's great but I have a question. The keyboard layout is modded to have a unix layout (theferenc old kb)  and I need to add a scancode for the extra key where the backspace was. When I use hid_listen to check the debug, I can see that it send "6A" but I don't know where to add it to get it to send a real usb scancode.
Otherwise, the converter is working great, awesome work once again!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Dox on Fri, 02 December 2011, 19:06:56
I got it sorted out. I looked at the position of the signal in the debug matrix and added the scancode at the right place in the keymap.c. Now I just need t build an enclosure for the converter.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: alaricljs on Fri, 02 December 2011, 20:36:09
Maybe this (http://www.amazon.com/Altoids-Smalls-Sugar-Minta-Simply/dp/B003BTQZZG/ref=sr_1_8?s=grocery&ie=UTF8&qid=1322879353&sr=1-8), if you know someone that is into them :)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 03 December 2011, 00:01:32
Quote from: Dox;463084
Hey hasu, I sent you a pm but I think this could be useful for some other members so I'll post it here.


Yeah, I usually prefer to discuss in public thread, too. Thanks.
Though I think you already has got a right clue...

Currently my code supports US layout keyboard only, while 0x6A scan code seems to be international one in ISO or JIS layout. I will work on ISO/JIS keyboard support anytime soon.
I believe you need to define you own keymap macro of SSK layout to use the scan code in ps2_usb/keymap.c.

As for case thing, here in Japan FRISK is popular as a small DIY case while Altoids is very rare.
http://yonasu.com/frisk-variety-pack/
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Dox on Sun, 04 December 2011, 21:19:12
Shrink wrap will do it for now. The adapter is working great, thanks hasu!
[ATTACH=CONFIG]33960[/ATTACH][ATTACH=CONFIG]33961[/ATTACH][ATTACH=CONFIG]33962[/ATTACH]
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 05 December 2011, 21:44:50
Some keys specific to ISO/JIS keyboard are supported now.
Supported keys are Europe1 and Europe2 for ISO, Ro, Katakana/Hiragana, Yen, Henkan and Muhenkan for JIS.

I have tested this with JIS keyobard, but not with ISO. I don't have any ISO keyboard :)
If you have any problems, plz let me know.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Dox on Mon, 05 December 2011, 21:51:34
There was only one missing scancode (6A) from the unusual split backspace on the keyboard. You can see where I added the scancode on this commit. https://github.com/doxkb/tmk_keyboard/commit/be84d7cec96a197fb60d45b089063087f67632ff
Everything is working fine.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 05 December 2011, 22:01:29
The scan code '6A' actually is supported as JIS Yen key.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Dox on Mon, 05 December 2011, 22:05:20
Yeah it's weird that you can find this scancode on an ANSI model m.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 05 December 2011, 22:21:29
Model M has also key holes for ISO at the right of left SHIFT and the left of ENTER, right?
I think most Model M components can fits for all layout of ANSI, ISO and JIS(though some keys are missing) only with changing keycaps.
I think this could reduce a lot the cost of manufacturing.

BTW, I don't know JIS Model M exists :)
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: luckyy on Thu, 08 December 2011, 19:45:02
Hasu,

I must thank you for your work on this converter code.   I've tried a couple ps2->usb converters for my trusty old Dell AT101W, but with limited success, often they would not always register Shift properly, or would just have terrible rollover effects (keys repeating, missing, etc).  I've only been using your code + teensy 2.0 for a few hours, but it's already worlds better!

I am still having one strange issue, and I am not sure what the cause might be, but some of the punctuation chars (? and ; keys) work, but have a large delay in triggering.  Seriously delay, easily 100+ms delay from when I press, to when it actually inputs.   Yet the other keys, all around them, are 100% fine.  Obviously this doesn't happen on another machine that has a direct ps2 port still.

Any thoughts on what that could be?  Is there any diagnostic information I could provide you?   In my build options I have extended keys + mouse keys disabled, NKRO enabled.

Thanks again for a great tutorial and code!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Bongoojingie on Thu, 08 December 2011, 21:21:46
I'd love to get mousekeys on my Realforce 87U but I have no idea where I'm even going to start!  Time to read everything I guess!  I'm sure I'll be back here with questions!
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 08 December 2011, 22:25:34
Hi, luckyy.

Quote from: luckyy;466791

I must thank you for your work on this converter code.   I've tried a couple ps2->usb converters for my trusty old Dell AT101W, but with limited success, often they would not always register Shift properly, or would just have terrible rollover effects (keys repeating, missing, etc).  I've only been using your code + teensy 2.0 for a few hours, but it's already worlds better!


You have pull-up resistors on you Teensy? Without pull-up resistors it might cause similar problems.


Quote from: luckyy;466791

I am still having one strange issue, and I am not sure what the cause might be, but some of the punctuation chars (? and ; keys) work, but have a large delay in triggering.  Seriously delay, easily 100+ms delay from when I press, to when it actually inputs.   Yet the other keys, all around them, are 100% fine.  Obviously this doesn't happen on another machine that has a direct ps2 port still.


Hmm, I have not tested it much with disabling mousekeys. This option may cause your problem.
Those keys(; and /) on default layer are Fn keys used to change keymaps and which needs some complicated logic. This is problematic part.

Try LShift+RShift+1 to use plain QWERTY keymap without any Fn keys. I think you have no problem there.
You can make this plain keymap as default by editing keymap.c.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: luckyy on Sat, 10 December 2011, 18:16:48
Quote from: hasu;466887
You have pull-up resistors on you Teensy? Without pull-up resistors it might cause similar problems.
Hasu, I do not yet have the resistors on my Teensy, however I have not had this problem at all.  I will add the resistors, if I find it to be a problem.


Quote from: hasu;466887
Hmm, I have not tested it much with disabling mousekeys. This option may cause your problem.
Those keys(; and /) on default layer are Fn keys used to change keymaps and which needs some complicated logic. This is problematic part.

Try LShift+RShift+1 to use plain QWERTY keymap without any Fn keys. I think you have no problem there.
You can make this plain keymap as default by editing keymap.c.
[/QUOTE]

You were exactly right, it was the keymap, I made the default the regular QWERTY layout, and now my keyboard is working flawlessly.  No more odd delay on my ? or ; keys.   Thank you so much for the help, and again this great project!   I can now use my favorite keyboards again on newer computers without the unreliability that the average converters have been providing me.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Wed, 11 January 2012, 21:12:09
Hey hasu, I just tried to use your converter with my Monterey keyboard and it cannot read input reliably, I get slow response and/or a lot of dropped keys. If you take a look at Soarer's thread, you'll see where he describes some of the problems he's encountered (timing related). Do you think you could look into this?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 11 January 2012, 21:37:33
Why don't you give URL of the post in Soarer's thread?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Wed, 11 January 2012, 21:52:51
http://geekhack.org/showwiki.php?title=Island:17458&viewfull=1&page=12&do=comments#post362823

I don't have that particular board, but I believe the controllers are very similar.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 12 January 2012, 04:24:32
REVENGE, thanks for the link.

Hmm, those waveform will not work with my converter on Teensy too. I think AVR USART hardware can handle that fast signal without timing problem.

While my Teensy converter uses PS/2 handler implemented with software(poor my C lang), V-USB converter uses this USART hardware to reduce cycles for PS/2 handling. Of course you can use the USART hardware on Teensy too.

You have two option to take: building a V-USB converter or using USART on Teensy one.
 Looking these files will help you.
ps2_usb/Makefile.vusb
ps2_usb/config_vusb.h
ps2_usart.c
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Thu, 12 January 2012, 10:05:26
Quote from: hasu;488527
REVENGE, thanks for the link.

Hmm, those waveform will not work with my converter on Teensy too. I think AVR USART hardware can handle that fast signal without timing problem.

While my Teensy converter uses PS/2 handler implemented with software(poor my C lang), V-USB converter uses this USART hardware to reduce cycles for PS/2 handling. Of course you can use the USART hardware on Teensy too.

You have two option to take: building a V-USB converter or using USART on Teensy one.
 Looking these files will help you.
ps2_usb/Makefile.vusb
ps2_usb/config_vusb.h
ps2_usart.c
Roger that, I'll be looking into this, thanks! :D
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Fri, 13 January 2012, 01:05:23
So, I haven't figured out how to work your PS/2 via USART implementation, but I did build the Teensyduino PS2Keyboard implementation and it seems to work fine in serial mode. In fact, that thing also seems to work just fine with my set 3 terminal model F. Any limitations to using this as the basis for a converter?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 13 January 2012, 03:25:25
I just looked over PJRCs' PS2Keyboard source. It uses an interrupt routine for PS/2 handling instead of USART hardware I meant, and seems to support only Code Set 2. (Code Set 2 and 3 shares same code of alpha/numeric keys, but as for modifier, function key and etc. codes differ.)
I think USART implementation has no limitations at all except that you can't use USART function for another.


I can come up with three implementation method to handle the PS/2 signal.
1. simple and stupid wait & read loop(intensive use of cpu cycles)
2. Interrupt(a few use)
3. USART hardware(not use at all)

I used method 1. to implement my converter on Teensy and it was OK in most case.
I used method 3. to implement my converter with V-USB because it uses clock cycles intensively and very timing sensitive. I could not use even method 2 with V-USB due to very tight timing issue.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sun, 15 January 2012, 04:15:19
Hmm, do you have any hints for using the USART implementation with Teensy? I think I've changed the registers in the config header file to the ones used by the 32u4, but I get nothing, and I have no idea how to debug it either. :(
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 15 January 2012, 09:50:58
I added some files to support USART implementation.

Try latest source and do 'make -f Makefile.pjrc_usart'.
Note that pin configuration for this is different from 'simple and stupid' one. Connect Clock line to PD5 pin and Data to PD2.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sun, 15 January 2012, 13:03:35
Quote from: hasu;491025
I added some files to support USART implementation.

Try latest source and do 'make -f Makefile.pjrc_usart'.
Note that pin configuration for this is different from 'simple and stupid' one. Connect Clock line to PD5 pin and Data to PD2.
Sweet, getting it now to build. For the makefile and config, I actually had almost exactly the same thing as you (even named the files the same, teehee....) except my pin defs are different. I'm guessing I can't customize those and have to use what you set?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 15 January 2012, 13:07:10
Right. USART pins are fixed depending on MCU and my configuration is for Teensy(ATmega32U4).
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sun, 15 January 2012, 13:19:44
Nevermind, I'm being dumb.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 15 January 2012, 13:27:02
F2 is not present on ATMega32U4(Teensy 2.0).
But why do you find F2? you need D2 and D5 as I described before.
You need sleep? Me too :) I got to go to bed now.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sun, 15 January 2012, 13:43:28
Quote from: hasu;491132
F2 is not present on ATMega32U4(Teensy 2.0).
But why do you find F2? you need D2 and D5 as I described before.
You need sleep? Me too :) I got to go to bed now.
No, I needed to wake up and start paying attention, that's what. :P

Yeah, so it seems to work fine! Good stuff. The lock keys respond a little sluggishly, but I'm guessing that's because there're still some LED stuff going on? Is it even possible to support lock LEDs?
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 15 January 2012, 13:58:03
Nice!

Ah... USART is only for receiving, unfortunately it still uses 'simple and stupid' method to send command like SET LED(converter->keyboard communication).
It seems to have the timing issue when sending to the keyboard.

This patch might cure the problem by some chance. Try this.
Code: [Select]
diff --git a/ps2_usart.c b/ps2_usart.c
index 7d591c6..7160f57 100644
--- a/ps2_usart.c
+++ b/ps2_usart.c
@@ -127,7 +127,7 @@ uint8_t ps2_host_send(uint8_t data)
     WAIT(clock_lo, 15000, 1);
     /* data [2-9] */
     for (uint8_t i = 0; i < 8; i++) {
-        _delay_us(15);
+        _delay_us(1);
         if (data&(1<<i)) {
             parity = !parity;
             data_hi();
@@ -138,12 +138,12 @@ uint8_t ps2_host_send(uint8_t data)
         WAIT(clock_lo, 50, 3);
     }
     /* parity [10] */
-    _delay_us(15);
+    _delay_us(1);
     if (parity) { data_hi(); } else { data_lo(); }
     WAIT(clock_hi, 50, 4);
     WAIT(clock_lo, 50, 5);
     /* stop bit [11] */
-    _delay_us(15);
+    _delay_us(1);
     data_hi();
     /* ack [12] */
     WAIT(data_lo, 50, 6);
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sun, 15 January 2012, 15:54:29
Hmmzord, I'll try the patch later tonight. A more immediate problem is that I need to solder something (wire, pin, whatever) to D5 -  I'm using my hand to touch a wire to the contact and to do testing (:-/). Another crazy idea: would it be possible to use one of the digital pins exclusively to send lock LED commands to the keyboard? From what I understand, using the UART / USART is independent of regular programming.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: mich on Sat, 21 January 2012, 04:53:23
Hi, does anybody know if this software will fit onto an AT90USB162 (16k flash, 512 ram)?

I can buy either AT90USB162 or ATmega32U4, but I'd prefer the smaller one.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 21 January 2012, 07:27:32
mich,
I built binary with default configuration for at90usb162 though I have no chip to program and try.
I think this will fit on the chip and also you can reduce size by removing unused keymaps and functions.
Code: [Select]
  text    data     bss     dec     hex filename
  13734      18     114   13866    362a ps2_usb_pjrc.elf


REVENGE,
Did you try my patch? I want to hear the result. thanks.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Soarer on Sat, 21 January 2012, 07:34:16
Until fairly recently my converter worked on a '162. The limiting features are: only 512 bytes of RAM, and only 4 USB endpoints.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: REVENGE on Sat, 21 January 2012, 16:16:41
Quote from: hasu;495472
REVENGE,
Did you try my patch? I want to hear the result. thanks.
Weird, I thought I posted already...

It mostly works, but there are a few quirks. For some reason, the forward slash key does not work consistently. Sometimes it makes, but doesn't break, sometimes it doesn't repeat, sometimes it doesn't work at all. On my other PS/2 to USB converter and native PS/2, it works fine. This is with regards to the Monterey.
Title: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 21 January 2012, 18:56:11
Thanks.
The patch seems to cure the LED problem.

As for wierd key things, it is probably not a real bug or problem.
To activate cursor keys and mouse keys keymap layers, '/' and ';' are used as Fn key and normal key at same time.
Try '/' + hjkl to move cursor and ';' + hjkl to move mouse cursor. See the article page or keymap.c for detail.

This incur some side effects, as you described these keys has no key repeating and a legend is registered on key released not pressed.
(To register key you must press and release the key in about 200mS and to repeat key you can double tap the key and hold in that time.)
These side effects are not occurred on dedicated Fn keys. You can use unused key for this such as right windows key or something.

These functions might impose frustration on you in some situation.
This default keymap is just to demonstrate the functions of my firmware, you can change this keymap by editing keymap.c.
Or pressed LShift + RShift + 1 to switch normal QWERTY keymap without these Fn keys temporarily.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 04 December 2013, 10:05:20
I updated this project to support my DIY hardware. Fixed some bugs and add improvements.
https://github.com/tmk/keyboard_converter

Pic of herd of converters.
(http://i.imgur.com/6x42ENDl.jpg)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: jdcarpe on Wed, 04 December 2013, 10:11:06
USB-to-USB converter possible?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 04 December 2013, 10:31:25
Everything is possible :) My firmware doesn't support atm, though.

If you are interested in technical info...
This thread at DT:
http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841.html
and code:
https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb
It has stoped at very early stage of devlopement for long time.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: bcg on Fri, 06 December 2013, 20:50:51
I updated this project to support my DIY hardware. Fixed some bugs and add improvements.
https://github.com/tmk/keyboard_converter

Pic of herd of converters.
Show Image
(http://i.imgur.com/6x42ENDl.jpg)


Nice.  Real nice.   :thumb:
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: gropingmantis on Tue, 28 January 2014, 15:45:32
oops wrong thread
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 13 November 2014, 14:39:31
I merged a pull request of fix for V-USB version. Thank you, 0mark.

https://github.com/tmk/tmk_keyboard/pull/142
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: ryansoh3 on Wed, 19 November 2014, 23:03:15
Hats off to hasu for the awesome project.

Any particular reason why V-USB doesn't support System/Media control protocols?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 19 November 2014, 23:16:37
No reason. V-USB is awesome library you can support various USB functions including NKRO, those protocols. (TMK doesn't support NKRO with V-USB atm.) TMK's V-USB code supports System/Media key usages.
https://github.com/tmk/tmk_keyboard/blob/master/protocol/vusb/vusb.c#L337

But I've not used V-USB myself and not updated its code for long time, I'm not sure it still works.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: ryansoh3 on Thu, 20 November 2014, 00:55:58
Ah, thanks. I thought both NKRO and Sys/Media control wasn't supported because it said

Quote
The converter on V-USB lacks some features for now: USB NKRO and System/Media control.

Under USB Support https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: ryansoh3 on Sun, 23 November 2014, 12:10:07
Hey hasu,

I was able to setup my PS/2 to USB converter thanks to your code.

Now I have a fully functional Dell AT101W via an ATMega328P via VUSB. :)

Just wondering, how do I get the keyboard to be able to wake the computer from sleep?
With a Logitech Keyboard, I see the Power Management tab under Device Properties in Windows, but no tab for the Converter.

Does it have to do with missing Power Data and Power Capabilities info?

Plus under
Code: [Select]
powercfg -devicequery wake_armed in CMD the Converter isn't listed... meaning that it doesn't support wake from sleep.

Thanks!
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sun, 23 November 2014, 17:16:22
Glad to hear it works!

TMK VUSB doesn't support remote wakeup feature unfortunately while LUFA and PJRC stack support.

It is definitely possible to implement the feature on V-USB, but I have no time and plan  to do so for a while.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: ryansoh3 on Mon, 24 November 2014, 00:24:44
Gotcha, thanks for the info mate. :)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: UFOnet on Tue, 25 November 2014, 16:19:11
Hi there.
Is it possible to use this project also with Arduino Leonardo?

Thanks.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 25 November 2014, 17:11:44
yes, it works.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Lubed Up Slug on Tue, 25 November 2014, 22:16:40
lol wrong thread sorry
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 25 November 2014, 22:26:39
First, with this converter you never need any diodes. Maybe, you are in wrong thread.

Make sure your keymap is clean and plain without fancy functions. And check your hardware.


EDIT: oops, I'm too quick :D
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: UFOnet on Wed, 26 November 2014, 04:09:49
Hi there.
Is it possible to use this project also with Arduino Leonardo?

Thanks.

yes, it works.

Thanks for answer. And is it possible to programm it without loosing arduino bootloader?
Is it possible to programm it via serial port or ISP programmer is needed.

Could you, please, post some instruction how to do it? I`m real beginner.

Thanks.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: robercik on Sat, 21 February 2015, 13:49:45
Glad to hear it works!

TMK VUSB doesn't support remote wakeup feature unfortunately while LUFA and PJRC stack support.

It is definitely possible to implement the feature on V-USB, but I have no time and plan  to do so for a while.

This is done in my project of clean keyboard and mouse translator with atmega328p:

https://github.com/robszy/ps2usb
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 21 February 2015, 15:29:22
Thanks. I'll look into later.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Yeitso on Mon, 16 March 2015, 04:12:24
Can't seem to get this to work. Im using a Pro Micro and have Data hooked up to PD1 and clock to PD0 and nothing happens when i hook up the converter exept it shows up in my hardwarelist as a keyboard.
I've added a 4K pull-up resistor to the data line from VCC and that made the keyboard light up when i hooked it up but its still not working. Do I need a pul-up resistor on the clock line aswell?

Ive changed the PS2_DATA_BIT to 1 and PS_CLOCK_BIT to 0 in the config on USART as the Pro Micro does not have PD5 (it does but thats one of the internal leds).
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 16 March 2015, 13:06:56
Use two pullup resistors on both signal lines, just in case.
You can't use PS2_USART on Leonardo and Pro Micro, use PS2_BUSYWAIT(or PS2_INT) instead. In particular PS2_BUSYWAIT works with any pin combination, it would be useful. Also PS2_INT works for your pin configuration.

It seems people are confused by flexible pin configuration and variation of protocol implementations, If I have  time I'll change pin usage same as Soarer's and use busywait impl by default to allow users chaging pins freely.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: lmorchard on Tue, 02 February 2016, 13:24:22
Don't have a lot to say in this thread yet - except for thank you!

I just got a few IBM Model M keyboards from a friend of mine. So, I ran down to the local Microcenter, bought a Teensy 2.0. I sacrificed an old PS/2 extension cable I had lying around, and 10 minutes later I had everything wired up. Installed the toolchain and had the firmware running in another 15 minutes.

It's rather ugly, but I've got this all hooked up to my Mac and I'm happily tweaking the key maps to swap in more useful keys. Hoping to wrap my head around the source code some more to see if maybe there's anything more interesting I can do! I might also try embedding a Teensy in one of these keyboards, just to make everything cleaner.

Again, thanks for your work!

[attach=1]
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 02 February 2016, 19:56:57
Great, glad to hear it works for you!
Enjoy both clicky springs and snappy domes :D
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Newbie75 on Wed, 09 March 2016, 17:36:02
Hi, is it also possible to use teensy 2.0 vice versa. So that I can connect my usb-keyboard via teensy to the ps/2 input of my computer? And furthermore, will your firmware provided work with this?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 09 March 2016, 18:12:41
No.
1) Teensy 2.0 doesn't support USB keyboard input.
2) My firmware doesn't support PS/2 output.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Newbie75 on Thu, 10 March 2016, 11:46:11
Thanks a lot for your reply..  ;)  Do you know a way to realize this? Because despite USB-connectivity of my keyboard I would prefer PS/2. (Although my keyboard doesnīt support PS/2, so that a simple USB A to PS/2 connector is useless). The Reason for me is, to get the real NKRO (which is limited via USB to 6KRO). Also I would be able to send key events like system control (power down, sleep, etc. ..)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: mougrim on Thu, 17 March 2016, 16:42:18
Thank you for a good work, Hasu!

Can I ask you if this converter could be used with a Atmega328-based controller, say, Arduino Nano?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 17 March 2016, 17:02:12
yes, use vusb stack.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itzmeluigi on Thu, 17 March 2016, 20:44:52

Hi ive been trying to setup TMK PS/2 to USB converter using Arduino Nano atmega328p with Makefile.vusb. The keyboard powers up and the LED's blink on the Arduino when keys are pressed but the keybaord doesnt output any characters.

I have CLOCK connected to PD5 pin and DATA connected to PD2 pin but it still doesnt work.


Makefile.vusb:
Code: [Select]
# Target file name (without extension).
TARGET = ps2_usb_vusb

# Directory common source filess exist
TMK_DIR = ../../tmk_core

# Directory keyboard dependent files exist
TARGET_DIR = .

# keyboard dependent files
SRC = keymap_common.c \
matrix.c \
led.c

ifdef KEYMAP
    SRC := keymap_$(KEYMAP).c $(SRC)
else
    SRC := keymap_plain.c $(SRC)
endif

CONFIG_H = config.h


# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
PS2_USE_USART = yes


# V-USB debug level: To use ps2_usart.c level must be 0
# ps2_usart.c requires USART to receive PS/2 signal.
OPT_DEFS += -DDEBUG_LEVEL=0


# MCU name, you MUST set this to match the board you are using
# type "make clean" after changing this, so all files will be rebuilt
#MCU = at90usb162       # Teensy 1.0
#MCU = atmega32u4       # Teensy 2.0
#MCU = at90usb646       # Teensy++ 1.0
#MCU = at90usb1286      # Teensy++ 2.0
MCU = atmega328p


# Processor frequency.
#   Normally the first thing your program should do is set the clock prescaler,
#   so your program will run at the correct speed.  You should also set this
#   variable to same clock speed.  The _delay_ms() macro uses this, and many
#   examples use this variable to calculate timings.  Do not add a "UL" here.
F_CPU = 16000000


# Build Options
#   comment out to disable the options.
#
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
#NKRO_ENABLE = yes # USB Nkey Rollover
NO_UART = no # UART is unavailable



#---------------- Programming Options --------------------------
AVRDUDE = avrdude
# Type: avrdude -c ? to get a full listing.
AVRDUDE_PROGRAMMER = usbasp
AVRDUDE_PORT =
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep

# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y

# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V

# Increase verbosity level.  Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v

#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)

PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)


# Boot Section Size in bytes
#   Teensy halfKay   512
#   Atmel DFU loader 4096
#   LUFA bootloader  4096
#   USBasp           2048
OPT_DEFS += -DBOOTLOADER_SIZE=512


# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)


include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/protocol/vusb.mk
include $(TMK_DIR)/rules.mk



Config.h
Code: [Select]
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CONFIG_H
#define CONFIG_H

#include <avr/interrupt.h>

#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x6512
#define DEVICE_VER      0x0001
#define MANUFACTURER    t.m.k.
#define PRODUCT         PS/2 keyboard converter
#define DESCRIPTION     convert PS/2 keyboard to USB


/* matrix size */
#define MATRIX_ROWS 32  // keycode bit: 3-0
#define MATRIX_COLS 8   // keycode bit: 6-4


/* key combination for command */
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
    keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
)


//#define NO_SUSPEND_POWER_DOWN


/*
 * PS/2 Busywait
 */
#ifdef PS2_USE_BUSYWAIT
#define PS2_CLOCK_PORT  PORTD
#define PS2_CLOCK_PIN   PIND
#define PS2_CLOCK_DDR   DDRD
#define PS2_CLOCK_BIT   1
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    0
#endif

/*
 * PS/2 Pin interrupt
 */
#ifdef PS2_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
#define PS2_CLOCK_PORT  PORTD
#define PS2_CLOCK_PIN   PIND
#define PS2_CLOCK_DDR   DDRD
#define PS2_CLOCK_BIT   1
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    0
#define PS2_INT_INIT()  do {    \
    EICRA |= ((1<<ISC11) |      \
              (0<<ISC10));      \
} while (0)
#define PS2_INT_ON()  do {      \
    EIMSK |= (1<<INT1);         \
} while (0)
#define PS2_INT_OFF() do {      \
    EIMSK &= ~(1<<INT1);        \
} while (0)
#define PS2_INT_VECT    INT1_vect
#endif

/*
 * PS/2 USART
 */
#ifdef PS2_USE_USART
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
/* XCK for clock line and RXD for data line */
#define PS2_CLOCK_PORT  PORTD
#define PS2_CLOCK_PIN   PIND
#define PS2_CLOCK_DDR   DDRD
#define PS2_CLOCK_BIT   5
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    2
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
#define PS2_USART_INIT() do {   \
    PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT);   \
    PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT);     \
    UCSR1C = ((1 << UMSEL10) |  \
              (3 << UPM10)   |  \
              (0 << USBS1)   |  \
              (3 << UCSZ10)  |  \
              (0 << UCPOL1));   \
    UCSR1A = 0;                 \
    UBRR1H = 0;                 \
    UBRR1L = 0;                 \
} while (0)
#define PS2_USART_RX_INT_ON() do {  \
    UCSR1B = ((1 << RXCIE1) |       \
              (1 << RXEN1));        \
} while (0)
#define PS2_USART_RX_POLL_ON() do { \
    UCSR1B = (1 << RXEN1);          \
} while (0)
#define PS2_USART_OFF() do {    \
    UCSR1C = 0;                 \
    UCSR1B &= ~((1 << RXEN1) |  \
                (1 << TXEN1));  \
} while (0)
#define PS2_USART_RX_READY      (UCSR1A & (1<<RXC1))
#define PS2_USART_RX_DATA       UDR1
#define PS2_USART_ERROR         (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
#define PS2_USART_RX_VECT       USART1_RX_vect
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
/* XCK for clock line and RXD for data line */
#define PS2_CLOCK_PORT  PORTD
#define PS2_CLOCK_PIN   PIND
#define PS2_CLOCK_DDR   DDRD
#define PS2_CLOCK_BIT   4
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    0
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
#define PS2_USART_INIT() do {   \
    PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT);   \
    PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT);     \
    UCSR0C = ((1 << UMSEL00) |  \
              (3 << UPM00)   |  \
              (0 << USBS0)   |  \
              (3 << UCSZ00)  |  \
              (0 << UCPOL0));   \
    UCSR0A = 0;                 \
    UBRR0H = 0;                 \
    UBRR0L = 0;                 \
} while (0)
#define PS2_USART_RX_INT_ON() do {  \
    UCSR0B = ((1 << RXCIE0) |       \
              (1 << RXEN0));        \
} while (0)
#define PS2_USART_RX_POLL_ON() do { \
    UCSR0B = (1 << RXEN0);          \
} while (0)
#define PS2_USART_OFF() do {    \
    UCSR0C = 0;                 \
    UCSR0B &= ~((1 << RXEN0) |  \
                (1 << TXEN0));  \
} while (0)
#define PS2_USART_RX_READY      (UCSR0A & (1<<RXC0))
#define PS2_USART_RX_DATA       UDR0
#define PS2_USART_ERROR         (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
#define PS2_USART_RX_VECT       USART_RX_vect
#endif
#endif

#endif

Does everything look ok? Did i configure the files wrong? Im temporarily out of ideas hopefully theres a way to get it working

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 18 March 2016, 09:11:08
Your pin configuration is wrong. as config.h indicates, you have to use pd0/rxd and pd4/xck pin for atmega328p.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itzmeluigi on Fri, 18 March 2016, 10:58:49
Your pin configuration is wrong. as config.h indicates, you have to use pd0/rxd and pd4/xck pin for atmega328p.

I moved the wires CLOCK and DATA to PD0 and PD4 but the result is the same.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 18 March 2016, 16:46:13
Post pic of your wiring.
Did you connect DATA to PD0 and Clock ot PD4? Do you have pull up resistors?
And do you have components(zeners and registers on INT0/INT1) for VUSB?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: itzmeluigi on Fri, 18 March 2016, 17:16:01
Post pic of your wiring.
Did you connect DATA to PD0 and Clock ot PD4? Do you have pull up resistors?
And do you have components(zeners and registers on INT0/INT1) for VUSB?

Yup i connected DATA to PD0 and Clock to PD4.  I didnt use pullup resistors, are they required? If so where should i wire them to?

I dont think i have zeners and registers on INT0/INT1. I just cut a PS/2 cable and connected the wires from it to the 1pin connectors on the Arduino Nano.

Data and Clock wires:
(http://i.imgur.com/M1T6b54.jpg)


5v and GND wires:
(http://i.imgur.com/7yOgST3.jpg)

PS/2 cable wiring:
(http://i.imgur.com/cxhnSHl.jpg)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 18 March 2016, 17:28:51
I haven't touched VUSB PS/2 converter for long time but just confirmed it still works from the latest source, glad.

Saw your pic, it seems like you don't have hardware for VUSB. Arduino nano is not compatible for VUSB you'll have to attach USB connector and resistors and zener diodes yourself.(EDIT: you cannot use Nano's USB connector for VUSB, it can be used only for programming flash.)
Do you know about what VUSB is or how it works, did you read VUSB docs or something? If you are not familir with VUSB you definitely need to read its doc or tutorial.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: QuincyJones on Mon, 04 July 2016, 03:01:25
I haven't touched VUSB PS/2 converter for long time but just confirmed it still works from the latest source, glad.

Saw your pic, it seems like you don't have hardware for VUSB. Arduino nano is not compatible for VUSB you'll have to attach USB connector and resistors and zener diodes yourself.(EDIT: you cannot use Nano's USB connector for VUSB, it can be used only for programming flash.)
Do you know about what VUSB is or how it works, did you read VUSB docs or something? If you are not familir with VUSB you definitely need to read its doc or tutorial.

Are you sure?

I'm thinking of doing the same thing, and posts like ( http://stackoverflow.com/questions/11967197/arduino-application-communication-over-built-in-usb ) this make me think it's possible! Also, pin 0 in the photo above appears to be marked txd, not pin 1!

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 04 July 2016, 04:10:11
Yes, my post you quoted is still correct.
USB hardware of Nano is dedicated to doing serial communication, you cannot use it for other purpose, for example USB keyobard.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: QuincyJones on Mon, 04 July 2016, 13:59:20
Yes, my post you quoted is still correct.
USB hardware of Nano is dedicated to doing serial communication, you cannot use it for other purpose, for example USB keyobard.

That's a shame and has saved me some money not buying the ones I had lined up!

Is there a definite flash size specified for this? I'm investigating some ATTiny85 boards which apparently support v-usb but will only have about 6k of flash
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 05 July 2016, 03:48:49
Tmk doesn't fit in that small 6kb anymore, get 168 or 328. It needs around 6500 bytes when building without some features. That  being said, you will be able to build it less than 6kb if you have decent SKILLs and passion. In that case I can help you.

But If you want to just save your money I can't help you.  :)

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 16 September 2016, 22:20:57
Keymap editor is available now.

For TMK PS/2-USB converter(Rev.2):
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb

For old TMK PS/2-USB converter(Rev.1):
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb_rev1

If you made a converter yourself with Teensy or ATMega32u4 you will be able to use editor for Rev.1.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Wed, 05 October 2016, 22:38:09
PS/2 converter has had some problem on USB suspend/resume, I updated code and firmware on keymap editor for this and I think it works now.
You can try the new firmware if you have problem.

https://github.com/tmk/tmk_keyboard/commit/1a7d1f9f4d6fdebb6e1d088ffcb37745ddf119d2
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Sat, 29 October 2016, 09:20:54
Hello Hasu,

(sorry for not reading the whole thread)

I intend to make such a converter using a "Pro Micro". My question is, in the 'converter/ps2_usb' folder, which is the "proper" Makefile to use? Or, is it enough if I change 'atmega32u2' to 'atmega32u4' in the main "Makefile"? And thanks (again) for creating TMK and all the features, and keyboards,  and converters that it supports :)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Sat, 29 October 2016, 11:48:29
Hello Hasu,

(sorry for not reading the whole thread)

I intend to make such a converter using a "Pro Micro". My question is, in the 'converter/ps2_usb' folder, which is the "proper" Makefile to use? Or, is it enough if I change 'atmega32u2' to 'atmega32u4' in the main "Makefile"? And thanks (again) for creating TMK and all the features, and keyboards,  and converters that it supports :)


I think you are doning right way. Use Makefile and change mcu and frequency setting for your hardware.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Sat, 29 October 2016, 12:18:39

Ok - Thanks! :)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Mon, 21 November 2016, 04:01:56
Another question (related to this (https://deskthority.net/post339923.html#p339923)):

Is it possible to use the converter with two PS/2 devices as two connected inputs, in order to be seen by the PC as a single, programmable, USB connected device?

(i.e. two inputs, one output)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Mon, 21 November 2016, 13:56:07
No, current code doesn't  support multiple instance of PS/2, but you can still use it as starting point.
i.e. TMK is not itself enough for your need but C/C++ can do anything you want :D
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 22 November 2016, 03:07:22
No, current code doesn't  support multiple instance of PS/2, but you can still use it as starting point.
i.e. TMK is not itself enough for your need but C/C++ can do anything you want :D

Fair enough :) And you're right, it will still be easier than starting from scratch!
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Tactile on Thu, 08 December 2016, 16:22:52
How to handle multiple key codes?

I have an unusual keyboard from a piece of medical equipment. My PS/2 to USB converter using a teensy 2.0 is built and working great as a pass-through converter. Through the converter the keyboard behaves exactly as it does when plugged into the PS/2 port. Now I need to work with the oddball keys on this keyboard.

I have keys which when pressed send:
F9 + a
F9 + b
F9 + c
 ...
F9 + z
F10 + a
F10 + b
 ...
F10 + h

How can I deal with these multiple key codes in order to reprogram these keys?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 08 December 2016, 16:28:49
Do you have pic of the keyboard? Just curious.

You will have to write C code to handle those keys.

Sent from my Nexus 5X

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Tactile on Thu, 08 December 2016, 16:34:37
Do you have pic of the keyboard? Just curious.

You will have to write C code to handle those keys.

Sent from my Nexus 5X

I was thinking I need to put a case into matrix.c but I'm unclear how to check for one key code then catch the next to compare.

It's a TG3 brand board and here it is...

[attach=1]
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: TioSolid on Thu, 12 January 2017, 10:19:43
Hi everyone. I have a noppoo choc mini and im using this adapter since its original controller (for usb use) is a complete mess because of its NKRO over usb implementation.

Thing is: My noppoo sometimes has a LOT of chatter and looking through the TMK_CORE files in github I saw that the base firmware has a debounce setting in it, but the PS2 converter has not (afaik). So, would be possible to add a debounce routine in this converter and if yes, how would one go about doing it? I can code reasonably well, but since my understanding of the tmk firmware is pretty much zero, I have no clue about where to start
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 12 January 2017, 21:53:17
Hi everyone. I have a noppoo choc mini and im using this adapter since its original controller (for usb use) is a complete mess because of its NKRO over usb implementation.

Thing is: My noppoo sometimes has a LOT of chatter and looking through the TMK_CORE files in github I saw that the base firmware has a debounce setting in it, but the PS2 converter has not (afaik). So, would be possible to add a debounce routine in this converter and if yes, how would one go about doing it? I can code reasonably well, but since my understanding of the tmk firmware is pretty much zero, I have no clue about where to start

In genral converters don't have debouncer and keyboard should have it. I think you better repair your keyboard,  probably by replacing switches? If it is not option you can implement debouncing in converter firmware. In matrix_scan() the converter keeps key states in matrix[] array according to key events from keyboard. You can place your logic in this function.
https://github.com/tmk/tmk_keyboard/blob/master/converter/ps2_usb/matrix.c#L144-L383
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Tactile on Thu, 12 January 2017, 22:34:47
What are the symptoms if we need pull up resistors & don't have them?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 12 January 2017, 22:48:47
What are the symptoms if we need pull up resistors & don't have them?

It wouldn't work simply, otherwise goes mad?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: TioSolid on Fri, 13 January 2017, 05:24:14
Hi everyone. I have a noppoo choc mini and im using this adapter since its original controller (for usb use) is a complete mess because of its NKRO over usb implementation.

Thing is: My noppoo sometimes has a LOT of chatter and looking through the TMK_CORE files in github I saw that the base firmware has a debounce setting in it, but the PS2 converter has not (afaik). So, would be possible to add a debounce routine in this converter and if yes, how would one go about doing it? I can code reasonably well, but since my understanding of the tmk firmware is pretty much zero, I have no clue about where to start

In genral converters don't have debouncer and keyboard should have it. I think you better repair your keyboard,  probably by replacing switches? If it is not option you can implement debouncing in converter firmware. In matrix_scan() the converter keeps key states in matrix[] array according to key events from keyboard. You can place your logic in this function.
https://github.com/tmk/tmk_keyboard/blob/master/converter/ps2_usb/matrix.c#L144-L383

Thanks very much, Will check this out!
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: catawalks on Mon, 20 February 2017, 19:40:55
Alright, I think I'm missing something or I did something wrong. I've got a Dell AT101W PS/2 board that I'm wiring up a Teensy 2.0 with the default TMK PS2-USB Converter Rev.1 firmware.

I've got Vcc connected to +5v, GND connected to ground, PD0 connected to Data, and PD1 connected to Clock.

When I connect the USB connector to it, all the LEDs light up for like half a second and then they all go off. After that the teensy shows in device manager as a keyboard, but nothing on the keyboard works.

Do I have the lines backwards or am I using the wrong firmware or something? I tried putting a 4.7k resistor on the data and clock lines connecting to Vcc but still nothing.

Any ideas would be greatly appreciated.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Randalljai on Sun, 11 June 2017, 12:28:01
has anyone used this with the realforce 89u JIS? there are some keys that computer does not recognize (windows 10) so how would the hasu work in this situation?

here are some of the things i wan to do (here's a pic for reference: http://imgur.com/a/3okAc)

the red square will be all spacebar function
the blue square will turn into a windows key
the yellow line's function would swap (currently the yellow key doesn't have a function, so when swapped, it would move up a row and turn into a enter key as well, the green square
and the pink box will turn into backspace
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Eraicos on Fri, 10 November 2017, 09:01:48
Hey Hasu, the USB-to-USB converter has a limited memory, does this converter have that limitation or it can store more layers? How much memory does it have?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Fri, 10 November 2017, 17:25:53
Hey Hasu, the USB-to-USB converter has a limited memory, does this converter have that limitation or it can store more layers? How much memory does it have?

You will have 11kb free on flash which is enough to define 32 layers.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Darkshado on Tue, 02 January 2018, 00:52:27
Hello Hasu,

Trying to use an ISO modded F AT with the PS/2 converter, the modded keys send some unassigned codes. I tried merely adding the codes to the KEYMAP_ALL macros but this commit (4be3562 (https://github.com/louisrousseau/tmk_keyboard/commit/4be356231c22c6b614cd199418e41e17a335a162)) leads to build errors:

Code: [Select]
In file included from keymap_plain.c:1:0:
keymap_common.h:131:17: error: 'KC_K19' undeclared here (not in a function); did you mean 'KC_F19'?
     { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO    }, \
                 ^
keymap_common.h:171:1: note: in expansion of macro 'KEYMAP_ALL'
 KEYMAP_ALL( \
 ^~~~~~~~~~
keymap_common.h:196:1: note: in expansion of macro 'KEYMAP_FULL'
 KEYMAP_FULL( \
 ^~~~~~~~~~~
keymap_plain.c:21:5: note: in expansion of macro 'KEYMAP'
     KEYMAP(
     ^~~~~~

And so on. I tried searching for the declaration of existing codes to no avail, with all the preprocessor business going on, not sure what to look for either.

Help?

Thanks,

Darkshado
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 02 January 2018, 18:26:40
Hello Hasu,

Trying to use an ISO modded F AT with the PS/2 converter, the modded keys send some unassigned codes. I tried merely adding the codes to the KEYMAP_ALL macros but this commit (4be3562 (https://github.com/louisrousseau/tmk_keyboard/commit/4be356231c22c6b614cd199418e41e17a335a162)) leads to build errors:

Code: [Select]
In file included from keymap_plain.c:1:0:
keymap_common.h:131:17: error: 'KC_K19' undeclared here (not in a function); did you mean 'KC_F19'?
     { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO    }, \
                 ^
keymap_common.h:171:1: note: in expansion of macro 'KEYMAP_ALL'
 KEYMAP_ALL( \
 ^~~~~~~~~~
keymap_common.h:196:1: note: in expansion of macro 'KEYMAP_FULL'
 KEYMAP_FULL( \
 ^~~~~~~~~~~
keymap_plain.c:21:5: note: in expansion of macro 'KEYMAP'
     KEYMAP(
     ^~~~~~

And so on. I tried searching for the declaration of existing codes to no avail, with all the preprocessor business going on, not sure what to look for either.

Help?

Thanks,

Darkshado

you have to add parameters of the macro KEYMAP_ALL within these lines for the "unassigned codes" you already added in keymap array.
https://github.com/louisrousseau/tmk_keyboard/blob/4be356231c22c6b614cd199418e41e17a335a162/converter/ps2_usb/keymap_common.h#L114-L120
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Darkshado on Wed, 03 January 2018, 02:05:03
Got it to work, it was a matter of paying closer attention to the error messages and how C macros are processed :D

https://github.com/tmk/tmk_keyboard/pull/509

Thanks,

Darkshado
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: equalunique on Thu, 18 January 2018, 13:02:53
Hasu, I noticed that on github under features you have the following listed:

"Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols"

Is it possible to connect a TMK keyboard to a PS/2 port on a computer? If so, then how difficult/easy would that be to do?

Otherwise, it would seem that the only open source firmwares capable of PS/2 output are ps2avr/ps2avrgb.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Thu, 18 January 2018, 23:25:13
answered here. https://geekhack.org/index.php?topic=93596.msg2549642#msg2549642
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: TieuNgu on Tue, 17 April 2018, 20:13:09
https://imgur.com/a/gglWr

I'm trying to make the adapter work with my BTC 5100C. This is my first time of doing this and I don't know where to start. When I plugged the keyboard in, it wasn't even recognized. Would anyone have any experience on this?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 17 April 2018, 20:46:17
https://imgur.com/a/gglWr

I'm trying to make the adapter work with my BTC 5100C. This is my first time of doing this and I don't know where to start. When I plugged the keyboard in, it wasn't even recognized. Would anyone have any experience on this?


1) FIrst, without keyboard check your converter is recogized with device manager if you are on windows, use proper command or see log file if you are on Linux or something. It should have feed:6512 as USB VID:PID.

EDIT: It is recognized as normal 'HID keyboard Device' in WIndows 10. The converter should add two 'HID keyboard Device' entries when using default firmware. Note that 'Standard PS/2 Keyboard' is internal keyboard in my ThinkPad, you won't see it even if you plug your BTC keybaord into converter.

(https://i.imgur.com/G3BcsID.png)


1a) This is optional. Push button to put the converter into flash mode. You should see  03eb:2ff0 as VID:PID. Refer this If you need to install driver to flash new firmware. https://github.com/tmk/tmk_keyboard/wiki/Driver-install-on-Windows

2) plug-in the keyboard. The converter should work with PS/2 keyboard now.

If not flash default firmware downloaded from here. Don't edit keymap here.
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb

EDIT: oh, make sure that  your USB cable has good quality enough first before that.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: TieuNgu on Tue, 17 April 2018, 21:08:30
Thanks for the help!

With that I'm now able to get by board recognized and I could type now. Next, I would like to remap some of my keys, could you let me know how to do it?

https://imgur.com/a/gglWr

I'm trying to make the adapter work with my BTC 5100C. This is my first time of doing this and I don't know where to start. When I plugged the keyboard in, it wasn't even recognized. Would anyone have any experience on this?


1) FIrst, without keyboard check your converter is recogized with device manager if you are on windows, use proper command or see log file if you are on Linux or something. It should have feed:6512 as USB VID:PID.
Show Image
(https://i.imgur.com/G3BcsID.png)



1a) This is optional. Push button to put the converter into flash mode. You should see  03eb:2ff0 as VID:PID. Refer this If you need to install driver to flash new firmware. https://github.com/tmk/tmk_keyboard/wiki/Driver-install-on-Windows

2) plug-in the keyboard. The converter should work with PS/2 keyboard now.

If not flash default firmware downloaded from here. Don't edit keymap here.
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb

EDIT: oh, make sure that  your USB cable has good quality enough first before that.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 17 April 2018, 21:13:06
What did you do to recognized you keyboard actually?
And what do you think your problem was?

Refer this for remap.
https://github.com/tmk/tmk_keyboard/wiki

Thanks for the help!

With that I'm now able to get by board recognized and I could type now. Next, I would like to remap some of my keys, could you let me know how to do it?

https://imgur.com/a/gglWr

I'm trying to make the adapter work with my BTC 5100C. This is my first time of doing this and I don't know where to start. When I plugged the keyboard in, it wasn't even recognized. Would anyone have any experience on this?


1) FIrst, without keyboard check your converter is recogized with device manager if you are on windows, use proper command or see log file if you are on Linux or something. It should have feed:6512 as USB VID:PID.
Show Image
(https://i.imgur.com/G3BcsID.png)



1a) This is optional. Push button to put the converter into flash mode. You should see  03eb:2ff0 as VID:PID. Refer this If you need to install driver to flash new firmware. https://github.com/tmk/tmk_keyboard/wiki/Driver-install-on-Windows

2) plug-in the keyboard. The converter should work with PS/2 keyboard now.

If not flash default firmware downloaded from here. Don't edit keymap here.
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb

EDIT: oh, make sure that  your USB cable has good quality enough first before that.

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: TieuNgu on Tue, 17 April 2018, 21:24:31
I was using the front USB port of my computer and the keyboard was not recognized. Then I tried the back USB port and it worked immediately. Refer to this picture (https://imgur.com/a/flaZs)

Per the remap wiki, I understand that I have to remap my key with this editor (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb)

However, this is my keyboard layout (https://ssli.ebayimg.com/images/g/XiUAAOSws5pZJ1uq/s-l1600.jpg). How can I use your editor to remap this layout?

What did you do to recognized you keyboard actually?
And what do you think your problem was?

Refer this for remap.
https://github.com/tmk/tmk_keyboard/wiki

Thanks for the help!

With that I'm now able to get by board recognized and I could type now. Next, I would like to remap some of my keys, could you let me know how to do it?

https://imgur.com/a/gglWr

I'm trying to make the adapter work with my BTC 5100C. This is my first time of doing this and I don't know where to start. When I plugged the keyboard in, it wasn't even recognized. Would anyone have any experience on this?


1) FIrst, without keyboard check your converter is recogized with device manager if you are on windows, use proper command or see log file if you are on Linux or something. It should have feed:6512 as USB VID:PID.
Show Image
(https://i.imgur.com/G3BcsID.png)



1a) This is optional. Push button to put the converter into flash mode. You should see  03eb:2ff0 as VID:PID. Refer this If you need to install driver to flash new firmware. https://github.com/tmk/tmk_keyboard/wiki/Driver-install-on-Windows

2) plug-in the keyboard. The converter should work with PS/2 keyboard now.

If not flash default firmware downloaded from here. Don't edit keymap here.
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb

EDIT: oh, make sure that  your USB cable has good quality enough first before that.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 17 April 2018, 21:42:43
I was using the front USB port of my computer and the keyboard was not recognized. Then I tried the back USB port and it worked immediately. Refer to this picture (https://imgur.com/a/flaZs)

Thanks for the pic. I don't know much but have heard some people said they had problem with USB 3 ports like you described.

Quote
Per the remap wiki, I understand that I have to remap my key with this editor (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?ps2_usb)

However, this is my keyboard layout (https://ssli.ebayimg.com/images/g/XiUAAOSws5pZJ1uq/s-l1600.jpg). How can I use your editor to remap this layout?

You can't break the converter hardware with flashing firmware. Just do trial and error you will know how this works eventually.

For example, if you want to remap ESC of you keyboard  just edit key makred as ESC (in initial keymap)  in keymap editor basically.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 03 July 2018, 06:23:33
To continue the question I put in the other thread (https://geekhack.org/index.php?topic=72052.msg2630974#msg2630974) (and trying to move it here) - the question is related to adding extra buttons to the ps2_usb converter, buttons directly connected to the Atmega32u4's pins. In addition to your answer, is it right that I need also:

1. to use the busy wait method, since the PS2 keyboard won't know to generate an interrupt when I press a button not connected to it. Or, is the PS2 keyboard interrupt generated automatically at some period, even if nothing happens?

and:

2. (if needed) add debouncing delays or treatment similar to gh60 code (using two matrixes) ?

Thanks again!

P.S. I noted that you added that question and its answer to the TMK FAQ Wiki :)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 03 July 2018, 07:23:44
1. Not sure what your concern is. But I think there are no reason that you have to use 'PS2_USE_BUSYWAIT' instead of 'PS2_USE_INT'.

2. yes, you will need to debounce the button. the gh60 code won't be suitable in this case, you may want to check onekey project instead. Or you can find many good example codes on the net.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 03 July 2018, 07:29:59
Thanks again! :)

At 1, my concern is this: in my understanding, there is a physical keyboard hooked on PS2 to the Atmega32u4 controller; when I press a key on the keyboard, it generates an interrupt, and the Atmega32u4 processes it. But, if I press a button connected *directly* to the Atmega32u4 controller, the PS2 keyboard didn't generate an interrupt, so, does 'matrix_scan()' get called if there is no interrupt generated? In fewer words, is 'matrix_scan()' called if there is no keyboard interrupt? Or is the keyboard interrupt happening periodically? I hope my question is clear(er).
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 03 July 2018, 07:47:08
Ah, OK.
matrix_scan() is called as frequently as possible in infinite loop in main() regardless of PS/2 keyboard signal interrupt.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 03 July 2018, 07:51:00
Ah, OK.
matrix_scan() is called as frequently as possible in infinite loop in main() regardless of PS/2 keyboard signal interrupt.

Thanks, got it! I suppose this can help with debouncing too :)
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 03 July 2018, 11:22:02
The "extra buttons" code is here,  in case anybody is interested: https://github.com/VanLaser/tmk_keyboard/commit/d359581e87d2a2b64f62858ba33a6b5efb3e2cc8

It uses buttons PD4 (nr. 4 on Pro Micro) and PD7 (nr. 6 on Pro Micro). Debouncing is based on the TMK 'onekey' keyboard code. I haven't tested with an actual PS2 keyboard connected, yet, just with buttons, so the "laser" keymap may still have mapping errors (but the buttons do work).

With the testbed below, I use just one switch to trigger both "extra buttons" pins; the 2nd switch is used to reset the Pro Micro.

[attach=1]
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 03 July 2018, 17:01:27
The "extra buttons" code is here,  in case anybody is interested: https://github.com/VanLaser/tmk_keyboard/commit/d359581e87d2a2b64f62858ba33a6b5efb3e2cc8

It uses buttons PD4 (nr. 4 on Pro Micro) and PD7 (nr. 6 on Pro Micro). Debouncing is based on the TMK 'onekey' keyboard code. I haven't tested with an actual PS2 keyboard connected, yet, just with buttons, so the "laser" keymap may still have mapping errors (but the buttons do work).

With the testbed below, I use just one switch to trigger both "extra buttons" pins; the 2nd switch is used to reset the Pro Micro.

(Attachment Link)

Great job so far!
Let us know the result when you actually test with PS/2 keyboard.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 03 July 2018, 18:10:39
Sure, I'll post after testing with a PS2 keyboard attached.

Meanwhile, I added a mini joystick to pins PF6 and PF7 (A1 and A0 on the Pro Micro) and I "imported" the relevant code from Wez' flutterby QMK project, code that reads the analog values and send mouse reports based on them (described here (https://www.facebook.com/notes/wez-furlong/building-a-keyboard-ii/10154296367151787/), source code here (https://github.com/wez/qmk_firmware/tree/flutterby/keyboards/flutterby)).

So basically (still without the testing with a PS2 keyboard attached), I have a thumbstick as mouse and two mouse buttons :)

[attach=1]
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Wed, 04 July 2018, 17:54:27

I don't have a PS2 mother socket, so I tested in another way - I flashed the new firmware in a Pro Micro already used as a converter and placed inside a PS2 keyboard. The keymap is good :) and by shorting GND and pins PD4 and PD7 (4 and 6) I saw the clicks. Without a thumbstick connected to that Pro Micro, the mouse was stuck to the left-down corner of the screen, and connecting A0 or A1 to the VCC (hope that was allowed) made the mouse move from that corner. So, I say it works, even if I didn't make the official test with everything connected at the same time.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 29 January 2019, 07:36:24

A question (sorry if asked before): if a USB keyboard comes with a passive PS/2 converter, does it mean that it could use your "PS/2 to USB" converter instead of the more expensive USB2USB converter? I read somewhere that "PS2 host to USB device adapters are passive and just convert the connector. They require the keyboard or Mouse to support both protocols and automatically detect which to use." My idea would be to hook up the pins from the PCB connector that normally go to the USB jack to the PS/2 part of the PS/2-to-USB converter. Would that work? (the keyboard would detect that it's in the PS/2 mode)

While in the end the connection is still USB, the purpose is of course that of making the keyboard fully programmable with TMK, using the cheaper to buy/make PS/2-to-USB converter.

Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: hasu on Tue, 29 January 2019, 08:09:03

A question (sorry if asked before): if a USB keyboard comes with a passive PS/2 converter, does it mean that it could use your "PS/2 to USB" converter instead of the more expensive USB2USB converter? I read somewhere that "PS2 host to USB device adapters are passive and just convert the connector. They require the keyboard or Mouse to support both protocols and automatically detect which to use." My idea would be to hook up the pins from the PCB connector that normally go to the USB jack to the PS/2 part of the PS/2-to-USB converter. Would that work? (the keyboard would detect that it's in the PS/2 mode)

While in the end the connection is still USB, the purpose is of course that of making the keyboard fully programmable with TMK, using the cheaper to buy/make PS/2-to-USB converter.



Yes, you can use PS/2-USB converter if your keyboard itself supports PS/2 through 'passive adapter'. I believe your keyboard does support PS/2 if it comes with the 'passive adapter' shipped from manufacturer.

I think 'passive adapter' converts just physical connector form and play no role in terms of electrics, so you can hook up the converter directly to keyboard without passive adapter.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: Laser on Tue, 29 January 2019, 08:14:27

Thanks again Hasu! That's actually GREAT :)
Title: Re: PS/2 to USB keyboard wireless converter
Post by: youxiaojie on Tue, 29 January 2019, 14:06:02
I am trying to extend the tmk PS 2 to USB converter by nrf 24l
01 to send and receive  USB hid, can anyone help me? I couldn't find main program in converter for atmega 32U4 or 328P.
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: youxiaojie on Tue, 29 January 2019, 15:05:44
keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
   Is it a printer? And for a simplified example, int p[][3][4] means?
Or a 3D matrix?
answer: this is a 3d matrix, the first division means keyboard layers, auto defined when matrix initialized.
eg int 3dmatix[][3][4]={{{0,1,2,3},{4,5,6,7},{8,9,10,11}},{{20,21,22,23},{24,25,26,27},{28,29,30,31}}}; initialized a 3d matix, the first division is caculated here is 2,so 3d matrix[2][3][4].
and we can define a pointer int *p[3][4]=3dmatrix[0];
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: youxiaojie on Fri, 01 February 2019, 11:44:50
dear friend I see config.h and find:
/* matrix size */
#define MATRIX_ROWS 32  // keycode bit: 3-0
#define MATRIX_COLS 8   // keycode bit: 6-4

I feel it should be

/* matrix size */
#define MATRIX_ROWS 32  // keycode bit: 7-4
#define MATRIX_COLS 8   // keycode bit: 3-0
Am I right? Is keycode scancode?
Title: Re: PS/2 to USB keyboard converter for Teensy with mousekeys and NKRO
Post by: brentward on Wed, 27 March 2019, 17:07:26
I'm having the same issue using a Teensy 2.0 with an IBM Model M. I have mine connected in the same way and I've tried to use pull up resistors also, but it flashes when I plug it in then doesn't work.

I'm using a Mac and it shows up in System Information but sometimes it gives a message that it is using too much power so it is being shut off.

I've tried modifying the tsk_core/protocol/lufa/descriptor.c file to increase .MaxPowerConsumption in the ConfigurationDescriptor to USB_CONFIG_POWER_MA(500), but that didn't solve the issue. I've confirmed that now in System Information it recognizes that the device is requesting 500 mA.

From what I can tell 500 mA should be more than enough to power the Model M, so I'm guessing I have something wired wrong. I've even tried swapping out the Teensy with a Arduino Pro Micro that I know is working (it is currently functioning in a ABD to USB converter) and both of them behave the same.

Does anyone have any suggestions as to why it would shut off right after the lights turn on in the keyboard power up test?

Alright, I think I'm missing something or I did something wrong. I've got a Dell AT101W PS/2 board that I'm wiring up a Teensy 2.0 with the default TMK PS2-USB Converter Rev.1 firmware.

I've got Vcc connected to +5v, GND connected to ground, PD0 connected to Data, and PD1 connected to Clock.

When I connect the USB connector to it, all the LEDs light up for like half a second and then they all go off. After that the teensy shows in device manager as a keyboard, but nothing on the keyboard works.

Do I have the lines backwards or am I using the wrong firmware or something? I tried putting a 4.7k resistor on the data and clock lines connecting to Vcc but still nothing.

Any ideas would be greatly appreciated.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Wed, 27 March 2019, 18:57:16
I think computer(USB host) doesn't measure real current device draws, it just knows it from MaxPowerConsumption value. And resettable fuse would be used to protect USB port from accidental short circuit and overcurrent.

I suppose there are two scenarios for the problem:

1) Resettable fuse is tripped with short circuit.
2) Computer shudowns device(or just warns, perhaps) if sum of MaxPowerConsumption values(of all connected devices) exceeds power budget of USB port.
3) or other hardware/firmware errors

Decreasing MaxPowerConsumption value may mitigate the problem if it is caused from case 2.
But I guess iffy wiring is more likely and it makes accidental short circuit occasionally?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Thu, 28 March 2019, 10:35:32
Thanks for replying. I have new info about the issue.

Iíve figured out that if I plug in the converter without the PS2 port plugged into it but then plug it in after waiting more than about 3 seconds but less than about 8 seconds it works perfectly. Since it works in this way consistenty and doesnít shut off or fail Iím thinking the wiring isnít the issue.

Would there be a way to delay powering up the VCC pin for 5 seconds after the Teensy starts? I tried adding a sleep(5) in the main function in main.cpp before the keyboard init function but that didnít do the trick.

More about my configuration: it has the clock on PD1 data on PD0 both with 1k pull up resistors. The tmk build is rev2 with the only change from default being changing the MCU to atmega32u4.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Thu, 28 March 2019, 19:16:32
Interesting.

Did you get any dialog or something on your OS?

I'd try some to know where the issue is located in keyobard, converter and firmware.
0) Plugin the converter without keyboard and see if you still have same issue.
1) Try Soarer's firmware and see if you still have same issue with it.
2) If you have other PS/2 keyboard and check the converter itself works well.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: JosefM on Tue, 02 April 2019, 12:38:15
Hi,
I'm totally new to AVR, and I'm not understanding how to build the files (I need it for a Teensy 2.0++).
I tried to install WinAVR on Windows, but building failed because the paths in the various files are in Unix format (for example the last lines in Makefile are
Code: [Select]
include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk
)

I tried to install cross-avr-gcc7 on a SuSE Linux machine (965.7 MiB), but, when compiling, I got many errors about missing files. I eventually copied all the content of the avr\include folder from my WinAVR installation to tmk_keyboard/tmk_core/common folder downloaded from github: no file was replaced/overwritten, and the errors about missing files disappeared, but now I've the following

Code: [Select]
avr-gcc (Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


mkdir -p obj_ps2_usb/protocol/lufa
Compiling C: ../../tmk_core/protocol/lufa/lufa.c
avr-gcc -c -mmcu=atmega32u2 -gdwarf-2 -DF_CPU=16000000UL -DSUSPEND_MODE_STANDBY -DBOOTLOADER_SIZE=4096 -DPS2_USE_INT -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DNO_LIMITED_CONTROLLER_CONNECT -DPROTOCOL_LUFA -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DNKRO_ENABLE -DVERSION=494faeb4-dirty -Os -funsigned-char -funsigned-bitfields -ffunction-s
ections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_ps2_usb/protocol/lufa/lufa.lst -I. -I../../tmk_core -I../../tmk_core/protocol -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_ps2_usb_protocol_lufa_lufa.o.d  ../../tmk_core/protocol/lufa/lufa.c -o obj_ps2_usb/protocol/lufa/lufa.o
In file included from ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/../../Common/Common.h:96:0,
                 from ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/USB.h:382,
                 from ../../tmk_core/protocol/lufa/descriptor.h:47,
                 from ../../tmk_core/common/report.h:83,
                 from ../../tmk_core/protocol/lufa/lufa.c:39:
../../tmk_core/protocol/lufa/lufa.c: In function 'EVENT_USB_Device_Connect':
../../tmk_core/common/avr/pgmspace.h:249:46: error: variable '__c' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 # define PSTR(s) (__extension__({static char __c[] PROGMEM = (s); &__c[0];}))
                                              ^
../../tmk_core/common/print.h:41:27: note: in expansion of macro 'PSTR'
 #define print(s)    xputs(PSTR(s))
                           ^~~~
../../tmk_core/protocol/lufa/lufa.c:221:5: note: in expansion of macro 'print'
     print("[C]");
     ^~~~~
../../tmk_core/protocol/lufa/lufa.c: In function 'EVENT_USB_Device_Disconnect':
../../tmk_core/common/avr/pgmspace.h:249:46: error: variable '__c' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 # define PSTR(s) (__extension__({static char __c[] PROGMEM = (s); &__c[0];}))
                                              ^
../../tmk_core/common/print.h:41:27: note: in expansion of macro 'PSTR'
 #define print(s)    xputs(PSTR(s))
                           ^~~~
../../tmk_core/protocol/lufa/lufa.c:232:5: note: in expansion of macro 'print'
     print("[D]");
     ^~~~~
../../tmk_core/protocol/lufa/lufa.c: In function 'setup_mcu':
../../tmk_core/protocol/lufa/lufa.c:609:5: warning: implicit declaration of function 'clock_prescale_set' [-Wimplicit-function-declaration]
     clock_prescale_set(clock_div_1);
     ^~~~~~~~~~~~~~~~~~
../../tmk_core/protocol/lufa/lufa.c:609:24: error: 'clock_div_1' undeclared (first use in this function)
     clock_prescale_set(clock_div_1);
                        ^~~~~~~~~~~
../../tmk_core/protocol/lufa/lufa.c:609:24: note: each undeclared identifier is reported only once for each function it appears in
In file included from ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/../../Common/Common.h:96:0,
                 from ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/USB.h:382,
                 from ../../tmk_core/protocol/lufa/descriptor.h:47,
                 from ../../tmk_core/common/report.h:83,
                 from ../../tmk_core/protocol/lufa/lufa.c:39:
../../tmk_core/protocol/lufa/lufa.c: In function 'main':

I suspect the problem is because I copied the files from WinAVR, which seems to be 9 years old.
Could I compile the project using Atmel Studio? I'm installing it right now

EDIT: I installed Atmel Studio: I couldn't open a project (I assume it's not been developed using such IDE), but, after copying its own .h files, the project "seems" to compile without errors... it creates a folder named obj_ps2_usb, but it doesn't contain any hex files.
Unfortunately, like I said, I'm new to AVR ĶCUs: I've been using other ĶCUs (you know: the old PICs), but I've always used their IDE (on Windows), and I've always been writing my codes in Assembly, rarely using external libraries... I assume what I lack the more is a basic knowledge on how to compile a program on Unix-like machines...
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Tue, 02 April 2019, 19:18:47
JosefM,
See this wiki entry.
https://github.com/tmk/tmk_keyboard/wiki#build-firmware
Title: Re: TMK PS/2 to USB keyboard converter
Post by: JosefM on Wed, 03 April 2019, 00:16:39
JosefM,
See this wiki entry.
https://github.com/tmk/tmk_keyboard/wiki#build-firmware

Thank you: I had checked just the instructions on the OP of this thread (https://www.geekhack.org/index.php?topic=14618.msg282919#msg282919). I see now that, had I followed the last link in that post, I'd have found the instructions.
I'll try it tomorrow
Title: Re: TMK PS/2 to USB keyboard converter: compiling for Teensy 2.0++
Post by: JosefM on Wed, 03 April 2019, 23:07:49
I tried the VM+Ubuntu method, but it was giving me the same errors as the SuSE machine did.
I eventually managed to compile it on SuSE (copying the aforementioned .h files from Atmel Studio installation), but only if setting
Code: [Select]
MCU ?= atmega32u2in the Makefile. Using
Code: [Select]
MCU ?= at90usb1286(the MCU on the Teensy 2.0++) it wasn't working.
I eventually modified config.h appending " || defined(__AVR_AT90USB1286__)" at the end of line 64, which now looks like
Code: [Select]
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) || defined(__AVR_AT90USB1286__)
The lines modified in Makefile are
Code: [Select]
MCU ?= at90usb1286

BOOTLOADER_SIZE ?= 1024

CONSOLE_ENABLE ?= no # Console for debug(+400)

The second line is because of the size of the bootloader in the Teensy, while the third is to disable debugging codes, which may be used for sniffing what I type, bypassing what both the OS and the firewall do for preventing that behavior (which is why I'm not using Soarer's code, even though I bought the Teensy explicitly for that, as suggested on Deskthority.net (https://deskthority.net/wiki/Teensy))

After doing all of that, the program is now running on the Teensy 2.0++.
Too bad the USB keyboard protocol doesn't support many of the advanced features of this keyboard :(
I may evaluate modifying the firmware in the keyboard to send a break code every time a key is repeated, but it may cause problems with many programs.

(https://i.postimg.cc/4NKR9TfD/Image1.png)
Why so many input devices?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Thu, 04 April 2019, 00:14:51
Why so many input devices?

They are used for NKRO, mouse emulation and media keys.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: JosefM on Thu, 04 April 2019, 00:58:03
Why so many input devices?

They are used for NKRO, mouse emulation and media keys.

Yes, it came to my mind later: I found it back and was right gonna modify my post adding this video (go to 2'48" (https://www.youtube.com/watch?v=AWkvzycD5PE&t=2m48s))
Title: Re: TMK PS/2 to USB keyboard converter
Post by: wsr80913 on Sun, 07 April 2019, 17:17:10
I have a model M13 keyboard, and an Alps Glidepoint keyboard.  They have two PS/2 connectors, one for the trackpoint, and one for the keyboard.  They work well with a simple glop-top active converter, but I like being able to program things/remap keys in a device-independent way.

I ran around in circles for a bit, then realized TMK supports ps/2 mice.  I built a PS2_USE_INT PS2_MOUSE_ENABLE version, and it works, although it seems to stutter a bit.

I poked about trying to get PS2_USE_USART to work, read that the useful pins are limited - PD5 is an LED on a Pro Micro, which is what I'm working on right now - and thought I'd ask:

Is USART limited to just PD5 & PD2?

is a 32u4 fast enough to convert PS/2 keyboard and mouse on the same chip?

And renaming PS2_DATA_BIT & PS2_CLOCK_BIT for the second set of pins looks like it should work.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 07 April 2019, 17:48:00
I have a model M13 keyboard, and an Alps Glidepoint keyboard.  They have two PS/2 connectors, one for the trackpoint, and one for the keyboard.  They work well with a simple glop-top active converter, but I like being able to program things/remap keys in a device-independent way.

I ran around in circles for a bit, then realized TMK supports ps/2 mice.  I built a PS2_USE_INT PS2_MOUSE_ENABLE version, and it works, although it seems to stutter a bit.

I poked about trying to get PS2_USE_USART to work, read that the useful pins are limited - PD5 is an LED on a Pro Micro, which is what I'm working on right now - and thought I'd ask:

Is USART limited to just PD5 & PD2?

is a 32u4 fast enough to convert PS/2 keyboard and mouse on the same chip?

And renaming PS2_DATA_BIT & PS2_CLOCK_BIT for the second set of pins looks like it should work.

Yes, pins for USART is fixed and not configurable with Atmega32u4.
I think so but current TMK firmware doesn't support PS/2 keyboard and mouse at same time basically. Problem is that you can't create two instances of PS2_USE_INT, you will have to refactor PS/2 protocol codes.

It may work with configuring like PS2_USE_INT for keyboard and PS2_USE_USART for mouse, but I'm not sure.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Mon, 08 April 2019, 13:14:21
Sorry it took so long to reply to this, I was out of town.

0) When I plug in the converter with no keyboard there is no indication that there is any issue.
1) I loaded up Soarer's firmware and the keyboard works fine on it without hot swapping
2) I have no other PS/2 keyboards to try, but the same Teensy works perfectly fine when loaded with the Soarer firmware, and also when wiring it to an ADB port and loading the TMK add_to_usb converter, so it seems like the converter hardware is fine.

I've seen Chyrosan22 on youtube indicate very similar behavior on an OmniKey ULTRA in this video:
He indicated that it was caused by a bad capacitor and when he replaced it the behavior was fixed. My multimeter doesn't have a specific setting for testing capacitors but do you think replacing the two electrolytic capacitors on the controller would be worthwhile?

I'm not very familiar with Soarer's converter; I know how to modify TMK to do what I want so I'd like to get it working. But I'm assuming I can get my custom layers in Soarer's converter working. I haven't looked at the source code yet so I don't know what it includes.

Interesting.

Did you get any dialog or something on your OS?

I'd try some to know where the issue is located in keyobard, converter and firmware.
0) Plugin the converter without keyboard and see if you still have same issue.
1) Try Soarer's firmware and see if you still have same issue with it.
2) If you have other PS/2 keyboard and check the converter itself works well.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Wed, 10 April 2019, 22:36:27
I think the "drawing too much power" error basically indicates there is something wrong on hardware.

From the tests your converter hardware has no problem, so I think the keyobard is root cause fo your problem.
Yes, capacitors is what you have to check at first. IBM Model M2 is infamous for its bad capacitors but I haven't heard this on Model M so far. Though, I think checking/Replacing capacitors on your keyboard is still worthwhile.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Thu, 11 April 2019, 17:29:27
I pulled the caps the other night and some new ones came today while I was at work. Tonight I'll solder the new caps into the controller. I'll let you know how it goes.

Thanks for the help!
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Fri, 12 April 2019, 13:59:49
I replaced the 2 electrolytic capacitors and I'm still having issues. Interestingly, now it works when I plug it straight in (without hot swapping) sometimes, but not every time... weird.

This is making me wonder why it works fine on Soarer's firmware but has intermittent issues on the TMK firmware. I want to stick with TMK because of the ACTION_LAYER_TAP_KEY ability which it doesn't seem like Soarer's firmware supports.

Do you know enough about how Soarer's converter to think of why it would work in this case but not TMK?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Fri, 12 April 2019, 14:08:37
I just rebuilt the firmware after changing the lufa/descriptor.c to:
Code: [Select]
.MaxPowerConsumption    = USB_CONFIG_POWER_MA(250) and now it seems to be working 100% successfully.

I tested with the setting at a few different values, 125 mA, 200 mA, and 250 mA. At 125 the frequency of success on plugin it straight in was about the same as default. At 200 it seemed to work about 2 out of 3 times. At 250 I haven't had any failures so far..

My speculation is that MacOS was disabling the port when the device drew more power than it said it should be drawing. Now with the new capacitors it is drawing less power but still more than the 100 mA that the the TMK code has set as the default.

Thoughts?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 13 April 2019, 22:23:37
Hmm, Soarer's conveter declares 100mA in its descriptor as well. I'm not sure if it is really the cause.
https://github.com/tmk/tmk_keyboard/wiki/Soarer's-Converter-Descriptor
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Sun, 14 April 2019, 16:12:53
Yeah, I guess that isn't the difference that is making Soarer's firmware working.

I've discovered that the TMK firmware with the descriptor set to 250 mA (or even 500 mA) isn't as reliable as I thought. I tried using it on my older (late 2010) MacBook Pro and on a new Raspberry Pi 3 B+ and it doesn't work on them reliably. On the older MBP it works when hot swapping but not when plugged straight in. On the Raspberry Pi it doesn't work at all.

With Soarer's firmware it works on both the older MBP and the Raspberry Pi.

Now I'm back to wondering why it works fine with Soarer's converter but not TMK. I'm hoping I can get the TMK firmware to work reliably. Could it be a difference in how they are booting up?

Would it be possible put a delay in the VCC on the controller coming on?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Mon, 15 April 2019, 04:10:02
On the older MBP did you get error message or something?
Raspberry Pi says something in log file when the converter fails?

You can get debug info with hid_listen tool on both Soarer's and TMK. You may find some clue there.
https://www.pjrc.com/teensy/hid_listen.html

I guess keyboard initialization timing/method or something may cause the difference.

No you can't controll VCC line from firmware.

And what is your keyboard model exactly?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: _GMK_ on Mon, 15 April 2019, 06:13:44
Works perfectly with cherry g80-8000. Thanks for designing this  :thumb:
Maybe I'll buy one for home too. Any hardware update planned?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Mon, 15 April 2019, 14:30:14
There was no message from the MBP when it fails. Initially I was getting messages that the USB port was turned off because the device was using too much power but I haven't got that message in a while.

I'll take a look at the logs on the Raspberry Pi and I'll also look at the debug for both versions when I get hime and I'll update this thread.

The keyboard is a 1397735 manufactured on 12 Aug 1994. It is a version that has a thick coiled detachable SDL to PS/2 cable. The controller looks like this one:
https://clickykeyboards.com/product/model-m-internal-keyboard-controller-logic-board-with-sdl-port/
Title: Re: TMK PS/2 to USB keyboard converter
Post by: brentward on Fri, 26 April 2019, 14:32:30
It took me a while to get back to this. I haven't tried the HID debugging yet, but I do have logs from both computers that aren't working correctly, On the Raspberry Pi I've realized that it does sometimes work. I've captured logs from it not working and then working. I plugged it in at 12:26:06 in the logs and it didn't work, then I unplugged it and plugged it back in a few times until it worked when plugging it back in at 12:27:34.
Here are the syslog entries:
Code: [Select]
Apr 26 12:26:06 raspberrypi kernel: [ 2189.778392] usb 1-1.1.2: new full-speed USB device number 23 using dwc_otg
Apr 26 12:26:19 raspberrypi kernel: [ 2202.538520] usb 1-1.1.2: device not accepting address 23, error -110
Apr 26 12:26:19 raspberrypi kernel: [ 2202.638558] usb 1-1.1.2: new full-speed USB device number 24 using dwc_otg
Apr 26 12:26:34 raspberrypi kernel: [ 2217.858672] usb 1-1.1.2: device descriptor read/64, error -110
Apr 26 12:27:04 raspberrypi kernel: [ 2247.898952] usb 1-1.1.2: new full-speed USB device number 25 using dwc_otg
Apr 26 12:27:16 raspberrypi kernel: [ 2259.719067] usb 1-1.1.2: device not accepting address 25, error -32
Apr 26 12:27:19 raspberrypi kernel: [ 2263.249090] usb 1-1.1.2: new full-speed USB device number 27 using dwc_otg
Apr 26 12:27:32 raspberrypi kernel: [ 2275.899225] usb 1-1.1.2: device not accepting address 27, error -110
Apr 26 12:27:34 raspberrypi kernel: [ 2278.099227] usb 1-1.1.2: new full-speed USB device number 29 using dwc_otg
Apr 26 12:27:37 raspberrypi kernel: [ 2280.439471] usb 1-1.1.2: New USB device found, idVendor=feed, idProduct=6512
Apr 26 12:27:37 raspberrypi kernel: [ 2280.439487] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Apr 26 12:27:37 raspberrypi kernel: [ 2280.439496] usb 1-1.1.2: Product: ChopperHello PS/2
Apr 26 12:27:37 raspberrypi kernel: [ 2280.439505] usb 1-1.1.2: Manufacturer: ChopperHello
Apr 26 12:27:37 raspberrypi kernel: [ 2280.448655] input: ChopperHello ChopperHello PS/2 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/0003:FEED:6512.0011/input/input12
Apr 26 12:27:37 raspberrypi kernel: [ 2280.510324] hid-generic 0003:FEED:6512.0011: input,hidraw0: USB HID v1.11 Keyboard [ChopperHello ChopperHello PS/2] on usb-3f980000.usb-1.1.2/input0
Apr 26 12:27:37 raspberrypi kernel: [ 2280.517544] input: ChopperHello ChopperHello PS/2 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.1/0003:FEED:6512.0012/input/input13
Apr 26 12:27:37 raspberrypi kernel: [ 2280.579700] hid-generic 0003:FEED:6512.0012: input,hidraw1: USB HID v1.11 Device [ChopperHello ChopperHello PS/2] on usb-3f980000.usb-1.1.2/input1
Apr 26 12:27:37 raspberrypi kernel: [ 2280.586355] hid-generic 0003:FEED:6512.0013: hiddev96,hidraw2: USB HID v1.11 Device [ChopperHello ChopperHello PS/2] on usb-3f980000.usb-1.1.2/input2
Apr 26 12:27:37 raspberrypi kernel: [ 2280.594378] input: ChopperHello ChopperHello PS/2 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.3/0003:FEED:6512.0014/input/input14
Apr 26 12:27:37 raspberrypi kernel: [ 2280.660397] hid-generic 0003:FEED:6512.0014: input,hidraw3: USB HID v1.11 Keyboard [ChopperHello ChopperHello PS/2] on usb-3f980000.usb-1.1.2/input3

Console output from mac:
Code: [Select]
default 12:17:03.895474 -0700 kernel 013333.717355 IOUSBHostDevice@fd130000: IOUSBHostDevice::start: device descriptor request completed with 0xe0005000 and bytesTransferred 0
default 12:17:03.895729 -0700 kernel 013333.717609 AppleUSB20HubPort@fd130000: AppleUSB20HubPort::resetAndCreateDevice: failed to start device
default 12:17:03.895795 -0700 kernel 013333.717674 AppleUSB20HubPort@fd130000: AppleUSB20HubPort::resetAndCreateDevice: failed to create device (0xe00002e9), disabling port
default 12:17:21.810753 -0700 kernel 013351.632159 AppleUSB20HubPort@fd130000: AppleUSB20HubPort::interruptOccurred: change bits still set, port status 0x00000100
default 12:17:25.048644 -0700 kernel 013354.869965 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:17:28.793433 -0700 kernel 013358.614651 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:17:31.914748 -0700 kernel 013361.735890 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:17:32.101275 -0700 kernel 013361.922412 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:17:50.793640 -0700 kernel 013380.614281 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:18:00.775158 -0700 kernel 013390.595528 AppleUSB20HubPort@fd130000: AppleUSB20HubPort::interruptOccurred: change bits still set, port status 0x00000100
default 12:18:01.170828 -0700 kernel 013390.991189 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:18:02.790473 -0700 kernel 013392.610797 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures
default 12:18:14.407379 -0700 kernel 013404.227393 AppleUSB20HubPort@fd130000: AppleUSB20HubPort::interruptOccurred: change bits still set, port status 0x00000100
default 12:18:16.127062 -0700 kernel 013405.947034 AppleUSB20HubPort@fd130000: AppleUSBHostPort::disconnect: persistent enumeration failures

Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 27 April 2019, 02:29:19
brentward,
I assume that you pluged converter with the keyboard.
Does the converter work every time when pluging it without the keyboard?
Then, what happens when hookup the keyboard to the converter?

And do you have same result with using my prebuild binary?
https://github.com/tmk/tmk_keyboard/blob/master/converter/ps2_usb/binary/ps2_usb_rev1_unimap.hex

EDIT: Ignore this.

I guess that keyboard startup procedure prevents USB initialization and you can improve the startup procedure in firmware. The firmware is blocked somewhere in the startup procedure, perhaps.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 08 September 2019, 22:29:38
Updated README and Makefiles.
It may make a bit easier for those unfamiliar with TMK and AVR controllers hoepfully...
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Mon, 09 September 2019, 21:24:19
Hasu -
Just tested your updated ps2_usb with Makefile.32u4. Works beautifully. Thanks again for all your help!

-----------------------

Okay so I'm trying to make my own layouts and I'm pretty confused by the ps2 scan codes. I found this reference manual (https://babbage.cs.qc.cuny.edu/courses/cs345/Manuals/ms_scancode.pdf), which mostly makes sense with regards to the scan codes, but I'm confused by it in a few places.

For example, "Print Screen" seems to correspond to the code "E012E07C", or "Up Arrow" is "E075". On the other hand, in "keymap_common.h" in ps2_usb, it appears that "Print Screen" corresponds to "FC" and "Up Arrow" to "F5".

Would you mind giving me a brief explanation of what you did here? I'm a little confused. I know I don't strictly need to know this information to accomplish what I'm trying to, but I'm still curious.

Thanks Hasu.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Wed, 11 September 2019, 23:16:11
Hasu -

I'm trying to make it so that I can press a button (or a combination of buttons) to reset the pro micro/enter bootloader. I tried both mapping a key to KC_BOOTLOADER and RSHIFT+LSHIFT+PAUSE, and both exhibit the same behavior - after a moment the keyboard disconnects then reconnects, and I haven't succesfully been able to use this method to flash the pro micro. I've had to press a physical button wired into the GND and RESET pins of the pro micro.

As a note, I use the RSHIFT+LSHIFT+PAUSE method to enter the bootloader on my Zenith, which uses the xt_usb converter, and that works fine. Any ideas about how to fix this problem?

Thanks!
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Thu, 12 September 2019, 23:12:22
With PS/2 scan code or Code Set 2 some key can be multi-bitye code like PrintScreen while most of others are one-byte.
In TMK firmware the multi-byte PS/2 scan codes are translated into TMK specific one-byte code internally used to simplify process of them. One-byte PS/2 scan codes(0x00-7F) are mapped to themselves in TMK interanl code area(0x00-7F) without translation. Basically two-byte E0-prifixed scan codes(Up key for example) are mapped into the latter half of TMK internal code area(0x80-FF) simply which is not used as original PS/2 scan code. And as you described, PrintScreen scan code is mapped to 0xFC exceptioanlly,  for example. This translation happens in matrix.c.

You can refer this about the translation.
https://github.com/tmk/tmk_keyboard/blob/master/converter/ps2_usb/matrix.c#L144-L383

This explains for some exceptional keys including PrintScreen.
https://github.com/tmk/tmk_keyboard/blob/master/converter/ps2_usb/matrix.c#L81-L143



Hasu -
Just tested your updated ps2_usb with Makefile.32u4. Works beautifully. Thanks again for all your help!

-----------------------

Okay so I'm trying to make my own layouts and I'm pretty confused by the ps2 scan codes. I found this reference manual (https://babbage.cs.qc.cuny.edu/courses/cs345/Manuals/ms_scancode.pdf), which mostly makes sense with regards to the scan codes, but I'm confused by it in a few places.

For example, "Print Screen" seems to correspond to the code "E012E07C", or "Up Arrow" is "E075". On the other hand, in "keymap_common.h" in ps2_usb, it appears that "Print Screen" corresponds to "FC" and "Up Arrow" to "F5".

Would you mind giving me a brief explanation of what you did here? I'm a little confused. I know I don't strictly need to know this information to accomplish what I'm trying to, but I'm still curious.

Thanks Hasu.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Thu, 12 September 2019, 23:57:47
The code BOOTLOADER may not work at current revision. I'll fix it some later when I get time.
Use key combo: LShift+RShift+Pause for now.

The keycombo works as what it is expected with TMK PS/2 converter on my site. and you confirmed with your other converter yourself. Code related to kick bootloader is same as the xt_usb converter, it should work. TMK firmware just jumps into bootloader area(at end section of Flash memory) when the combo is held.

Perhaps, Pro Micro bootloader may need some prerequisite in register or memory before jumping the bootloader area.

I believe this is code for the bootloader. You may want to look into the code to find something clue.
https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina

And this is TMK code related to.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/avr/bootloader.c


As you know Pro micro bootloader is infamous for usability and diffcult to flash reliably due to its requirement for timing :(
I for one don't want to use my time to add support for it. But I'm open for code contribution to my repo, of course :D



Hasu -

I'm trying to make it so that I can press a button (or a combination of buttons) to reset the pro micro/enter bootloader. I tried both mapping a key to KC_BOOTLOADER and RSHIFT+LSHIFT+PAUSE, and both exhibit the same behavior - after a moment the keyboard disconnects then reconnects, and I haven't succesfully been able to use this method to flash the pro micro. I've had to press a physical button wired into the GND and RESET pins of the pro micro.

As a note, I use the RSHIFT+LSHIFT+PAUSE method to enter the bootloader on my Zenith, which uses the xt_usb converter, and that works fine. Any ideas about how to fix this problem?

Thanks!


Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Fri, 13 September 2019, 10:40:42
Weird I don't know. It definitely works with the Zenith (xt_usb) but RSHIFT+LSFHIFT+PAUS does not work with my ps2 converted boards.

I can try to look at the code but I doubt I'm a competent enough programmer to solve the problem.


I'll take a look at those links and see what I can do. Thanks for the input, Hasu.

Oh - and thanks for the info about the ps2 scan codes. Definitely interested in understanding what's going on there.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Fri, 13 September 2019, 19:17:31
Did you check if your keyboard can recoginze the keycombo?
Some of PS/2 keyboards can fail especially if it is old without diodes.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sat, 14 September 2019, 12:02:38
Did you check if your keyboard can recoginze the keycombo?
Some of PS/2 keyboards can fail especially if it is old without diodes.

So I think one of the keyboards (BSR) doesn't have NKRO and so I can't actually press RSHIFT+LSHIFT+PAUS simultaneously. For this keyboard, I tried mapping a macro to RSHIFT+LSHIFTT+PAUS, but that didn't seem to work at all. Not sure why.

The other keyboard, the RT101+, has diodes and so I can actually simultaneously press RSHIFT+LSHIFT+PAUS. I get the keyboard disconnected "ding" from windows, but then just a few seconds later (maybe exactly two, going off the 2000ms delay specified in bootloader.c), I get the "reconnected" ding. I can't tell if it's actually entering the bootloader during that time, as I haven't so far been able to use this method to flash the pro micro.

in tmk_keyboard/tmk_core/common/avr/bootloader.c, I just tried setting '_delay_ms' to 10000 (10s) for both PROTOCOL_LUFA and PROTOCOL_PJRC. This certainly changed how long the keyboard went disconnected for, but it still doesn't seem to be entering the bootloader. At any rate, I'm unable to flash to it within the period between when it disconnects and reconnects, during which it presumably should be in bootloader.

I noticed in bootloader.c the following comment

Code: [Select]
/* Jumping To The Bootloader
 * http://www.pjrc.com/teensy/jump_to_bootloader.html
 *
 * This method doen't work when using LUFA. idk why.
 * - needs to initialize more regisers or interrupt setting?
 */

Maybe xt_usb is using pjrc and ps2_usb is using LUFA? I really have no idea what any of that means I'm just guessing here, but I don't know how to find out either. Or how to fix the problem, of course.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 14 September 2019, 19:05:24
Are pro micros used for both your converters from same source? I guess pro micro can have different revision of bootloader.



Did you check if your keyboard can recoginze the keycombo?
Some of PS/2 keyboards can fail especially if it is old without diodes.

So I think one of the keyboards (BSR) doesn't have NKRO and so I can't actually press RSHIFT+LSHIFT+PAUS simultaneously. For this keyboard, I tried mapping a macro to RSHIFT+LSHIFTT+PAUS, but that didn't seem to work at all. Not sure why.

How did you define your keymap? Post your keymap.
I don't think it is very easy to emulate the keycombo in keymapping.


Quote
The other keyboard, the RT101+, has diodes and so I can actually simultaneously press RSHIFT+LSHIFT+PAUS. I get the keyboard disconnected "ding" from windows, but then just a few seconds later (maybe exactly two, going off the 2000ms delay specified in bootloader.c), I get the "reconnected" ding. I can't tell if it's actually entering the bootloader during that time, as I haven't so far been able to use this method to flash the pro micro.

That indicates the firmware does what it is expected.
You are on Windows? Why don't you check what happens with device manager? You will see something change on that.
If you are on Linux you can check it easily by seeing log like /var/log/kern.log.



Quote
in tmk_keyboard/tmk_core/common/avr/bootloader.c, I just tried setting '_delay_ms' to 10000 (10s) for both PROTOCOL_LUFA and PROTOCOL_PJRC. This certainly changed how long the keyboard went disconnected for, but it still doesn't seem to be entering the bootloader. At any rate, I'm unable to flash to it within the period between when it disconnects and reconnects, during which it presumably should be in bootloader.

I noticed in bootloader.c the following comment

Code: [Select]
/* Jumping To The Bootloader
 * http://www.pjrc.com/teensy/jump_to_bootloader.html
 *
 * This method doen't work when using LUFA. idk why.
 * - needs to initialize more regisers or interrupt setting?
 */

Maybe xt_usb is using pjrc and ps2_usb is using LUFA? I really have no idea what any of that means I'm just guessing here, but I don't know how to find out either. Or how to fix the problem, of course.

Both uses LUFA stack.


Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sat, 14 September 2019, 20:47:30
How did you define your keymap? Post your keymap.
I don't think it is very easy to emulate the keycombo in keymapping.


I made this keymap (Calling it IBM_AT for the moment) for my specific layout. Notice the "RESET" macro I defined, which I just tried mapping to a key in the layout.

Code: [Select]
#include "keymap_common.h"

// KC_BOOTLOADER should put the keyboard into bootloader mode, but it seems to put it in for like a second then take it out.



const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: default
* ,---.   ,---------------. ,---------------. ,---------------. ,-----------.     
* |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|     
* `---'   `---------------' `---------------' `---------------' `-----------'     
* ,-----------------------------------------------------------. ,-----------. ,---------------.
* |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|   BS  | |Ins|Hom|PgU| |NmL|  /|  *|  -|
* |-----------------------------------------------------------| |-----------| |---------------|
* |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  | |Del|End|PgD| |  7|  8|  9|   |
* |-----------------------------------------------------------| `-----------' |-----------|  +|
* |CapsL |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|   Ent  |               |  4|  5|  6|   |
* |-----------------------------------------------------------|     ,---.     |---------------|
* |Shft|  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|   Shift  |     |Up |     |  1|  2|  3|   |
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
* | CTRL|   |   ALT|        SPACE            |  ALT|   |  CTRL| |Lef|Dow|Rig| |      0|  .|   |
* `-----------------------------------------------------------' `-----------' `---------------'
*/

    // KEYMAP_IBM_AT(
    // ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,
    // GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
    // TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    // CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,
    // LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,  PENT,
    // LCTL,     LALT,          SPC,                            RALT,     RCTL,       LEFT,DOWN,RGHT,      P0,     PDOT
    // ),


    KEYMAP_IBM_AT(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,  PENT,
    LCTL,     LALT,          SPC,                            RALT,     RCTL,       LEFT,DOWN,RGHT,      P0,     PDOT
    ),
};

enum macro_id {
  RESET,
};

const action_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_TOGGLE(1),                     // FN0
    [1] = ACTION_LAYER_MOMENTARY(2),                  // FN1
    [2] = ACTION_MACRO(RESET),
};



/*
 * Macro definition
 */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case RESET:
          return (record->event.pressed ?
              MACRO( T(LSFT), T(RSFT), T(PAUS), END ) :
              MACRO_NONE);
    }
    return MACRO_NONE;
}



That indicates the firmware does what it is expected.
You are on Windows? Why don't you check what happens with device manager? You will see something change on that.
If you are on Linux you can check it easily by seeing log like /var/log/kern.log.

/var/log/kern.log trying to enter bootloader with RSHIFT+LSHIFT+PAUS:
Code: [Select]
7445a7446,7480
> Sep 14 19:34:09 SilverServer kernel: [  216.248715] usb 1-1.4: new full-speed USB device number 3 using ehci-pci
> Sep 14 19:34:09 SilverServer kernel: [  216.358766] usb 1-1.4: New USB device found, idVendor=feed, idProduct=6512, bcdDevice= 0.01
> Sep 14 19:34:09 SilverServer kernel: [  216.358769] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> Sep 14 19:34:09 SilverServer kernel: [  216.358771] usb 1-1.4: Product: PS/2 keyboard converter
> Sep 14 19:34:09 SilverServer kernel: [  216.358773] usb 1-1.4: Manufacturer: t.m.k.
> Sep 14 19:34:09 SilverServer kernel: [  216.378003] hidraw: raw HID events driver (C) Jiri Kosina
> Sep 14 19:34:09 SilverServer kernel: [  216.384743] usbcore: registered new interface driver usbhid
> Sep 14 19:34:09 SilverServer kernel: [  216.384744] usbhid: USB HID core driver
> Sep 14 19:34:09 SilverServer kernel: [  216.392101] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:FEED:6512.0001/input/input10
> Sep 14 19:34:09 SilverServer kernel: [  216.448963] hid-generic 0003:FEED:6512.0001: input,hidraw0: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input0
> Sep 14 19:34:09 SilverServer kernel: [  216.449154] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:FEED:6512.0002/input/input11
> Sep 14 19:34:09 SilverServer kernel: [  216.509043] hid-generic 0003:FEED:6512.0002: input,hidraw1: USB HID v1.11 Mouse [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input1
> Sep 14 19:34:09 SilverServer kernel: [  216.509301] input: t.m.k. PS/2 keyboard converter System Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0003/input/input12
> Sep 14 19:34:09 SilverServer kernel: [  216.568920] input: t.m.k. PS/2 keyboard converter Consumer Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0003/input/input13
> Sep 14 19:34:09 SilverServer kernel: [  216.569176] hid-generic 0003:FEED:6512.0003: input,hidraw2: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input2
> Sep 14 19:34:09 SilverServer kernel: [  216.569460] hid-generic 0003:FEED:6512.0004: hiddev0,hidraw3: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input3
> Sep 14 19:34:09 SilverServer kernel: [  216.569641] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.4/0003:FEED:6512.0005/input/input14
> Sep 14 19:34:10 SilverServer kernel: [  216.628980] hid-generic 0003:FEED:6512.0005: input,hidraw4: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input4
> Sep 14 19:34:14 SilverServer kernel: [  221.234337] usb 1-1.4: USB disconnect, device number 3
> Sep 14 19:34:25 SilverServer kernel: [  231.620737] usb 1-1.4: new full-speed USB device number 4 using ehci-pci
> Sep 14 19:34:25 SilverServer kernel: [  231.730621] usb 1-1.4: New USB device found, idVendor=feed, idProduct=6512, bcdDevice= 0.01
> Sep 14 19:34:25 SilverServer kernel: [  231.730624] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> Sep 14 19:34:25 SilverServer kernel: [  231.730626] usb 1-1.4: Product: PS/2 keyboard converter
> Sep 14 19:34:25 SilverServer kernel: [  231.730627] usb 1-1.4: Manufacturer: t.m.k.
> Sep 14 19:34:25 SilverServer kernel: [  231.732091] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:FEED:6512.0006/input/input15
> Sep 14 19:34:25 SilverServer kernel: [  231.789134] hid-generic 0003:FEED:6512.0006: input,hidraw0: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input0
> Sep 14 19:34:25 SilverServer kernel: [  231.790295] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:FEED:6512.0007/input/input16
> Sep 14 19:34:25 SilverServer kernel: [  231.849023] hid-generic 0003:FEED:6512.0007: input,hidraw1: USB HID v1.11 Mouse [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input1
> Sep 14 19:34:25 SilverServer kernel: [  231.850088] input: t.m.k. PS/2 keyboard converter System Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0008/input/input17
> Sep 14 19:34:25 SilverServer kernel: [  231.908939] input: t.m.k. PS/2 keyboard converter Consumer Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0008/input/input18
> Sep 14 19:34:25 SilverServer kernel: [  231.909193] hid-generic 0003:FEED:6512.0008: input,hidraw2: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input2
> Sep 14 19:34:25 SilverServer kernel: [  231.910258] hid-generic 0003:FEED:6512.0009: hiddev0,hidraw3: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input3
> Sep 14 19:34:25 SilverServer kernel: [  231.911226] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.4/0003:FEED:6512.000A/input/input19
> Sep 14 19:34:25 SilverServer kernel: [  231.969145] hid-generic 0003:FEED:6512.000A: input,hidraw4: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input4
> Sep 14 19:34:36 SilverServer kernel: [  243.419667] usb 1-1.4: USB disconnect, device number 4

/var/log/kern.log entering bootloader by bridging GND and RST on pro micro:


Code: [Select]
7496a7497,7522
> Sep 14 19:39:09 SilverServer kernel: [  515.741535] usb 1-1.4: new full-speed USB device number 6 using ehci-pci
> Sep 14 19:39:58 SilverServer kernel: [  564.921669] usb 1-1.4: new full-speed USB device number 7 using ehci-pci
> Sep 14 19:39:58 SilverServer kernel: [  565.031119] usb 1-1.4: New USB device found, idVendor=2341, idProduct=0036, bcdDevice= 0.01
> Sep 14 19:39:58 SilverServer kernel: [  565.031123] usb 1-1.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
> Sep 14 19:39:58 SilverServer kernel: [  565.031124] usb 1-1.4: Product: Arduino Leonardo
> Sep 14 19:39:58 SilverServer kernel: [  565.031126] usb 1-1.4: Manufacturer: Arduino LLC
> Sep 14 19:39:58 SilverServer kernel: [  565.043666] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
> Sep 14 19:39:58 SilverServer kernel: [  565.044044] usbcore: registered new interface driver cdc_acm
> Sep 14 19:39:58 SilverServer kernel: [  565.044044] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
> Sep 14 19:40:06 SilverServer kernel: [  572.736657] usb 1-1.4: USB disconnect, device number 7
> Sep 14 19:40:06 SilverServer kernel: [  572.969688] usb 1-1.4: new full-speed USB device number 8 using ehci-pci
> Sep 14 19:40:06 SilverServer kernel: [  573.079438] usb 1-1.4: New USB device found, idVendor=feed, idProduct=6512, bcdDevice= 0.01
> Sep 14 19:40:06 SilverServer kernel: [  573.079441] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> Sep 14 19:40:06 SilverServer kernel: [  573.079443] usb 1-1.4: Product: PS/2 keyboard converter
> Sep 14 19:40:06 SilverServer kernel: [  573.079445] usb 1-1.4: Manufacturer: t.m.k.
> Sep 14 19:40:06 SilverServer kernel: [  573.080919] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:FEED:6512.0010/input/input25
> Sep 14 19:40:06 SilverServer kernel: [  573.138090] hid-generic 0003:FEED:6512.0010: input,hidraw0: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input0
> Sep 14 19:40:06 SilverServer kernel: [  573.139229] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:FEED:6512.0011/input/input26
> Sep 14 19:40:06 SilverServer kernel: [  573.197981] hid-generic 0003:FEED:6512.0011: input,hidraw1: USB HID v1.11 Mouse [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input1
> Sep 14 19:40:06 SilverServer kernel: [  573.199025] input: t.m.k. PS/2 keyboard converter System Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0012/input/input27
> Sep 14 19:40:06 SilverServer kernel: [  573.257893] input: t.m.k. PS/2 keyboard converter Consumer Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:FEED:6512.0012/input/input28
> Sep 14 19:40:06 SilverServer kernel: [  573.258144] hid-generic 0003:FEED:6512.0012: input,hidraw2: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input2
> Sep 14 19:40:06 SilverServer kernel: [  573.259212] hid-generic 0003:FEED:6512.0013: hiddev0,hidraw3: USB HID v1.11 Device [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input3
> Sep 14 19:40:06 SilverServer kernel: [  573.260386] input: t.m.k. PS/2 keyboard converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.4/0003:FEED:6512.0014/input/input29
> Sep 14 19:40:06 SilverServer kernel: [  573.318085] hid-generic 0003:FEED:6512.0014: input,hidraw4: USB HID v1.11 Keyboard [t.m.k. PS/2 keyboard converter] on usb-0000:00:1a.0-1.4/input4
> Sep 14 19:40:11 SilverServer kernel: [  578.112654] usb 1-1.4: USB disconnect, device number 8

Happy to try anything you suggest, or provide further information.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 14 September 2019, 21:20:46
Your keymap is lagacy now  and the latest firmware for PS/2 converter doesn't lagacy keymap anymore by default, you have to use unimap instead. You have to comment out UNIMAP_ENABLE=yes and KEYMAP_SCTION_ENABLE=yes lines in Makefile.32u4 to enable the lagacy keymap. And T()  macro means 'type', not hold so it won't work for modifiers if I remember it correctly.

Let's forget the keymap and macro here, and test the converter with  RT101+.

From the log you post I think the pro micro uses old bootloader and it probably comes from original arduino Leonardo.

I still suspect bootloader of you converters are not same and you need to something to do before jump.

I like to see /var/log/kern.log
1) when entering bootloader of XT converter by pressing the keycombo
2) when entering bootloader of XT converter by using RST pin
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sat, 14 September 2019, 21:31:34
The bootloader seems to be comprised of sources I refered previsously.
I just skimmed this now and found bootlkey and something, this is needed to enter bootloader? It is worth looking into this closely and write code to test.

https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/caterina/Caterina.c

Or you may find solution or clue in QMK or other projects?


EDIT: And I found this issue in TMK repo. Probably you have to set 'bootkey' before jump(reset) bootloader.
https://github.com/tmk/tmk_keyboard/issues/256
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sun, 15 September 2019, 00:46:19
Your keymap is lagacy now  and the latest firmware for PS/2 converter doesn't lagacy keymap anymore by default, you have to use unimap instead. You have to comment out UNIMAP_ENABLE=yes and KEYMAP_SCTION_ENABLE=yes lines in Makefile.32u4 to enable the lagacy keymap. And T()  macro means 'type', not hold so it won't work for modifiers if I remember it correctly.

Yeah....I kind of did that on purpose. I don't understand/know how to use unimap. I'll...uhh...try to figure it out.

I like to see /var/log/kern.log
1) when entering bootloader of XT converter by pressing the keycombo
2) when entering bootloader of XT converter by using RST pin

Let me give this code

EDIT: And I found this issue in TMK repo. Probably you have to set 'bootkey' before jump(reset) bootloader.
https://github.com/tmk/tmk_keyboard/issues/256

a try first, and if I can't get anywhere with that I'll post the /var/log/kern.log outputs you requested.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 15 September 2019, 01:35:49
This is code I refered.
https://github.com/ahtn/tmk_keyboard/commit/773d609bd87d15bb48b3176209c2e2db0b2db178#diff-15c696338fb35b3fa3201e97e19ece2eR113-R119

You can add the code here in TMK to test it.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/avr/bootloader.c#L110



EDIT: and this is related code of the booloader side.
https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/caterina/Caterina.c#L68-L69
https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/caterina/Caterina.c#L130

Also you can refer to QMK code.
https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/avr/bootloader.c
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sun, 15 September 2019, 14:21:20
Hasu -

I added that code (the promicro_bootloader_jmp function) into bootloader.c and wrote a macro in keymap_IBM_AT.c to call it. It works, i.e. I successfully flashed my pro micro by mapping a key to PROMICRO_PROGRAM and was able to enter the bootloader mode by pressing it.

I still think it's strange that I have to use this method to enter the bootloader for ps2_usb, though. My xt_usb conversion of my Zenith uses a pro micro too and RSHIFT+LSHIFT+PAUS enters the bootloader no problem. Very strange, IMO.

Anyway, Thank you so much for working with me on this, at some point I will fork TMK and upload my changes to it. Been meaning to do that.

And in the meantime, I'll try to see if I can figure out unimap and use that instead of legacy keymap. 

Thanks again.

Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 15 September 2019, 19:05:58
Great.

I also have no idea why xt_usb conveter works with the bootlader. /var/log/kern.log would be helpful probably as I said.
Quote
I like to see /var/log/kern.log
1) when entering bootloader of XT converter by pressing the keycombo
2) when entering bootloader of XT converter by using RST pin

How did you build firmware for your xt_usb converter? it is really TMK, or QMK?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sun, 15 September 2019, 20:13:58
Great.

I also have no idea why xt_usb conveter works with the bootlader. /var/log/kern.log would be helpful probably as I said.
Quote
I like to see /var/log/kern.log
1) when entering bootloader of XT converter by pressing the keycombo
2) when entering bootloader of XT converter by using RST pin

How did you build firmware for your xt_usb converter? it is really TMK, or QMK?

You know what, color me confused Hasu. I sincerely apologize, I converted my Zenith with a Teensy 2.0. I don't know why I had convinced myself so that I had used a pro micro, but clearly I confused myself along the line somewhere.

The magic command does in fact work just fine with the Teensy, I can open up teensy.exe, enter bootloader mode, and then flash to it, all without pressing any physical buttons on the microcontroller.

Oops. Sorry Hasu!

Oh, and yes it's definitely TMK. I tried to get QMK working, and it almost does. With QMK, all seems very well, then all of a sudden the keyboard goes nuts and it's like the keymap breaks and even my normal keyboard starts behaving strangely and I have to reboot my computer to fix it.

For example, the keyboard will work normally for a bit, then all of a sudden the inputs go crazy and, like, the "a" key starts behaving like tab or something. I can probably reproduce the behavior and try to give you more details if you want.

Oh hasu look at this: https://github.com/qmk/qmk_firmware/issues/3091

Something I discovered while trying to convert a different keyboard, but that I got working with QMK (and a pro micro). To get the reset button working you have to set BOOTLOADER to "caterina," maybe there is an easy fix for TMK in there somewhere?
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sun, 22 March 2020, 19:17:57
Hasu,
I just converted a Northgate Omnikey 102 from PS2 (scan code set 2) to USB, and I'm having an issue. Specifically, When plugging the keyboard in, I get the "device connected" chime, immediately followed by the "device disconnected chime," and the two back LEDs on the pro-micro go red and nothing works.

Note that this doesn't happen every single time, sometimes I'll plug it in and everything will work normally, or I can also get it working by resetting the pro micro a bunch of times.

Actually, testing this some more just now, it seems like the only way to reliably get it working is reset the pro micro (at least once, sometimes more) by bridging the GND and RST pins.

I believe I'm having the same issue on another ps2-usb conversion I did on an RT101+, I think the behavior is the same.

Do you have any idea how to fix this problem? I'm not really familiar enough with the code and protocol conversion process to come solve it quickly.

Let me know if you have any questions. Thanks Hasu.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 22 March 2020, 21:40:16
It is certainly difficult to debug this kind of problem.
Try getting output from hid_listen when it happens, it may be helpful.
Also OS system logs would be very helpful but  I don't know how to get them on Windows(I assume seeing you said 'chime'). If the problem also happens on Linux check logs under /var/log/ like kern.log or syslog, you may find USB errors or something.


The converter firmware can do something perhaps but I don't have definite idea.
I'd think of aspect of hardware before tweeking firmware.

1. ProMicro bootloader starts first and then runs converter firmware at power up. Meanwhile Teensy and TMK converter runs firmware immediately without bootloader intervention. This may cause the problem.

If you have Teensy or TMK converter try it and see difference.

2. Some keyboards draw more rush current on plugin, this can make microcontroller unstable and causes Brownout-reset in the result. This doesn't matter in most cases because it is recovered with brownout-reset.
This can happen also on TMK converter and Teensy when plug Model F with converter already powered from USB port.  To prevent/mitigate this connect keyboard with converter first, then plugin them USB port. Use decent USB cable too.

Try other keyboards and see difference. Soldering big enough capacitor like 100uF or more on ProMicro may prevent this.

3. Check USB cable, keyboard cable, wires and soldering points. Unstable connection may cause unexpected result.



Hasu,
I just converted a Northgate Omnikey 102 from PS2 (scan code set 2) to USB, and I'm having an issue. Specifically, When plugging the keyboard in, I get the "device connected" chime, immediately followed by the "device disconnected chime," and the two back LEDs on the pro-micro go red and nothing works.

TMK PS/2 firmware doesn't control any LED on Pro Micro. What those LEDs show when working normally?
I guess bootloader controls the LEDs.

Pro Micro seems to have various version/configurations from various vendors/manufacturers and this makes really difficult to support people with them in trouble.


Quote
Note that this doesn't happen every single time, sometimes I'll plug it in and everything will work normally, or I can also get it working by resetting the pro micro a bunch of times.

How often does the issue happen?


Quote
Actually, testing this some more just now, it seems like the only way to reliably get it working is reset the pro micro (at least once, sometimes more) by bridging the GND and RST pins.

I believe I'm having the same issue on another ps2-usb conversion I did on an RT101+, I think the behavior is the same.

Bridging is not reliable from my experience. I also bridge the pins with tweezers and know it doesn't work sometimes. You should solder push button perhaps.

Post detailed pics of both keyboards and Pro Micro so that we can know how your keyboard is converted. That would be useful to help you.


EDIT: And try Soarer's converter and see difference.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Mon, 23 March 2020, 21:18:21
Ok that's a lot of stuff Hasu. I'll get to each of these in turn and update you accordingly. Thank you for the response.
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Sun, 12 April 2020, 14:33:17
Hasu,
I've got some updates for you. Forgive me for not having gotten to try everything you suggested, but I do have some findings.

- I tried converting this board with a teensy, and, indeed, it works fine. No weird issues at all.

- I figured out a consistent, though hacky, way to get the pro micro to work. Steps are:

- So, once again I guess, is there some adjustment that can be made to the firmware to automatically do this? Like recognize that it's a pro-micro I guess, then send the appropriate signals to it so that you don't have to do it manually?

I do actually wonder - if you could just put a different bootloader on it, would that work? I'll have to try that one.

Let me know your thoughts. Thanks Hasu.




Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 12 April 2020, 18:16:49
Hasu,
I've got some updates for you. Forgive me for not having gotten to try everything you suggested, but I do have some findings.

- I tried converting this board with a teensy, and, indeed, it works fine. No weird issues at all.

- I figured out a consistent, though hacky, way to get the pro micro to work. Steps are:
  • Plug in pro micro (keyboard does not work at this point).
  • Reset pro micro (bridge GND and RST)
  • Wait a little bit (I'm guessing for wait for the pro-micro to automatically exit bootloader mode)
  • ->Keyboard works

- So, once again I guess, is there some adjustment that can be made to the firmware to automatically do this? Like recognize that it's a pro-micro I guess, then send the appropriate signals to it so that you don't have to do it manually?

I do actually wonder - if you could just put a different bootloader on it, would that work? I'll have to try that one.

Let me know your thoughts. Thanks Hasu.







I guess power voltage causes if the issue happens on specific keyboards.
You did solder bridge on J1?

I got cheap Pro Micro/5V clone from China vendor other day and found it is not configured as 5V correctly as I expected. It gives keyboard only 4.6V unless you make solder bridge on J1.
I believe SparkFun Pro Micro is legitimate and J1 is already solder bridged for users from the factory.


EDIT:
PancakeMSTR, Could you try this new converter on your Zenith, Omnikey and RT101+ and report the result on its thread? It would be helpful to improve the converter firmware code. The converter supports AT,XT and Terminal with one firmware like soarer's

https://geekhack.org/index.php?topic=103648.0
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Sun, 12 April 2020, 21:42:50
I found that prebuilt firmware doesn't work at all on my Pro Micro, it still stops working even after pressing reset button, unlike your case.
This means that firmware downlaoded from Keymap Editor or github won't work with Pro Micro.


EDIT: Ignore this, I was confused. Prebuilt binary 'ps2_usb_rev1_unimap.hex' is not compatible with Pro Micro from the beginning.



I confirmed that firmware built from the latest source works with my cheap Pro Micro got from ebay.

I'll update the prebuilt firmware some later but you have to build firmware yourself until then.

EDIT: I think it should work if you build firmware from the latest source.  You will get `ps2_usb_32u4.hex` file with command `make -f Makefile.32u4`.




You still want to check this project and you can help me.

EDIT:
PancakeMSTR, Could you try this new converter on your Zenith, Omnikey and RT101+ and report the result on its thread? It would be helpful to improve the converter firmware code. The converter supports AT,XT and Terminal with one firmware like soarer's

https://geekhack.org/index.php?topic=103648.0

Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Mon, 13 April 2020, 10:18:28

I guess power voltage causes if the issue happens on specific keyboards.
You did solder bridge on J1?

Lol. J1 was not solder bridged, but I just bridged it myself and the keyboard now works perfectly. That was clearly the problem. Welp, at least there was a really easy solution this time!!

EDIT:
PancakeMSTR, Could you try this new converter on your Zenith, Omnikey and RT101+ and report the result on its thread? It would be helpful to improve the converter firmware code. The converter supports AT,XT and Terminal with one firmware like soarer's
https://geekhack.org/index.php?topic=103648.0

I'd be delighted. I'll report back with results when I get a chance to test it.


Thanks as usual Hasu!
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Mon, 13 April 2020, 17:41:45

I guess power voltage causes if the issue happens on specific keyboards.
You did solder bridge on J1?

Lol. J1 was not solder bridged, but I just bridged it myself and the keyboard now works perfectly. That was clearly the problem. Welp, at least there was a really easy solution this time!!

Good to hear that.


Quote
EDIT:
PancakeMSTR, Could you try this new converter on your Zenith, Omnikey and RT101+ and report the result on its thread? It would be helpful to improve the converter firmware code. The converter supports AT,XT and Terminal with one firmware like soarer's
https://geekhack.org/index.php?topic=103648.0

I'd be delighted. I'll report back with results when I get a chance to test it.


Thanks as usual Hasu!

Great, Iooking forward!
Title: Re: TMK PS/2 to USB keyboard converter
Post by: PancakeMSTR on Tue, 14 April 2020, 10:07:57
Hi Hasu,

So, strangely, I tried that same trick - solder jumping J1 - with my RT101+ that is behaving identically to how the Omnikey was, but it didn't work :(

Still the same behavior with the RT101+ (have to reset the pro micro to get the keyboard to connect properly). So I dunno, that's a weird one. Gonna have to look into other options for it.

And I tested your IBM PC converter on the Omnikey. I replied in the corresponding thread, but, long story short, it seems to be working pretty well but for some minor weirdness.

I'll reply there with follow up tests on the RT101+ and Zenith. Probably some other stuff too, if it works well (which it looks like it will) I'll likely use it as my de-facto standard going forward. I have quite a few more keyboards still to convert (though, to be fair, they are mostly ADB).

Anyway, great work Hasu! I remain wildly impressed by your commitment to this community!
Title: Re: TMK PS/2 to USB keyboard converter
Post by: hasu on Tue, 14 April 2020, 19:20:12
Hi Hasu,

So, strangely, I tried that same trick - solder jumping J1 - with my RT101+ that is behaving identically to how the Omnikey was, but it didn't work :(

Still the same behavior with the RT101+ (have to reset the pro micro to get the keyboard to connect properly). So I dunno, that's a weird one. Gonna have to look into other options for it.

You are using two Pro Micros? Did you got the Pro Micros from same source?
Post pics of them and wirings, that would be useful.

Can you use same Pro Micro with both Omnikey and RT101+? I mean one which works well with Ominikey in particular.

Also check output from hid_listen to confirm that you are using same firmware on the two Pro Micros. You will see version string like below.
Quote
Waiting for new device:....
Listening:


TMK:23305ad9/LUFA






Quote
And I tested your IBM PC converter on the Omnikey. I replied in the corresponding thread, but, long story short, it seems to be working pretty well but for some minor weirdness.

I did check your post. Thanks.
I don't find any reason why problem happens only with F11 and RALT. These keys have normal scan code and nothing special.

Are you sure that this PS/2 converter doesn't has the minor weirdness?
Also what if with Soarer's converter?

I believe you already did but I must ask. Did you try cleaning the switches?