CN116707048A - OTG-based charging control method and related device - Google Patents

OTG-based charging control method and related device Download PDF

Info

Publication number
CN116707048A
CN116707048A CN202211085690.6A CN202211085690A CN116707048A CN 116707048 A CN116707048 A CN 116707048A CN 202211085690 A CN202211085690 A CN 202211085690A CN 116707048 A CN116707048 A CN 116707048A
Authority
CN
China
Prior art keywords
terminal device
terminal equipment
otg
terminal
lock
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211085690.6A
Other languages
Chinese (zh)
Other versions
CN116707048B (en
Inventor
赵小利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211085690.6A priority Critical patent/CN116707048B/en
Publication of CN116707048A publication Critical patent/CN116707048A/en
Application granted granted Critical
Publication of CN116707048B publication Critical patent/CN116707048B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02JCIRCUIT ARRANGEMENTS OR SYSTEMS FOR SUPPLYING OR DISTRIBUTING ELECTRIC POWER; SYSTEMS FOR STORING ELECTRIC ENERGY
    • H02J7/00Circuit arrangements for charging or depolarising batteries or for supplying loads from batteries
    • H02J7/00032Circuit arrangements for charging or depolarising batteries or for supplying loads from batteries characterised by data exchange
    • H02J7/00034Charger exchanging data with an electronic device, i.e. telephone, whose internal battery is under charge
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02JCIRCUIT ARRANGEMENTS OR SYSTEMS FOR SUPPLYING OR DISTRIBUTING ELECTRIC POWER; SYSTEMS FOR STORING ELECTRIC ENERGY
    • H02J7/00Circuit arrangements for charging or depolarising batteries or for supplying loads from batteries
    • H02J7/34Parallel operation in networks using both storage and other dc sources, e.g. providing buffering
    • H02J7/342The other DC source being a battery actively interacting with the first one, i.e. battery to battery charging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
    • Y02E60/10Energy storage using batteries

Landscapes

  • Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

The embodiment of the application provides an OTG-based charging control method and a related device, and relates to the technical field of terminals. The method comprises the following steps: the first terminal equipment charges the second terminal equipment based on OTG; at a first moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment continuously charges the second terminal equipment, the first terminal equipment is in an awakening state, and the battery electric quantity of the second terminal equipment is smaller than a first preset value; at a second moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment does not charge the second terminal equipment, the first terminal equipment is in a dormant state, the battery electric quantity of the second terminal equipment is larger than or equal to a first preset value, and the second moment is later than the first moment. Therefore, after the first terminal equipment stops charging the second terminal equipment, the first terminal equipment can enter a dormant state, so that the power consumption of the first terminal equipment is reduced, and the cruising ability of the first terminal equipment is improved.

Description

OTG-based charging control method and related device
Technical Field
The application relates to the technical field of terminals, in particular to an OTG-based charging control method and a related device.
Background
With the development of terminal technology, electronic device data interchange (OTG) technology has been widely used in mobile terminal devices. The OTG technology enables data exchange, charging, etc. between the terminal devices to be connected with each other.
When using OTG to charge for equipment, take the tablet computer to charge the process of handwriting pen as an example, under the condition that the OTG connection function of tablet computer is opened, tablet computer can connect the handwriting pen through the stick that charges, and then, tablet computer can charge for the handwriting pen.
However, when the OTG is used to charge the device, there is often a problem that the power consumption of the power supply device is large, and the endurance of the power supply device is reduced.
Disclosure of Invention
The embodiment of the application provides an OTG-based charging control method and a related device, which can enable terminal equipment to enter a dormant state after the terminal equipment stops charging connected equipment, so that the power consumption of the terminal equipment can be reduced, and the cruising ability of the terminal equipment is improved.
In a first aspect, an embodiment of the present application provides an OTG-based charging control method, including:
the first terminal equipment charges the second terminal equipment based on OTG; at a first moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment continuously charges the second terminal equipment, the first terminal equipment is in an awakening state, and the battery electric quantity of the second terminal equipment is smaller than a first preset value; at a second moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment does not charge the second terminal equipment, the first terminal equipment is in a dormant state, the battery electric quantity of the second terminal equipment is larger than or equal to a first preset value, and the second moment is later than the first moment. Therefore, after the first terminal equipment stops charging the second terminal equipment, the first terminal equipment can enter a dormant state, the power consumption of the first terminal equipment is reduced, and the cruising ability of the first terminal equipment is improved.
In a possible implementation manner, between the first time and the second time, the method may include: when the first terminal equipment determines that the electric quantity of the second terminal equipment is larger than or equal to a second preset value, the first terminal equipment releases the OTG lock; the second preset value is greater than or equal to the first preset value. In this way, the first terminal device can be put into the sleep state after the first terminal device stops charging the second terminal device, so that the power consumption of the first terminal device can be reduced.
In a possible implementation manner, the first terminal device releases the OTG lock, which may include: the Bluetooth service module of the first terminal equipment sends a field identifier for releasing the wakeup lock to the USB service module; the USB service module of the first terminal device analyzes the field identification and informs the USB driver to release the OTG lock. Therefore, the OTG lock can be conveniently released based on interaction of the Bluetooth service module, the USB service module and the USB driver of the first terminal equipment.
In a possible implementation manner, before the first terminal device releases the OTG lock, the method may include: the first terminal equipment acquires the battery power of the second terminal equipment according to the first period; or the first terminal equipment receives information from the second terminal equipment, wherein the information is used for indicating that the electric quantity of the second terminal equipment is larger than or equal to a second preset value. In this way, the first terminal device periodically acquires the battery power of the second terminal device, so that the first terminal device can sense the battery power of the second terminal device in real time; the first terminal equipment receives the information from the second terminal equipment, so that the communication interaction between the first terminal equipment and the second terminal equipment can be reduced, and the power consumption and the calculation power of the first terminal equipment are saved.
In a possible implementation manner, after the first terminal device releases the OTG lock, the method may include: when the first terminal equipment detects that the first terminal equipment does not receive the triggering operation within the preset time, and locks for preventing the first terminal equipment from dormancy in the first terminal equipment are in a release state, the first terminal equipment enters a dormancy state. In this way, the first terminal device sets the sleep state through the preset duration, and can enter the sleep state on the premise that the user does not trigger operation in a period of time, so that when the user triggers operation in the period of time, frequent operation is not needed, the terminal device exits the sleep state, and user experience is improved.
In a possible implementation manner, after the second time, the method may include: the first terminal equipment acquires the battery electric quantity of the second terminal equipment according to a second period, wherein the second period is larger than the first period; when the first terminal equipment determines that the electric quantity of the second terminal equipment is smaller than or equal to a third preset value, the first terminal equipment performs OTG locking, and the third preset value is smaller than or equal to the first preset value; the first terminal device resumes the awake state and charges the second terminal device. Thus, after the first terminal device stops charging the second terminal device, the first terminal device may periodically acquire the battery power of the second terminal device. When the first terminal device judges that the battery power of the second terminal device is lower, the first terminal device can recharge the second terminal device, so that the power of the second terminal device can keep a higher value.
In a possible implementation manner, after the first terminal device resumes the awake state and charges the second terminal device, the method may include: when the first terminal equipment determines that the electric quantity of the second terminal equipment is larger than or equal to a second preset value, the first terminal equipment releases the OTG lock and enters a dormant state again, and the second terminal equipment is not charged. Therefore, the power consumption of the terminal equipment can be reduced, and the cruising ability of the terminal equipment is improved.
In a second aspect, an embodiment of the present application provides an OTG-based charging control device, where the charging control device may be a terminal device, or may be a chip or a chip system in the terminal device. The means for charging control may comprise a processing unit and a communication unit. The processing unit is configured to implement the first aspect or any method related to processing in any possible implementation manner of the first aspect. The communication unit may be any step related to communication in implementing the first aspect or any possible implementation of the first aspect based on control of the processing unit. When the means of charging control is a terminal device, the processing unit may be a processor and the communication unit may be a short-range connection device. The means for charging control may further comprise a memory unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored in the storage unit, so that the terminal device implements a method described in the first aspect or any one of possible implementation manners of the first aspect. When the means of charging control is a chip or a system of chips within the terminal device, the processing unit may be a processor. The processing unit executes instructions stored by the storage unit to cause the terminal device to implement a method as described in the first aspect or any one of the possible implementations of the first aspect. The memory unit may be a memory unit (e.g., a register, a cache, etc.) in the chip, or a memory unit (e.g., a read-only memory, a random access memory, etc.) located outside the chip in the terminal device.
The processing unit is configured to charge the second terminal device based on the OTG.
In a possible implementation manner, the processing unit is further configured to release the OTG lock when the first terminal device determines that the electric quantity of the second terminal device is greater than or equal to a second preset value.
In a possible implementation manner, the processing unit is further configured to instruct, based on the bluetooth service module of the first terminal device, to release the OTG lock to the USB service module; and notifying the USB driver to release the OTG lock based on the USB service module of the first terminal equipment.
In a possible implementation manner, the processing unit is specifically further configured to send, to the USB service module, a field identifier for releasing the wakeup lock based on the bluetooth service module of the first terminal device; and analyzing the field identification based on the USB service module of the first terminal equipment, and informing the USB driver to release the OTG lock.
In a possible implementation manner, the processing unit is further configured to enter the sleep state when the first terminal device detects that the first terminal device does not receive the trigger operation within a preset duration, and locks in the first terminal device for preventing the first terminal device from being dormant are all in a release state.
In a possible implementation manner, the processing unit is further configured to obtain a battery power of the second terminal device according to the first period. And the communication unit is also used for receiving information from the second terminal equipment, wherein the information is used for indicating that the electric quantity of the second terminal equipment is larger than or equal to a second preset value.
In a possible implementation manner, the processing unit is further configured to obtain a battery power of the second terminal device according to a second period, where the second period is greater than the first period; the OTG locking method is particularly used for carrying out OTG locking when the first terminal equipment determines that the electric quantity of the second terminal equipment is smaller than or equal to a third preset value, and the third preset value is smaller than or equal to the first preset value; the method is particularly used for recovering the wake-up state and charging the second terminal equipment.
In a possible implementation manner, the processing unit is further configured to release the OTG lock and enter the sleep state again when the first terminal device determines that the electric quantity of the second terminal device is greater than or equal to the second preset value, and does not charge the second terminal device.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory is configured to store code instructions, and the processor is configured to execute the code instructions to perform the OTG-based charging control method described in the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, in which a computer program or instructions are stored which, when run on a computer, cause the computer to perform the OTG-based charging control method described in the first aspect or any one of the possible implementations of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when run on a computer, causes the computer to perform the OTG-based charging control method described in the first aspect or any one of the possible implementations of the first aspect.
In a sixth aspect, the present application provides a chip or chip system comprising at least one processor and a communication interface, the communication interface and the at least one processor being interconnected by wires, the at least one processor being adapted to execute a computer program or instructions to perform the OTG-based charging control method described in the first aspect or any one of the possible implementations of the first aspect. The communication interface in the chip can be an input/output interface, a pin, a circuit or the like.
In one possible implementation, the chip or chip system described above further includes at least one memory, where the at least one memory has instructions stored therein. The memory may be a memory unit within the chip, such as a register, a cache, etc., or may be a memory unit of the chip (e.g., a read-only memory, a random access memory, etc.).
It should be understood that, the second aspect to the sixth aspect of the present application correspond to the technical solutions of the first aspect of the present application, and the advantages obtained by each aspect and the corresponding possible embodiments are similar, and are not repeated.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 2 is a schematic software structure of a terminal device according to an embodiment of the present application;
fig. 3 is a schematic diagram of an OTG charging scenario provided in an embodiment of the present application;
fig. 4 is a schematic diagram of an OTG-based charge control method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a specific method for OTG-based charging control according to an embodiment of the present application;
fig. 6 is a schematic flow chart of an OTG-based charging control method according to an embodiment of the present application;
fig. 7 is a module interaction flow chart of a detailed OTG-based charging control method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
In order to facilitate the clear description of the technical solutions of the embodiments of the present application, the following simply describes some terms and techniques involved in the embodiments of the present application:
1. OTG technology: OTG technology can achieve data transfer or charging between electronic devices without a personal computer (personal computer, PC). The two terminal devices are illustratively connected through an OTG interface, and the two terminal devices can communicate based on the OTG technology or can be charged based on the OTG technology.
2. Wake-up state: when the system lock resource of the electronic device is locked by the application program, and/or the electronic device is on, the electronic device can keep an awake state. In the wake-up state, the CPU and other components of the electronic device are not powered off, and the electronic device consumes a large amount of power.
3. Sleep state: when the electronic equipment enters a dormant state, memory data can be stored in the hard disk, all parts in the electronic equipment are powered off, all application programs stop running, and the electronic equipment in the dormant state basically does not consume power.
4. Terminology
In embodiments of the present application, the words "first," "second," and the like are used to distinguish between identical or similar items that have substantially the same function and effect. For example, the first chip and the second chip are merely for distinguishing different chips, and the order of the different chips is not limited. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
5. Terminal equipment
The terminal device of the embodiment of the application can also be any form of electronic device, for example, the electronic device can include a handheld device with an image processing function, a vehicle-mounted device and the like. For example, some electronic devices are: a mobile phone, tablet, palm, notebook, mobile internet device (mobile internet device, MID), wearable device, virtual Reality (VR) device, augmented reality (augmented reality, AR) device, wireless terminal in industrial control (industrial control), wireless terminal in unmanned (self driving), wireless terminal in teleoperation (remote medical surgery), wireless terminal in smart grid (smart grid), wireless terminal in transportation security (transportation safety), wireless terminal in smart city (smart city), wireless terminal in smart home (smart home), cellular phone, cordless phone, session initiation protocol (session initiation protocol, SIP) phone, wireless local loop (wireless local loop, WLL) station, personal digital assistant (personal digital assistant, PDA), handheld device with wireless communication function, public computing device or other processing device connected to wireless modem, vehicle-mounted device, wearable device, terminal device in future communication network (public land mobile network), or land mobile communication network, etc. without limiting the application.
By way of example, and not limitation, in embodiments of the application, the electronic device may also be a wearable device. The wearable device can also be called as a wearable intelligent device, and is a generic name for intelligently designing daily wear by applying wearable technology and developing wearable devices, such as glasses, gloves, watches, clothes, shoes and the like. The wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also can realize a powerful function through software support, data interaction and cloud interaction. The generalized wearable intelligent device includes full functionality, large size, and may not rely on the smart phone to implement complete or partial functionality, such as: smart watches or smart glasses, etc., and focus on only certain types of application functions, and need to be used in combination with other devices, such as smart phones, for example, various smart bracelets, smart jewelry, etc. for physical sign monitoring.
In addition, in the embodiment of the application, the electronic equipment can also be terminal equipment in an internet of things (internet of things, ioT) system, and the IoT is an important component of the development of future information technology, and the main technical characteristics of the IoT are that the article is connected with a network through a communication technology, so that the man-machine interconnection and the intelligent network of the internet of things are realized.
The electronic device in the embodiment of the application may also be referred to as: a terminal device, a User Equipment (UE), a Mobile Station (MS), a Mobile Terminal (MT), an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a user terminal, a wireless communication device, a user agent, a user equipment, or the like.
In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a central processing unit (central processing unit, CPU), a memory management unit (memory management unit, MMU), and a memory (also referred to as a main memory). The operating system may be any one or more computer operating systems that implement business processes through processes (processes), such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. The application layer comprises applications such as a browser, an address book, word processing software, instant messaging software and the like.
By way of example, fig. 1 shows a schematic diagram of an electronic device.
The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the application, the electronic device may include more or less components than illustrated, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a USB interface, among others.
It should be understood that the connection relationship between the modules illustrated in the embodiments of the present application is only illustrative, and does not limit the structure of the electronic device. In other embodiments of the present application, the electronic device may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The electronic device implements display functions via a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The electronic device may implement shooting functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer-executable program code that includes instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device (e.g., audio data, phonebook, etc.), and so forth. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor. For example, the OTG-based charge control method of the embodiment of the present application may be performed.
The charge management module 140 may be used to control and protect related functions of battery charging of the terminal device, and the charging process may be terminated when the terminal device completes battery charging. In addition, the charging management module can also provide related functions such as reverse charging for various external devices based on OTG technology.
Fig. 2 is a software configuration block diagram of a terminal device according to an embodiment of the present application. The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun row (Android run) and system libraries, and a kernel layer, respectively.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications for cameras, calendars, phones, maps, games, and the like.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions.
As shown in fig. 2, the application framework layer may include a bluetooth service module, a USB service module, a window manager, a resource manager, a notification manager, a content provider, a view system, and the like.
The Bluetooth service module is used for discovering and pairing other Bluetooth devices, connecting other Bluetooth devices and transmitting data with other Bluetooth devices. For example, in the embodiment of the application, the terminal device can obtain the battery power of the device connected with the terminal device through bluetooth through the bluetooth service module, and realize data interaction with the USB service module.
The USB service module provides rich communication protocol interfaces for realizing communication or charging between terminal devices.
The window manager is used for managing window programs. The window manager may obtain the display screen size, determine if there is a status bar, lock screen, touch screen, drag screen, intercept screen, etc.
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in a status bar, giving out a prompt tone, vibrating a terminal device, flashing an indicator light, etc.
The content provider is used for realizing the function of data sharing among different application programs, allowing one program to access the data in the other program, and simultaneously ensuring the safety of the accessed data.
The view system may be responsible for interface rendering and event handling for the application.
Android runtimes include core libraries and virtual machines. Android run time is responsible for scheduling and management of the Android system. Illustratively, the power management runtime (power manager runtime, PM runtime) in the Android runtime may be used to obtain lock resources of the terminal device, so as to assist the terminal device in managing the power state, the sleep state, the awake state, and the like.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like. For example, in the embodiment of the present application, the virtual machine may be used to perform functions such as detecting an electric quantity state, reverse charging of OTG, and releasing OTG lock by USB drive.
The system library may include a plurality of functional modules. For example: media Libraries (Media Libraries), function Libraries (Function Libraries), graphics processing Libraries (e.g., openGL ES), etc.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The function library provides multiple service API interfaces for the developer, and is convenient for the developer to integrate and realize various functions quickly.
The graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The kernel layer is a layer between hardware and software. The kernel layer may include display drivers, camera drivers, audio drivers, central processor drivers, USB drivers, battery drivers, and the like. For example, in the embodiment of the present application, the USB driver may provide an OTG reverse charging function, and may also perform releasing an OTG lock or holding an OTG lock, and the CPU core may include 1 or more CPU computing units, and may perform wake-up and sleep of the terminal device. The battery drive may monitor the battery status of the terminal device (e.g., battery level, battery temperature, etc.), etc.
With the development of terminal technology, OTG technology has been widely used in mobile terminal devices. The OTG technology enables data exchange, charging, etc. between the terminal devices to be connected with each other.
As shown in fig. 3, taking the charging process of the tablet computer 301 to the handwriting pen 302 as an example, under the condition that the OTG connection function of the tablet computer 301 is opened, the tablet computer 301 is connected to the handwriting pen 302 through the charging rod 303, and then the tablet computer 301 can charge the handwriting pen 302.
When the tablet 301 charges the stylus 302, the tablet 301 will hold the OTG lock and will not enter the sleep state. When the tablet pc 301 stops charging the stylus 302 and the tablet pc 301 and the stylus 302 remain connected, the tablet pc 301 will not release the OTG lock, so that the tablet pc 301 cannot enter the sleep state all the time, and there is a problem of greater power consumption.
In view of this, in the OTG-based charging control method provided by the embodiment of the present application, after the terminal device stops charging the connected device, the terminal device may enter a sleep state, so that power consumption of the terminal device may be reduced, and cruising ability of the terminal device may be improved.
The OTG-based charge control method according to the embodiment of the present application is described in detail below by way of specific examples. The following embodiments may be combined with each other or implemented independently, and the same or similar concepts or processes may not be described in detail in some embodiments.
Fig. 4 shows an OTG-based charge control method according to an embodiment of the present application. The method comprises the following steps:
s401, the first terminal equipment charges the second terminal equipment based on OTG.
When the first terminal device and the second terminal device are connected through the OTG line, if the ID pin in the OTG line connected to the first terminal device is shorted to the ground after the first terminal device detects that the OTG line is inserted, the first terminal device may be used as a main device, and further may output a supply voltage through a battery module of the first terminal device; the OTG interface connected with the second terminal equipment is not provided with an ID pin, and the second terminal equipment can be used as slave equipment, so that the first terminal equipment charges the second terminal equipment based on OTG.
S402, at a first moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment continuously charges the second terminal equipment, the first terminal equipment is in an awake state, and the battery electric quantity of the second terminal equipment is smaller than a first preset value.
In the embodiment of the present application, the first time may be understood as any time when the first terminal device continuously charges the second terminal device based on the OTG.
It should be noted that S402 describes that, when the first terminal device continuously charges the second terminal device, the battery state of the second terminal device at the first moment is a description of a scenario.
In one possible implementation, the first terminal device and/or the second terminal device may not need to sense the magnitude relation between the battery power of the second terminal device and the first preset value. The first preset value may be a larger battery power value, for example, may be any value from 50% to 100%, where the first preset value is derived to facilitate distinguishing between the charging scenario of S402 and the non-charging scenario of S403, and does not necessarily participate in the execution logic of the first terminal device.
In another possible implementation, the first preset value may be the maximum electric quantity that the second terminal device needs to charge, or it may be understood that when the battery electric quantity of the second terminal device does not reach the electric quantity of the first preset value, the first terminal device continuously charges the second terminal device, and when the battery electric quantity of the second terminal device reaches the electric quantity of the first preset value, the first terminal device may stop charging the second terminal device. The first preset value may be preset in the first terminal device, or may be obtained from the second terminal device by the first terminal device, or may be user-defined. The specific value of the first preset value is not limited herein.
For example, the first terminal device may continuously acquire the battery power of the second terminal device, when the first terminal device determines that the battery power value of the second terminal device is less than the first preset value, the first terminal device may continuously charge the second terminal device, and when the first terminal device determines that the battery power value of the second terminal device is greater than or equal to the first preset value, the first terminal device may stop charging the second terminal device.
S403, at a second moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment does not charge the second terminal equipment, the first terminal equipment is in a dormant state, the battery electric quantity of the second terminal equipment is larger than or equal to a first preset value, and the second moment is later than the first moment.
In the embodiment of the present application, the second time may be understood as any time after the first terminal device stops charging the second terminal device, and the first terminal device has entered the sleep state before the second time. For example, the second time may be a time corresponding to when the first terminal device just stops charging the second terminal device; the second time may be any time after the first terminal device stops charging the second terminal device.
It should be noted that S403 describes that when the first terminal device stops charging the second terminal device, the battery state of the second terminal device at the second moment is a description of a scenario.
In one possible implementation, the first terminal device and/or the second terminal device may not need to sense the magnitude relation between the battery power of the second terminal device and the first preset value, where the first preset value is led out to facilitate distinguishing between the charging scenario of S402 and the non-charging scenario of S403, and does not necessarily participate in the execution logic of the first terminal device.
In another possible implementation, the second time may be a time corresponding to when the first terminal device just stops charging the second terminal device, the first preset value may be a maximum electric quantity that the second terminal device needs to charge, and when the battery electric quantity of the second terminal device reaches the electric quantity of the first preset value, the first terminal device may stop charging the second terminal device and execute the step of entering the sleep state. The first preset value may refer to the description of S402, which is not described in detail.
In the embodiment of the present application, the first terminal device may enter the sleep state through any possible implementation, and the embodiment of the present application does not limit how the first terminal device enters the sleep state. In summary, in the embodiment of the present application, after the first terminal device stops charging the second terminal device, the first terminal device may enter a sleep state, so that power consumption of the first terminal device may be reduced, and endurance of the first terminal device may be improved.
Optionally, on the basis of the embodiment corresponding to fig. 4, the entering the sleep state by the first terminal device may include: the first terminal device may release the OTG lock and thereby enter a dormant state. Fig. 5 illustrates a specific method for OTG-based charging control according to an embodiment of the present application, where the specific method includes:
s501, the first terminal equipment charges the second terminal equipment based on OTG.
S502, at a first moment, the first terminal equipment is kept connected with the OTG of the second terminal equipment, the first terminal equipment continuously charges the second terminal equipment, the first terminal equipment is in an awake state, and the battery electric quantity of the second terminal equipment is smaller than a first preset value.
S501 and S502 may refer to descriptions of S401 and S402, and are not described in detail.
S503, the first terminal device determines that the electric quantity of the second terminal device is larger than or equal to a second preset value; the second preset value is greater than or equal to the first preset value.
In the embodiment of the application, the second preset value can be used for judging whether the first terminal equipment stops charging the second terminal equipment, and the second preset value can be preset in the first terminal equipment, can be obtained from the second terminal equipment by the first terminal equipment, or can be user-defined in the first terminal equipment. The embodiment of the present application is not limited herein with respect to the specific value of the second preset value. For example, the second preset value may be any value from 80% to 100%. When the battery power value of the second terminal device does not reach a second preset value, the first terminal device can continue to charge the second terminal device; when the battery power value of the second terminal device reaches the second preset value, the first terminal device may stop charging the second terminal device.
The first terminal device may determine that the electric quantity of the second terminal device is greater than or equal to a second preset value based on the electric quantity of the second terminal device acquired by the first terminal device, and the first terminal device may also determine that the electric quantity of the second terminal device is greater than or equal to the second preset value based on an indication of the second terminal device.
In an exemplary implementation, the first terminal device may obtain the battery power of the second terminal device according to the first period, and determine whether the power of the second terminal device is greater than or equal to a second preset value.
The first period may represent a period in which the first terminal device obtains a battery level of the second terminal device during a process of charging the second terminal device by the first terminal device. The first period may be preset in the first terminal device, for example, the first period may be set such that the first terminal device acquires the battery power value of the second terminal device every 5 s. The first period may also be a period in which the second terminal device sends the battery power of the second terminal device to the first terminal device, or may be user-defined in the first terminal device. Embodiments of the present application are not limited herein with respect to the specific value of the first period.
The first terminal device may obtain the battery power value of the second terminal device via bluetooth, for example. After the first terminal device and the second terminal device are mutually paired in Bluetooth, a Bluetooth channel can be established, and the first terminal device can acquire the battery power value of the second terminal device through the Bluetooth channel. In this way, the first terminal device can sense the battery power of the second terminal device in real time.
In another possible implementation manner, the first terminal device may receive information from the second terminal device, where the information is used to indicate that the electric quantity of the second terminal device is greater than or equal to a second preset value.
The information may be a battery power value reported by the second terminal device when the second terminal device reaches a second preset value, or may be a full power field identifier reported by the second terminal device when the second terminal device reaches the second preset value, and specifically, a full power information type reported by the second terminal device, which is not limited in this embodiment of the present application. In this way, the first terminal device can reduce communication interaction with the second terminal device, and power consumption and calculation force of the first terminal device are saved.
S504, the first terminal equipment releases the OTG lock.
In the embodiment of the present application, the OTG lock may be managed by a USB driver in the first terminal device, for example, when the first terminal device charges to the second terminal device based on OTG, the USB driver of the first terminal device may perform the OTG lock, and when the first terminal device stops charging to the second terminal device, the USB driver of the first terminal device may release the OTG lock.
For example, when the first terminal device determines that the electric quantity of the second terminal device is greater than or equal to the second preset value, the first terminal device may stop charging the second terminal device, and the first terminal device may implement releasing the OTG lock based on the bluetooth service module, the USB service module, and the USB driver of the first terminal device.
For example, the bluetooth service module of the first terminal device may determine, according to the obtained battery power value of the second terminal device, whether the battery power of the second terminal device reaches a second preset value, and send a message for releasing the OTG lock to the USB service module of the first terminal device when the battery power of the second terminal device reaches the second preset value. The USB service module of the first terminal device may receive the message transmitted by the bluetooth service module of the first terminal device, and further notify the USB driver of the first terminal device to release the OTG lock. The USB driver of the first terminal device may be configured to receive the notification of releasing the OTG lock delivered by the USB service module of the first terminal device, and release the OTG lock.
In a specific possible implementation, the first terminal device releasing the OTG lock may include the bluetooth service module of the first terminal device sending a field identifier for releasing the wake lock to the USB service module of the first terminal device, where the USB service module of the first terminal device receives and parses the field identifier, and notifies the USB driver of the first terminal device to release the OTG lock. The value of the field identifier of the unlock wakeup lock may be an integer, boolean or other type of field, for example, the field identifier of the unlock wakeup lock may be set to false, and the field identifier of the unlock wakeup lock may be set to true. The specific value of this field identification, embodiments of the present application are not limited in this regard.
In one possible implementation of sending, by the bluetooth service module of the first terminal device, a field identifier for releasing the wakeup lock to the USB service module of the first terminal device, the bluetooth service module of the first terminal device may send, after determining the electric quantity value of the second terminal device each time, a message of the field identifier to the USB service module of the first terminal device, where the field identifier may be for releasing the wakeup lock or may be for not releasing the wakeup lock. The USB service module of the first terminal device may determine whether to notify the USB driver of the first terminal device to release the OTG lock by receiving and analyzing the field identifier. If the field identifier indicates that the wakeup lock is released, the USB service module of the first terminal device may notify the USB driver of the first terminal device to release the OTG lock.
In another possible implementation of the method for transmitting the field identifier for releasing the wakeup lock to the USB service module of the first terminal device, the bluetooth service module of the first terminal device may transmit the field identifier message for releasing the wakeup lock to the USB service module of the first terminal device after determining that the battery power of the second terminal device reaches the second preset value, and the USB service module of the first terminal device may receive the message for releasing the wakeup lock transmitted by the bluetooth service module of the first terminal device and notify the USB driver of the first terminal device to release the OTG lock.
In the embodiment of the application, the release of the OTG lock can be realized conveniently based on interaction of the Bluetooth service module, the USB service module and the USB drive of the first terminal equipment.
S505, when the first terminal equipment detects that the first terminal equipment does not receive the triggering operation within the preset time, and locks in the first terminal equipment for preventing the first terminal equipment from dormancy are all in a release state, the first terminal equipment enters a dormancy state.
In the embodiment of the present application, the triggering operation may be any user operation received by the first terminal device, for example, a touch operation performed by a user on a display screen of the first terminal device, a voice input by the user to the first terminal device, and the embodiment of the present application is not limited herein.
The lock for preventing the first terminal device from being dormant may include any lock capable of preventing the first terminal device from being dormant, such as an OTG lock. In a possible implementation of the first terminal device entering the sleep state, when the first terminal device detects that the trigger operation is not received within a preset duration, and locks in the first terminal device for preventing the first terminal device from being dormant are all in a release state, the first terminal device may enter the sleep state. The preset duration may be preset by the first terminal device according to experience, for example, the preset duration may be set to any value between 1 and 10 seconds(s), such as 5s, and the embodiment of the present application is not limited herein for a specific value of the preset duration. In this way, the first terminal device sets the sleep state through the preset duration, and can enter the sleep state on the premise that the user does not trigger operation in a period of time, so that when the user triggers operation in the period of time, frequent operation is not needed, the terminal device exits the sleep state, and user experience is improved.
In another possible implementation of the first terminal device entering the sleep state, when the first terminal device detects that the locks for preventing the first terminal device from sleeping are both released, and no trigger operation is received, the first terminal device may immediately enter the sleep state. Therefore, the first terminal equipment can enter the dormant state in time on the premise of releasing the lock, and power consumption is reduced.
Optionally, on the basis of the embodiment corresponding to fig. 4, after the second moment, the first terminal device may further recharge the second terminal device, where recharging may be understood as a process that the first terminal device remains connected to the second terminal device, and when the electric quantity of the second terminal device is consumed to a certain value, the first terminal device resumes charging the second terminal device, so that the cycle is circulated. Reference may be made specifically to the descriptions of S506 to S508.
S506, the first terminal device determines that the electric quantity of the second terminal device is smaller than or equal to a third preset value; the third preset value is less than or equal to the first preset value.
In the embodiment of the application, after the first terminal device enters the sleep state, the first terminal device can acquire the battery power of the second terminal device according to the second period, wherein the second period is greater than the first period. Thus, the first terminal device does not need to frequently inquire the electric quantity of the second terminal device after dormancy, and the power consumption of the first terminal device can be kept small.
The second period may represent a period in which the first terminal device queries the battery level of the second terminal device after hibernation. After the first terminal device stops charging the second terminal device and the first terminal device is in a dormant state, the battery power of the second terminal device gradually decreases along with the consumption of the battery power of the second terminal device, and the first terminal device can periodically inquire the battery power of the second terminal device. And when the electric quantity of the second terminal equipment is smaller than a third preset value, the first terminal equipment can recharge the second terminal equipment. The second period may be preset in the first terminal device, for example, the second period may be set so that the first terminal device obtains the battery power value of the second terminal device every 50 s. And the user-defined setting in the first terminal equipment is also possible. Embodiments of the present application are not limited herein with respect to the specific values of the second period.
The third preset value may be used to determine whether recharging of the second terminal device is required. For example, when the battery power value of the second terminal device is greater than or equal to the third preset value, the first terminal device may not charge the second terminal device; when the battery power value of the second terminal device is smaller than the third preset value, the first terminal device can recharge the second terminal device. The third preset value may be preset in the first terminal device, or may be obtained from the second terminal device by the first terminal device, or may be user-defined in the first terminal device. The specific value of the third preset value is not limited herein.
S507, the first terminal equipment performs OTG locking.
S508, the first terminal equipment resumes the wake-up state and charges the second terminal equipment.
In one possible method for restoring the wake-up state of the first terminal device, the USB driver of the first terminal device may prevent the first terminal device from continuing to sleep by holding the wakeup lock again, so as to restore the wake-up state of the first terminal device.
In another possible method for the first terminal device to resume the awake state, the first terminal device may prevent the first terminal device from continuing to sleep by receiving a broadcast message with a lower battery level of the second terminal device by the broadcast receiver, so as to resume the awake state of the first terminal device. The specific method for recovering the wake-up state of the first terminal device is not limited herein.
In the embodiment of the application, after the first terminal equipment stops charging the second terminal equipment, the first terminal equipment can periodically acquire the battery power of the second terminal equipment. When the first terminal device judges that the battery power of the second terminal device is lower, the first terminal device can recharge the second terminal device, so that the power of the second terminal device can keep a higher value.
It will be appreciated that after S508, the steps of S503-S508 may be re-performed, enabling one or more recharging, so that the power of the second terminal device can be kept at a higher value.
Specifically, fig. 6 is a schematic flow chart of an OTG-based charging control method according to an embodiment of the present application. The specific steps can be as follows:
s601, the second terminal equipment can obtain a battery power value through a power module of the second terminal equipment, and the obtained battery power value is stored in a buffer area, so that the first terminal equipment can obtain the battery power value through Bluetooth. The battery power value of the second terminal device can be obtained by periodically inquiring the power module of the second terminal device through the second terminal device.
S602, the first terminal equipment periodically acquires the battery power value of the second terminal equipment through the established Bluetooth channel. It will be appreciated that the period in which the first terminal device obtains the battery power value of the second terminal device may be the same as or different from the period in which the second terminal device queries the power module to obtain the battery power value.
S603, the Bluetooth service module of the first terminal equipment judges whether the first terminal equipment needs to continuously charge the second terminal equipment according to the acquired battery power value. The specific judging method can refer to the description of the corresponding embodiment of fig. 4 and fig. 5, and will not be repeated.
S604, if the first terminal device needs to continue charging the second terminal device, the field identifier for releasing the wakeup lock may be set to false by default, and the Bluetooth service module of the first terminal device may send a field identifier message for not releasing the wakeup lock to the USB service module of the first terminal device.
S605, if the first terminal device does not need to charge the second terminal device, the Bluetooth service module of the first terminal device can set a field identifier for releasing the wakeup lock as true, and the Bluetooth service module of the first terminal device sends a field identifier message for releasing the wakeup lock to the USB service module of the first terminal device.
S606, the USB service module of the first terminal equipment receives and analyzes the field identification message transmitted by the Bluetooth service module of the first terminal equipment.
S607, if the value of the field identifier is false, which indicates that the first terminal device needs to continue charging the second terminal device, the USB driver of the first terminal device is not notified to release the OTG lock, and the first terminal device can continue to maintain the wake-up state to charge the second terminal device.
S608, if the value of the field identifier is true, which indicates that the first terminal device may stop charging the second terminal device, the USB driver of the first terminal device may be further notified to release the OTG lock. The USB driver of the first terminal device receives the notification of releasing the OTG lock transmitted by the USB service module of the first terminal device, and releases the OTG lock, so that the first terminal device can enter a dormant state.
S609, when the first terminal equipment is in a dormant state, a certain heartbeat can be kept, and the battery electric quantity of the second terminal equipment is periodically inquired to judge whether the second terminal equipment needs to be charged again.
It should be noted that, for the second terminal device, when the second terminal device is full of electric quantity, the power module of the second terminal device may also actively report an event of full electric quantity to the bluetooth service module of the second terminal device, so that the second terminal device may know that the electric quantity is full, and in a possible implementation, the second terminal device may also send information of full electric quantity to the first terminal device.
According to the OTG-based charging control method provided by the embodiment of the application, after the first terminal equipment stops charging the second terminal equipment, the first terminal equipment can release the OTG lock and enter a dormant state, so that the power consumption of the terminal equipment is reduced.
As shown in fig. 7, an embodiment of the present application shows a detailed module interaction flowchart of an OTG-based charge control method. The first terminal device may include a short-range connection device, a bluetooth service module, a USB driver, a power management run time, a CPU core, etc., where the bluetooth service module, the USB driver, the power management run time, and the CPU core may refer to S504 and the description of the software structure of the corresponding terminal device in fig. 2 specifically, which is not described herein. The short-range connection device can realize relevant functions such as Bluetooth, wireless fidelity (wireless fidelity, WIFI) technology, global positioning system (global position system, GPS) and the like. The specific interaction process comprises the following steps:
After the first terminal device is connected with the second terminal device through a USB OTG line, the USB driver of the first terminal device can charge the second terminal device by using an OTG function, and the USB driver of the first terminal device is provided with a wakeup lock to prevent the first terminal device from entering a dormant state.
The short-distance connection device of the first terminal device can periodically acquire the battery power value of the second terminal device through the Bluetooth channel established with the second terminal device, and send the battery power value of the second terminal device to the Bluetooth service module of the first terminal device. The bluetooth service module of the first terminal device can judge whether the first terminal device needs to stop charging the second terminal device or not according to the acquired battery power value of the second terminal device. If the Bluetooth service module of the first terminal device judges that the first terminal device can stop charging the second terminal device, the field identification information for releasing the wakeup lock can be sent to the USB service module of the first terminal device, and after the USB service module of the first terminal device receives and analyzes the field identification information, the USB drive of the first terminal device can be informed of releasing the wakeup lock, and further, the USB drive of the first terminal device executes the release of the OTG lock.
When the CPU core of the first terminal equipment detects that the first terminal equipment does not receive the triggering operation within the preset time, and the CPU core of the first terminal equipment inquires that the locks in the power management runtime are in a release state, the first terminal equipment can enter a dormant state.
In one possible implementation, after the first terminal device enters the sleep state, the CPU core of the first terminal device may maintain a certain heartbeat, and periodically query the battery power of the second terminal device to determine whether to recharge the second terminal device.
In the embodiment of the application, after the first terminal equipment stops charging the second terminal equipment, the first terminal equipment can enter the dormant state, so that the power consumption of the first terminal equipment is reduced, and the cruising ability of the first terminal equipment is improved.
The foregoing description of the solution provided by the embodiments of the present application has been mainly presented in terms of a method. To achieve the above functions, it includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the present application may be implemented in hardware or a combination of hardware and computer software, as the method steps of the examples described in connection with the embodiments disclosed herein. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the device for realizing the OTG-based charging control method according to the method example, for example, each functional module can be divided corresponding to each function, and two or more functions can be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Fig. 8 is a schematic structural diagram of a chip according to an embodiment of the present application. Chip 800 includes one or more (including two) processors 801, communication lines 802, communication interfaces 803, and memory 804.
In some implementations, the memory 804 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
The methods described in the embodiments of the present application may be applied to the processor 801 or implemented by the processor 801. The processor 801 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry in hardware in the processor 801 or by instructions in software. The processor 801 may be a general purpose processor (e.g., a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), an off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic device, discrete gates, transistor logic, or discrete hardware components, and the processor 801 may implement or perform the methods, steps, and logic diagrams associated with the various processes disclosed in embodiments of the application.
The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a state-of-the-art storage medium such as random access memory, read-only memory, programmable read-only memory, or charged erasable programmable memory (electrically erasable programmable read only memory, EEPROM). The storage medium is located in the memory 804, and the processor 801 reads information in the memory 804 and performs the steps of the method described above in combination with its hardware.
The processor 801, the memory 804, and the communication interface 803 may communicate with each other via a communication line 802.
In the above embodiments, the instructions stored by the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be written in the memory in advance, or may be downloaded in the form of software and installed in the memory.
Embodiments of the present application also provide a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL), or wireless (e.g., infrared, wireless, microwave, etc.), or semiconductor medium (e.g., solid state disk, SSD)) or the like.
The embodiment of the application also provides a computer readable storage medium. The methods described in the above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer readable media can include computer storage media and communication media and can include any medium that can transfer a computer program from one place to another. The storage media may be any target media that is accessible by a computer.
As one possible design, the computer-readable medium may include compact disk read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disk memory; the computer readable medium may include disk storage or other disk storage devices. Moreover, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital versatile disc (digital versatile disc, DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

Claims (11)

1. An OTG-based charge control method, the method comprising:
the first terminal equipment charges the second terminal equipment based on OTG;
at a first moment, the first terminal equipment keeps OTG connection with the second terminal equipment, the first terminal equipment continuously charges the second terminal equipment, the first terminal equipment is in an awake state, and the battery capacity of the second terminal equipment is smaller than a first preset value;
At a second moment, the first terminal equipment keeps OTG connection with the second terminal equipment, the first terminal equipment does not charge the second terminal equipment, the first terminal equipment is in a dormant state, the battery capacity of the second terminal equipment is larger than or equal to the first preset value, and the second moment is later than the first moment.
2. The method of claim 1, further comprising, between the first time and the second time:
when the first terminal device determines that the electric quantity of the second terminal device is larger than or equal to a second preset value, the first terminal device releases an OTG lock; the second preset value is greater than or equal to the first preset value.
3. The method of claim 2, wherein the first terminal device includes a bluetooth service module, a USB service module, and a USB driver, and wherein the first terminal device releases an OTG lock, comprising:
the Bluetooth service module of the first terminal equipment indicates to the USB service module to release an OTG lock;
and the USB service module of the first terminal equipment informs the USB driver to release the OTG lock.
4. A method according to claim 3, wherein the bluetooth service module of the first terminal device indicates to the USB service module to release an OTG lock, comprising: the Bluetooth service module of the first terminal equipment sends a field identifier for releasing a wakeup lock to the USB service module;
The USB service module of the first terminal device notifying the USB driver to release the OTG lock includes: and the USB service module of the first terminal equipment analyzes the field identification and informs the USB driver to release the OTG lock.
5. The method according to any of claims 2-4, wherein after the first terminal device releases the OTG lock, further comprising:
and when the first terminal equipment detects that the first terminal equipment does not receive the triggering operation within a preset time period, and the locks in the first terminal equipment for preventing the first terminal equipment from dormancy are in a release state, the first terminal equipment enters the dormancy state.
6. The method according to any one of claims 2-5, wherein when the first terminal device determines that the power of the second terminal device is greater than or equal to a second preset value, before the first terminal device releases the OTG lock, the method further comprises:
the first terminal equipment acquires the battery electric quantity of the second terminal equipment according to a first period;
or the first terminal equipment receives information from the second terminal equipment, wherein the information is used for indicating that the electric quantity of the second terminal equipment is larger than or equal to the second preset value.
7. The method of any of claims 1-6, further comprising, after the second time, a step of:
the first terminal equipment acquires the battery electric quantity of the second terminal equipment according to a second period, wherein the second period is larger than the first period;
when the first terminal device determines that the electric quantity of the second terminal device is smaller than or equal to a third preset value, the first terminal device performs OTG locking, and the third preset value is smaller than or equal to the first preset value;
and the first terminal equipment resumes the awakening state and charges the second terminal equipment.
8. The method of claim 7, wherein after the first terminal device resumes the awake state and charges the second terminal device, further comprising:
when the first terminal device determines that the electric quantity of the second terminal device is greater than or equal to a second preset value, the first terminal device releases an OTG lock and enters the dormant state again, and the second terminal device is not charged.
9. A terminal device, comprising: memory for storing a computer program, and a processor for executing the computer program to perform the OTG-based charge control method according to any one of claims 1 to 8.
10. A computer readable storage medium storing instructions that, when executed, cause a computer to perform the OTG-based charge control method of any of claims 1-8.
11. A computer program product comprising a computer program which, when run, causes an electronic device to perform the OTG-based charging control method of any of claims 1-8.
CN202211085690.6A 2022-09-06 2022-09-06 OTG-based charging control method and related device Active CN116707048B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211085690.6A CN116707048B (en) 2022-09-06 2022-09-06 OTG-based charging control method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211085690.6A CN116707048B (en) 2022-09-06 2022-09-06 OTG-based charging control method and related device

Publications (2)

Publication Number Publication Date
CN116707048A true CN116707048A (en) 2023-09-05
CN116707048B CN116707048B (en) 2024-06-25

Family

ID=87826358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211085690.6A Active CN116707048B (en) 2022-09-06 2022-09-06 OTG-based charging control method and related device

Country Status (1)

Country Link
CN (1) CN116707048B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005287278A (en) * 2004-03-31 2005-10-13 Casio Comput Co Ltd Device and method for controlling charge of electronic terminal
CN104362687A (en) * 2014-10-24 2015-02-18 福建联迪商用设备有限公司 Bidirectional power balance method and device based on USB-OTG
CN106684967A (en) * 2016-11-29 2017-05-17 维沃移动通信有限公司 Charging method for mobile terminal and mobile terminal
CN106802872A (en) * 2016-12-16 2017-06-06 华勤通讯技术有限公司 A kind of method and terminal that equipment room charging is carried out by USB interface
WO2017206890A1 (en) * 2016-05-31 2017-12-07 广东欧珀移动通信有限公司 Wakeup lock-based processing method and apparatus, storage medium, and electronic device
WO2018113128A1 (en) * 2016-12-20 2018-06-28 华为技术有限公司 Method for recognizing plug-and-play device, and electronic device
CN108631401A (en) * 2018-05-23 2018-10-09 北京小米移动软件有限公司 Charging circuit, method, electronic equipment and storage medium
CN108988404A (en) * 2017-05-31 2018-12-11 维沃移动通信有限公司 A kind of method and mobile terminal of mobile terminal charging
CN112311029A (en) * 2019-07-30 2021-02-02 华为技术有限公司 Charging method, electronic device and storage medium
US20210175735A1 (en) * 2019-12-06 2021-06-10 Beijing Xiaomi Mobile Software Co., Ltd. Charging circuit, electronic device, charging control method and device
CN113013934A (en) * 2019-12-19 2021-06-22 华为技术有限公司 Electronic equipment, electronic device and charging method
CN114816031A (en) * 2022-05-09 2022-07-29 海信电子科技(深圳)有限公司 Power saving method of terminal device, terminal device and medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005287278A (en) * 2004-03-31 2005-10-13 Casio Comput Co Ltd Device and method for controlling charge of electronic terminal
CN104362687A (en) * 2014-10-24 2015-02-18 福建联迪商用设备有限公司 Bidirectional power balance method and device based on USB-OTG
WO2017206890A1 (en) * 2016-05-31 2017-12-07 广东欧珀移动通信有限公司 Wakeup lock-based processing method and apparatus, storage medium, and electronic device
CN106684967A (en) * 2016-11-29 2017-05-17 维沃移动通信有限公司 Charging method for mobile terminal and mobile terminal
CN106802872A (en) * 2016-12-16 2017-06-06 华勤通讯技术有限公司 A kind of method and terminal that equipment room charging is carried out by USB interface
CN108475245A (en) * 2016-12-20 2018-08-31 华为技术有限公司 The recognition methods of PnP device and electronic equipment
WO2018113128A1 (en) * 2016-12-20 2018-06-28 华为技术有限公司 Method for recognizing plug-and-play device, and electronic device
CN108988404A (en) * 2017-05-31 2018-12-11 维沃移动通信有限公司 A kind of method and mobile terminal of mobile terminal charging
CN108631401A (en) * 2018-05-23 2018-10-09 北京小米移动软件有限公司 Charging circuit, method, electronic equipment and storage medium
CN112311029A (en) * 2019-07-30 2021-02-02 华为技术有限公司 Charging method, electronic device and storage medium
WO2021017823A1 (en) * 2019-07-30 2021-02-04 华为技术有限公司 Charging method, electronic device and storage medium
US20210175735A1 (en) * 2019-12-06 2021-06-10 Beijing Xiaomi Mobile Software Co., Ltd. Charging circuit, electronic device, charging control method and device
CN113013934A (en) * 2019-12-19 2021-06-22 华为技术有限公司 Electronic equipment, electronic device and charging method
CN114816031A (en) * 2022-05-09 2022-07-29 海信电子科技(深圳)有限公司 Power saving method of terminal device, terminal device and medium

Also Published As

Publication number Publication date
CN116707048B (en) 2024-06-25

Similar Documents

Publication Publication Date Title
KR102148948B1 (en) Multi tasking method of electronic apparatus and electronic apparatus thereof
WO2023051355A1 (en) Permission check method and electronic device
CN116707048B (en) OTG-based charging control method and related device
CN115835135A (en) CELL fence matching method and electronic equipment
CN115904851A (en) Terminal equipment and external equipment access detection system
WO2021238376A1 (en) Function pack loading method and apparatus, and server and electronic device
CN116501534B (en) Charging abnormality management method and related device
CN116088970B (en) Method for controlling application call and related device
CN115902766B (en) Measurement method and related device
CN116069697B (en) Type-C interface level control method and related device
CN116365670B (en) Charging control method, device and storage medium
CN116737037B (en) Stack management method in interface display and related device
CN115421599B (en) Input method display control method and related device
CN116196621B (en) Application processing method and related device
CN116736999B (en) Control method of electronic equipment and electronic equipment
CN116701101B (en) SensorHUB abnormality detection method and electronic equipment
CN117271170B (en) Activity event processing method and related equipment
CN116737104B (en) Volume adjusting method and related device
CN116737258B (en) Method and related device for unloading application
CN116089110B (en) Method for controlling process interaction and related device
CN117116258B (en) Voice awakening method and electronic equipment
CN116708615B (en) Device registration method, device registration apparatus and storage medium
WO2024055867A1 (en) Application cloning-based interface display method and related apparatus
CN118519512A (en) Exception handling method and related device
CN117858279A (en) SIM card service processing method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant