TOP

How to determine which battery provides power for USB dual power supply?

1) Using keys: judge the state of the key before power on. If it is high, that is battery power; while if it is low, it is USB power. 

2) Circuit check (the following diagram is only for reference):


3) Judge by the program: through D+/D- line. As these two I/O port are shared with PS2, set them to input pull up mode, read the two line state before power on. Because if connect with USB port. USB hub inside will drop-down these two I/O as low. If high, it is battery power.