ps2dev
ps2dev copied to clipboard
Question about possible fix for stuck keys
Hi, I'm Lukas from Prague 10 (I guess we live close to each other).
I have a working solution with Teensy 3.2 + USB Host + 3.3/5V logic level shifter. I have modern USB keyboard connected to PC AT retro gaming machine thanks to your PS2DEV library and USBHID library. It works as active PS/2 converter.
I have currently tested this on: 386DX, 486DX4 and Pentium 133 MMX.
Each machine shows a similar issue and that is stuck key. Only those keys get stuck: CTRL, ALT, SHIFT, ARROW keys.
Which is mostly used in gaming. KeyDown event won't get delivered. On a second press and release, it gets fixed.
This is just my blind guesswork. Do you think that changing some type of delay (perhaps bigger delay for old AMIKEY keyboard PC controllers) would work? Or some solution with double checking these specific scan codes and sending KeyDown event twice as a workaround?
Here is a prototype of code based on some japanese guy, who made PS/2 converter. I bought an AT PC prototype from one smart Russian guy on E-Bay and now I'm trying to fix a few software bugs: USBKBD2PS2_v3.zip
Because how easily you can get AT mechanical keyboard nowadays and how easily you can get USB mechanical keyboard, right?
Thank you for any tips!
Hi. At the beginning of this file: https://github.com/Harvie/ps2dev/blob/master/src/ps2dev.cpp
you can find some timing constants, namely these:
#define CLKFULL 40
#define CLKHALF 20
#define BYTEWAIT 1000
#define TIMEOUT 30
If you are willing to experiment with them a bit, to find some SAFER values providin better compatibility with various devices, i will surely consider update as long as the timing will still remain in bounds given by PS/2 protocol specification.
Regarding your presence in Prague, i can reccomend you to visit this place: https://brmlab.cz/ Recently i am rather busy, so i don't go there very often, but it's nice place to meet like-minded people :-)
Hi, did you check this documentation? https://www.tayloredge.com/reference/Interface/atkeyboard.pdf
It says timing is important and it contains PS/2 source at the end.
You can see that there are 3 different delays, not only half and full. Therefore your current library might not be up to the specification, correct?
bsf STATUS, RP0 ;Acknowledge
bcf DATA
Delay 11
bcf CLOCK
Delay 45
bsf CLOCK
Delay 7
bsf DATA