[go: up one dir, main page]

CN110442539B - Mobile phone OTG switching method and device - Google Patents

Mobile phone OTG switching method and device Download PDF

Info

Publication number
CN110442539B
CN110442539B CN201910521576.5A CN201910521576A CN110442539B CN 110442539 B CN110442539 B CN 110442539B CN 201910521576 A CN201910521576 A CN 201910521576A CN 110442539 B CN110442539 B CN 110442539B
Authority
CN
China
Prior art keywords
mobile phone
otg
threshold
mode
current value
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.)
Active
Application number
CN201910521576.5A
Other languages
Chinese (zh)
Other versions
CN110442539A (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 CN201910521576.5A priority Critical patent/CN110442539B/en
Publication of CN110442539A publication Critical patent/CN110442539A/en
Application granted granted Critical
Publication of CN110442539B publication Critical patent/CN110442539B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Telephone Function (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

本申请实施例提供一种手机OTG切换方法和装置,在手机处于OTG模式的情况下,检测该手机的通用串行总线USB接口中电源总线Vbus管脚的电流值;可以理解,若该电流值过小,可以认为Vbus管脚中没有构成电流回路,即没有其他电子设备接入手机,进而可以认为手机误触发进入了OTG模式,因此当电流值小于第一门限时,该手机从OTG模式切换到充电模式,当电流值大于第二门限值时,手机执行所述OTG模式下的OTG识别流程,避免了因为手机错误的进入OTG模式而无法正常充电的现象发生。

Figure 201910521576

The embodiments of the present application provide a method and device for switching the OTG of a mobile phone. When the mobile phone is in the OTG mode, the current value of the Vbus pin of the power bus in the universal serial bus USB interface of the mobile phone is detected; If it is too small, it can be considered that there is no current loop in the Vbus pin, that is, no other electronic devices are connected to the mobile phone, and then it can be considered that the mobile phone has entered the OTG mode by mistake. Therefore, when the current value is less than the first threshold, the mobile phone switches from OTG mode In the charging mode, when the current value is greater than the second threshold value, the mobile phone performs the OTG identification process in the OTG mode, so as to avoid the phenomenon that the mobile phone cannot be charged normally because the mobile phone enters the OTG mode by mistake.

Figure 201910521576

Description

Mobile phone OTG switching method and device
Technical Field
The present application relates to communications technologies, and in particular, to a method and an apparatus for switching an OTG of a mobile phone.
Background
With The development of Universal Serial Bus (USB) technology, OTG (On-The-Go) technology based On USB is gradually developed, and The OTG technology can realize data transmission between electronic devices without a Personal Computer (PC). For example, a digital camera can be directly connected to a printer by OTG technology to print out a photo.
In the prior art, in order to implement the OTG function, a pin ID is usually added to a USB port of an electronic device (e.g., a mobile phone, a tablet computer, etc.), so that the electronic device can implement identification and data interaction with other electronic devices by setting the pin ID. In specific application, taking an electronic device as a mobile phone capable of realizing an OTG function as an example, the USB protocol specifies: when the ID pin of the mobile phone is at a high level, the mobile phone enters a charging mode, which may specifically refer to: the mobile phone can be charged through a USB; when the ID pin of the mobile phone is at a low level, the mobile phone is in an OTG mode, and the OTG mode may specifically refer to: the mobile phone can execute OTG processing flow with other electronic equipment through the USB, and the Vbus pin of the mobile phone USB outputs about 5V voltage to the other electronic equipment.
However, in the prior art, a phenomenon that a mobile phone capable of realizing an OTG function cannot be normally charged after being connected to a charging power supply often occurs, so that the use of a user is affected.
Disclosure of Invention
The application provides a method and a device for switching an OTG (on-the-go) of a mobile phone, which avoid the phenomenon that the mobile phone cannot be normally charged after being connected to a charging power supply.
A first aspect of the present application provides a method for switching an OTG of a mobile phone, including: under the condition that the mobile phone is in an OTG mode, the mobile phone detects the current value of a Vbus pin in a Universal Serial Bus (USB) interface of the mobile phone; and when the current value is smaller than a first threshold, the mobile phone is switched from the OTG mode to a charging mode. When the current value is greater than a second threshold, the mobile phone executes an OTG identification process in the OTG mode; wherein the first threshold is smaller than the second threshold.
In one exemplary approach, the first threshold comprises: anywhere between 0 and 1 milliamp.
In one exemplary approach, the second threshold comprises: anywhere between 1 milliamp and 10 milliamps.
In an exemplary manner, when the current value is less than a first threshold, the switching the handset from the OTG mode to the charging mode includes: and when the current value is smaller than a first threshold, the mobile phone ends the OTG identification process and closes the output voltage of the Vbus pin.
A second aspect of the present application provides a mode switching apparatus, including: the detection module is used for detecting the current value of a Vbus pin in a Universal Serial Bus (USB) interface of the mobile phone under the condition that the mobile phone is in an OTG mode. And the switching module is used for switching the mobile phone from the OTG mode to the charging mode when the current value is smaller than a first threshold. And the execution module is used for executing the OTG identification process in the OTG mode when the current value is greater than a second threshold, wherein the first threshold is less than the second threshold.
In one exemplary approach, the first threshold comprises: any value between 0 and 1 milliamp; the second threshold includes: anywhere between 1 milliamp and 10 milliamps.
In an exemplary manner, the switching module includes: and the switching submodule is used for ending the OTG identification process of the mobile phone and closing the output voltage of the Vbus pin when the current value is smaller than a first threshold.
A third aspect of the present application provides a handset comprising a processor, a memory for storing instructions, and a transceiver for communicating with other devices, the processor being configured to execute the instructions stored in the memory to cause the handset to perform a method as claimed in any one of the first aspects of the present application.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon instructions that, when executed, cause a computer to perform the method according to any of the first aspects of the present application.
A fifth aspect of the present application provides a computer program product comprising instructions that, when executed, cause a computer to perform the method of any of the first aspects of the present application.
A sixth aspect of the present application provides a system-on-chip or system-on-chip, where the system-on-chip or system-on-chip is applicable to a network device, and the system-on-chip or system-on-chip includes: the network device comprises at least one communication interface, at least one processor and at least one memory, wherein the communication interface, the memory and the processor are interconnected through a bus, and the processor enables the network device to execute the method according to the first aspect of the application by executing the instructions stored in the memory.
The embodiment of the application provides a method and a device for switching an OTG (on-the-go) function of a mobile phone, and an inventor finds that the phenomenon that the mobile phone with the OTG function cannot be normally charged after being connected to a charging power supply often occurs in the prior art because the mobile phone enters an OTG mode by mistake, specifically, in a USB (universal serial bus) pin, an ID (identification) pin is adjacent to a Grounding (GND) pin, and in the using process of the mobile phone, the mobile phone can be in a humid or dust environment, so that a USB (universal serial bus) port is corroded, short circuits can be caused by corrosion of the adjacent ID pin and the GND pin in the USB port, the level of the ID pin of the mobile phone is lowered, the mobile phone enters the OTG mode by mistake, and the mobile phone cannot be normally charged. Based on the discovery, in the embodiment of the application, under the condition that the mobile phone is in the OTG mode, the mobile phone detects the current value of the Vbus pin of the power bus in the USB interface of the universal serial bus of the mobile phone; it can be understood that if the current value is too small, it may be considered that no current loop is formed in the Vbus pin, that is, no other electronic device is connected to the mobile phone, and further, it may be considered that the mobile phone is triggered by mistake to enter the OTG mode, so that when the current value is smaller than the first threshold, the mobile phone is switched from the OTG mode to the charging mode, and when the current value is larger than the second threshold, the mobile phone executes the OTG identification process in the OTG mode, thereby avoiding the occurrence of the phenomenon that the mobile phone cannot be charged normally due to entering the OTG mode by mistake.
Drawings
Fig. 1 is a schematic circuit diagram of a mode switching application scenario according to an embodiment of the present application;
fig. 2 is a flowchart of a method for switching an OTG of a mobile phone according to an embodiment of the present application;
fig. 3 is a functional structure schematic diagram of a mobile phone OTG switching device provided in the embodiment of the present application;
fig. 4 is a schematic structural diagram of a mobile phone according to an embodiment of the present application.
Detailed Description
The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, such as "one or more", unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" means one, two or more. The term "and/or" is used to describe an association relationship that associates objects, meaning that three relationships may exist; for example, a and/or B, may represent: a alone, both A and B, and B alone, where A, B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Embodiments of OTG-enabled electronic devices, user interfaces for such electronic devices, and for using such electronic devices are described below. In some embodiments, the electronic device may be a portable electronic device, such as a cell phone, a tablet, a wearable electronic device with wireless communication capabilities (e.g., a smart watch), and the like, that also includes other functionality, such as personal digital assistant and/or music player functionality. Exemplary embodiments of the portable electronic device include, but are not limited to, a mount
Figure BDA0002096858990000031
Figure BDA0002096858990000032
Or other operating system. The portable electronic device may also be other portable electronic devices such as a laptop computer (laptop) or the like. It should also be understood that in other embodiments, the electronic device may not be a portable electronic device, but may be a desktop computer.
The mobile phone related to the embodiment of the application may include a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a Central Processing Unit (CPU), a 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 processing 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 list, word processing software, instant messaging software and the like.
In specific application, in a mobile phone with an OTG function (which may also be referred to as an OTG device), after a USB interface of the OTG device is connected to a charging power supply, there is no way to charge the OTG device normally.
The inventor finds that the OTG device cannot be normally charged after being connected to the charging power supply, which may be caused by the OTG device entering the OTG mode by mistake. Specifically, in the USB pin, the ID pin is adjacent to a Ground (GND) pin, and during the use of the mobile phone, the mobile phone may be in a wet or dust environment, so that the USB port of the mobile phone is corroded, and the adjacent ID pin and the GND pin in the USB port may cause a short circuit due to corrosion, so that the level of the ID pin is lowered, and the mobile phone enters the OTG mode by mistake. In particular, for the mobile phone in the charging mode, if there is an OTG request, the mobile phone software does not respond, and continues the charging mode; similarly, for the mobile phone in the OTG mode, if there is a charging request, the mobile phone software does not respond, and continues the OTG mode. Therefore, the phenomenon that the mobile phone cannot be charged normally after being connected to the charging power supply is caused.
Based on the discovery, the embodiment of the application detects the current value of the Vbus pin by using the current detection unit in the mobile phone, and further determines whether the mobile phone triggers the OTG mode by mistake. Specifically, fig. 1 is a circuit schematic diagram of a mode switching application scenario according to an embodiment of the present disclosure, and as shown in fig. 1, a mobile phone according to an embodiment of the present disclosure may include a USB connector 10, a processor 20, and a current detection unit 30.
Specifically, the USB connector 10 may include five pins: ID pin, GND pin, D-pin, D + pin, and Vbus pin. One end of the current detection unit 30 is connected to the Vbus pin, the other end of the current detection unit 30 is connected to the processor 20, and the processor 20 can detect the current value of the Vbus pin through the current detection unit 30; the ID pin is connected to the processor 20, and the level state (high level or low level) of the ID pin can be acquired or controlled by the processor 20; the D-pin and the D + pin are connected with the processor 20, and when the USB connector is connected to other electronic equipment, the other electronic equipment can carry out data communication and the like with the processor 20 of the mobile phone through the D-pin and/or the D + pin; the Vbus pin is also connected to the processor 20, and the level state (high level or low level) of the Vbus pin and the like can be acquired or controlled by the processor 20; the GND pin is connected to the processor 20, and common ground of the USB connector 10 and the processor 20 is realized.
The connection in the embodiment of the present application may be realized by welding, coupling, or the like, and this is not particularly limited in the embodiment of the present application.
Generally, when the ID pin of the mobile phone is at a high level, the mobile phone is in a charging mode, the mobile phone can be normally charged, and the voltage of the ID pin may be 1.8V or higher; when the ID pin of the mobile phone is at a low level, the mobile phone is in an OTG mode, the mobile phone can execute an OTG processing procedure, Vbus outputs a voltage of about 5V, and the D-pin or D + pin can perform communication interaction with an electronic device connected to the mobile phone.
It should be noted that, in the OTG mode, when the ID pin of the mobile phone is at a low level, it indicates that the mobile phone is an OTG master device, and it is suitable that the other electronic device performing OTG communication with the mobile phone is an OTG slave device, the master device may send a control instruction to the slave device, and the slave device may perform corresponding operation according to the control instruction.
It can be understood that, if other electronic devices can also implement the OTG function, after the mobile phone is connected to the other electronic devices through the OTG, the OTG role of the mobile phone and the other electronic devices can be changed (as the master device or as the slave device) according to the setting of the ID pin of the mobile phone and the setting of the ID pin of the other electronic devices, which is not specifically limited in this embodiment of the application.
In practical applications, the processor 20 may be an execution main body for executing the OTG switching method of the mobile phone, and the processor 20 may be a central processing unit of the mobile phone, or the like. The current detection unit 30 may be determined according to an actual application scenario, and for example, the current detection unit 30 may be composed of resistors, transistors, and other electrical devices. It can be understood that, in a typical mobile phone, the current detection unit 30 between the Vbus pin and the processor 20 can detect the current of the Vbus pin, and an Analog-to-Digital converter (ADC) reads a register, so as to obtain the current value of the Vbus pin. The processor 20 and the current detection unit 30 are not particularly limited in the embodiment of the present application.
Fig. 2 is a flowchart of a method for switching an OTG of a mobile phone according to an embodiment of the present disclosure, and as shown in fig. 2, based on the current structure of fig. 1, the method according to the embodiment may include the following steps:
step S101: under the condition that the mobile phone is in the OTG mode, the mobile phone detects the current value of a Vbus pin in a USB interface of the mobile phone.
In the embodiment of the present application, the OTG mode may specifically refer to: the mobile phone can execute OTG processing flow with other electronic equipment through the USB, and the Vbus pin of the mobile phone USB outputs about 5V voltage to the other electronic equipment.
In specific application, whether the mobile phone enters the OTG mode or not can be determined by the level state of the ID pin of the USB port, and specifically, the mobile phone can be considered to be in the OTG mode when the ID pin of the mobile phone is at a low level.
It can be understood that, in practical application, whether the mobile phone enters the OTG mode may also be determined in other manners, for example, after the mobile phone is connected to the charging power supply, if the mobile phone cannot be normally charged, the mobile phone may also be considered to be in the OTG mode.
In the embodiment of the application, under the condition that the mobile phone is in the OTG mode, the mobile phone detects the current value of the Vbus pin of the power bus in the USB interface of the universal serial bus of the mobile phone. Specifically, referring to fig. 1, the detection of the current of the Vbus pin may be implemented by a current detection unit 30 between the Vbus pin and the processor 20, and the register may be read by an analog-to-digital converter (ADC), so as to obtain the current value of the Vbus pin. It can be understood that, in practical application, the current value of the Vbus pin of the power bus in the USB interface of the universal serial bus of the mobile phone may also be detected in other manners, which is not specifically limited in this embodiment of the present application.
Step S102: and when the current value is smaller than a first threshold value, the mobile phone is switched from the OTG mode to a charging mode.
In the embodiment of the present application, the first threshold may be determined according to an actual application scenario, and in a specific application, if the current value of the Vbus pin is too small, it may be considered that no current loop is formed in the Vbus pin, that is, no other electronic device is connected to the mobile phone, so the first threshold may be 0 or a smaller value, and the first threshold is not specifically limited in the embodiment of the present application. Considering that the current identification accuracy of a general current detection unit is 1mA, and the actual current of the Vbus pin is 0, the detected current value may be 0 to 1mA, that is, although the Vbus pin is detected to be not 0, the Vbus pin is not actually connected to the slave device, so that, in order to avoid a current test error of the Vbus pin due to the accuracy of the current detection unit, in some embodiments of the present application, the first threshold may be 0 to 1 mA.
In the embodiment of the application, under the condition that the current value of the Vbus pin is smaller than the first threshold, no slave device is connected to the mobile phone, no current is consumed on a VBus path, and the mobile phone enters an OTG mode due to original false triggering such as interface short circuit, so that the mobile phone is switched from the OTG mode to a charging mode, and the mobile phone can be normally charged in the charging mode.
In an optional implementation manner, when the current value is smaller than a first threshold value, switching the mobile phone from the OTG mode to a charging mode includes:
and when the current value is smaller than a first threshold, the mobile phone ends the OTG identification process and closes the output voltage of the Vbus pin.
In this application embodiment, when the mobile phone is in the OTG mode, the mobile phone may automatically execute the OTG identification process, specifically, the mobile phone will be in a state of communication interaction with the slave device, and the mobile phone outputs an output voltage of about 5V to the slave device through the Vbus pin, so that the specific implementation of switching the mobile phone from the OTG mode to the charging mode may be: the mobile phone ends the OTG identification process and closes the output voltage of the Vbus pin. In a specific application, the OTG identification process of the mobile phone may be ended by a software program in the processor, or may be ended by another method, which is not specifically limited in this embodiment of the present application.
Step S103: and when the current value is greater than the second threshold, the mobile phone executes the OTG identification process in the OTG mode.
In this embodiment of the present application, the second threshold is greater than the first threshold, and the second threshold may be determined according to an actual application scenario, and in a specific application, if the Vbus pin is connected to a slave device, specifically, the slave device may be a usb disk or other OTG slave devices, the Vbus pin and the slave device may form a current loop, and the current loop generally has a higher current value, so that the second threshold may be a higher value, and the second threshold is not specifically limited in this embodiment of the present application. In practical application, considering that the current identification accuracy of a general current detection unit is 1mA and the current consumption of the slave device is generally above 10mA, in an implementation manner of the embodiment of the present application, the second threshold is between 1mA and 10mA, and when the current value is greater than the second threshold, it may be determined that the Vbus pin is connected to the slave device.
In the embodiment of the application, when the current value is greater than the second threshold, the mobile phone may be considered to have access to the slave device, and therefore the mobile phone may execute the OTG identification procedure in the OTG mode.
In summary, the present application provides a method and an apparatus for switching an OTG of a mobile phone, and an inventor finds that, in the prior art, a phenomenon that the mobile phone capable of implementing the OTG function cannot be normally charged after being connected to a charging power supply often occurs because the mobile phone enters an OTG mode by mistake, specifically, in a USB pin, an ID pin is adjacent to a Ground (GND) pin, and in a using process of the mobile phone, the mobile phone may be in a humid or dusty environment, so that a USB port is corroded, and short circuits may be caused by corrosion between the adjacent ID pin and the GND pin in the USB port, so that a level of the ID pin of the mobile phone is lowered, and the mobile phone enters the OTG mode by mistake, thereby causing the mobile phone to be unable to be normally charged. Based on the discovery, in the embodiment of the application, under the condition that the mobile phone is in the OTG mode, the mobile phone detects the current value of the Vbus pin of the power bus in the USB interface of the universal serial bus of the mobile phone; it can be understood that if the current value is too small, it may be considered that no current loop is formed in the Vbus pin, that is, no other electronic device is connected to the mobile phone, and further, it may be considered that the mobile phone is triggered by mistake to enter the OTG mode, so that when the current value is smaller than the first threshold, the mobile phone is switched from the OTG mode to the charging mode, and when the current value is larger than the second threshold, the mobile phone executes the OTG identification process in the OTG mode, thereby avoiding the occurrence of the phenomenon that the mobile phone cannot be charged normally due to entering the OTG mode by mistake.
Fig. 3 shows a functional structure schematic diagram of a mobile phone OTG switching device according to an embodiment of the present application, and as shown in fig. 3, the device includes:
the detecting module 310 is configured to detect a current value of a Vbus pin of a power bus in a USB interface of a universal serial bus of a mobile phone when the mobile phone is in an OTG mode.
The switching module 320 is configured to switch the mobile phone from the OTG mode to the charging mode when the current value is smaller than a first threshold.
The executing module 320 is configured to execute the OTG identification process in the OTG mode when the current value is greater than a second threshold, where the first threshold is smaller than the second threshold.
In one exemplary approach, the first threshold comprises: any value between 0 and 1 milliamp; the second threshold includes: anywhere between 1 milliamp and 10 milliamps.
In an exemplary manner, the switching module includes: and the switching submodule is used for ending the OTG identification process of the mobile phone and closing the output voltage of the Vbus pin when the current value is smaller than a first threshold.
The embodiment of the application provides a method and a device for switching an OTG (on-the-go) function of a mobile phone, and an inventor finds that the phenomenon that the mobile phone with the OTG function cannot be normally charged after being connected to a charging power supply often occurs in the prior art because the mobile phone enters an OTG mode by mistake, specifically, in a USB (universal serial bus) pin, an ID (identification) pin is adjacent to a Grounding (GND) pin, and in the using process of the mobile phone, the mobile phone can be in a humid or dust environment, so that a USB (universal serial bus) port is corroded, short circuits can be caused by corrosion of the adjacent ID pin and the GND pin in the USB port, the level of the ID pin of the mobile phone is lowered, the mobile phone enters the OTG mode by mistake, and the mobile phone cannot be normally charged. Based on the discovery, in the embodiment of the application, under the condition that the mobile phone is in the OTG mode, the mobile phone detects the current value of the Vbus pin of the power bus in the USB interface of the universal serial bus of the mobile phone; it can be understood that if the current value is too small, it may be considered that no current loop is formed in the Vbus pin, that is, no other electronic device is connected to the mobile phone, and further, it may be considered that the mobile phone is triggered by mistake to enter the OTG mode, so that when the current value is smaller than the first threshold, the mobile phone is switched from the OTG mode to the charging mode, and when the current value is larger than the second threshold, the mobile phone executes the OTG identification process in the OTG mode, thereby avoiding the occurrence of the phenomenon that the mobile phone cannot be charged normally due to entering the OTG mode by mistake.
Fig. 4 illustrates a mobile phone provided in an embodiment of the present application, and as shown in fig. 4, the mobile phone includes a processor 410, a memory 420, and a transceiver 430, where the memory 420 is used to store instructions, the transceiver 430 is used to communicate with other devices, and the processor 410 is used to execute the instructions stored in the memory, so as to cause the mobile phone to perform the method according to any one of the present applications.
Embodiments of the present application also provide a computer-readable storage medium storing instructions that, when executed, cause a computer to perform a method as in any of the present applications.
Embodiments of the present application also provide a computer program product comprising instructions that, when executed, cause a computer to perform a method as in any of the present applications.
An embodiment of the present application further provides a system on chip or a system on chip, where the system on chip or the system on chip may be applied to a network device, and the system on chip or the system on chip includes: the network device comprises at least one communication interface, at least one processor and at least one memory, wherein the communication interface, the memory and the processor are interconnected through a bus, and the processor enables the network device to execute the method in the application by executing instructions stored in the memory.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the unit is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the method according to various embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

Claims (4)

1. A method for switching OTG of a mobile phone is characterized by comprising the following steps:
under the condition that the mobile phone is in an OTG mode, the mobile phone detects the current value of a Vbus pin in a Universal Serial Bus (USB) interface of the mobile phone;
when the current value is smaller than a first threshold value, the mobile phone is switched from the OTG mode to a charging mode, where the first threshold value includes: any value between 0 and 1 milliamp;
when the current value is greater than a second threshold value, the mobile phone executes an OTG identification process in the OTG mode, where the second threshold value includes: any value between 1 milliamp and 10 milliamps;
wherein the first threshold value is less than the second threshold value;
when the current value is smaller than a first threshold value, switching the mobile phone from the OTG mode to a charging mode includes:
and when the current value is smaller than a first threshold, the mobile phone ends the OTG identification process and closes the output voltage of the Vbus pin.
2. An OTG switching device for a mobile phone, comprising:
the detection module is used for detecting the current value of a Vbus pin in a Universal Serial Bus (USB) interface of the mobile phone under the condition that the mobile phone is in an OTG mode;
a switching module, configured to switch the mobile phone from the OTG mode to a charging mode when the current value is smaller than a first threshold, where the first threshold includes: any value between 0 and 1 milliamp;
an execution module, configured to execute an OTG identification procedure in the OTG mode when the current value is greater than a second threshold, where the second threshold includes: any value between 1 milliamp and 10 milliamps;
wherein the first threshold value is less than the second threshold value;
and the switching submodule is used for ending the OTG identification process of the mobile phone and closing the output voltage of the Vbus pin when the current value is smaller than a first threshold.
3. A handset comprising a processor, a memory for storing instructions, and a transceiver for communicating with other devices, the processor being configured to execute the instructions stored in the memory to cause the handset to perform the method of claim 1.
4. A computer-readable storage medium having instructions stored thereon that, when executed, cause a computer to perform the method of claim 1.
CN201910521576.5A 2019-06-17 2019-06-17 Mobile phone OTG switching method and device Active CN110442539B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910521576.5A CN110442539B (en) 2019-06-17 2019-06-17 Mobile phone OTG switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910521576.5A CN110442539B (en) 2019-06-17 2019-06-17 Mobile phone OTG switching method and device

Publications (2)

Publication Number Publication Date
CN110442539A CN110442539A (en) 2019-11-12
CN110442539B true CN110442539B (en) 2021-08-31

Family

ID=68429224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910521576.5A Active CN110442539B (en) 2019-06-17 2019-06-17 Mobile phone OTG switching method and device

Country Status (1)

Country Link
CN (1) CN110442539B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996187B (en) * 2022-05-06 2024-07-26 东莞市步步高教育软件有限公司 OTG function control method and device, computer equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221546A (en) * 2007-01-12 2008-07-16 奇岩电子股份有限公司 Device capable of automatically detecting universal serial bus host or peripheral equipment
CN104778144A (en) * 2015-04-21 2015-07-15 广东欧珀移动通信有限公司 OTG-based intelligent terminal operation control method and device
CN105068959A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 A charging method and device for a terminal and a terminal with a data exchange function
CN105071484A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105071488A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105071489A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105182154A (en) * 2015-08-25 2015-12-23 广东欧珀移动通信有限公司 Universal serial bus interface detection circuit and method
CN106844265A (en) * 2017-02-06 2017-06-13 维沃移动通信有限公司 The control method and mobile terminal of a kind of general-purpose serial bus USB interface

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221546A (en) * 2007-01-12 2008-07-16 奇岩电子股份有限公司 Device capable of automatically detecting universal serial bus host or peripheral equipment
CN104778144A (en) * 2015-04-21 2015-07-15 广东欧珀移动通信有限公司 OTG-based intelligent terminal operation control method and device
CN105068959A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 A charging method and device for a terminal and a terminal with a data exchange function
CN105071484A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105071488A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105071489A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Charging method and apparatus of terminal having data exchange function
CN105182154A (en) * 2015-08-25 2015-12-23 广东欧珀移动通信有限公司 Universal serial bus interface detection circuit and method
CN106844265A (en) * 2017-02-06 2017-06-13 维沃移动通信有限公司 The control method and mobile terminal of a kind of general-purpose serial bus USB interface

Also Published As

Publication number Publication date
CN110442539A (en) 2019-11-12

Similar Documents

Publication Publication Date Title
US8762746B1 (en) Power management in electronic devices
US10592253B2 (en) Technologies for pre-memory phase initialization of a computing device
CN108475245B (en) Plug and play device identification method and electronic device
CN107480086B (en) Terminal and control method thereof
WO2019199611A1 (en) Overcurrent protection for universal serial bus type-c (usb-c) connector systems
CN103744821A (en) Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal
US20170255585A1 (en) Method and system for switching role of usb otg device and otg device thereof
CN107766097B (en) An electronic device that performs a start-up operation based on a start-up instruction provided by an endpoint device
CN106786960A (en) Charge control method, device and terminal
US9946552B2 (en) System and method for detecting redundant array of independent disks (RAID) controller state from baseboard management controller (BMC)
US11341076B2 (en) Hot-plugged PCIe device configuration system
US9779047B2 (en) Universal intelligent platform management interface (IPMI) host to baseboard management controller (BMC) communication for non-x86 and legacy free systems
US20150169491A1 (en) Electronic device using usb socket to load firmware and firmware loading method thereof
CN111830394A (en) Charging circuit fault detection method, electronic device and computer readable storage medium
CN112187252A (en) Interface identification circuit, method, equipment and electronic equipment
US8990461B2 (en) On-The-Go (OTG) USB devices configuration method for identifying configuration of other connected devices by reacting to change in resistance value on a resistive line
CN110442539B (en) Mobile phone OTG switching method and device
US20110072168A1 (en) Data transfer system with different operating modes
CN109697179B (en) Hardware resource expansion system and hot plug management device
EP2750030A1 (en) Method, apparatus and processor for reading BIOS
US7266680B1 (en) Method and apparatus for loading configuration data
US8566575B2 (en) Computer apparatus and method for charging portable electronic device using the computer apparatus
CN111949103B (en) Integrated electronic device with data access, transmission and power management and method thereof
US7418539B2 (en) System and method for utilizing an external computing device to access storage inside an inactive computing device
CN114546899A (en) USB device connection method, system and computer readable storage medium

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
TA01 Transfer of patent application right

Effective date of registration: 20210423

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Applicant after: Honor Device Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address