Content originally posted in LPCWare by Rob65 on Mon Mar 12 11:47:59 MST 2012
Unfortunately there is no standard (or there are too many) in how, and if, the USB lines are connected.
At least Apple behaves differently than some of the other USBchargers I have.
Why would you want to detect if you are connected to a charger?
Do you use USB in your device? Then you can just use the VBUS pin to detect that a voltage is present. If you are able to attach to the host then you are connected to a host and you should present your power requirements and keep to them, if not then it is most likely that you are connected to a charger.
I am not compensating for user errors in my device. I even have a few chargers with a USB plus that provide 12V 1.2A. I think quite some USB devices will transform into short-term smoke generators when I connect them to these chargers :eek:
Rob