Hot-plugging PS/2 keyboard

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
azblue
Member
Member
Posts: 147
Joined: Sat Feb 27, 2010 8:55 pm

Hot-plugging PS/2 keyboard

Post 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).
Rew
Member
Member
Posts: 28
Joined: Mon Oct 29, 2012 2:26 pm

Re: Hot-plugging PS/2 keyboard

Post 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)
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Hot-plugging PS/2 keyboard

Post 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.
Carpe diem!
Post Reply