CN109032984A - A kind of method and USB OTG equipment of multiplexing USB interface - Google Patents

A kind of method and USB OTG equipment of multiplexing USB interface Download PDF

Info

Publication number
CN109032984A
CN109032984A CN201810548237.1A CN201810548237A CN109032984A CN 109032984 A CN109032984 A CN 109032984A CN 201810548237 A CN201810548237 A CN 201810548237A CN 109032984 A CN109032984 A CN 109032984A
Authority
CN
China
Prior art keywords
usb
equipment
level
external
type
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.)
Pending
Application number
CN201810548237.1A
Other languages
Chinese (zh)
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.)
GUANGZHOU GEOELECTRON SCIENCE & TECHNOLOGY Co Ltd
Original Assignee
GUANGZHOU GEOELECTRON SCIENCE & TECHNOLOGY 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 GUANGZHOU GEOELECTRON SCIENCE & TECHNOLOGY Co Ltd filed Critical GUANGZHOU GEOELECTRON SCIENCE & TECHNOLOGY Co Ltd
Priority to CN201810548237.1A priority Critical patent/CN109032984A/en
Publication of CN109032984A publication Critical patent/CN109032984A/en
Pending legal-status Critical Current

Links

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/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • 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)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

A kind of method and USB OTG equipment of multiplexing USB interface, it include: when the USB interface on the usb bus of USB OTG equipment is inserted into external equipment, output is for obtaining the inquiry message of the device type of external equipment and monitoring feedback information of the user response after inquiry message, when the device type of feedback information instruction external equipment is the first device type, it disconnects the other equipment of removing external equipment connected on usb bus and the level of the ID pin of the corresponding USB socket of usb bus is simultaneously adjusted to the first level, using USB OTG equipment as from equipment;When the device type of feedback information instruction external equipment is the second device type, the level of the ID pin of the corresponding USB socket of usb bus is adjusted to second electrical level, using USB OTG equipment as main equipment;It can ensure that USB OTG equipment can work normally under various working environments, improve reliability when its work.

Description

