As stated above, the cause of this issue may be related to your keyboard or mouse driver. Open the Device Manager in the Safe Mode and see if your keyboard or mouse driver shows a warning sign.
If your keyboard or mouse starts working after connecting to another USB port, you will be able to login to your system. Now, open the Device Manager and reinstall the USB Root Hub driver.
If you want to enable the keyboard again, you will need to go to Device Manager, navigate to Keyboards, find your in-built keyboard, and enable it once more. Alternatively, you can simply try ...