Page 1 of 1
Hot-plugging PS/2 keyboard
Posted: Sun Mar 21, 2021 4:39 pm
by azblue
My PS/2 came unplugged on accident, so I plugged it back in. I assumed I'd have to reset the computer to get the OS to recognize they keyboard, but it had no trouble reading keypresses after that. I was a little surprised; I assumed PS/2 devices couldn't be hot-plugged. Am I wrong on that? Is there some signal PS/2 devices send when they're plugged in? Or should I assume the OS (Zorin in my case) periodically tries to detect the keyboard, and assumes its been unplugged if it stops getting responses? (And then resets the keyboard when it begins getting responses again).
Re: Hot-plugging PS/2 keyboard
Posted: Sun Mar 21, 2021 5:15 pm
by Rew
PS/2 was not designed for hot swap and it is not officially supported. There is no mechanism for device discovery during a hot plug. However, it seems likely that a device which goes missing like yours and comes back will work ok. From a control standpoint the host is just waiting for a message from the device. If the device goes away and comes back it just looks like there were no messages for a period of time. It really is more of an electrical question. pS/2 is implemented with open/drain IO that is biased high by the host. With any reasonably protected controller on device side you would be unlikely to damage the device and unlikely to get noise.
TLDR: you are correct, it wasn't designed for hot swap but will work in most cases (this is less true for mice than keyboards)
Re: Hot-plugging PS/2 keyboard
Posted: Sun Mar 21, 2021 9:33 pm
by nullplan
In my experience it won't work, so I'm surprised it did for you. I have not attempted this in a long time, but I do remember both mouse and keyboard becoming unresponsive once either of them is unplugged or replugged. This happened to me more than a decade ago, so I don't remember clearly what exactly happened, but it was reproducible multiple times that both PS/2 devices would just turn off if anything changes with the plugs at run time.