摘要 |
The present invention is applicable to the interface field, and in particular, relates to a power supply method for a terminal device, where the terminal device is communicatively connected to an accessory device. The method includes: detecting, by the terminal device, an ID resistance value of the accessory device; identifying a type of the accessory device according to the detected ID resistance value; selecting a power supply mode of the terminal device according to the identified type of the accessory device; and supplying power according to the selected power supply mode. In this way, the power input or output of the terminal device is free from the restriction of an OTG working mode of the terminal device. |
主权项 |
1. A power supply method for a terminal device, wherein the terminal device is communicatively connected to an accessory device, and the method comprises:
detecting, by the terminal device, an ID resistance value of the accessory device; identifying a type of the accessory device according to the detected ID resistance value; selecting a power supply mode of the terminal device according to the identified type of the accessory device, wherein the selecting of the power supply mode comprises: selecting one configuration file in the accessory device randomly without a preference, as a current Power supply Policy to select a power supply mode, determining whether the selected configuration file runs successfully; if the running Succeeds, using the selected configuration file as the current power supply policy to select a power supply mode otherwise if the running fails, selecting the other configuration file in the accessory device as the current power supply policy to select a Power supply mode; and supplying power according to the selected power supply mode. |