Method for multiplexing USB interface and USB OTG equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method for multiplexing Universal Serial Bus (USB) interfaces and a USB OTG device.
Background
The USB interface is a general interface for data exchange, and is widely used in various communication products. With The increasing computing power of mobile devices and The demand of practical applications, The USB implementers association (USB users) developed The specification of USB OTG (On-The-Go), and often called USB OTG devices.
Common USB OTG devices, such as mobile embedded devices, can be plugged into an external device through a USB interface on a USB bus. The mobile embedded equipment needs a mobile power supply to supply power in a mobile environment, so that the mobile embedded equipment is required to be used as main equipment, and the mobile power supply is used as slave equipment; the mobile embedded device also needs to exchange data with a Personal Computer (PC) through a USB bus, and in this case, the mobile embedded device needs to be a slave device, and the PC needs to be a master device. However, according to the USB OTG specification, when selecting the USB OTG device as the master device or the slave device, the USB OTG device is determined according to the level of the ID pin of the USB socket: when the ID pin of the USB socket is grounded (low level), the USB OTG device serves as a master device; when the ID pin of the USB socket is floating (high level), the USB OTG device acts as a slave. In practical applications, a person skilled in the art finds that, when the mobile embedded device is connected to a PC, if the USB OTG device is connected to some external devices that require the USB OTG device as a master device, the ID pin of the USB socket is already in a grounded state (low level), so that the mobile embedded device is still determined as the master device, which may result in that the USB OTG device cannot normally communicate with the PC; when the mobile embedded device is connected to the mobile power supply, the state of the ID pin of the USB socket is a suspended state (high level), and the mobile embedded device is determined to be a slave device, so that the mobile power supply cannot charge the slave device, and the external device cannot normally operate. Therefore, the role of the USB OTG device is determined simply by the level of the ID pin of the USB socket, which causes many problems, and the USB OTG device or the external device cannot work normally.
Disclosure of Invention
The embodiment of the invention discloses a method for multiplexing a USB interface and a USB OTG device, which can improve the reliability of normal operation of the USB OTG device.
The first aspect of the embodiments of the present invention discloses a method for multiplexing USB interfaces, including:
detecting whether a USB interface on a USB bus of the USB OTG equipment is inserted into external equipment;
when the USB interface is detected to be inserted into the external equipment, outputting inquiry information for acquiring the equipment type of the external equipment, and monitoring feedback information after a user responds to the inquiry information, wherein the feedback information carries the equipment type of the external equipment;
when the feedback information indicates that the device type of the external device is a first device type, disconnecting other devices connected on the USB bus and excluding the external device, and adjusting the level of an ID pin of a USB socket corresponding to the USB bus to a first level so that the USB OTG device is accessed to the external device as a slave device;
when the feedback information indicates that the device type of the external device is a second device type, adjusting the level of the ID pin of the USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, when it is detected that the USB interface is inserted into the external device, the outputting query information for acquiring a device type of the external device, and monitoring feedback information of a user after responding to the query information includes:
when the USB interface is detected to be inserted into the external equipment, voice playing is carried out to obtain inquiry information of the equipment type of the external equipment, voice information input by a user and used for responding to the inquiry information is collected, and the voice information is determined as feedback information after the user responds to the inquiry information; or,
the method comprises the steps of controlling a plurality of indicator lamps on an indicator lamp panel to flicker, detecting confirmation operation of a user on one of the indicator lamps, obtaining confirmation information on the one indicator lamp when the confirmation operation is detected, determining the confirmation information as feedback information after the user responds to inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, the disconnecting the other device connected to the USB bus, which is connected to the USB bus and is removed from the external device, includes:
and sending a control signal to a USB bus switch through a micro control unit of the USB OTG device so as to control the USB bus switch to disconnect the connection between the USB bus and the D + pin of the other device, the connection between the USB bus and the D-pin of the other device and the connection between the USB bus switch and the VBUS pin of the other device.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, when the feedback information indicates that the device type of the external device is a second device type, the method further includes, after adjusting a level of an ID pin of a USB socket corresponding to the USB bus to a second level to enable the USB OTG device to be connected to the external device as a master device, the method further includes:
acquiring a contact current value of the USB OTG device connected with the external device, and judging whether the contact current value is larger than a preset current value;
and when the contact current value is larger than the preset current value, outputting a prompt message for indicating that the USB OTG equipment is in a charging state.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, when the feedback information indicates that the device type of the external device is a second device type, adjusting a level of an ID pin of a USB socket corresponding to the USB bus to a second level so that the USB OTG device is connected to the external device as a master device includes:
when the feedback information indicates that the device type of the external device is a second device type, judging whether the level of an ID pin of a USB socket corresponding to the USB bus is a second level;
if so, keeping the level of the ID pin at the second level so as to enable the USB OTG device to be used as a main device to be connected with the external device.
The second aspect of the embodiments of the present invention discloses a USB OTG device, including:
the detection unit is used for detecting whether a USB interface on a USB bus of the USB OTG equipment is inserted into external equipment;
the interaction unit is used for outputting inquiry information for acquiring the equipment type of the external equipment and monitoring feedback information after a user responds to the inquiry information when the detection unit detects that the USB interface is inserted into the external equipment, wherein the feedback information carries the equipment type of the external equipment;
the first execution unit is configured to disconnect other devices connected to the USB bus and excluding the external device when the interaction unit monitors that the feedback information indicates that the device type of the external device is a first device type, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to a first level, so that the USB OTG device is accessed to the external device as a slave device;
and the second execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is the second device type, adjust the level of the ID pin of the USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device.
As an optional implementation manner, in the second aspect of the embodiment of the present invention, the manner that the interaction unit is configured to output inquiry information used for acquiring a device type of the external device when it is detected that the USB interface is inserted into the external device, and monitor feedback information of a user after responding to the inquiry information is specifically:
the interaction unit is used for playing inquiry information for acquiring the equipment type of the external equipment by voice when the USB interface is detected to be inserted into the external equipment, acquiring voice information input by a user for responding to the inquiry information, and determining the voice information as feedback information after the user responds to the inquiry information; or controlling a plurality of indicator lamps on an indicator lamp panel to flash, detecting the confirmation operation of a user on one of the indicator lamps, when the confirmation operation is detected, obtaining the confirmation information on the one indicator lamp, and determining the confirmation information as feedback information after the user responds to the inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
As an optional implementation manner, in the second aspect of the embodiment of the present invention, when the interaction unit monitors that the feedback information indicates that the device type of the external device is the first device type, the first execution unit is configured to disconnect other devices connected on the USB bus and excluding the external device, and adjust a level of an ID pin of a USB socket corresponding to the USB bus to a first level, so that a manner that the USB OTG device accesses the external device as a slave device is specifically:
the first execution unit is configured to send a control signal to a USB bus switch through a micro control unit of the USB OTG device when the interaction unit monitors that the feedback information indicates that the device type of the external device is the first device type, so as to control the USB bus switch to disconnect the connection between the USB bus and the D + pin of the other device, disconnect the connection between the USB bus and the D-pin of the other device, and disconnect the connection between the USB bus switch and the VBUS pin of the other device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is connected to the external device as a slave device.
As an optional implementation manner, in a second aspect of the embodiment of the present invention, the USB OTG device further includes:
an obtaining unit, configured to, when the second execution unit indicates that the device type of the external device is a second device type, adjust a level of an ID pin of a USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device, and then obtain a contact current value of the USB OTG device connected to the external device;
the judging unit is used for judging whether the contact current value acquired by the acquiring unit is larger than a preset current value or not;
and the output unit is used for outputting a prompt message for indicating that the USBOTG device is in a charging state when the contact current value is greater than the preset current value.
As an optional implementation manner, in a second aspect of the embodiment of the present invention, when the interaction unit monitors that the feedback information indicates that the device type of the external device is a second device type, the second execution unit is configured to adjust a level of an ID pin of a USB socket corresponding to the USB bus to a second level, so that a manner of connecting the USB OTG device as a master device to the external device is specifically:
the second execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is a second device type, determine whether the level of the ID pin of the USB socket corresponding to the USB bus is a second level; if so, keeping the level of the ID pin at the second level so as to enable the USB OTG device to be used as a main device to be connected with the external device.
A third aspect of the embodiments of the present invention discloses a USB OTG device, including:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to execute the method for multiplexing the USB interface disclosed by the first aspect of the embodiment of the invention.
A fourth aspect of the embodiments of the present invention discloses a computer-readable storage medium storing a computer program, where the computer program enables a computer to execute the method for multiplexing USB interfaces disclosed in the first aspect of the embodiments of the present invention.
A fifth aspect of embodiments of the present invention discloses a computer program product, which, when run on a computer, causes the computer to perform some or all of the steps of any one of the methods of the first aspect.
A sixth aspect of the present embodiment discloses an application publishing platform, where the application publishing platform is configured to publish a computer program product, where the computer program product is configured to, when running on a computer, cause the computer to perform part or all of the steps of any one of the methods in the first aspect.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, whether a USB interface on a USB bus of a USB OTG device is inserted into an external device is detected; when the USB interface is detected to be inserted into the external equipment, outputting inquiry information for acquiring the equipment type of the external equipment and monitoring feedback information after a user responds to the inquiry information, wherein the feedback information carries the equipment type of the external equipment; when the feedback information indicates that the equipment type of the external equipment is the first equipment type, disconnecting other equipment connected on the USB bus except the external equipment, and adjusting the level of the ID pin of the USB socket corresponding to the USB bus to be the first level so that the USB OTG equipment is used as slave equipment to be accessed into the external equipment; when the feedback information indicates that the device type of the external device is the second device type, adjusting the level of the ID pin of the USB socket corresponding to the USB bus to be the second level so that the USB OTG device is connected with the external device as a main device; by implementing the embodiment of the invention, the user can confirm the device type of the external device accessed by the USB OTG device, and further adjust the level of the ID pin of the USB socket according to the device type to set the USB OTG device as the master device or the slave device, so that the USB OTG device can be ensured to normally work in various working environments, and the reliability of the USB OTG device during working is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart illustrating a method for multiplexing USB interfaces according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another method for multiplexing USB interfaces according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating another method for multiplexing USB interfaces according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a USB OTG device disclosed in the embodiment of the present invention;
FIG. 5 is a schematic structural diagram of another USB OTG device disclosed in the embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another USB OTG device disclosed in the embodiment of the present invention;
fig. 7 is a schematic structural diagram of another USB OTG device disclosed in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It is to be noted that the terms "comprises" and "comprising" and any variations thereof in the embodiments and drawings of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
The embodiment of the invention discloses a method for multiplexing a USB interface and a USB OTG device, which can ensure that the USB OTG device can normally work in various working environments and improve the reliability of the USB OTG device in working. The following are detailed below.
Example one
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a method for multiplexing USB interfaces according to an embodiment of the present invention. As shown in fig. 1, the method for multiplexing USB interfaces may include the following steps:
101. the USB OTG device detects whether a USB interface on a USB bus of the USB OTG device is inserted into an external device, if so, the steps 102 to 103 or the steps 102 and 104 are executed, and if not, the process is ended.
In the embodiment of the present invention, at least one USB interface may be disposed on a USB bus of the USB OTG device, and any USB interface may be inserted into an external device, where the external device may be a mobile power supply, a personal computer, or other USB OTG devices, and the embodiment of the present invention is not limited in this respect. When the external device is a mobile power supply, the USB OTG device is required to be used as a master device, and the mobile power supply is required to be used as a slave device; when the external device is a personal computer or other USB OTG device, the USB OTG device is required to be a slave device, and the personal computer or other USB OTG device is required to be a master device. If the configuration of the master device and the slave device of the USB OTG device is wrong, the charging may be abnormal or the data transmission may be abnormal. Therefore, when the USB OTG device detects that the USB interface on the USB bus of the USB OTG device is inserted into the external device, step 102 to step 103 or step 102 and step 104 are executed.
In the embodiment of the present invention, the USB interface may be a type-c interface. If the type-c interface is adopted, the USB OTG equipment always keeps the cc line in the USB OTG equipment and the cc line on the plug of the type-c interface in a connection state, the type-c interface works based on a Power Delivery Protocol (PD), and when the external equipment inserted into the type-c interface is a mobile Power supply supporting fast charging, the USB OTG equipment can realize the fast charging of the mobile Power supply through the type-c interface.
102. The USB OTG equipment outputs inquiry information used for acquiring the equipment type of the external equipment and monitors feedback information after a user responds to the inquiry information, wherein the feedback information carries the equipment type of the external equipment.
In the embodiment of the present invention, the manner in which the USB OTG device outputs the query information for acquiring the device type of the external device may be that the USB OTG device outputs the query text information for acquiring the device type of the external device on the display screen, or that the USB OTG device broadcasts the query voice information for acquiring the device type of the external device by voice, and the like, which is not limited in the embodiment of the present invention.
As an optional implementation manner, the USB OTG device monitors feedback information after the user responds to the inquiry information, where the feedback information carrying the device type of the external device may include:
the USB OTG equipment sends a starting instruction to the keyboard equipment which is paired with the USB OTG equipment in advance so as to start the keyboard equipment;
the USB OTG equipment receives feedback information which is input by the keyboard equipment after the user responds to the inquiry information and is returned by the keyboard equipment;
and the USB OTG equipment analyzes the feedback information to obtain the equipment type of the external equipment contained in the feedback information.
By implementing the optional implementation manner, the USB OTG device may send a start instruction to a keyboard device that is paired with the USB OTG device in advance to start the keyboard device to receive feedback information entered by a user, so that the user may input device type information of an external device through a keyboard, thereby implementing configuration of the USB OTG device as a master device and a slave device. The process enables the user to input feedback information more conveniently, accords with the use habit of the user and improves the user experience.
103. When the feedback information indicates that the device type of the external device is the first device type, the USB OTG device disconnects other devices connected on the USB bus except the external device, and adjusts the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is used as a slave device to be connected into the external device.
In the embodiment of the present invention, the first device type may include a device type of an electronic device such as a personal computer or other USB OTG device, which is used for performing data transmission with the USB OTG device, and the first device type may also include a device type of an electronic device capable of implementing other functions, and it is only necessary to meet the requirement that after the electronic device is inserted into the USB interface, the electronic device operates as a master device, and the USB OTG device operates as a slave device; when the feedback information indicates that the device type of the external device is the first device type, it indicates that the USB OTG device requires the USB OTG device to access the external device as a slave device if data exchange is to be performed with the external device, but at this time, another device except the external device may be connected to the USB bus, for example, another USB interface on the USB bus is connected to a mobile power source, where the USB OTG device is required to be connected to the mobile power source as a master device to perform normal charging. At this time, in order to preferentially realize data transmission between the USB OTG device and the external device, the USB OTG device disconnects another device connected to the USB bus excluding the external device, and adjusts the level of the ID pin of the USB socket corresponding to the USB bus to a first level (high level) so that the USB OTG device is connected to the external device as a slave device.
104. When the feedback information indicates that the device type of the external device is the second device type, the USB OTG device adjusts the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB OTG device is connected to the external device as a master device.
In the embodiment of the present invention, the second device type may include a device type of an electronic device such as a mobile power supply for implementing a charging function of the USB OTG device, and the second device type may also include a device type of an electronic device capable of implementing other functions, and it is only necessary to meet that, after the electronic device is inserted into the USB interface, the electronic device operates as a slave device, and the USB OTG device operates as a master device; when the feedback information indicates that the device type of the external device is the second device type, the level of the ID pin of the USB socket corresponding to the USB bus is adjusted to the second level (low level), so that the USB OTG device is connected with the external device as a master device to charge the USB OTG device.
In this embodiment of the present invention, when the feedback information indicates that the device type of the external device is the second device type, the USB OTG device adjusts the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB OTG device is connected to the external device as a host device, which may include:
when the feedback information indicates that the device type of the external device is the second device type, the USB OTG device judges whether the level of the ID pin of the USB socket corresponding to the USB bus is the second level;
if so, the USB OTG equipment keeps the level of the ID pin at the second level so as to enable the USB OTG equipment to be used as a main equipment to be connected with an external equipment.
It should be noted that, when the feedback information indicates that the device type of the external device is the second device type, since a plurality of other devices excluding the external device are already connected to the USB bus, the level of the ID pin of the USB socket is the second level, and the USB OTG device needs to keep the level of the ID pin at the second level, so that the USB OTG device is connected to the external device as a host device.
It can be seen that, by implementing the method for multiplexing the USB interface described in fig. 1, when it is detected that the USB interface is inserted into the external device, query information for acquiring a device type of the external device is output, and feedback information after a user responds to the query information is monitored, where the feedback information carries the device type of the external device; when the feedback information indicates that the equipment type of the external equipment is the first equipment type, disconnecting other equipment connected on the USB bus except the external equipment, and adjusting the level of the ID pin of the USB socket corresponding to the USB bus to be the first level so that the USB OTG equipment is used as slave equipment to be accessed into the external equipment; and when the feedback information indicates that the device type of the external device is the second device type, adjusting the level of the ID pin of the USB socket corresponding to the USB bus to be the second level so as to enable the USB OTG device to be connected with the external device as a main device. In the process, the user can confirm the device type of the external device accessed by the USB OTG device, and further adjust the level of the ID pin of the USB socket according to the device type so as to set the USB OTG device as a master device or a slave device, so that the USB OTG device can be ensured to normally work under various working environments, and the reliability of the USB OTG device during working is improved.
Example two
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another method for multiplexing USB interfaces according to an embodiment of the present invention. As shown in fig. 2, the method for multiplexing USB interfaces may include the following steps:
201. the USB OTG device detects whether a USB interface on a USB bus of the USB OTG device is inserted into an external device, if so, the steps 202 to 203 or the steps 202 and 204 are executed, and if not, the process is ended.
202. The USB OTG equipment outputs inquiry information used for acquiring the equipment type of the external equipment and monitors feedback information after a user responds to the inquiry information, and the feedback information carries the equipment type of the external equipment.
As an optional implementation manner, the outputting, by the USB OTG device, inquiry information for acquiring a device type of the external device, and monitoring feedback information of the user after responding to the inquiry information may include:
the USB OTG equipment voice playing is used for acquiring inquiry information of the equipment type of the external equipment, acquiring voice information input by a user and used for replying the inquiry information, and determining the voice information as feedback information after the user responds to the inquiry information; or,
the USB OTG equipment controls a plurality of indicator lamps on an indicator lamp panel to flicker, detects the confirmation operation of a user on one of the indicator lamps, obtains the confirmation information on the one indicator lamp when the confirmation operation is detected, and determines the confirmation information as feedback information after the user responds to inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
By implementing the optional implementation mode, the USB OTG device can monitor the feedback information of the user by playing the query information in voice and collecting the voice information input by the user to reply to the query information in voice, and can also control the indicator light to flash to detect the confirmation operation of the user on the indicator light, so as to monitor the feedback information of the user. The process provides multiple interaction modes with the user to acquire the equipment type of the external equipment, so that the use habit of the user is better fitted, and the user experience is improved.
203. When the feedback information indicates that the device type of the external device is the first device type, the USB OTG device sends a control signal to the USB bus switch through the micro control unit of the USB OTG device to control the USB bus switch to disconnect the USB bus from the D + pin of the other device, disconnect the USB bus from the D-pin of the other device, and disconnect the USB bus from the VBUS pin of the other device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is accessed to the external device as a slave device.
In the embodiment of the invention, the pins on the USB bus can comprise a VBUS pin, a D + pin, a D-pin and an ID pin, and the pins on the USB socket corresponding to the USB bus can comprise the VBUS pin, the D + pin and the D-pin. When an external device is inserted into a USB interface of a USB OTG device, an insertion signal when the external device is inserted is detected, when the insertion signal is detected, a micro control unit can inquire whether the device type of the external device of a user is a first device type through a loudspeaker, the micro control unit can also output an inquiry signal and the like through an LED lamp on the USB OTG device, when the device type of the external device is indicated to be the first device type according to feedback information returned by the user according to the inquiry, a control signal is sent to a USB bus switch to control the USB bus switch to disconnect the connection between the USB bus and a D + pin of other devices, the connection between the USB bus and a D-pin of other devices and the connection between the USB bus switch and a VBUS pin of other devices, the level of an ID pin of a USB socket corresponding to the USB bus is adjusted to be a first level, and the USB socket is communicated with the D + pin of the, The USB socket and the D-pin of the micro control unit and the VBUS pin of the USB socket and the micro control unit are used for enabling the USB OTG device to be used as a slave device to be connected into an external device.
204. When the feedback information indicates that the device type of the external device is the second device type, the USB OTG device adjusts the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB OTG device is connected to the external device as a master device.
In the embodiment of the present invention, when the feedback information indicates that the device type of the external device is the second device type, the USB OTG device may adjust the level of the ID pin of the USB socket corresponding to the USB bus to the second level, connect the USB socket to the VBUS pin of the micro control unit, disconnect the D + pin of the USB socket and the micro control unit, and disconnect the D-pin of the USB socket and the micro control unit, so that the USB OTG device is connected to the external device as a master device, and maintain the normal connection between the micro control unit and other devices.
Therefore, by implementing the method for multiplexing the USB interface described in fig. 2, the USB OTG device can be set as a master device or a slave device through interaction with a user, thereby ensuring normal implementation of data exchange and charging functions and improving the reliability of normal operation of the USB OTG device.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic flowchart illustrating another method for multiplexing USB interfaces according to an embodiment of the present invention. As shown in fig. 3, the method for multiplexing USB interfaces may include the following steps:
301. the USB OTG device detects whether the USB interface on the USB bus is plugged into the external device, if so, performs step 302 to step 303 or performs step 302 and step 304 to step 305, and if not, ends the process.
302. The USB OTG equipment outputs inquiry information used for acquiring the equipment type of the external equipment and monitors feedback information after a user responds to the inquiry information, and the feedback information carries the equipment type of the external equipment.
303. When the feedback information indicates that the device type of the external device is the first device type, the USB OTG device sends a control signal to the USB bus switch through the micro control unit of the USB OTG device to control the USB bus switch to disconnect the USB bus from the D + pin of the other device, disconnect the USB bus from the D-pin of the other device, and disconnect the USB bus from the VBUS pin of the other device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is accessed to the external device as a slave device.
After step 303 is executed, the present flow ends.
304. When the feedback information indicates that the device type of the external device is the second device type, the USB OTG device adjusts the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB OTG device is connected to the external device as a master device.
After step 304 is performed, the process goes to step 305.
305. The USB OTG device obtains a current value of a contact point of the USB OTG device and the external device, and judges whether the current value of the contact point is larger than a preset current value, if so, step 306 is executed, and if not, the process is finished.
In the embodiment of the present invention, when the current value of the connection point between the USB OTG device and the external device is greater than the preset current value, it indicates that the USB OTG device is in a normal charging state, and at this time, step 306 is executed; and when the current value of a contact point for connecting the USB OTG equipment and the external equipment is smaller than or equal to the preset current value, indicating that the USB OTG equipment is in an abnormal charging state, and ending the process.
As an optional implementation manner, after determining that the contact current value is less than or equal to the preset current value, the following steps may be further performed:
the USB OTG equipment sends an electric quantity detection signal to external equipment, and the electric quantity detection signal is used for indicating to acquire the current electric quantity value of the external equipment;
the USB OTG equipment receives the current electric quantity value of the external equipment returned by the external equipment according to the electric quantity detection signal and judges whether the current electric quantity value is lower than a preset electric quantity value or not;
when the current electric quantity value is lower than the preset electric quantity value, the USB OTG equipment sends a first prompt message, and the first prompt message is used for prompting that the external equipment is in a low electric quantity state;
and when the current electric quantity value is not lower than the preset electric quantity value, the USB OTG equipment sends a second prompt message, and the second prompt message is used for prompting that the external equipment is in a fault state.
By implementing the optional implementation mode, after the current value of the contact is judged to be less than or equal to the preset current value, the USB OTG device can acquire the current electric quantity value of the external device, if the current electric quantity value is lower than the preset electric quantity value, the external device is in a low-electric-quantity state, and the abnormal charging is generated due to the low-electric-quantity state of the external device, a first prompt message is sent out so as to remind a user of charging the external device to ensure that the external device charges the USB OTG device normally; if the current electric quantity value is not lower than the preset electric quantity value, the external equipment is in a state of sufficient electric quantity, but the USB OTG equipment is not normally charged, and at the moment, the external equipment is in a fault state and sends out a second prompt message to remind a user to repair the external equipment so as to ensure that the external equipment normally charges the USB OTG equipment. The process sends different prompt messages aiming at different abnormal conditions, so that the user can solve the abnormal charging condition in a targeted manner, and the efficiency of solving the abnormal conditions is improved.
306. The USB OTG device outputs a prompt message for indicating that the USB OTG device is in a charging state.
As an alternative embodiment, after step 306 is executed, the following steps may be further executed:
the USB OTG equipment detects the temperature value of the USB OTG equipment by using a temperature detection unit of the USB OTG equipment;
and when the temperature value reaches a preset temperature threshold value, the USB OTG equipment performs current limiting operation on a current signal transmitted to the USB OTG equipment by the external equipment.
Therefore, by implementing the method for multiplexing the USB interface described in fig. 3, the USB OTG device can be set as a master device or a slave device through interaction with a user, thereby ensuring normal implementation of data exchange and charging functions and improving the reliability of normal operation of the USB OTG device.
In addition, by implementing the method for multiplexing the USB interface described in fig. 3, after the USB OTG device is connected with the external device as the master device, a contact current value of the USB OTG device connected with the external device may be obtained, and when the contact current value is greater than a preset current value, a prompt message indicating that the USB OTG device is in a charging state may be output. The process can output the prompt message for indicating that the USB OTG equipment is in the charging state when the USB OTG equipment is used as the main equipment and connected with the external equipment and the current value of the connecting point is larger than the preset current value, so that the false alarm condition that the USB OTG equipment is connected with the external equipment as the main equipment but the charging is abnormal due to the fault of the external equipment is reduced, and the precision of outputting the prompt message is improved.
In addition, by implementing the method for multiplexing the USB interface described in fig. 3, after the current value of the contact is determined to be greater than the preset current value, the temperature value of the USB OTG device may be detected by using the temperature detection unit of the USB OTG device, and when the temperature value reaches the preset temperature threshold value, it indicates that the temperature of the USB OTG device is too high, and at this time, the current limiting operation may be performed on the current signal transmitted from the external device to the USB OTG device, so as to control the temperature of the USB OTG device, play a role in protecting the USB OTG device, and make charging more intelligent.
Example four
Referring to fig. 4, fig. 4 is a schematic structural diagram of a USB OTG device according to an embodiment of the present invention. As shown in fig. 4, the USB OTG device may include:
the detecting unit 401 is configured to detect whether a USB interface on a USB bus of a USB OTG device is plugged into an external device.
An interaction unit 402, configured to output query information for acquiring a device type of the external device when the detection unit 401 detects that the USB interface is inserted into the external device, and monitor feedback information after the user responds to the query information, where the feedback information carries the device type of the external device.
As an optional implementation manner, the interaction unit 402 monitors feedback information after the user responds to the query information, where the feedback information carrying the device type of the external device may include:
the interaction unit 402 sends a start instruction to a keyboard device which is paired with the USB OTG device in advance to start the keyboard device;
the interaction unit 402 receives feedback information which is returned by the keyboard device and is input by the user through the keyboard device after responding to the inquiry information;
the interaction unit 402 analyzes the feedback information to obtain the device type of the external device included in the feedback information.
By implementing the optional implementation manner, the USB OTG device may send a start instruction to a keyboard device that is paired with the USB OTG device in advance to start the keyboard device to receive feedback information entered by a user, so that the user may input device type information of an external device through a keyboard, thereby implementing configuration of the USB OTG device as a master device and a slave device. The process enables the user to input feedback information more conveniently, accords with the use habit of the user and improves the user experience.
The first executing unit 403 is configured to, when the interacting unit 402 monitors that the feedback information indicates that the device type of the external device is the first device type, disconnect other devices connected on the USB bus and excluding the external device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is used as a slave device to access the external device.
The second executing unit 404 is configured to, when the interacting unit 402 monitors that the feedback information indicates that the device type of the external device is the second device type, adjust the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB otg device is connected to the external device as a master device.
Therefore, by implementing the USB OTG device described in fig. 4, the USB OTG device can be set as a master device or a slave device through interaction with a user, thereby ensuring normal implementation of data exchange and charging functions and improving reliability of normal operation of the USB OTG device.
EXAMPLE five
Referring to fig. 5, fig. 5 is a schematic structural diagram of another USB OTG device disclosed in the embodiment of the present invention. The USB OTG device 400 shown in fig. 5 is optimized from the USB OTG device 400 shown in fig. 4, and compared with the USB OTG device 400 shown in fig. 4, in the USB OTG device 400 shown in fig. 5:
the manner that the interaction unit 402 is configured to output query information for acquiring a device type of the external device when it is detected that the USB interface is inserted into the external device, and monitor feedback information of the user after responding to the query information may specifically be:
an interaction unit 402, configured to, when it is detected that the USB interface is inserted into the external device, perform voice playing to obtain query information of a device type of the external device, collect voice information input by a user to reply to the query information, and determine the voice information as feedback information after the user responds to the query information; or controlling a plurality of indicator lamps on an indicator lamp panel to flash, detecting the confirmation operation of a user on one of the indicator lamps, when the confirmation operation is detected, obtaining the confirmation information on the one indicator lamp, and determining the confirmation information as feedback information after the user responds to inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
Optionally, the first executing unit 403 is configured to, when the interacting unit 402 monitors that the feedback information indicates that the device type of the external device is the first device type, disconnect other devices connected on the USB bus and excluding the external device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the manner that the USB OTG device accesses the external device as the slave device may specifically be:
the first execution unit 403, configured to send a control signal to the USB bus switch through the micro control unit of the USB OTG device when the interaction unit 402 monitors that the feedback information indicates that the device type of the external device is the first device type, to control the USB bus switch to disconnect the connection between the USB bus and the D + pin of the other device, disconnect the connection between the USB bus and the D-pin of the other device, and disconnect the connection between the USB bus and the VBUS pin of the other device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is accessed to the external device as a slave device.
Further optionally, the USB OTG device 400 shown in fig. 5 may further include:
an obtaining unit 405, configured to, when the second executing unit 404 indicates that the device type of the external device is the second device type, adjust the level of the ID pin of the USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a host device, and then obtain a contact current value of the USB OTG device connected to the external device.
A judging unit 406, configured to judge whether the contact current value acquired by the acquiring unit 405 is greater than a preset current value.
As an alternative embodiment, after determining that the contact current value is less than or equal to the preset current value, the determining unit 406 may further be configured to:
sending an electric quantity detection signal to the external equipment, wherein the electric quantity detection signal is used for indicating to acquire the current electric quantity value of the external equipment;
receiving the current electric quantity value of the external equipment returned by the external equipment according to the electric quantity detection signal, and judging whether the current electric quantity value is lower than a preset electric quantity value or not;
when the current electric quantity value is judged to be lower than the preset electric quantity value, sending a first prompt message, wherein the first prompt message is used for prompting that the external equipment is in a low electric quantity state;
and when the current electric quantity value is not lower than the preset electric quantity value, sending a second prompt message, wherein the second prompt message is used for prompting that the external equipment is in a fault state.
By implementing the optional implementation mode, after the current value of the contact is judged to be less than or equal to the preset current value, the USB OTG device can acquire the current electric quantity value of the external device, if the current electric quantity value is lower than the preset electric quantity value, the external device is in a low-electric-quantity state, and the abnormal charging is generated due to the low-electric-quantity state of the external device, a first prompt message is sent out so as to remind a user of charging the external device to ensure that the external device charges the USB OTG device normally; if the current electric quantity value is not lower than the preset electric quantity value, the external equipment still does not normally charge the USB OTG equipment in the state of sufficient electric quantity, and at the moment, the external equipment is in a fault state and sends out a second prompt message to remind a user to repair the external equipment so as to ensure that the external equipment normally charges the USB OTG equipment. The process sends different prompt messages aiming at different abnormal conditions, so that the user can solve the abnormal charging condition in a targeted manner, and the efficiency of solving the abnormal conditions is improved.
As another alternative, after the determining unit 406 determines that the contact current value is greater than the preset current value, the determining unit 406 may further be configured to:
detecting the temperature value of the USB OTG equipment by using a temperature detection unit of the USB OTG equipment;
and when the detected temperature value reaches a preset temperature threshold value, performing current limiting operation on a current signal transmitted from the external equipment to the USB OTG equipment.
An output unit 407, configured to output a prompt message indicating that the USB OTG device is in a charging state when the determination unit 406 determines that the contact current value is greater than the preset current value.
Still further optionally, in the USB OTG device 400 shown in fig. 5:
the second execution unit 404 is configured to, when the interaction unit 402 monitors that the feedback information indicates that the device type of the external device is the second device type, adjust the level of the ID pin of the USB socket corresponding to the USB bus to the second level, so that the USB otg device serving as the master device is connected to the external device in a specific manner:
the second execution unit 404 is configured to, when the interaction unit 402 monitors that the feedback information indicates that the device type of the external device is the second device type, determine whether the level of the ID pin of the USB socket corresponding to the USB bus is the second level; if yes, the level of the ID pin is kept to be the second level, so that the USB OTG device is connected with the external device as a main device.
Therefore, by implementing the USB OTG device described in fig. 5, the USB OTG device can be set as a master device or a slave device through interaction with a user, thereby ensuring normal implementation of data exchange and charging functions and improving reliability of normal operation of the USB OTG device.
In addition, by implementing the USB OTG device described in fig. 5, multiple interaction modes with the user are provided to obtain the device type of the external device, so that the use habit of the user is better fitted, and the user experience is improved.
In addition, by implementing the USB OTG device described in fig. 5, the prompt message indicating that the USB OTG device is in the charging state may be output only when the USB OTG device is used as the host device and connected to the external device and the current value of the connection point is greater than the preset current value, so that a false alarm condition that the USB OTG device is connected to the external device as the host device but the charging is abnormal due to a fault of the external device is reduced, and accuracy of outputting the prompt message is improved.
In addition, through implementing the USB OTG device described in fig. 5, after the contact current value is determined to be greater than the preset current value, the temperature value of the USB OTG device may be detected by using the temperature detection unit of the USB OTG device, and when the temperature value reaches the preset temperature threshold value, it is indicated that the temperature of the USB OTG device is too high, and at this time, the current limiting operation may be performed on the current signal transmitted from the external device to the USB OTG device, so as to control the temperature of the USB OTG device, play a role in protecting the USB OTG device, and make charging more intelligent.
EXAMPLE six
Referring to fig. 6 and 7 together, fig. 6 and 7 are schematic structural diagrams of another USB OTG device disclosed in the embodiment of the present invention. As shown in fig. 6, the USB OTG device may include:
a memory 601 in which executable program code is stored;
a processor 602 coupled to a memory 601;
the processor 602 calls the executable program code stored in the memory 601 to execute any one of the methods of multiplexing USB interfaces of fig. 1 to 3.
Referring to fig. 7, n USB interfaces (not shown) are connected to the USB bus, and the USB interfaces are respectively connected to the external devices 1-n, wherein the connection between the external devices 1-n and the USB interfaces on the USB bus is controlled via the USB bus switch. When the feedback information indicates that the type of the external device connected to the USB OTG device is the first device type, the micro control unit may send a switch control instruction to the USB bus switch to control the USB bus switch to disconnect the connection between the D + pin of the other device connected to the USB bus except the external device and the USB bus, the connection between the D-pin of the other device and the USB bus, and the connection between the VBUS pin of the other device and the USB bus, and adjust the ID pin of the USB socket corresponding to the USB bus switch to a first level, and simultaneously connect the D + pin of the micro control unit and the USB socket, the D-pin of the micro control unit and the USB socket, and the VBUS pin of the micro control unit and the USB socket, so that the USB OTG device is accessed to the external device as a slave device. When the feedback information indicates that the type of the external device connected with the USB OTG device is the second device type, the ID pin of the USB socket corresponding to the USB bus switch is adjusted to the second level, and the VBUS pin of the micro control unit is communicated with the USB socket, so that the USB OTG device is connected with the external device as a main device. The process ensures the normal realization of the data exchange and charging functions of the USB OTG equipment and improves the reliability of the normal work of the USB OTG equipment.
The embodiment of the invention discloses a computer-readable storage medium which stores a computer program, wherein the computer program enables a computer to execute any one method for multiplexing a USB interface in figures 1-3.
Embodiments of the present invention also disclose a computer program product, wherein, when the computer program product is run on a computer, the computer is caused to execute part or all of the steps of the method as in the above method embodiments.
The embodiment of the present invention also discloses an application publishing platform, wherein the application publishing platform is used for publishing a computer program product, and when the computer program product runs on a computer, the computer is caused to execute part or all of the steps of the method in the above method embodiments.
In various embodiments of the present invention, it should be understood that the sequence numbers of the above-mentioned processes do not imply an inevitable order of execution, and the execution order of the processes should be determined by their functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A from which B can be determined. It should also be understood, however, that determining B from a does not mean determining B from a alone, but may also be determined from a and/or other information.
In addition, functional units in the embodiments of the present invention 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, and can also be realized in a form of a software functional unit.
The integrated units, if implemented as software functional units and sold or used as a stand-alone product, may be stored in a computer accessible memory. Based on such understanding, the technical solution of the present invention, which is a part of or contributes to the prior art in essence, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for causing a computer device (which may be a personal computer, a server, a network device, or the like, and may specifically be a processor in the computer device) to execute part or all of the steps of the above-described method of each embodiment of the present invention.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by instructions associated with a program, which may be stored in a computer-readable storage medium, where the storage medium includes 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), compact disc-Read-Only Memory (CD-ROM), or other Memory, magnetic disk, magnetic tape, or magnetic tape, Or any other medium which can be used to carry or store data and which can be read by a computer.
The method for multiplexing USB interfaces and the USB OTG device disclosed in the embodiments of the present invention are described in detail above, and a specific example is applied in the description to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method of multiplexing a universal serial bus USB interface, comprising:
detecting whether a USB interface on a USB bus of the USB OTG equipment is inserted into external equipment;
when the USB interface is detected to be inserted into the external equipment, outputting inquiry information for acquiring the equipment type of the external equipment, and monitoring feedback information after a user responds to the inquiry information, wherein the feedback information carries the equipment type of the external equipment;
when the feedback information indicates that the device type of the external device is a first device type, disconnecting other devices connected on the USB bus and excluding the external device, and adjusting the level of an ID pin of a USB socket corresponding to the USB bus to a first level so that the USB OTG device is accessed to the external device as a slave device;
when the feedback information indicates that the device type of the external device is a second device type, adjusting the level of the ID pin of the USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device.
2. The method according to claim 1, wherein outputting query information for obtaining a device type of the external device when the USB interface is detected to be inserted into the external device, and monitoring feedback information of a user after responding to the query information comprises:
when the USB interface is detected to be inserted into the external equipment, voice playing is carried out to obtain inquiry information of the equipment type of the external equipment, voice information input by a user and used for responding to the inquiry information is collected, and the voice information is determined as feedback information after the user responds to the inquiry information; or,
the method comprises the steps of controlling a plurality of indicator lamps on an indicator lamp panel to flicker, detecting confirmation operation of a user on one of the indicator lamps, obtaining confirmation information on the one indicator lamp when the confirmation operation is detected, determining the confirmation information as feedback information after the user responds to inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
3. The method according to claim 1 or 2, wherein the disconnecting the other device connected to the USB bus excluding the external device comprises:
and sending a control signal to a USB bus switch through a micro control unit of the USB OTG device so as to control the USB bus switch to disconnect the connection between the USB bus and the D + pin of the other device, the connection between the USB bus and the D-pin of the other device and the connection between the USB bus switch and the VBUS pin of the other device.
4. The method according to any one of claims 1 to 3, wherein when the feedback information indicates that the device type of the external device is a second device type, the level of the ID pin of the USB socket corresponding to the USB bus is adjusted to a second level, so that after the USB OTG device is connected to the external device as a master device, the method further comprises:
acquiring a contact current value of the USB OTG device connected with the external device, and judging whether the contact current value is larger than a preset current value;
and when the contact current value is larger than the preset current value, outputting a prompt message for indicating that the USB OTG equipment is in a charging state.
5. The method according to claim 1, wherein when the feedback information indicates that the device type of the external device is a second device type, adjusting the level of the ID pin of the USB socket corresponding to the USB bus to a second level so that the USB OTG device is connected to the external device as a master device comprises:
when the feedback information indicates that the device type of the external device is a second device type, judging whether the level of an ID pin of a USB socket corresponding to the USB bus is a second level;
if so, keeping the level of the ID pin at the second level so as to enable the USB OTG device to be used as a main device to be connected with the external device.
6. A USB OTG device, comprising:
the detection unit is used for detecting whether a USB interface on a USB bus of the USB OTG equipment is inserted into external equipment;
the interaction unit is used for outputting inquiry information for acquiring the equipment type of the external equipment and monitoring feedback information after a user responds to the inquiry information when the detection unit detects that the USB interface is inserted into the external equipment, wherein the feedback information carries the equipment type of the external equipment;
the first execution unit is configured to disconnect other devices connected to the USB bus and excluding the external device when the interaction unit monitors that the feedback information indicates that the device type of the external device is a first device type, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to a first level, so that the USB OTG device is accessed to the external device as a slave device;
and the second execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is the second device type, adjust the level of the ID pin of the USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device.
7. The USB OTG device according to claim 6, wherein the interaction unit is configured to output query information for obtaining a device type of the external device when it is detected that the USB interface is inserted into the external device, and the manner of monitoring feedback information of a user after responding to the query information is specifically:
the interaction unit is used for playing inquiry information for acquiring the equipment type of the external equipment by voice when the USB interface is detected to be inserted into the external equipment, acquiring voice information input by a user for responding to the inquiry information, and determining the voice information as feedback information after the user responds to the inquiry information; or controlling a plurality of indicator lamps on an indicator lamp panel to flash, detecting the confirmation operation of a user on one of the indicator lamps, when the confirmation operation is detected, obtaining the confirmation information on the one indicator lamp, and determining the confirmation information as feedback information after the user responds to the inquiry information, wherein each indicator lamp corresponds to one equipment type, and the confirmation information is used for indicating the equipment type corresponding to the one indicator lamp.
8. The USB OTG device according to claim 6 or 7, wherein the first execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is a first device type, disconnect another device connected on the USB bus and excluding the external device, and adjust a level of an ID pin of a USB socket corresponding to the USB bus to a first level, so that a manner that the USB OTG device accesses the external device as a slave device is specifically:
the first execution unit is configured to send a control signal to a USB bus switch through a micro control unit of the USB OTG device when the interaction unit monitors that the feedback information indicates that the device type of the external device is the first device type, so as to control the USB bus switch to disconnect the connection between the USB bus and the D + pin of the other device, disconnect the connection between the USB bus and the D-pin of the other device, and disconnect the connection between the USB bus switch and the VBUS pin of the other device, and adjust the level of the ID pin of the USB socket corresponding to the USB bus to the first level, so that the USB OTG device is connected to the external device as a slave device.
9. The USB OTG device of any one of claims 6 to 8, wherein the USB OTG device further comprises:
an obtaining unit, configured to, when the second execution unit indicates that the device type of the external device is a second device type, adjust a level of an ID pin of a USB socket corresponding to the USB bus to a second level, so that the USB OTG device is connected to the external device as a master device, and then obtain a contact current value of the USB OTG device connected to the external device;
the judging unit is used for judging whether the contact current value acquired by the acquiring unit is larger than a preset current value or not;
and the output unit is used for outputting a prompt message for indicating that the USB OTG equipment is in a charging state when the contact current value is greater than the preset current value.
10. The USB OTG device according to claim 9, wherein the second execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is a second device type, adjust a level of an ID pin of a USB socket corresponding to the USB bus to a second level, so that a manner in which the USB OTG device is connected to the external device as a master device specifically is:
the second execution unit is configured to, when the interaction unit monitors that the feedback information indicates that the device type of the external device is a second device type, determine whether the level of the ID pin of the USB socket corresponding to the USB bus is a second level; if so, keeping the level of the ID pin at the second level so as to enable the USB OTG device to be used as a main device to be connected with the external device.
CN201810548237.1A 2018-05-31 2018-05-31 A kind of method and USB OTG equipment of multiplexing USB interface Pending CN109032984A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810548237.1A CN109032984A (en) 2018-05-31 2018-05-31 A kind of method and USB OTG equipment of multiplexing USB interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810548237.1A CN109032984A (en) 2018-05-31 2018-05-31 A kind of method and USB OTG equipment of multiplexing USB interface

