Port identification method and device, mobile terminal and computer program product
By identifying and re-identifying the port type of the charging interface in the mobile terminal, the problem of slow charging caused by misidentification of the charging interface is solved, achieving faster charging speed and higher charging efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-03-31
AI Technical Summary
Mobile terminals are prone to misidentifying port types during the charging interface identification process, which slows down the charging speed and affects the user experience.
When other electronic devices are detected connected to the charging interface, the port type is identified and re-identified. If the port type has a maximum charging current less than or equal to a first current threshold, it is charged according to the first charging mode; if the port type has a faster charging speed, it is charged according to the second charging mode, thus avoiding slow charging caused by misidentification.
It improves the charging speed of mobile terminals, ensures the accuracy and efficiency of the charging process, and avoids slow charging problems caused by misidentification.
Smart Images

Figure CN121770118A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of charging technology, specifically to a port identification method and device, a mobile terminal, and a computer program product. Background Technology
[0002] As mobile terminals integrate more and more functions, the types of ports for other interfaces connected to the charging interface of mobile terminals are also increasing, such as: ports for data transmission only, ports for charging only, or ports that can achieve both data transmission and charging.
[0003] In practice, it has been found that various factors may cause mobile terminals to incorrectly identify port types, thereby affecting the functionality of mobile terminals. Therefore, how to accurately identify the access port type is an urgent problem that needs to be optimized. Summary of the Invention
[0004] This application discloses a port identification method and device, a mobile terminal, and a computer program product, which can avoid the problem of slow charging of the mobile terminal due to misidentification of the access port type, thereby ensuring the charging speed of the mobile terminal.
[0005] The first aspect of this application discloses a port identification method applied to a mobile terminal, the method comprising: When it is detected that the charging port of the mobile terminal is connected to another electronic device, the port type corresponding to the target interface of the electronic device is identified, and the target interface is the interface through which the electronic device connects to the mobile terminal; If the port type is the first port type, then the port type corresponding to the target interface of the electronic device is re-identified, and if the re-identified port type is the first port type, charging is performed according to the first charging mode, wherein the first port type is a port type whose maximum charging current is less than or equal to a first current threshold. If the port type is the second port type, then charging is performed according to the second charging mode, and the charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0006] A second aspect of this application discloses a port identification device applied to a mobile terminal, the device comprising: The identification unit is used to identify the port type corresponding to the target interface of the electronic device when it is detected that the charging interface of the mobile terminal is connected to another electronic device, wherein the target interface is the interface through which the electronic device is connected to the mobile terminal; The identification unit is further configured to, when the port type is the first port type, re-identify the port type corresponding to the target interface of the electronic device, and if the re-identified port type is the first port type, charge according to the first charging mode, wherein the first port type is a port type whose maximum charging current is less than or equal to a first current threshold. The first charging unit is used to charge the device according to a second charging mode when the port type is the second port type, wherein the charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0007] A third aspect of this application discloses a mobile terminal, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute the method disclosed in the first aspect of this application.
[0008] A fourth aspect of this application discloses a computer-readable storage medium storing a computer program, wherein the computer program causes a computer to perform the method disclosed in the first aspect of this application.
[0009] The fifth aspect of this application discloses a computer program product that, when run on a computer, causes the computer to perform some or all of the steps of any of the methods disclosed in the first aspect of this application.
[0010] The sixth aspect of this application discloses an application publishing platform for publishing computer program products, wherein when the computer program products are run on a computer, the computer performs some or all of the steps of any of the methods disclosed in the first aspect of this application.
[0011] Compared with related technologies, the embodiments of this application have the following beneficial effects: The port identification method disclosed in this application can be applied to a mobile terminal. When the mobile terminal detects that its charging port is connected to another electronic device, it can identify the port type corresponding to the target interface of the electronic device. The target interface is the interface through which the electronic device connects to the mobile terminal. If the port type is a first port type, the port type corresponding to the target interface of the electronic device is re-identified. If the re-identified port type is the first port type, charging is performed according to a first charging mode. The first port type is a port type whose maximum charging current is less than or equal to a first current threshold. If the port type is a second port type, charging is performed according to a second charging mode. The charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0012] By implementing the embodiments of this application, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid slow charging due to misidentification of the accessed port type, thereby ensuring the charging speed of the mobile terminal. In addition, if the target interface is identified as a second port type with a faster charging speed, it is not necessary to re-identify the interface type of the target interface, and charging can be performed according to the second charging mode with a faster charging speed to improve the charging speed of the mobile terminal. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a schematic diagram of the structure of a mobile terminal disclosed in an embodiment of this application; Figure 2 This is a flowchart illustrating a port identification method disclosed in an embodiment of this application; Figure 3 This is a flowchart illustrating another port identification method disclosed in an embodiment of this application; Figure 4 This is a flowchart illustrating another port identification method disclosed in the embodiments of this application; Figure 5 This is a schematic diagram of a method process disclosed in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a port identification device disclosed in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a mobile terminal disclosed in an embodiment of this application. Detailed Implementation
[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0016] It should be noted that the terms "first," "second," "third," and "fourth," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "having," and any variations thereof, in the embodiments of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0017] This application discloses a port identification method and device, a mobile terminal, and a computer program product, which can avoid the problem of slow charging of the mobile terminal due to misidentification of the access port type, thereby ensuring the charging speed of the mobile terminal.
[0018] The technical solution of this application will be described in detail below with reference to specific embodiments.
[0019] To more clearly illustrate the port identification method disclosed in the embodiments of this application, port identification methods in related technologies will be introduced first.
[0020] The BC1.2 (Battery Charging Specification 1.2) specification defines three different types of USB (Universal Serial Bus) ports: Standard Downstream Port (SDP), Dedicated Charging Port (DCP), and Charging Downstream Port (CDP), as well as protocols for identifying port types.
[0021] The standard downstream port (SDP) is a typical port of a personal computer (PC). This type of port has pull-down resistors on both D+ and D-, and the maximum charging current is 500mA.
[0022] Dedicated charging ports (DCPs) are ports for adapters, car chargers, etc. The D+ and D- terminals of the port are shorted and do not need to be enumerated.
[0023] Downlink charging port (CDP): This type of port supports high-current 1.5A charging and is also compatible with USB 2.0 data transfer. Because it can support data transfer, D+ and D- also have pull-down resistors.
[0024] The D+ and D- pins are a pair of differential communication pins, and also the core hardware carriers for USB data transmission and charging port identification. D+ (Data Positive) is the positive data line, and D- (Data Negative) is the negative data line. Together, they form a differential signal line, transmitting signals through the level difference between the two lines. This provides much stronger anti-interference capabilities than single-ended signal lines, and is the foundation for stable communication in the USB protocol.
[0025] The process of detecting the port type includes: Initial detection: This stage mainly determines whether the USB port is for charging or data transmission. First, the switches VDP_SRC and IDM_SINK in the mobile terminal are closed, and the voltage VDP_SRC is connected to the D+ port. The voltage of the D+ port is generally 0.6V. Then, the voltage of the D- port is detected. If the detected D- port voltage is less than the specified reference voltage, i.e., VD- < VDAT_REF, the port is determined to be of type SDP; if it is greater than the specified reference voltage, it is determined to be of type CDP or DCP for charging applications.
[0026] Secondary detection: This stage confirms whether the USB port supports data transfer protocols after it is designated as a charging port, thus distinguishing between CDP and DCP types. First, the VDM_SRC switch is closed, pulling D- high to 0.6V. Then, the voltage of D+ is detected. If D+ is less than the specified reference voltage (VD+ < VDAT_REF), the port is determined to be of CDP type; if it is greater than the specified reference voltage, the port is determined to be of DCP type.
[0027] In related technologies, mobile terminals can use their included power management integrated circuit (PMIC) module to operate the D+ and D- communication pins to perform BC1.2 charging protocol identification in order to identify whether the port type of the accessed interface is SDP, CDP, or DCP.
[0028] However, in practice, it has been found that other physical transceiver modules in mobile terminals also operate the D+ and D- communication pins, which in turn affects the PMIC module's ability to identify the port type of the access interface.
[0029] For example, please refer to Figure 1 , Figure 1 This is a schematic diagram of the structure of a mobile terminal disclosed in an embodiment of this application. The mobile terminal 102 may include a PMIC module 104, a UFCS PHY module 106, a VOOC PHY module 108, and an eUSB module 110.
[0030] Among them, the UFCS PHY module 106 is a physical transceiver module that integrates the Universal Fast Charging Specification (UFCS) fast charging protocol. The UFCS logic layer interacts with the adapter by reading and writing data on D+ and D- according to the state machine of the fast charging protocol. The VOOC PHY module 108 is a physical transceiver module for the fast charging protocol. The VOOC logic layer interacts with the VOOC adapter by reading and writing data on D+ and D-. The eUSB module 110 is a physical transceiver module that interacts between the host and the device after the interface is identified as SDP type. Its interaction data is exchanged with the computer through D+ and D-.
[0031] In practice, it has been found that due to malfunctions in the D+ and D- controllers of mobile terminals, the BC1.2 of the PMIC module may fail to correctly identify the port type, or other physical transceiver modules may interfere with the PMIC module's identification by operating the D+ and D- communication pins. This may cause an interface that should be identified as a DCP type for fast charging to be incorrectly identified as an SDP type. If identified as an SDP type, it will charge at a normal charging current of 500mA, resulting in slow charging and reducing the user experience.
[0032] The port identification method disclosed in this application can be applied to mobile terminals. Optionally, the mobile terminal may include portable terminals such as mobile phones and tablets, or wearable devices such as smartwatches and smart bracelets, etc., and is not limited thereto.
[0033] Optionally, when the mobile terminal detects that its charging port is connected to another electronic device, it can identify the port type corresponding to the target interface of the electronic device, where the target interface is the interface connecting the electronic device and the mobile terminal. If the port type is a first port type, the mobile terminal re-identifies the port type corresponding to the target interface of the electronic device. If the re-identified port type is the first port type, the mobile terminal charges according to the first charging mode, where the first port type is a port type with a maximum charging current less than or equal to a first current threshold. If the port type is a second port type, the mobile terminal charges according to the second charging mode, where the charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0034] By implementing the embodiments of this application, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid slow charging due to misidentification of the accessed port type, thereby ensuring the charging speed of the mobile terminal. In addition, if the target interface is identified as a second port type with a faster charging speed, it is not necessary to re-identify the interface type of the target interface, and charging can be performed according to the second charging mode with a faster charging speed to improve the charging speed of the mobile terminal.
[0035] Based on this, the port identification method and apparatus, mobile terminal, and computer program product disclosed in the embodiments of this application will be described below.
[0036] Please see Figure 2 , Figure 2 This is a flowchart illustrating a port identification method disclosed in an embodiment of this application. Optionally, this method can be applied to the mobile terminal described above, or other execution entities. This embodiment uses a mobile terminal as an example for illustration and should not be construed as limiting the scope of this application. Optionally, the method may include: 202. When it is detected that the charging port of the mobile terminal is connected to another electronic device, identify the port type corresponding to the target interface of the electronic device. The target interface is the interface through which the electronic device connects to the mobile terminal.
[0037] In this embodiment of the application, other electronic devices may include: adapters, computers, mobile phones and other electronic devices, wherein the adapter may include a charger, which is not limited here.
[0038] In this embodiment of the application, when the mobile terminal detects that the charging interface is connected to another electronic device, it can identify the port type corresponding to the target interface of the electronic device through the PIMC module described above.
[0039] 204. If the port type is the first port type, then re-identify the port type corresponding to the target interface of the electronic device, and if the re-identified port type is the first port type, charge according to the first charging mode. The first port type is the port type whose maximum charging current is less than or equal to the first current threshold.
[0040] In this embodiment of the application, the first port type may include the SDP type described above, and the first current threshold may include the charging current of 500mA corresponding to the SDP type.
[0041] In this embodiment of the application, when the mobile terminal detects that its charging interface is connected to another electronic device, it can configure the second control flag bit corresponding to the mobile terminal to be enabled. The second control flag bit is used to indicate whether the port type of the connected interface is allowed to be re-identified.
[0042] The second control flag may include an enabled state (i.e., "true") and a disabled state (i.e., "false"). The enabled state indicates that the port type of the access interface can be re-identified; the disabled state indicates that the port type of the access interface cannot be re-identified.
[0043] Optionally, the second control flag may include the "rerun" flag, which is not limited here.
[0044] Optionally, if the mobile terminal recognizes that the port type of the target interface is the first port type, it can determine whether the second control flag is currently configured to be enabled. If the second control flag is currently configured to be enabled, the mobile terminal can re-identify the port type corresponding to the target interface of the electronic device.
[0045] Alternatively, after re-identifying the port type corresponding to the target interface of the electronic device, the mobile terminal device can configure the second control flag to be disabled, thereby avoiding the mobile terminal from repeatedly executing the step of re-identifying the port type corresponding to the target interface of the electronic device, thus ensuring the normal operation of the mobile terminal.
[0046] In an optional embodiment, the mobile terminal device may increment the first accumulated value by one when it re-identifies the port type corresponding to the target interface of the electronic device. If the first accumulated value is less than the first accumulated threshold, the second control flag of the electronic device can be left unconfigured; if the first accumulated value is greater than or equal to the first accumulated threshold, the second control flag of the electronic device can be configured to be disabled.
[0047] The first accumulation threshold can be set by the developers based on extensive development experience to control the number of times the port type is identified in a loop, making the number of times the port type is identified in a loop controllable and improving the flexibility of the method.
[0048] 206. If the port type is the second port type, then charging will be performed according to the second charging mode. The charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0049] In this embodiment of the application, the second port type may include the DCP type described above, and the second charging mode may be the charging mode supported by the DCP type interface.
[0050] In one optional embodiment, when the mobile terminal recognizes that the port type of the target interface is the second port type, it can perform a fast charging protocol handshake operation through the first port interaction module; if the handshake operation is successful, it will charge according to the second charging mode corresponding to the fast charging protocol.
[0051] The first port interaction module may include the UFCS PHY module or the VOOC PHY module mentioned above, without any limitation here.
[0052] In this embodiment, the charging speed corresponding to the second charging mode can be greater than or equal to the second current threshold, and the second current threshold can be greater than the first current threshold. In an optional embodiment, the second current threshold can be 1.5A, which is not limited here.
[0053] By implementing the methods disclosed in the above embodiments, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid the mobile terminal misidentifying the target interface for fast charging as a normal charging interface, thereby avoiding the problem of slow charging of the mobile terminal; in addition, if the port type of the target interface is identified as a second port type with a faster charging speed, the interface type of the target interface does not need to be re-identified, and charging is performed according to the second charging mode with a faster charging speed to improve the charging speed of the mobile terminal.
[0054] Please see Figure 3 , Figure 3 This is a flowchart illustrating another port identification method disclosed in an embodiment of this application. Optionally, this method can be applied to the mobile terminal described above, or other execution entities. This embodiment uses a mobile terminal as an example for illustration and should not be construed as limiting the scope of this application. Optionally, the method may include: 302. When it is detected that the charging port of the mobile terminal is connected to another electronic device, identify the port type corresponding to the target interface of the electronic device. The target interface is the interface through which the electronic device connects to the mobile terminal.
[0055] 304. If the port type is the first port type, then re-identify the port type corresponding to the target interface of the electronic device. The first port type is a port type whose maximum charging current is less than or equal to the first current threshold.
[0056] 306. If the re-identified port type is the first port type, then perform an enumeration operation, which includes the initialization operation of the port protocol, and the port protocol is the port protocol corresponding to the first port type.
[0057] In this embodiment of the application, if the mobile terminal device re-identifies that the port type of the target interface is still the first port type, it can determine whether the second control flag bit described above is configured to be disabled; if the second control flag bit is currently configured to be disabled, the mobile terminal can perform an enumeration operation.
[0058] The enumeration operation is a standardized initialization process for establishing communication between a USB device and the host / port. Its core purpose is to enable the port to recognize "what device is connected" and "what functions the device supports", so as to lay the foundation for subsequent data transmission or charging negotiation.
[0059] Optionally, the enumeration operation includes port protocol initialization, which includes requesting device descriptors, configuration descriptors, etc. The device descriptor may include basic identification information such as the device's manufacturer identifier, product identifier, and protocol version, used for port identification of the device type. The configuration descriptor may include configuration information such as the device's supported power supply mode, data transmission rate, and number of interfaces, used for determining the port's compatibility with the device.
[0060] Optionally, the initialization operation may also include request operations on interface descriptors, endpoint descriptors, etc., which are not limited here.
[0061] In one alternative embodiment, the mobile terminal can control the second port interaction module to raise the level of the first sub-pin in the communication pin to a level threshold, thereby triggering the mobile terminal to perform an enumeration operation.
[0062] The second port interaction module may include the eUSB module described above, and the communication pins include the D+ and D- pins described above. The first sub-pin may be the D+ pin. The level threshold may be an enumerated trigger threshold specified by the interface protocol, for example, such as 3.3V in the USB 2.0 specification, and is not limited here.
[0063] As mentioned earlier, DCP type ports do not need to be enumerated. If the enumeration is successful, it means that the target interface is the first port type (SDP type), and the PMIC module has not made a mistake in identification. If the enumeration fails, it means that the target interface may be of DCP type, not the first port type, and the PMIC module has made a mistake in identification.
[0064] By implementing the above method, when the target interface is identified as the first port type in both instances, an enumeration operation can be performed to further determine whether the target interface is indeed the first port type. Charging is then performed based on the result of the enumeration operation, thus avoiding situations where the charging current exceeds the safe charging current corresponding to the target interface, leading to interface overheating, triggering overcurrent protection, etc. This improves the flexibility of the method.
[0065] 308. Based on the execution result of the enumeration operation, charge according to the first charging mode.
[0066] In one optional embodiment, the execution result of the enumeration operation may include successful enumeration and unsuccessful enumeration. Optionally, if the execution result of the enumeration operation indicates successful enumeration, the mobile terminal may charge according to the first current output by the electronic device; if the execution result of the enumeration operation indicates unsuccessful enumeration, the mobile terminal may charge according to the second current output by the electronic device.
[0067] The first current can be less than or equal to the first current threshold corresponding to the first port type described above, such as 450mA, 500mA, etc., and is not limited here. The second current can be greater than the first current, and less than or equal to the maximum charging current supported by the electronic device. The maximum charging current supported by the electronic device refers to the maximum charging current that the electronic device (e.g., adapter) can withstand.
[0068] Optionally, the mobile terminal device can determine the maximum charging current supported by the electronic device through the current sensing function. Optionally, the current sensing function may include an input current limit (ICL) function. The input current limit function can combine a stepped current level and an adaptive input current limit (AICL) voltage threshold to detect the maximum load capacity of the charger. The detection process may include: gradually increasing the ICL level, monitoring whether the VBUS voltage is lower than the threshold, and finally locking the maximum stable output current of the charger.
[0069] In one alternative embodiment, the mobile terminal can gradually increase the upper limit of the input current of the mobile terminal until the output voltage of the monitored electronic device is less than the voltage threshold, and then charge according to the second current currently output by the electronic device.
[0070] The voltage threshold can be the voltage threshold of AICL introduced earlier, such as 4.5V, 5V, etc., and is not limited here.
[0071] Optionally, the mobile terminal can set a unit current and gradually increase the upper limit of the input current of the mobile terminal by increasing the unit current each time, so as to increase the output current of the electronic device, until the output voltage of the electronic device is less than the voltage threshold, and then charge according to the second current currently output by the electronic device.
[0072] The unit current can be the ICL range mentioned earlier, which can be set by the developers based on extensive experience. Typical values can include 500mA, 600mA, etc., and are not limited here.
[0073] For example, the mobile terminal sets the upper limit of the input current to 500mA and monitors the output voltage (VBUS) of the electronic device; if the output voltage of the electronic device is greater than or equal to 4.5V, it means that the electronic device can withstand the charging current, and the mobile terminal can increase the unit current by one level to set the upper limit of the input current to 1000mA, and monitor the output voltage (VBUS) of the electronic device; if the output voltage of the electronic device is still greater than or equal to 4.5V, the mobile terminal can increase the unit current by another level to set the upper limit of the input current to 1500mA; If the mobile terminal sets the upper limit of the input current to 1500mA and the output voltage of the electronic device is less than 4.5V, it means that the electronic device cannot withstand a charging current of 1500mA. In this case, the mobile terminal can set the upper limit of the input current to 1000mA and charge according to the charging current of 1000mA.
[0074] By implementing the above method, if the mobile terminal identifies the target interface as the first port type in both port type identifications and the enumeration is successful, it can confirm that the target interface is indeed of type SDP. In this case, the mobile terminal can charge according to the first current corresponding to the first port type, avoiding the charging current from exceeding the safe charging current corresponding to the first port type, which could lead to port overheating, triggering overcurrent protection, etc. In addition, if the enumeration fails, it means that the port type identification of the target interface is incorrect and may not be the first port type. In this case, the mobile terminal can determine the maximum charging current supported by the electronic device and charge according to the maximum charging current to improve the charging efficiency of the mobile terminal.
[0075] As another optional implementation, if the enumeration is unsuccessful, the mobile terminal can disconnect from the electronic device; further, if a reconnection to the electronic device is detected, the step of identifying the port type corresponding to the target interface of the electronic device in step 302 can be re-executed. If the port type is the first port type, then re-identify the port type corresponding to the target interface of the electronic device; if the re-identified port type is the first port type, then perform an enumeration operation. If the enumeration is unsuccessful, charging will proceed according to the second current output by the electronic device.
[0076] Optionally, the method of controlling the disconnection between the mobile terminal and the electronic device may include: controlling the bus voltage of the mobile terminal to pull down to ground potential, so that when the electronic device connected to the terminal device (e.g., an adapter) detects a short circuit caused by the bus voltage being pulled down to ground potential, it stops supplying power to the terminal device, thereby disconnecting from the terminal device. Further, after detecting a disconnection from the electronic device, the mobile terminal may reconnect to the electronic device after waiting for a first time period.
[0077] The bus voltage (Vbus) is the core power line pin responsible for powering the USB interface of the terminal device. It serves as the energy transmission channel connecting the charger (adapter) and the terminal device, and is also a key carrier for charging protocol negotiation and power status detection. Optionally, the terminal device can control the bus voltage to be pulled down to ground potential via the USB anti-burn port.
[0078] Optionally, the mobile terminal can use a USB anti-burn port to connect the bus voltage to the ground wire through a preset resistor, thereby pulling the bus voltage down to ground potential and short-circuiting the bus voltage.
[0079] Optionally, the first duration can be between 200ms and 800ms, and is not limited here.
[0080] By implementing the above method, if the mobile terminal fails to enumerate, it can re-execute port identification twice. If both port identification results are for the first port type, the enumeration operation can be performed again. If the enumeration still fails, charging will proceed according to the second current output by the electronic device. In other words, if the first enumeration fails, the above method can re-execute the process to confirm whether the enumeration operation has truly failed. This avoids using a charging current exceeding the safe charging current corresponding to the first port type when the target interface is of that type, which could lead to port overheating, triggering overcurrent protection, or other issues.
[0081] In another alternative embodiment, the mobile terminal disconnects from the electronic device, and upon detecting a reconnection to the electronic device, the enumeration operation can be re-executed.
[0082] By implementing the above method, if the enumeration fails, the mobile terminal can stop identifying the port type and instead perform another enumeration operation to verify whether the result of the previous enumeration operation was accurate.
[0083] As another alternative implementation, if the mobile terminal fails to enumerate successfully, it can determine whether the first control flag of the mobile device is enabled. The first control flag is used to indicate whether it is allowed to actively disconnect from the electronic device.
[0084] Optionally, the first control flag may include an enabled state (i.e., "true") and a disabled state (i.e., "false"). The enabled state indicates that active disconnection from electronic devices is allowed; the disabled state indicates that active disconnection from electronic devices is not allowed. Optionally, the first control flag may include the "Allow_disconnect" flag, which is not limited here.
[0085] Alternatively, if the first control flag of the mobile device is enabled, the mobile device can disconnect from the electronic device and configure the first control flag of the electronic device to be disabled. Furthermore, if a reconnection to the electronic device is detected, the step of identifying the port type corresponding to the target interface of the electronic device in step 302 can be re-executed; if the port type is the first port type, the port type corresponding to the target interface of the electronic device is re-identified; if the re-identified port type is the first port type, an enumeration operation is performed; if the enumeration is unsuccessful and the first control flag of the electronic device is in a disabled state, charging is performed according to the second current output by the electronic device.
[0086] By implementing the above method, the mobile terminal can avoid repeatedly executing the step of identifying the port type corresponding to the target interface of the electronic device when the re-enumeration fails. This prevents the mobile terminal from getting stuck in a loop of repeatedly identifying port types and performing enumeration operations, thus ensuring the normal operation of the mobile terminal.
[0087] In an optional embodiment, when the mobile terminal determines that the first control flag is enabled and disconnects from the electronic device, it can increment the second accumulated value by one. If the second accumulated value is less than the second accumulated threshold, the first control flag of the electronic device is not configured to be disabled, and the step of identifying the port type corresponding to the target interface of the electronic device in step 302 is re-executed when a reconnection with the electronic device is detected. If the second accumulated value is greater than or equal to the second accumulated threshold, the first control flag of the electronic device is configured to be disabled, and the step of identifying the port type corresponding to the target interface of the electronic device in step 302 is re-executed when a reconnection with the electronic device is detected.
[0088] The second accumulation threshold can be set by developers based on extensive development experience to control the number of iterations, making the method more controllable and increasing its flexibility.
[0089] 310. If the port type is the second port type, then charging will be performed according to the second charging mode. The charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0090] By implementing the methods disclosed in the above embodiments, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid misidentifying the fast charging target interface as a normal charging interface, thereby preventing the mobile terminal from experiencing slow charging. Furthermore, if the target interface is identified as a second port type with a faster charging speed, re-identification of the target interface's interface type is not required, and charging can proceed according to the second charging mode with the faster charging speed, thereby improving the charging speed of the mobile terminal. Also, if the target interface is identified as a first port type twice, an enumeration operation can be performed to further determine whether the target interface is indeed a first port type, and charging can be performed based on the enumeration operation result, avoiding situations where the charging current exceeds the safe charging current corresponding to the target interface, leading to interface overheating, triggering overcurrent protection, etc., thus improving the flexibility of the method. If both port type identifications confirm the target interface is the first port type and the enumeration is successful, it can be determined that the target interface is indeed of type SDP. In this case, the mobile terminal can charge according to the first current corresponding to the first port type, avoiding situations where the charging current exceeds the safe charging current for the first port type, thus preventing port overheating and triggering overcurrent protection. Conversely, if the enumeration fails, it indicates that the target interface's port type identification is incorrect and may not be the first port type. In this case, the mobile terminal can determine the maximum charging current supported by the electronic device and charge according to the maximum charging current to improve charging efficiency. Furthermore, if the first enumeration fails, the process can be re-executed to re-enumerate the interface, confirming that the enumeration operation truly failed. This prevents charging with a current exceeding the safe charging current for the first port type when the target interface is indeed the first port type, thus avoiding situations where port overheating and triggering overcurrent protection. Finally, this prevents the mobile terminal from repeatedly looping through the process of identifying the target interface's port type after a failed re-enumeration, ensuring the normal operation of the mobile terminal.
[0091] Please see Figure 4 , Figure 4 This is a flowchart illustrating another port identification method disclosed in this application. Optionally, this method can be applied to the mobile terminal described above, or other execution entities. This application uses a mobile terminal as an example for illustration and should not be construed as limiting the scope of this application. Optionally, the method may include: 402. When it is detected that the charging port of the mobile terminal is connected to another electronic device, identify the port type corresponding to the target interface of the electronic device. The target interface is the interface through which the electronic device connects to the mobile terminal.
[0092] 404. If the port type is the first port type, then re-identify the port type corresponding to the target interface of the electronic device, and if the re-identified port type is the first port type, charge according to the first charging mode. The first port type is the port type whose maximum charging current is less than or equal to the first current threshold.
[0093] 406. If the port type is the second port type, then charging will be performed according to the second charging mode. The charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0094] 408. If the first condition is met, reset the multiple port interaction modules corresponding to the mobile terminal. The multiple port interaction modules identify the port type of the interface or interact with other electronic devices through the same communication pin.
[0095] In this embodiment of the application, the port interaction module may include at least two of the PMIC module, UFCS PHY module, VOOC PHY module and eUSB module described above.
[0096] Optionally, the multiple port interaction module includes at least: a port identification module and a data transceiver module. Optionally, the port identification module includes a PMIC module; the data transceiver module includes one or more of a UFCS PHY module, a VOOC PHY module, and an eUSB module, which are not limited here.
[0097] As mentioned earlier, PMIC modules, UFCS PHY modules, VOOC PHY modules, and eUSB modules can all operate the D+ and D- communication pins. To prevent other modules besides the PMIC module from affecting the PMIC module's port type identification by operating the communication pins, the above method is implemented. The mobile terminal can reset multiple port interaction modules corresponding to the mobile terminal to isolate multiple port interaction modules from the communication pins. This reduces the impact of other port interaction modules on the subsequent port identification module during the port type identification process, thereby improving the accuracy of the mobile terminal in identifying the port type.
[0098] Optionally, resetting the multiple port interaction modules corresponding to the mobile terminal may include setting the multiple port interaction modules corresponding to the mobile terminal to a high-impedance state; wherein, the high-impedance state refers to the state in which the port interaction module is isolated from the communication pin.
[0099] It is understandable that when the port interaction module is isolated from the communication pin, the port interaction module cannot operate the communication pin. This reduces the impact of other port interaction modules when the subsequent port identification module identifies the port type through the communication pin.
[0100] By implementing the above method, multiple port interaction modules can be reset to a high-impedance state, thereby isolating the port interaction modules from the communication pins. This prevents the subsequent port identification module from being affected by other port interaction modules during the port type identification process, thus improving the accuracy of the mobile terminal in identifying the port type.
[0101] In one alternative embodiment, the first condition may include: detecting that other electronic devices have disconnected from the mobile terminal; and / or detecting that the target subsystem of the mobile terminal is in a downtime state, the target subsystem including multiple port interaction modules.
[0102] Optionally, the mobile terminal can continuously monitor whether the target subsystem is in a crash state after powering on. The target subsystem includes, but is not limited to, systems such as Advanced Digital Signal Processor (ADSP) systems and Second-Order Cone Programming (SOCP) systems. A crash state (i.e., a crash status) indicates that the target subsystem cannot function properly.
[0103] By implementing the above method, multiple port interaction modules corresponding to the mobile terminal can be reset when other electronic devices are disconnected from the mobile terminal, or during the recovery process of the target subsystem including multiple port interaction modules from a crash state. This can prevent other port interaction modules from affecting the port identification module's identification of the port type when a target interface is accessed next time, thereby avoiding the problem of slow charging of the mobile terminal due to incorrect port type identification.
[0104] As an optional implementation, after resetting the multiple port interaction modules corresponding to the mobile terminal, the mobile terminal can configure the first control flag bit of the mobile terminal to be enabled. The first control flag bit is used to indicate whether it is allowed to actively disconnect from the electronic device.
[0105] Optionally, the mobile terminal can also configure its first control flag to be enabled if it detects that the target subsystem is not down.
[0106] By implementing the above method, the mobile terminal can configure the first control flag to be enabled in advance, thereby allowing the mobile terminal to re-perform port type identification and enumeration operations in the event of enumeration failure, in order to confirm whether the execution result of the enumeration operation is accurate. This can avoid using a charging current exceeding the safe charging current corresponding to the first port type when the target interface is the first port type, which could lead to port overheating, triggering overcurrent protection, and other situations.
[0107] In another alternative embodiment, when the mobile terminal detects that another electronic device has disconnected from the mobile terminal, it can set a timing thread, which is used to configure the first control flag of the mobile terminal to be enabled when the timing duration reaches a second duration.
[0108] Optionally, the second duration can be longer than the first duration described above. Typical values for the second duration can be 2 seconds, 3 seconds, etc., and are not limited here.
[0109] It should be noted that the previously described method of controlling the bus voltage of the electronic device to pull down to ground potential, triggering the electronic device to disconnect, and then reconnecting after a delay of several hundred milliseconds, is a software-simulated physical disconnection. The entire process (from disconnection to reconnection) takes only about 1 second (e.g., 500ms-1s). However, when the user manually unplugs the adapter (physical unplugging), the mobile terminal will detect that the bus voltage has been disconnected for a long time (more than 2 seconds). At this time, the 2-second timer thread will not be canceled, and the first control flag after the timer ends will be configured to be enabled. Thus, when the user plugs the charger back in later, the mobile terminal has regained the permission to "allow one active disconnection", thereby ensuring that the mobile terminal can re-perform port type identification and enumeration operations.
[0110] Optionally, when the mobile terminal detects that its charging port is connected to another electronic device, it can determine whether the aforementioned timing thread exists. If it does, the timing thread is canceled, thereby preventing the timing thread from repeatedly configuring the first control flag to the enabled state. This prevents the mobile terminal from getting stuck in a loop of repeatedly identifying port types and performing enumeration operations, ensuring the normal operation of the mobile terminal.
[0111] In one optional embodiment, each port interaction module can be equipped with a corresponding switch module between itself and the communication pin. Optionally, the mobile terminal can control the connection between the corresponding port interaction module and the communication pin by controlling the switch module corresponding to each port interaction module.
[0112] When the switch module is on, the port interaction module is connected to the communication pin, allowing it to identify the port type of the interface or interact with other electronic devices. When the switch module is off, the port interaction module and the communication pin are physically isolated, meaning the port interaction module is disconnected from the communication pin.
[0113] Optionally, when the mobile terminal controls the switch module of any port interaction module to be in the on state, it can control the switch modules of the remaining port interaction modules to be in the off state, thereby avoiding mutual interference between port interaction modules due to simultaneous operation of communication pins.
[0114] For example, when the mobile terminal turns on the switch module corresponding to the port identification module (PMIC module), it can turn off the switch modules of other port interaction modules. This can prevent the port identification module from being affected by other port interaction modules during the process of identifying the port type, thereby improving the accuracy of the mobile terminal in identifying the port type.
[0115] It should be further explained that physically disconnecting the port interaction module from the communication pin through the switch module is more thorough than configuring the high-impedance state through software as described earlier. This is because the circuit of the unused module has no electrical connection with the communication pin, eliminating any possibility of leakage current or level pulling, thus completely avoiding mutual interference between the port interaction modules.
[0116] By implementing the methods disclosed in the above embodiments, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid misidentifying the fast-charging target interface as a normal charging interface, thereby preventing the mobile terminal from experiencing slow charging. Furthermore, if the target interface is identified as a second port type with a faster charging speed, re-identification of the target interface's interface type is not required, and charging can proceed according to the second charging mode with the faster charging speed, thereby improving the charging speed of the mobile terminal. Additionally, the mobile terminal can reset multiple port interaction modules corresponding to the mobile terminal to isolate these modules from the communication pins, thereby reducing the influence of other port interaction modules on the subsequent port identification module during port type identification, thus improving the accuracy of the mobile terminal's port type identification. Multiple port interaction modules can be reset to a high-impedance state, isolating them from communication pins. This prevents the port identification module from being affected by other port interaction modules during port type identification, improving the accuracy of port type identification by the mobile terminal. Furthermore, when other electronic devices disconnect from the mobile terminal, or during the recovery process of a target subsystem including multiple port interaction modules from a crash, the corresponding port interaction modules can be reset. This prevents other port interaction modules from interfering with the port identification module's port type identification the next time a target interface is accessed, thus avoiding slow charging due to port type identification errors. Additionally, the mobile terminal can pre-configure the first control flag to be enabled, allowing it to re-perform port type identification and enumeration operations in case of enumeration failure, confirming the accuracy of the enumeration results. This prevents charging with a current exceeding the safe charging current corresponding to the first port type when the target interface is of that type, thus avoiding port overheating and triggering overcurrent protection.
[0117] To more clearly illustrate the port identification method disclosed in the embodiments of this application, the following is combined with... Figure 5 An alternative method is described. Please refer to [link / reference]. Figure 5 , Figure 5 This is a schematic diagram of a method process disclosed in an embodiment of this application. Wherein: 502. Mobile terminal powered on; 504. Determine if the target subsystem is down. If yes, proceed to step 506; otherwise, proceed to step 508. 506. Reset the multiple port interaction modules corresponding to the mobile terminal; 508. Configure the first control flag to the enabled state; 510. Determine if any electronic device is connected or disconnected; if an electronic device is disconnected, proceed to steps 512-516; if an electronic device is inserted, proceed to step 518. 512. Reset the multiple port interaction modules corresponding to the mobile terminal; 514. Set the timer thread; 516. Determine if the timing duration corresponding to the timing thread has reached the second duration. If yes, set the first control flag to enabled; otherwise, wait. 518. If a timer thread exists, cancel the timer thread; 520. Configure the second control flag to the enabled state; 522. Identify the port type of the target interface corresponding to the electronic device, and determine whether the port type is SDP. If not, proceed to step 524; if yes, proceed to step 526. 524. Then, attempt to initiate a fast charging protocol handshake, and if the handshake is successful, charge according to the second charging mode corresponding to the fast charging protocol; 526. Determine if the second control flag is enabled. If yes, proceed to step 528; otherwise, proceed to step 530. 528. Repeat step 522 and configure the second control flag to be disabled; 530. Perform enumeration operation; 532. Determine if the enumeration operation was successful. If successful, proceed to step 534; if unsuccessful, proceed to step 536. 534. Charge according to the charging current corresponding to the SDP type; 536. Determine if the first control flag is enabled. If yes, proceed to step 538; if no, proceed to step 542. 538. Disconnect from the electronic device and reconnect after a first set of time. 540. Configure the first control flag to the disabled state and re-execute step 530; 542. Determine the maximum charging current of the electronic device and charge it according to the maximum charging current output by the electronic device.
[0118] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a port identification device disclosed in an embodiment of this application. Optionally, this device can be applied to the mobile terminal described above, or other execution entities. This embodiment of the application uses a mobile terminal as an example for illustration and should not be construed as limiting the embodiments of this application. Optionally, the device may include an identification unit 602 and a first charging unit 604, wherein: The identification unit 602 is used to identify the port type corresponding to the target interface of the electronic device when it is detected that the charging interface of the mobile terminal is connected to another electronic device. The target interface is the interface through which the electronic device connects to the mobile terminal. The identification unit 602 is also used to re-identify the port type corresponding to the target interface of the electronic device when the port type is the first port type, and to charge according to the first charging mode if the re-identified port type is the first port type, wherein the first port type is a port type whose maximum charging current is less than or equal to the first current threshold. The first charging unit 604 is used to charge according to the second charging mode when the port type is the second port type. The charging speed of the second charging mode is greater than the charging speed corresponding to the first charging mode.
[0119] By implementing the above device, when the mobile terminal detects that the target interface is a first port type with a maximum charging current less than a first current threshold, it can re-identify the interface type of the target interface to avoid the mobile terminal misidentifying the fast charging target interface as a normal charging interface, thereby avoiding the problem of slow charging of the mobile terminal; in addition, if the target interface is identified as a second port type with a faster charging speed, it can proceed without re-identifying the interface type of the target interface and charge according to the first charging mode with a faster charging speed to improve the charging speed of the mobile terminal.
[0120] As an optional implementation method, Figure 6 The apparatus shown may also include an enumeration unit (not shown) and a second charging unit, wherein: The enumeration unit is used to perform an enumeration operation after re-identifying the port type corresponding to the target interface of the electronic device. If the re-identified port type is the first port type, the enumeration operation includes the initialization operation of the port protocol, and the port protocol is the port protocol corresponding to the first port type. The second charging unit is used to charge the electronic device according to the current output by the electronic device based on the execution result of the enumeration operation.
[0121] By implementing the above device, when the port type of the target interface is identified as the first port type twice, an enumeration operation can be performed to further determine whether the target interface is indeed the first port type. Based on the execution result of the enumeration operation, charging is performed to avoid the charging current exceeding the safe charging current corresponding to the target interface, which could lead to interface overheating, triggering overcurrent protection, etc., thus improving the flexibility of the method.
[0122] As an optional implementation, the execution result includes successful enumeration and unsuccessful enumeration; the second charging unit is further configured to charge according to the first current output by the electronic device in the case of successful enumeration; or, in the case of unsuccessful enumeration, charge according to the second current output by the electronic device, wherein the second current is greater than the first current and less than or equal to the maximum charging current supported by the electronic device.
[0123] By implementing the above device, if the mobile terminal identifies the target interface as the first port type in both port type identifications and the enumeration is successful, it can determine that the target interface is indeed of type SDP. In this case, the mobile terminal can charge according to the first current corresponding to the first port type, avoiding the charging current from exceeding the safe charging current corresponding to the first port type, which could lead to port overheating, triggering overcurrent protection, etc. In addition, if the enumeration fails, it means that the port type identification of the target interface is incorrect and may not be the first port type. In this case, the mobile terminal can determine the maximum charging current supported by the electronic device and charge according to the maximum charging current to improve the charging efficiency of the mobile terminal.
[0124] As an optional implementation, the second charging unit is further configured to disconnect from the electronic device if the enumeration is unsuccessful; and, if the electronic device is reconnected, to re-execute the step of identifying the port type corresponding to the target interface of the electronic device; and, if the re-identified port type is the first port type and the enumeration is unsuccessful, to charge according to the second current output by the electronic device.
[0125] By implementing the above device, if the mobile terminal fails to enumerate, it can re-execute port identification twice. If both port identification results are for the first port type, the enumeration operation can be performed again. If the enumeration still fails, charging is then performed according to the second current output by the electronic device. In other words, by implementing the above method, if the first enumeration fails, the process can be re-executed to re-enumerate the operation, thus confirming whether the enumeration operation has truly failed. This avoids using a charging current exceeding the safe charging current corresponding to the first port type when the target interface is of that type, which could lead to port overheating, triggering overcurrent protection, or other issues.
[0126] As an optional implementation, the second charging unit is also configured to disconnect from the electronic device and configure the first control flag of the electronic device to a disabled state when the enumeration fails and the first control flag of the electronic device is enabled. The first control flag is used to indicate whether active disconnection from the electronic device is allowed. Additionally, if the re-identified port type is the first port type, the enumeration was unsuccessful, and the first control flag of the electronic device is disabled, then charging is performed according to the second current output by the electronic device.
[0127] Implementing the above device can prevent the mobile terminal from repeatedly executing the step of identifying the port type corresponding to the target interface of the electronic device when the re-enumeration fails, thus avoiding the mobile terminal from getting stuck in a loop of repeatedly identifying port types and performing enumeration operations, and ensuring the normal operation of the mobile terminal.
[0128] As an optional implementation, the second charging unit is also used to gradually increase the upper limit of the input current of the mobile terminal until the output voltage of the monitored electronic device is less than the voltage threshold, and then charge according to the second current currently output by the electronic device.
[0129] By implementing the above device, the mobile terminal can determine the maximum charging current supported by the electronic device and charge according to the maximum charging current, thereby improving the charging efficiency of the mobile terminal.
[0130] As an optional implementation method, Figure 6 The illustrated device may also include a reset unit (not shown), wherein: The reset unit is used to reset multiple port interaction modules corresponding to the mobile terminal when a first condition is met. The multiple port interaction modules identify the port type of the interface or interact with other electronic devices through the same communication pin.
[0131] By implementing the above device, the mobile terminal can reset multiple port interaction modules corresponding to the mobile terminal to isolate the multiple port interaction modules from the communication pins, thereby reducing the influence of other port interaction modules on the subsequent port identification module in the process of identifying port type, and thus improving the accuracy of the mobile terminal in identifying port type.
[0132] As an optional implementation, the first condition includes: Other electronic devices were detected to have disconnected from the mobile terminal; and / or, The target subsystem of the mobile terminal was detected to be in a downtime state. The target subsystem includes multiple port interaction modules.
[0133] By implementing the above device, multiple port interaction modules corresponding to the mobile terminal can be reset when other electronic devices are disconnected from the mobile terminal, or during the recovery process of the target subsystem including multiple port interaction modules from a crash state. This can prevent other port interaction modules from affecting the port identification module's identification of the port type when a target interface is accessed next time, thereby avoiding the problem of slow charging of the mobile terminal due to incorrect port type identification.
[0134] As an optional implementation, the reset unit is also used to set multiple port interaction modules corresponding to the mobile terminal to a high-impedance state, which means that the port interaction module and the communication pin are isolated.
[0135] By implementing the above device, multiple port interaction modules can be reset to a high-impedance state, thereby isolating the port interaction modules from the communication pins. This prevents the subsequent port identification module from being affected by other port interaction modules during the port type identification process, thus improving the accuracy of the mobile terminal in identifying the port type.
[0136] As an optional implementation method, Figure 6 The illustrated device may also include a configuration unit (not shown), wherein: The configuration unit is used to configure the first control flag of the mobile terminal to the enabled state after resetting the multiple port interaction modules corresponding to the mobile terminal. The first control flag is used to indicate whether active disconnection from the electronic device is allowed.
[0137] By implementing the above device, the mobile terminal can configure the first control flag to be enabled in advance, thereby allowing the mobile terminal to re-perform port type identification and enumeration operations in the event of enumeration failure, in order to confirm whether the execution result of the enumeration operation is accurate. This can avoid using a charging current exceeding the safe charging current corresponding to the first port type when the target interface is the first port type, which could lead to port overheating, triggering overcurrent protection, and other situations.
[0138] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a mobile terminal disclosed in an embodiment of this application. Figure 7 As shown, the mobile terminal may include: a memory 701 storing executable program code; and a processor 702 coupled to the memory 701; wherein the processor 702 calls the executable program code stored in the memory 701 to execute the port identification method disclosed in the above embodiments.
[0139] This application discloses a computer-readable storage medium storing a computer program that causes a computer to execute the port identification method disclosed in the above embodiments.
[0140] This application also discloses an application publishing platform, which is used to publish computer program products. When the computer program products are run on a computer, the computer performs some or all of the steps of the methods described in the above method embodiments.
[0141] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Those skilled in the art should also recognize that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0142] In the various embodiments of this application, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0143] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0144] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0145] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-accessible memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several requests to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute some or all of the steps of the methods described in the various embodiments of this application.
[0146] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compactdisc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0147] The port identification method and apparatus, mobile terminal, and computer program product disclosed in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A port identification method, characterized by, The method is applied to a mobile terminal and comprises the following steps: In a case where a charging interface of the mobile terminal accesses another electronic device, a port type corresponding to a target interface of the electronic device is identified, the target interface being an interface through which the electronic device is connected to the mobile terminal; If the port type is a first port type, the port type corresponding to the target interface of the electronic device is re-identified, and if the re-identified port type is the first port type, charging is performed in a first charging mode, the first port type being a port type with a maximum charging current less than or equal to a first current threshold; If the port type is a second port type, charging is performed in a second charging mode, the second charging mode having a charging speed greater than that of the first charging mode.
2. The method of claim 1, wherein, If the re-identified port type is the first port type, charging is performed in the first charging mode, comprising the following steps: If the re-identified port type is the first port type, an enumeration operation is performed, the enumeration operation comprising an initialization operation of a port protocol, the port protocol being a port protocol corresponding to the first port type; Charging is performed in the first charging mode according to an execution result of the enumeration operation.
3. The method of claim 2, wherein, The execution result comprises successful enumeration and unsuccessful enumeration; and charging in the first charging mode according to the execution result of the enumeration operation comprises the following steps: If the enumeration is successful, charging is performed in a first current output by the electronic device; If the enumeration is unsuccessful, charging is performed in a second current output by the electronic device, the second current being greater than the first current and less than or equal to a maximum charging current supported by the electronic device.
4. The method of claim 3, wherein, Before the charging in the second current output by the electronic device, the method further comprises the following steps: If the enumeration is unsuccessful, the electronic device is disconnected; In a case where the electronic device is reconnected, the step of identifying the port type corresponding to the target interface of the electronic device is re-executed; If the re-identified port type is the first port type and the enumeration is unsuccessful, charging is performed in the second current output by the electronic device. If the enumeration is unsuccessful and a first control flag bit of the electronic device is in an enabled state, the electronic device is disconnected and the first control flag bit of the electronic device is configured to be in a disabled state, the first control flag bit being used to indicate whether to allow active disconnection from the electronic device.
5. The method of claim 4, wherein, Charging in the second current output by the electronic device comprises the following steps: The upper limit value of the input current of the mobile terminal is gradually increased until, in a case where the output voltage of the electronic device is less than a voltage threshold, charging is performed in the second current currently output by the electronic device.
6. The method of claim 3, wherein, The method further comprises the following steps: 7. The method according to any one of claims 1 to 6, characterized in that, In the case of meeting the first condition, the plurality of port interaction modules corresponding to the mobile terminal are reset, the plurality of port interaction modules respectively identify the port type of the same communication pin interface or interact with other electronic devices through the same communication pin.
8. The method of claim 7, wherein, The first condition includes: detecting that the other electronic device is disconnected from the mobile terminal; and / or, detecting that a target subsystem of the mobile terminal is in a down state, the target subsystem including the plurality of port interaction modules.
9. The method of claim 7, wherein, The resetting of the plurality of port interaction modules corresponding to the mobile terminal includes: setting the plurality of port interaction modules corresponding to the mobile terminal to a high-impedance state, the high-impedance state being a state in which the port interaction modules are isolated from the communication pin.
10. The method of claim 7, wherein, After the resetting of the plurality of port interaction modules corresponding to the mobile terminal, the method includes: configuring a first control flag bit of the mobile terminal to an enabled state, the first control flag bit being used to indicate whether to allow active disconnection from the electronic device.
11. A port identification apparatus, characterized by, The device is applied to a mobile terminal and includes: an identification unit configured to identify a port type corresponding to a target interface of the electronic device in the case of detecting that a charging interface of the mobile terminal accesses the other electronic device, the target interface being an interface through which the electronic device is connected to the mobile terminal; the identification unit is further configured to re-identify the port type corresponding to the target interface of the electronic device in the case of the port type being a first port type, and perform charging in a first charging mode if the re-identified port type is the first port type, the first port type being a port type in which a maximum charging current is less than or equal to a first current threshold; a first charging unit configured to perform charging in a second charging mode in the case of the port type being a second port type, the second charging mode having a charging speed greater than a charging speed corresponding to the first charging mode.
12. A mobile terminal, characterized by The computer program product includes a memory storing executable program code and a processor coupled to the memory; wherein the processor invokes the executable program code stored in the memory to execute the method of any one of claims 1-10.
13. A computer program product, characterised in that, The computer program product includes a computer program, which, when executed by a processor, implements the method of any one of claims 1-10.