If your USB port gets mangled and a device isn't working as it should:
tward $ lspci | grep USB
00:1a.0 USB controller: ...
00:1d.0 USB controller: ...
Then do the following:
tward $ echo -n "00:1a.0" | \
sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
tward $ echo -n "00:1a.0" | \
sudo tee /sys/bus/pci/drivers/ehci_hcd/bind
For each of the above controllers.
Be aware that after you write to unbind, anything connected to that particular USB controller will be unavailable until you write to bind on the next command. So if your keyboard is connected to one of those, you may be in trouble.
Note: See the comment below for an updated procedure.
Note: See the comment below for an updated procedure.