Publications (1)

Publication Number Publication Date
CN109032984A true CN109032984A (en) 2018-12-18

Family

ID=64611912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810548237.1A Pending CN109032984A (en) 2018-05-31 2018-05-31 A kind of method and USB OTG equipment of multiplexing USB interface

Country Status (1)

Country Link
CN (1) CN109032984A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110471812A (en) * 2019-07-23 2019-11-19 广东以诺通讯有限公司 A kind of method of USB and AccessPort multiplexing
CN111447127A (en) * 2020-03-11 2020-07-24 北京金茂绿建科技有限公司 Bus multiplexing method and system
CN111836089A (en) * 2019-04-17 2020-10-27 百度在线网络技术(北京)有限公司 Processing method, device and equipment for matching channel list and storage medium
CN111949594A (en) * 2020-08-18 2020-11-17 上海乐今通信技术有限公司 Mobile terminal with multiple USB interfaces and implementation method
CN112579500A (en) * 2020-12-08 2021-03-30 深圳市道通科技股份有限公司 Method and device for prompting anti-misplug USB interface and electronic equipment
CN113157612A (en) * 2020-01-22 2021-07-23 海信视像科技股份有限公司 Interface adapting circuit and display device
CN118467435A (en) * 2024-07-11 2024-08-09 比亚迪股份有限公司 Universal serial bus control circuit, system, method, electronic device, medium, product, and vehicle

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103561369A (en) * 2013-10-31 2014-02-05 惠州Tcl移动通信有限公司 Usb interface circuit and electronic equipment
CN103744821A (en) * 2014-01-10 2014-04-23 广东欧珀移动通信有限公司 Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal
CN104090860A (en) * 2014-07-04 2014-10-08 苏州佳世达电通有限公司 Display device and operating method thereof
CN106598892A (en) * 2015-10-14 2017-04-26 小米科技有限责任公司 Switching control method and apparatus
KR20170098467A (en) * 2016-02-22 2017-08-30 에스케이텔레콤 주식회사 Apparatus and method for providing usb interface between potable device and external device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103561369A (en) * 2013-10-31 2014-02-05 惠州Tcl移动通信有限公司 Usb interface circuit and electronic equipment
CN103744821A (en) * 2014-01-10 2014-04-23 广东欧珀移动通信有限公司 Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal
CN104090860A (en) * 2014-07-04 2014-10-08 苏州佳世达电通有限公司 Display device and operating method thereof
CN106598892A (en) * 2015-10-14 2017-04-26 小米科技有限责任公司 Switching control method and apparatus
KR20170098467A (en) * 2016-02-22 2017-08-30 에스케이텔레콤 주식회사 Apparatus and method for providing usb interface between potable device and external device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111836089A (en) * 2019-04-17 2020-10-27 百度在线网络技术(北京)有限公司 Processing method, device and equipment for matching channel list and storage medium
CN110471812A (en) * 2019-07-23 2019-11-19 广东以诺通讯有限公司 A kind of method of USB and AccessPort multiplexing
CN113157612A (en) * 2020-01-22 2021-07-23 海信视像科技股份有限公司 Interface adapting circuit and display device
CN113157612B (en) * 2020-01-22 2022-12-13 海信视像科技股份有限公司 Interface adapting circuit and display device
CN111447127A (en) * 2020-03-11 2020-07-24 北京金茂绿建科技有限公司 Bus multiplexing method and system
CN111949594A (en) * 2020-08-18 2020-11-17 上海乐今通信技术有限公司 Mobile terminal with multiple USB interfaces and implementation method
CN112579500A (en) * 2020-12-08 2021-03-30 深圳市道通科技股份有限公司 Method and device for prompting anti-misplug USB interface and electronic equipment
CN118467435A (en) * 2024-07-11 2024-08-09 比亚迪股份有限公司 Universal serial bus control circuit, system, method, electronic device, medium, product, and vehicle

