I see a post after posting after reporting how to sleep with a USB port. What I don't see anywhere is a guide on how to prevent this.
I have a C # program that manages a piece of hardware that is a literal black box. I have no control over the physical insides. Unfortunately, if the USB port falls asleep, even for a minimum fraction of a second, the device loses its state and all current work will be lost.
I need a way to make sure that the USB ports never sleep while my application is running. Even if the data has not been sent to the port and even if the user does not touch the computer for several days.
A few things:
1: No need to keep the port unlocked only while the application is running. In fact, it will be preferable to permanently disable USB sleep.
2: Disabling other power-saving features in Windows is acceptable.
3: Just asking clients to disable USB hibernation is unacceptable. Many of them are not well versed in technology to follow written instructions for such purposes, and we do not have enough manpower to get through it hundreds and hundreds of users.
4: Using a computer for anything other than our software technically violates the license. Our license also reserves the right to change the configuration of Windows without the knowledge or consent of the user. Therefore, disconnecting USB sleeping quietly and transparently is highly recommended.