Terminal charging method, storage medium and electronic device
By using VBUS power supply when the terminal is connected to an external device, and using redundancy or data transmission pins for power supply when the charger is connected, the OTG communication interruption problem of gamepads when switching charging mode is solved, improving the user experience.
Patent Information
- Application Number
- CN202410126185.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-29
- Publication Date
- 2025-07-29
AI Technical Summary
When the gamepad switches the charging mode, OTG communication is interrupted, affecting the user experience.
When the terminal is connected to an external device, power is supplied through VBUS on the USB interface, and when the external device is connected to the charger, power is supplied using redundant pins or data transmission pins to keep OTG communication uninterrupted.
It realizes that the OTG communication between the terminal and the external device is not interrupted during the charger plug-in and unplugging process, improving the user experience.
Smart Images

Figure CN120389462A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of communications, and in particular, to a terminal charging method, a storage medium, and an electronic device. Background Art
[0002] The game controller connects to the phone wirelessly via Bluetooth (BT), Wi-Fi, or via a Universal Serial Bus (USB) cable. When the phone and game controller are connected, the phone is in the On-The-Go (OTG) output state, where the phone supplies power to the game controller, with current flowing from the phone to the game controller. To charge the phone, the game controller is connected to a data cable and a charger, transitioning the phone from the OTG state to the USB charging state. The charger then supplies power to the phone through the game controller, with current flowing from the game controller to the phone.
[0003] When a game controller is connected to a charger as an external device, the phone immediately turns off the OTG function and enters the USB charging state. The phone interrupts the OTG protocol and re-establishes the USB communication protocol with the game controller, which takes 3 to 5 seconds. This process appears to the user as the phone is re-pairing with the game controller. When the game controller is removed from the charger, the phone immediately turns off USB charging and enters the OTG working state. The phone interrupts the USB communication protocol and re-establishes the OTG protocol with the game controller, which takes 3 to 5 seconds. This process appears to the user as the phone is re-pairing with the game controller. During this pairing period, the game controller cannot be used, and the repeated interruptions caused by connecting and unplugging the charger will significantly affect the ongoing gaming experience.
[0004] In summary, when the terminal's external device switches charging modes, there is a problem of interruption of OTG communication with the terminal, which affects the user experience. Summary of the invention
[0005] Embodiments of the present invention provide a terminal charging method, a storage medium, and an electronic device to at least solve the problem in the related art that OTG communication interruption when an external device switches charging mode affects the user experience.
[0006] According to one embodiment of the present invention, a terminal charging method is provided, comprising: when an external device of the terminal is not connected to a charger, the terminal is connected to the external device via a USB interface, and the terminal supplies power to the external device via the VBUS of the USB interface; when the external device is connected to a charger, the charger supplies power to the external device, and the external device supplies power to the terminal via the VBUS or a redundant pin.
[0007] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0008] According to another embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0009] The present invention provides a terminal charging method, wherein, when an external device of the terminal is not connected to a charger, the terminal and the external device are connected via a USB interface, and the terminal supplies power to the external device via the VBUS of the USB interface; when the external device is connected to the charger, the charger supplies power to the external device, and the external device supplies power to the terminal via VBUS or a redundant pin. This solves the problem of OTG communication interruption when an external device switches charging modes in the related art, achieving the effect of maintaining OTG communication uninterrupted when the external device switches charging modes, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic diagram of the pin distribution of a USB Type C receptacle and plug according to an embodiment of the present invention;
[0011] Figure 2 This is a hardware structure block diagram of a mobile terminal according to a terminal charging method according to an embodiment of the present invention;
[0012] Figure 3 is a flow chart of a terminal charging method according to an embodiment of the present invention;
[0013] Figure 4 It is a frame structure diagram of a terminal charging device in the related art;
[0014] Figure 5 is a schematic diagram of the structure of a terminal charging device according to the first embodiment of the present invention;
[0015] Figure 6 is a flow chart of a terminal charging method according to embodiment 2 of the present invention;
[0016] Figure 7 is a schematic diagram of the structure of a terminal charging device according to a third embodiment of the present invention;
[0017] Figure 8 is a flowchart of a terminal charging method according to embodiment 3 of the present invention;
[0018] Fig. 9It is a framework structure diagram of a terminal charging device according to Embodiment 4 of the present invention;
[0019] Fig.10 It is a flowchart of a terminal charging method according to Embodiment 4 of the present invention. Detailed implementation manners
[0020] In the following, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in conjunction with the embodiments.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence.
[0022] In the related art, for example, when the V50 Design gaming phone is adapted to use the Chicken gamepad, the phone first powers the gamepad through the OTG function. At the same time, the gamepad is equipped with a USB interface. When the gamepad is inserted into the charger for charging, the phone will immediately turn off the OTG function and enter the charging state. This process will cause the phone to re-pair with the gamepad, which takes 3 - 5 seconds. During this period, the gamepad will be in an unusable state, which greatly affects the ongoing gaming experience.
[0023] Figure 1 It is a schematic diagram of the pin distribution of a USB Type C socket and plug according to an embodiment of the present invention. As Figure 1 shown, in order to support plugging in either way, a double-row symmetric pin design is adopted, and there are two groups of VBUS pins; in addition, for the interface that supports USB 3.0 transmission, two additional pairs of differential data transmission pins are added. In the traditional USB2.0, the socket and plug do not include differential data transmission pins.
[0024] The phone communicates with the gamepad through the Circuit Common (CC) pins to establish an OTG connection, and then the phone powers the gamepad through the Voltage Bus (VBUS) pins. Usually, the two-way VBUS of the USB interface is directly connected on the Printed Circuit Board (PCB).
[0025] In the embodiment of the present invention, the two-way VBUS is separately wired on the phone side and connected through a switch. The switch can be controlled by a pre-set power management module; when the gamepad is connected and inserted into the charger, the connection switch is disconnected. One path is used to maintain the phone's power supply to the gamepad device to keep the device normal; the other path is used to absorb the current from the charger to charge the phone, which is equivalent to adding an additional charging path. Under normal circumstances, the switch is closed; when the phone is connected to the gamepad, after establishing an OTG connection, the phone powers the gamepad through the two-way VBUS together.
[0026] When a mobile phone is connected to a gamepad and the gamepad is connected to a charger, the power management module controls the switch to disconnect the two VBUS lines. On the one hand, the external charger immediately powers the gamepad. On the other hand, the charger also charges the mobile phone through one VBUS line. When the gamepad is connected to the charger instantaneously and after the connection, the mobile phone will always maintain the OTG state connection with the gamepad, avoiding the problem of communication disconnection between the two. During the use of the mobile phone with the gamepad, the mobile phone and the gamepad always maintain the OTG connection and communication, and will not be affected by the insertion and removal of the charger to interrupt the communication, nor will it cause the game to be interrupted, significantly improving the user experience.
[0027] In the embodiments of the present invention, by using the fact that the Type-C interface has two groups of VBUS pins, the circuit design is modified, some components and related logics are added to enable the gamepad to charge the mobile phone. In addition, the complete USB 3.0 interface appears in pairs or has redundant pins, such as CC1 / CC2, Data Positive (D+) / Data Negative (D-), Transmit (TX) / Receive (RX) pins, and all can achieve the same effect according to the method of the embodiments of the present invention after the design is modified.
[0028] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 2 is the hardware structure block diagram of a mobile terminal for the terminal charging method in the embodiments of the present invention. As Figure 2 shown, the mobile terminal may include one or more ( Figure 2 only one is shown in the figure) processors 202 (the processor 202 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 204 for storing data. Among them, the above mobile terminal may further include a transmission device 206 for communication functions and an input / output device 208. Those of ordinary skill in the art can understand that Figure 2 the structure shown is only schematic and does not limit the structure of the above mobile terminal. For example, the mobile terminal may further include more or fewer components than Figure 2 shown in the figure, or have a different configuration from Figure 2 shown in the figure.
[0029] The memory 204 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the terminal charging method in the embodiments of the present invention. The processor 202 executes various functional applications and data processing by running the computer program stored in the memory 204, that is, implements the above-mentioned method. The memory 204 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 204 may further include a memory remotely disposed relative to the processor 202, and these remote memories can be connected to the mobile terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and combinations thereof.
[0030] The transmission device 206 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of the mobile terminal. In one instance, the transmission device 206 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus can communicate with the Internet. In one instance, the transmission device 206 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] In this embodiment, a terminal charging method running on the above-mentioned mobile terminal is provided. Figure 3 It is a flowchart of the terminal charging method according to the embodiments of the present invention, as Figure 3 shown, and the process includes the following steps:
[0032] Step S302, when the external device of the terminal is not connected to the charger, the terminal is connected to the external device through the USB interface, and the terminal supplies power to the external device through the VBUS of the USB interface.
[0033] In the actual implementation process, the terminal and the external device are connected through the USB, the terminal enters the OTG output mode, and the terminal supplies power to the external device through the VBUS of the USB interface.
[0034] In an exemplary embodiment, after the terminal supplies power to the external device through the VBUS, the method further includes: the external device performs charger connection detection to detect whether the USB interface of the external device is connected to the charger.
[0035] In the actual implementation process, the game controller, that is, the external device, needs to detect in real time whether a charger is inserted into the USB interface c during operation, and adjust the charging mode, the connection relationship of the circuit and pins according to the specific situation of whether the charger is connected.
[0036] Step S304: When the external device is connected to the charger, the charger supplies power to the external device, and the external device supplies power to the terminal through VBUS or a redundant pin.
[0037] In an exemplary embodiment, when the external device is connected to the charger, the external device supplies power to the terminal through the VBUS, including: the external device supplies power to the terminal through a first VBUS in the VBUS.
[0038] In an exemplary embodiment, when the external device is connected to the charger, the method further includes: the terminal supplies power to the external device via a second VBUS in the VBUS.
[0039] In practice, the terminal and external device can switch charging modes via the two VBUS pins within the VBUS. Furthermore, the terminal's Type C port has two CC pins, CC1 and CC2. After the external device is connected to the terminal and the positive and negative connections are confirmed, communication between the terminal and the external device only requires one CC1 or CC2, leaving the other idle. Therefore, a logic-controlled switch can be used to switch the idle CC pins to VBUS, serving as the charging path. Furthermore, the D+ / D-, TX / RX pins of a full USB 3.0 port can also be connected to VBUS via a switch, serving as the charging path.
[0040] In an exemplary embodiment, when the external device is connected to the charger, the external device supplies power to the terminal through the redundant pin, including: the external device supplies power to the terminal through the second CC pin of the redundant pin.
[0041] In an exemplary embodiment, when the external device is connected to the charger, the method further includes: the terminal and the external device perform OTG communication for data exchange via the first CC pin.
[0042] In an exemplary embodiment, when the external device is connected to the charger, the external device supplies power to the terminal through the redundant pin, including: the external device supplies power to the terminal through a data transmission pin among the redundant pins.
[0043] In actual implementation, before the external device supplies power to the terminal through the data transmission pin in the redundant pin, it is necessary to detect whether the data transmission pin is occupied, that is, to detect whether the terminal or external device has data transmission requirements, such as when the external device is connected to a computer via a data cable.
[0044] In an exemplary embodiment, before the external device supplies power to the terminal through the data transmission pin among the redundant pins, the method further includes: when the data transmission pin is occupied, the terminal and the external device reestablish a USB connection through the USB interface.
[0045] In an exemplary embodiment, when an external device is connected to a charger, before the external device supplies power to a terminal through VBUS or redundant pins, the method further includes: the terminal receives a charging request from the external device; the terminal sends a charging confirmation message to the external device so that the external device supplies power to the terminal.
[0046] In an exemplary embodiment, when the connection between the external device and the charger is changed from connected to disconnected, the terminal ends charging, the terminal supplies power to the external device through VBUS, and the terminal and the external device perform data exchange OTG communication through the first CC pin or the second CC pin in the redundant pins.
[0047] Through the above steps, a terminal charging method is provided. Wherein, when the external device of the terminal is not connected to the charger, the terminal is connected to the external device through a USB interface, and the terminal supplies power to the external device through the VBUS of the USB interface; when the external device is connected to the charger, the charger supplies power to the external device, and the external device supplies power to the terminal through VBUS or redundant pins. It solves the problem that OTG communication is interrupted when the external device switches the charging method in the related art, and achieves the effect of keeping OTG communication uninterrupted when the external device switches the charging method, improving the user experience.
[0048] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention.
[0049] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0050] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM), random access memory (RAM), mobile hard disk, magnetic disk or optical disk and other various media that can store computer programs.
[0051] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0052] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0053] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0054] In order to enable those skilled in the art to better understand the technical solutions of the present invention, they are described below in conjunction with embodiments.
[0055] Example 1
[0056] Figure 4 This is a frame structure diagram of a terminal charging device in the related art, such as Figure 4 As shown, when a mobile phone is inserted into a game controller, USB interface a is connected to USB interface b, and the power management module a on the mobile phone communicates with the control module on the game controller through the CC pin. Then, the mobile phone enters OTG output mode, and the power management module a controls the current to flow from the mobile phone to the game controller through VBUS.
[0057] When the game controller detects that a charger is plugged into USB port c, the game controller side control module and the mobile phone side power management module a interrupt OTG communication, and then the game controller side control module and the mobile phone side power management module a establish a USB connection. After the connection is established, the charging current enters the game controller through USB port c, and then enters the mobile phone through USB port b and USB port a to charge the battery. At the same time, relevant charging prompts appear on the mobile phone UI interface.
[0058] When the phone finishes charging, or the user removes the charger connected to the game controller, charging stops. The game controller's control module and the phone's power management module a terminate the USB connection, meaning the game controller stops charging the phone, and the charging prompt disappears from the phone's UI. The phone's power management module a then reestablishes communication with the game controller's control module, and the phone enters OTG output mode, with power flowing from the phone to the game controller.
[0059] In view of the charging mode and OTG communication mode supported by the above-mentioned framework structure, the OTG communication interruption phenomenon may occur. Therefore, the embodiment of the present invention provides another terminal charging method by improving the structure of the terminal charging device. Figure 5 FIG. 1 is a schematic diagram of a terminal charging device according to a first embodiment of the present invention. Figure 5As shown, the terminal, i.e., the mobile phone part, includes a processor, a power management module a, a charging management module a, a battery, a USB interface a, and a switch a. Among them, the external device, i.e., the gamepad part, includes a control module, a charging management module b, a USB interface b, a USB interface c, and a switch b.
[0060] Based on the framework structure of the embodiments of the present invention, the added hardware modules are: switch a on the mobile phone side and its related circuits with the charging management module a, the charging management module b on the gamepad side, switch b and its related circuits with the charging management module b. In the actual implementation process, the above modules can also be implemented by using the existing modules on the current mobile phone device, and no specific limitations are made here. Figure 4 In the mobile phone part: The processor is responsible for controlling the power management module a and the charging management module a. The power management module a is responsible for establishing an OTG connection with the gamepad through the USB interface a, and controlling the switch group to control the establishment of a USB connection with the gamepad. The charging management module a is responsible for charging the battery and supplying power to the processor and the power management module a. The battery is responsible for supplying power to the remaining modules in the mobile phone. The USB interface a is responsible for physically contacting the USB interface b of the gamepad and establishing an OTG connection or a USB connection according to the instructions of the power management module a. The switch a is responsible for switching the connection between VBUS a1 / VBUS a2 of the mobile phone USB interface a and the power management module a and the charging module a, and transmitting current according to the instructions of the power management module a.
[0061] In the gamepad part: The control module is responsible for controlling the components in the gamepad, the charging management module b, and the switch b. The control module is also responsible for distributing the current entering the gamepad to each module on the gamepad to maintain the power supply of each module. The above modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans. The charging management module b is responsible for charging the mobile phone and supplying power to the control module. The switch b is responsible for switching the connection between VBUS b1 / VBUS b2 of the handle USB interface b and the charging management module b, and the connection between the charging module b and the handle control module. The USB interface b is responsible for physically contacting the USB interface a of the mobile phone and establishing an OTG connection or a USB connection according to the instructions of the control module.
[0062] Embodiment 2
[0063] Based on the framework structure of the terminal charging device provided in Embodiment 1, in Embodiment 2, the implementation process of the terminal charging method is introduced.
[0064] It is a flowchart of the terminal charging method according to Embodiment 2 of the present invention. As Figure 6 shown, it includes the following steps: Figure 6
[0065] Step S601: In the default state, switch a connects the VBUS a1 and VBUS a2 pins of USB interface a and connects them to power management module a; switch b connects the VBUS b1 and VBUS b2 pins of USB interface b and connects them to the control module by default. When the mobile phone is inserted into the gamepad, USB interface a is connected to USB interface b. After the power management module a on the mobile phone side communicates with the control module on the gamepad side, the mobile phone enters the OTG output mode. The mobile phone powers the gamepad. After the current enters the gamepad, it is used to maintain the operation of the control module and the other modules on the gamepad. The other modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans.
[0066] Step S602: During the operation of the gamepad, it detects whether a charger is inserted into USB interface c.
[0067] Step S603: If the gamepad does not detect that a charger is inserted into USB interface c, the mobile phone side continuously maintains the OTG output mode, and the current always flows from the mobile phone to the gamepad.
[0068] Step S604: If the gamepad detects that a charger is inserted into USB interface c, the control switch group on the mobile phone side and the gamepad side switches the connection relationship of the VBUS1 / VBUS2 pins.
[0069] The power management module a on the mobile phone side controls switch a to disconnect VBUS a1 and VBUS a2, and keeps one path (such as VBUS a1) connected to the power management module a to control the current to flow from VBUS a1 of the mobile phone's USB interface a to the gamepad; the other path (such as VBUS a2) is connected to the charging management module a; at the same time, the control module on the gamepad side controls switch b to disconnect VBUS b1 and VBUS b2 on the gamepad side, and according to the current inflow channel information on the mobile phone side, connects one path (such as VBUS b2) to the VBUS of USB interface c, and the other path (such as VBUS b1) still remains connected to the control module. At the same time, the control module will start the charger to supply power to the gamepad. The current entering from USB interface c is used to maintain the operation of the control module and the other modules on the gamepad. The other modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans. After the charger supplies power to each module of the gamepad, the supply current flowing from the mobile phone side to the gamepad via the USB interface will decrease accordingly. The change in the current is completed through negotiation between the control module on the gamepad and the power management module a in the mobile phone. During this process, the relationship between the mobile phone supplying power to the gamepad remains unchanged all the time, and what changes is the magnitude of the supply current. Therefore, the mobile phone and the gamepad can always maintain the OTG working mode. In the traditional solution, after the charger is inserted, the charging current will flow from the gamepad into the mobile phone side, and the power management module on the mobile phone side needs to reset the connection relationship, and normal OTG communication cannot be guaranteed during this process.
[0070] Step S605: The game controller charges the mobile phone, and the mobile phone USB interface maintains the OTG output mode.
[0071] The control module on the game controller side communicates with the power management module a on the mobile phone side, requesting to charge the mobile phone through the VBUS b2 pin; after the mobile phone side confirms the charging request, the charging management module a on the mobile phone side starts, absorbs the current from the game controller to charge the battery, and at the same time, the relevant charging prompt appears on the mobile phone UI interface. During the above process, the mobile phone and the game controller always maintain the OTG working mode through the USB interface. At this time, part of the current entering the game controller is used to maintain the operation of each module in the game controller, and the other part enters the mobile phone through the VBUS b2 pin; the current entering the mobile phone is distributed under the control of the charging management module a on the mobile phone side, for example, part of the current is used to charge the battery, and the other part of the current is used to maintain the operation of each module in the mobile phone. When the mobile phone detects that the battery is fully charged, the charging management module a on the mobile phone side can allocate all the current entering the mobile phone to maintain the operation of each module in the mobile phone, and no longer enter the battery.
[0072] Step S606: When the user removes the charger connected to the game controller, the charger stops supplying power to the game controller.
[0073] In step S607, the game controller's charging management module b stops charging the phone. The charging prompt on the phone's UI disappears, but the phone and game controller remain in OTG mode via the USB port. After the user removes the charger from the game controller, the power supply current flowing from the phone to the game controller via the USB port increases. This increased current is used to maintain the operation of various modules in the game controller.
[0074] In the second embodiment, the Type C interface of the mobile phone has two CC pins CC1 and CC2. After the handle is inserted into the mobile phone, the positive and negative connection relationship is confirmed. The communication between the mobile phone and the handle only needs CC1 or CC2 to be completed, and the other line is idle.
[0075] Example 3
[0076] In the third embodiment, a logic control switch is added to switch the idle CC pin to be connected to VBUS as a charging path.
[0077] Figure 7 FIG. 1 is a schematic diagram of a terminal charging device according to a third embodiment of the present invention. Figure 7As shown in the figure, for the implementation of the charging solution using the CC pin, the additional hardware modules include: switches 1 / 2 on the mobile phone side and their related circuits connected to the charging management module a, the charging management module b on the gamepad side, switches 3 / 4, and their related circuits connected to the charging management module b. Switches 1 / 2 in the mobile phone are responsible for switching the connection between the CC pin and the power management module a and the charging management module a in the mobile phone, and transmitting communication information or charging current according to the instructions of the power management module a. Switches 3 / 4 in the gamepad part are responsible for switching the connection between the CC pin of the gamepad and the charging management module b and the gamepad control module.
[0078] According to Figure 7 the framework structure of the terminal charging device shown in the figure, in Embodiment 3, a terminal charging method is further provided. Figure 8 It is a flowchart of the terminal charging method according to Embodiment 3 of the present invention. As Figure 8 shown, it includes the following steps:
[0079] Step S801, in the default state, switch 1 / 2 connects the CC pin of the USB interface to the power management module a; switch 3 / 4 defaults to connecting the CC pin of USB interface b to the control module. When the mobile phone is inserted into the gamepad and USB interface a is connected to USB interface b, after the power management module a on the mobile phone side communicates with the control module on the gamepad side, the mobile phone enters the OTG output mode. The mobile phone powers the gamepad. After the current enters the gamepad, it is used to maintain the operation of the control module and the other modules on the gamepad. The other modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans.
[0080] Step S802, during the operation of the gamepad, it detects whether a charger is inserted into USB interface c.
[0081] Step S803, if the gamepad does not detect that a charger is inserted into USB interface c, the mobile phone side continues to maintain the OTG output mode, and the current always flows from the mobile phone to the gamepad.
[0082] Step S804, if the game controller detects that a charger is plugged into the USB interface c, the control switch group on the mobile phone side and the controller side switches the connection relationship of the VBUS / CC pins. The controller control module controls switch 3 or 4 to switch the idle CC pin on the controller side to connect to the charging management module b and connect to the VBUS. On the mobile phone side, the power management module a controls switch 1 or 2 to switch the idle CC pin on the mobile phone side to connect to the charging management module a. The control module will start to supply power to the game controller by the charger. The current entering from the USB interface c is used to maintain the operation of the control module and the other modules on the game controller. The other modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans. After the charger supplies power to each module of the game controller, the power supply current flowing from the mobile phone side to the game controller via the USB interface will decrease accordingly. The change in the current is completed through negotiation between the control module on the game controller and the power management module a in the mobile phone. During this process, the power supply relationship between the mobile phone and the game controller remains unchanged all the time. What changes is the magnitude of the power supply current. Therefore, the mobile phone and the game controller can always maintain the OTG working mode.
[0083] Step S805, the game controller charges the mobile phone, and the mobile phone USB interface maintains the OTG output mode.
[0084] The control module on the game controller side communicates with the power management module a on the mobile phone side to request to charge the mobile phone through the idle CC pin. After the mobile phone side confirms the charging request, the charging management module a on the mobile phone side starts to absorb the current from the game controller to charge the battery. At the same time, relevant charging prompts appear on the mobile phone UI interface. During the above process, the mobile phone and the game controller always maintain the OTG working mode through the USB interface. At this time, the current entering the game controller is partly used to maintain the operation of each module in the game controller, and the other part enters the mobile phone through the idle CC pin. The current entering the mobile phone is distributed under the control of the charging management module a on the mobile phone side. For example, part of the current charges the battery, and the other part of the current is used to maintain the operation of each module in the mobile phone. When the mobile phone detects that the battery is fully charged, the charging management module a on the mobile phone side can distribute all the current entering the mobile phone to maintain the operation of each module in the mobile phone and no longer enter the battery.
[0085] Step S806, when the user removes the charger connected to the game controller, the charger stops supplying power to the game controller.
[0086] Step S807, the charging management module b on the game controller side stops charging the mobile phone, the relevant charging prompts on the mobile phone UI interface disappear, and the mobile phone and the game controller still always maintain the OTG working mode through the USB interface. After the user removes the charger connected to the game controller, the power supply current flowing from the mobile phone side to the game controller via the USB interface will increase, and the increased current is used to maintain the operation of each module in the game controller.
[0087] Example 4
[0088] For a complete Type-C interface or a complete USB 3.0 interface, when connected to a charger, the data transmission pins (D+ / D- or Tx / Rx) are always in an idle state. Therefore, pins such as D+ / D- and TX / RX can also be connected to VBUS through switches to serve as a charging path.
[0089] In Example 4, charging is carried out using the data transmission pins. Fig. 9 is a framework structure diagram of the terminal charging device according to Example 4 of the present invention, as Fig. 9 shown, the additional hardware modules are: switch a on the mobile phone side and its related circuits with the charging management module a, the charging management module b on the gamepad side, switch b and its related circuits with the charging management module b.
[0090] Switch a in the mobile phone is responsible for switching the connection between the data transmission pins and the mobile phone processor and the charging module a, and transmitting data information or charging current according to the instructions of the processor. Switch b in the gamepad part is responsible for switching the connection between the data transmission pins of the gamepad and the charging module b and the gamepad control module.
[0091] According to Fig. 9 the framework structure of the terminal charging device shown, in Example 4, a terminal charging method is also provided. Fig.10 is a flowchart of the terminal charging method according to Example 4 of the present invention, as Fig.10 shown, including the following steps:
[0092] Step S1001: By default, switch a connects the data channel of USB interface a to the processor module; by default, switch b connects the data channel of USB interface b to the control module. When the mobile phone is inserted into the gamepad and USB interface a is connected to USB interface b, after the power management module a on the mobile phone side communicates with the control module on the gamepad side, the mobile phone enters the OTG output mode. The mobile phone powers the gamepad. After the current enters the gamepad, it is used to maintain the operation of the control module and the other modules on the gamepad. The other modules include, but are not limited to, devices such as buttons, joysticks, indicator lights, decorative lights, and fans.
[0093] Step S1002: During the operation of the gamepad, it detects whether a charger is inserted into USB interface c.
[0094] Step S1003: If the gamepad does not detect that a charger is inserted into USB interface c, the mobile phone side continues to maintain the OTG output mode, and the current always flows from the mobile phone to the gamepad.
[0095] Step S1004: If the game controller detects that a charger is plugged into USB port c, the controller control module needs to detect whether there is a data transmission demand, that is, whether the data channel is occupied, such as when the controller is connected to a PC via a data cable;
[0096] Step S1005: If the data channel does not need to be occupied, the control switches on the mobile phone side and the handle side switch the data pin connection relationship.
[0097] The gamepad control module controls switch b, switching the data channel pin on the gamepad to connect to the charging management module b and connect to VBUS. On the phone side, the processor module can control switch b, switching the data channel pin on the phone to connect to the charging management module a. The control module will start the charger to power the gamepad. The current entering from USB port c is used to maintain the operation of the control module and other modules on the gamepad, including but not limited to buttons, joysticks, indicator lights, decorative lights, fans, and other devices. After the charger supplies power to the various modules of the gamepad, the power supply current flowing from the phone to the gamepad via the USB port will decrease accordingly. The change in current is negotiated between the control module on the gamepad and the power management module a in the phone. During this process, the relationship between the phone and the gamepad remains unchanged; what changes is the supply current. Therefore, the phone and gamepad can always maintain OTG operating mode. In step S1005, the specific control logic is the same as step S604.
[0098] Step S1006: The game controller-side control module communicates with the mobile phone-side power management module a, requesting that the mobile phone be charged through the data channel pins. After the mobile phone confirms the charging request, the mobile phone-side charging management module a starts up, absorbing the current from the game controller to charge the battery, and a relevant charging prompt appears on the mobile phone UI. During the above process, the mobile phone and the game controller always maintain the OTG working mode through the USB interface. At this time, part of the current entering the game controller is used to maintain the operation of the various modules in the game controller, and the other part enters the mobile phone through the data channel pins. The current entering the mobile phone is distributed under the control of the mobile phone-side charging management module a, for example, part of the current is used to charge the battery, and the other part of the current is used to maintain the operation of the various modules in the mobile phone. When the mobile phone detects that the battery is fully charged, the mobile phone-side charging management module a can allocate all the current entering the mobile phone to maintain the operation of the various modules in the mobile phone, and no longer enter the battery.
[0099] Step S1007: When the user removes the charger connected to the game controller, the charger stops supplying power to the game controller.
[0100] Step S1008: The charging management module b on the gamepad side stops charging the mobile phone, and the relevant charging prompts on the mobile phone UI interface disappear. The mobile phone and the gamepad still maintain the OTG working mode through the USB interface all the time. After the user removes the charger connected to the gamepad, the power supply current flowing from the mobile phone side to the gamepad through the USB interface will increase, and the increased current is used to maintain the operation of each module in the gamepad.
[0101] Step S1009: If the data channel has an occupancy requirement, the mobile phone exits the OTG mode, re-establishes an OTG connection with the gamepad, and the gamepad charges the mobile phone through the USB interface.
[0102] The OTG connection between the mobile phone and the gamepad needs to be interrupted and a new USB connection needs to be established for charging. The switch connection relationship remains the default state. The processor on the mobile phone side communicates with the control module on the gamepad side to start the charging operation. At this time, the control module on the gamepad side interrupts the OTG communication with the power management module a on the mobile phone side, and then the control module on the gamepad side establishes a USB connection with the power management module a on the mobile phone side. After the connection is established, the charging current enters the gamepad through the USB interface c, and then enters the mobile phone through the USB interface b and the USB interface a to charge the battery. At the same time, relevant charging prompts appear on the mobile phone UI interface.
[0103] Step S1010: When the user removes the charger connected to the gamepad, the charger stops supplying power to the gamepad.
[0104] The control module on the gamepad side aborts the USB connection with the power management module a on the mobile phone side, that is, the gamepad stops charging the mobile phone, and the relevant charging prompts on the mobile phone UI interface disappear. Subsequently, the power management module a on the mobile phone side re-establishes communication with the control module on the gamepad side, and the mobile phone enters the OTG output mode. The current flows from the mobile phone to the gamepad. After the current enters the gamepad, it is used to maintain the operation of each module on the gamepad.
[0105] In summary, for the terminal charging method provided by the embodiment of the present invention, when the mobile phone is connected to the gamepad and the gamepad is connected to the charger, the mobile phone is charged by separating the VBUS pin. At the same time, the mobile phone still maintains the OTG state and is connected to the gamepad, avoiding the problem of disconnection of their communication and not causing any phenomenon that affects the user experience. During the use of the mobile phone with the gamepad, the mobile phone and the gamepad always maintain the OTG connection and communication, and will not be interrupted by the insertion and removal of the charger, significantly improving the user experience.
[0106] Obviously, those skilled in the art should understand that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a sequence different from that here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.
[0107] The foregoing is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A terminal charging method, characterized in that, Including: When the external device of the terminal is not connected to the charger, the terminal is connected to the external device through a USB interface, and the terminal supplies power to the external device through the VBUS of the USB interface; When the external device is connected to the charger, the charger supplies power to the external device, and the external device supplies power to the terminal through the VBUS or redundant pins.
2. The method according to claim 1, wherein When the external device is connected to the charger, the external device supplies power to the terminal through the VBUS, including: The external device supplies power to the terminal through the first VBUS in the VBUS.
3. The method according to claim 2, characterized in that, When the external device is connected to the charger, it further includes: The terminal supplies power to the external device through the second VBUS in the VBUS.
4. The method according to claim 1, characterized in that When the external device is connected to the charger, the external device supplies power to the terminal through redundant pins, including: The external device supplies power to the terminal through the second CC pin in the redundant pins.
5. The method according to claim 4, characterized in that When the external device is connected to the charger, it further includes: The terminal and the external device perform data exchange OTG communication through the first CC pin.
6. The method according to claim 1, characterized in that, When the external device is connected to the charger, the external device supplies power to the terminal through redundant pins, including: The external device supplies power to the terminal through the data transmission pin in the redundant pins.
7. The method according to claim 6, wherein Before the external device supplies power to the terminal through the data transmission pin in the redundant pins, the method further includes: When the data transmission pin is occupied, the terminal and the external device re - establish a USB connection through the USB interface.
8. The method according to claim 1, characterized in that, After the terminal supplies power to the external device through the VBUS, the method further includes: The external device performs charger connection detection to detect whether the USB interface of the external device is connected to the charger.
9. The method according to claim 1, wherein When the external device is connected to the charger, before the external device supplies power to the terminal through the VBUS or redundant pins, the method further includes: The terminal receives a charging request from the external device; The terminal sends a charging confirmation message to the external device so that the external device supplies power to the terminal.
10. The method according to claim 1, characterized in that, It further includes: When the external device and the charger are converted from connected to disconnected, the terminal ends charging, the terminal supplies power to the external device through the VBUS, and the terminal and the external device perform data exchange OTG communication through the first CC pin or the second CC pin in the redundant pins.
11. A computer-readable storage medium, characterized in that, A computer program is stored in the computer - readable storage medium, wherein when the computer program is executed by a processor, the method described in any one of claims 1 to 10 is implemented.
12. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the method described in any one of claims 1 to 10 is implemented.