Similar Documents

Publication Publication Date Title
CN109032984A (en) A kind of method and USB OTG equipment of multiplexing USB interface
US10910853B2 (en) Quick charging method, power adapter and mobile terminal
WO2017185686A1 (en) Charging power adjusting method and apparatus, and electronic device
US20200280198A1 (en) Method for controlling connection between electronic device and charging device, and device for providing same
WO2013152662A1 (en) Power supply method for terminal device, and terminal device thereof
KR20170125652A (en) Electronic device and controlling method thereof
US11462930B2 (en) Method and device for controlling charging on basis of state of battery
CN113411794A (en) Connection method, Bluetooth headset, terminal and computer storage medium
CN106786904A (en) Charging system of selection, device and charging equipment
CN108924325B (en) Data processing method and related device
CN110970954B (en) Charging control method and device, storage medium and split type electronic equipment
CN107276180B (en) Charging control method, device and system and user equipment
JP2020149239A (en) Photovoltaic power generation system, photovoltaic power generation processing apparatus, and control method and program for photovoltaic power generation processing apparatus
CN111355505B (en) SIM card seat type identification method, device and computer readable medium
CN107145405A (en) The baseboard management controller of server and its operating method and control circuit
CN104065728A (en) State information control method, related equipment and related system
JP2020124059A (en) Charge control device and charge control system
CN103795857A (en) Information processing method and electronic equipment
CN112825401B (en) Charging line, charger, charging control method and charging device
CN110970948A (en) Charging control method and device, storage medium and split type electronic equipment
CN113991804A (en) Charging protocol handshaking circuit and electronic equipment
US8832341B2 (en) Dynamically determining a primary or slave assignment based on receiving a power signal from the cable at the port of a device
CN112119566A (en) Power supply method, device, system and storage medium
CN113347508B (en) External device communication circuit, external device communication connection method and intelligent terminal device
CN109343689B (en) Information processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20181218

RJ01 Rejection of invention patent application after publication