Skip to content

Make it possible to detect if connected PC is running or shut down (Controllers with USB, 32u4) #7363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
M-Reimer opened this issue Mar 22, 2018 · 2 comments
Labels
Component: Hardware Related to the design of Arduino's hardware products Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) feature request A request to make an enhancement (not a bug fix)

Comments

@M-Reimer
Copy link

For some USB device projects it would be handy to know if the PC, my device is connected to, is still running or has been shut down. This has become a problem especially with "newer" motherboards, which now usually always have power on the USB power leads.

A common way to do this is to check if "SOF" events are still generated. Possible place to detect this would be:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/USBCore.cpp#L760
In another project (STM32 without Arduino libraries), I just used a timer interrupt counting up a variable. Then I reset this to zero every time a SOF event happens.
In my other code, I can now check the value of my variable. If it reaches a defined limit, the PC must have been shut down as the "resets to zero" no longer happen.

There may be simpler/better ways to do this in the Arduino core libraries and some API also has to be defined. Maybe you could consider adding such a feature. Would be very useful!

@facchinm facchinm added Component: Hardware Related to the design of Arduino's hardware products Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) Type: Improvement This proposal is considered to be especially beneficial labels Mar 23, 2018
@M-Reimer
Copy link
Author

I want to add, that accepting this pull request:
#6964
would fix this issue.

@per1234 per1234 removed the Type: Improvement This proposal is considered to be especially beneficial label Apr 2, 2019
@sandeepmistry
Copy link
Contributor

This has been added in arduino/ArduinoCore-avr#54.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Hardware Related to the design of Arduino's hardware products Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

No branches or pull requests

4 participants