NicoHood/HID

question: How to judge whether the computer is turned on or off?

Closed this issue · 7 comments

I will keep the keyboard connected every day.
I added some cool lights to it.
But, the backlight is still on after turning off the computer.
So, when the computer is turned off, does it send a specific command to the USB device?
Then i can use MCU get the command to turn off led light.

This problem is only for HID devices, i don't want to use any computer software to implement it.

Look at the BIOS of the computer. In some you can set, if the usb-ports are powered, when the computer is off. Maby try a other usb port on your computer, not all are powered in off mode or are you using a powered usb hub?

@underwoodblog
Sorry, I mean, in the case of not using the BIOS to turn off the USB power.
Does HID have any commands in this regard?

My purpose is not to disconnect the power to the device.
I want use the MCU to know if the computer is turned off so that I can do some special work.

@NicoHood Did you mean check USBConnected?
I think this can only determine whether the device has a valid address assigned by the host, but when the host is shut down, the address obtained by the device will not be reset.

The Lufa core does all that for you. It is more stable and I think you can detect the connected host much better than with the arduino environment. Just try it. That are the options you have.

Closing as this is no issue with hid.