https://github.com/funnyboy-roks/ps2-interface
A simple host interface for a PS/2 keyboard
https://github.com/funnyboy-roks/ps2-interface
arduino embedded-rust ps2-keyboard
Last synced: about 2 months ago
JSON representation
A simple host interface for a PS/2 keyboard
- Host: GitHub
- URL: https://github.com/funnyboy-roks/ps2-interface
- Owner: funnyboy-roks
- License: apache-2.0
- Created: 2023-08-08T09:21:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T21:28:44.000Z (almost 3 years ago)
- Last Synced: 2025-05-18T07:39:03.699Z (about 1 year ago)
- Topics: arduino, embedded-rust, ps2-keyboard
- Language: Rust
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PS/2 Interface
This a very simple PS/2 interface that I made just because I can.
Currently, it handles receiving bytes from the keyboard, though it
doesn't actually verify start/end bits properly since my keyboard doesn't
actually send the stop bit as a `1`?
It translates the scan codes into characters and prints them to the
serial monitor.
L/R Shift, L/R Ctrl, L/R Mod, L/R Alt are handled via a bitset and checked
when a keystroke is sent to be used for translation into text Shift
translates the keys to upper case or the key that is mapped on the
keyboard (i.e. `;` -> `:`). Ctrl/Mod/Alt are translated into ``,
``, ``, respectively, where `?` is replaced with the character
pressed (i.e. `Ctrl + b` -> ``).
## Circuit
The circuit is very simple, since hardware is connected directly to the
Arduino.

The only note that I have regarding the circuit is that the Keyboard's
PS/2 power is plugged directly into an Arduino output so we can turn it
on manually and see any startup output. This also helps since PS/2 is
not officially hot-swappable.
## Future
This is only a small personal project, so I'll probably never finish
these things:
- [ ] Host -> Keyboard Communication
- I've got a basic implementation, but it doesn't seem to be happy
and never sends the ACK bit or clocks. This may be because I
have a _very_ cheap keyboard (8 USD on ebay) and it just doesn't
work, or I'm doing something wrong. (I'm leaning towards the
latter)
- [This page](http://www.burtonsys.com/ps2_chapweske.htm) has some
very detailed information oh how the protocol should work, and
I've implemented it as far as I can tell, though still no luck.
It states that the host is supposed to time out at some point, but
I've not implemented this functionality yet, so it just freezes.
- [ ] Caps/Scroll/Num lock
- I'm waiting on fixing the above one before I do this, so that I
can turn on the lights (:
## References
I heavily relied on a few different sites for information about the PS/2
spec and other aspects of this implementation.
- http://www.burtonsys.com/ps2_chapweske.htm
- http://www1.cs.columbia.edu/~sedwards/classes/2011/4840/ps2-keyboard.pdf
- https://wiki.osdev.org/PS/2_Keyboard
- https://www.networktechinc.com/ps2-prots.html