USB keyboard stops working; Logging out/in fixes

Once or twice a week, my Apple USB keyboard stops working, giving the alert sound with every keypress. (But something’s getting through, because when I press and hold Cmd, my CheatSheet app displays the current set if keyboard shortcuts.)

Reinsetrting the USB plug doesn’t fix it, but logging out and back in does fix it. (the next time it happens I’ll try unplugging the Anker hub and letting it power down)
This has been an issue for several months, and the nuke-and-pave I did three weeks ago didn’t resolve it.

I’ve also tried connecting a bluetooth keyboard and that didn’t work either… so it’s probably not USB/hardware related???

Things I use that might be involved:
Late 2013 iMac. Latest Catalina
Anker USB hub that the keyboard uses
Wacom Intuos pen pad
Apple Magic Mouse or Magic Trackpad 2
Stream Deck
Luna Display with iPad connected by USB
Several USB external disks
Karabiner elements, using only the hyper-key tool

Any ideas?

Thanks,
Russell