If you use a simple mechanical keyboard-sharing switch, you may sometimes find that the keyboard gets disabled when you switch. Or more accurately, it seems to be the keyboard controller on the motherboard that gets disabled. Some motherboards are more likely to exhibit this problem than others, but it can mean loss of work that can't be saved without typing, or file system corruption because you can't shutdown cleanly. Even fancy electronic switches are not immune to this problem. One I've seen has an optional module to provide continuous power to the keyboard port, and that seems to avoid the problem.
I have found that resetting the keyboard repeat rate revives the keyboard in many environments. Of course, you have to have some method of doing this without using the keyboard. This can be clicking on an icon or some sort of remote access over a network. Note that if you also put your mouse on the switch, it can sometimes get disabled as well. Unlike the keyboard behavior, switching away and back usually seems to revive a mouse. Here are the things that work in different environments:
mode con rate=24 delay=1The only problem is, you probably can't setup a way trigger this. I know it works because I did it as a periodic event on a BBS, but in most cases, you can't do anything.
load keyb united states unload keyb
kbdrate -r 30