|The only thing that can cause that is a poor connection to a USB port or USB device.|
Have you, or is it possible someone else who had access to this computer...
- dropped it, or dropped anything on it, or otherwise exposed it to a physical jolt ?
- spilled liquid on it, or sprayed it with liquid, or exposed it to liquid such as rain ?
Since the USB ports last worked properly all the time, has there been a power failure event that happened while the AC adapter was plugged in ?
Those things are the most frequent reasons something inside the laptop has been damaged.
If you have an external hub plugged into a USB port, broken wires inside it's cord could cause your problem.
A physically damaged built in USB port could cause your problem.
Your touchpad, and your memory card reader if you have a built in one are often both connected to a USB header inside the case - a damaged or loose connection to that header could cause your problem. (The touchpad may be connected to a PS/2 header on older models).
A physically damaged memory card reader slot could cause your problem.