How can I device figure out if it's been connected to a standard USB 2.0 port that can deliver 500mA, or a proper USB charger that can deliver 1A or perhaps 2A?
Are you asking about simple USB chargers (DCP, dedicated charging port) or USB downstream ports with charging capability? DCP is signaled by shorting D+ and D-, intelligent USB ports use protocol means to announce the power capability.
This is a brute force method without guarantee ... and for sure beyond every specification.
One could try the same on a 230V / 16A mains line. Use a 14 Ohms resistor and test if the voltage drops....
Danger! I strictly recommend not to try this!
yes true, i am hoping that there is overload protection...even if there is not, its probable (but not certain) that it could handle the overload for a little bit anyway.......maybe you could start with a load of 5V/0.6A and see how that goes......if it drops out with that then its definetely a 500mA one....then again...a "500mA one" could probably supply 600mA for some time...so you will likely have to go heavier in loading.
I'm thinking of just figuring out if D+ and D- are shorted or not. If they aren't, I can draw 500mA. If they are shorted I know it's connected to a charging port, but I wouldn't really know how much current to draw from it.