Patent ID: 9128691
Filing Date: 2015-09-08
Classification: G06F

Abstract:
1. A method for selecting an internal circuit according to a USB interface status, wherein a first pin of a USB interface of a terminal is connected to a power supply through a pull-up resistor, the first pin is a D− or D+ pin of the USB interface, and a resistance value of the pull-up resistor can ensure that a voltage value obtained by a to-ground pull-down resistor is a logic low level when the pull-up resistor and the to-ground pull-down resistor whose resistance value is approximately 15 KΩ±5% are connected in series to divide a voltage of the power supply and wherein the first pin and a second in of the USB interface of the terminal, in an initial state, are connected to a first interface and a second interface of a processor of the terminal, respectively; the method comprising: when the terminal detects that an external USB device is inserted into the USB interface of the terminal, detecting whether a level status of the first pin of the USB interface of the terminal is high or low; if the level status of the first pin of the USB interface of the terminal is low, connecting D− and D+ pins of the USB interface of the terminal to corresponding pins of a USB data communication module of the terminal and controlling charging of the terminal according to a first policy, wherein the first policy is a corresponding policy applied when the external device is a data transmission device; and if the level status of the first pin of the USB interface of the terminal is high, determining whether level statuses of the D− and D+ pins of the USB interface of the terminal are consistent, and if consistent, controlling charging of the terminal according to a second policy; if inconsistent, controlling charging of the terminal according to a third policy, wherein the second policy is a corresponding policy applied when the external device is a standard power adapter, and the third policy is a corresponding policy applied when the external device is a non-standard power adapter; wherein the determining whether level statuses of the D− and D+ pins of the USB interface of the terminal are consistent comprises setting a second pin of the USB interface of the terminal to a low level; and wherein the second pin of the USB interface is a pin other than the first pin of the USB interface in the D− and D+ pins of the USB interface, determining whether the first pin of the USB interface is at a low level, and if the first pin of the USB interface is at a low level, determining that the level status of the D− pin and the level status of the D+ pin of the USB interface of the terminal are consistent.