CN112579500A - Method and device for prompting anti-misplug USB interface and electronic equipment - Google Patents

Method and device for prompting anti-misplug USB interface and electronic equipment Download PDF

Info

Publication number
CN112579500A
CN112579500A CN202011445135.0A CN202011445135A CN112579500A CN 112579500 A CN112579500 A CN 112579500A CN 202011445135 A CN202011445135 A CN 202011445135A CN 112579500 A CN112579500 A CN 112579500A
Authority
CN
China
Prior art keywords
usb interface
output port
usb
type
equipment
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
CN202011445135.0A
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.)
Autel Intelligent Technology Corp Ltd
Original Assignee
Autel Intelligent Technology Corp 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 Autel Intelligent Technology Corp Ltd filed Critical Autel Intelligent Technology Corp Ltd
Priority to CN202011445135.0A priority Critical patent/CN112579500A/en
Publication of CN112579500A publication Critical patent/CN112579500A/en
Pending legal-status Critical Current

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/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • 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
    • G06F13/4086Bus impedance matching, e.g. termination
    • 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]

Abstract

The invention relates to the technical field of USB interfaces, in particular to a method and a device for prompting an anti-misplug USB interface and electronic equipment, wherein the method comprises the following steps: detecting whether an external device is inserted into one of the at least two USB interfaces; if yes, acquiring the type of the external equipment; when the type of the external equipment is the main equipment, judging whether the type of the USB interface is the main equipment or not; and if the type of the USB interface is the main equipment, prompting the USB interface to insert an error message. The method and the device can identify whether the external equipment inserted into the USB interface is matched with the USB interface or not, and carry out friendly reminding on the user if the external equipment is not matched with the USB interface, so that the user can be intelligently helped to determine the correct USB interface, and the user experience is improved.

Description

Method and device for prompting anti-misplug USB interface and electronic equipment
Technical Field
The invention relates to the technical field of USB interfaces, in particular to a method and a device for prompting a USB interface to prevent wrong insertion and electronic equipment.
Background
At present, functions integrated on mobile terminal devices are more and more abundant, for example, a tablet computer can simultaneously support the requirement of a plurality of USB interfaces, and a type-A, type-B, type-C interface is defined in USB. the type-C interface is currently becoming the mainstream trend for consumer electronics.
the type-C type USB interface can be generally divided into a USB OTG interface and a USB Host interface, a general main control chip only comprises one USB OTG interface, and in some electronic products, the charging function can be fused on the USB OTG interface.
However, when the electronic product includes two types of interfaces, namely, USB OTG and USB Host, the user usually distinguishes the different USB interfaces according to the appearance, and if the interface is inserted incorrectly, the user can only recognize the USB symbol according to the appearance to confirm the correct USB interface, which are not intelligent enough. Therefore, how to intelligently detect whether the interface is connected correctly and carry out friendly reminding on the user has important significance.
Disclosure of Invention
The technical problem mainly solved by the embodiment of the invention is how to intelligently detect whether the USB interface is inserted wrongly so as to carry out friendly reminding on a user.
In order to solve the above technical problem, one technical solution adopted by the embodiment of the present invention is: the method for prompting the misplug-proof USB interface is applied to electronic equipment, the electronic equipment is provided with at least two USB interfaces, and the method comprises the following steps:
detecting whether an external device is inserted into one of the at least two USB interfaces;
if yes, acquiring the type of the external equipment;
when the type of the external equipment is the main equipment, judging whether the type of the USB interface is the main equipment or not;
and if the type of the USB interface is the main equipment, prompting the USB interface to insert an error message.
Optionally, the detecting whether an external device is inserted into one of the at least two USB interfaces includes:
registering an interrupt based on a first general purpose input/output port;
detecting whether an interrupt of the first general input/output port registration is triggered;
and if so, determining that external equipment is inserted into the USB interface, otherwise, determining that no external equipment is inserted into the USB interface.
Optionally, the obtaining the type of the external device includes:
acquiring the level of the first general input/output port, and determining that the external equipment is the main equipment when the level is high; and when the level is low level, determining that the external equipment is slave equipment.
Optionally, when the level of the first general purpose input/output port is a low level, the method further includes:
controlling a third general purpose input/output port to be enabled, the third general purpose input/output port being an output interface facing the external device.
Optionally, the determining whether the type of the USB interface is a master device includes:
registering the interrupt based on the second general input/output port;
when the interruption of the second general input/output port registration is triggered, acquiring the level of the second general input/output port;
and when the level of the second general input/output port is high level, determining that the type of the USB interface is the master device.
Optionally, the prompting the USB interface to insert the error reminding message includes:
and receiving a hot plug event, and popping up a USB interface error insertion reminding window according to the hot plug event.
Optionally, the USB interface includes a charger interface and an MTP device interface.
In order to solve the above technical problem, another technical solution adopted by the embodiment of the present invention is: the utility model provides a suggestion device of mistake proofing USB interface of inserting, is applied to electronic equipment, electronic equipment is equipped with two at least USB interfaces, the device includes:
the detection module is used for detecting whether external equipment is inserted into one of the at least two USB interfaces;
the acquisition module is used for acquiring the type of the external equipment if the external equipment is in the preset type;
the judging module is used for judging whether the type of the USB interface is the main equipment or not when the type of the external equipment is the main equipment;
and the sending module is used for prompting the USB interface to insert an error message if the type of the USB interface is the main equipment.
In order to solve the above technical problem, another technical solution adopted by the embodiment of the present invention is: provided is an electronic device including: at least one USB interface; a first universal input/output port, a second universal input/output port, and a third universal input/output port coupled to the at least one USB interface; the processor is in communication connection with the USB interface; a memory communicatively coupled to the processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executable by the at least one processor to enable the at least one processor to perform the method for prompting a misplug-proof USB interface as described above according to the first general purpose input/output port, the second general purpose input/output port, and the third general purpose input/output port.
Different from the situation of the related art, the embodiment of the invention detects whether the external equipment is inserted into one USB interface of at least two USB interfaces; if yes, acquiring the type of the external equipment; when the type of the external equipment is the main equipment, judging whether the type of the USB interface is the main equipment or not; and if the type of the USB interface is the main equipment, prompting the USB interface to insert an error message. The prompt method and device for the anti-misplug USB interface and the electronic device provided by the embodiment of the invention can identify whether the external device plugged into the USB interface is matched with the USB interface or not, and if not, friendly prompt is carried out on a user, so that the user can be intelligently helped to determine the correct USB interface, and the user experience is improved.
Drawings
One or more embodiments are illustrated in drawings corresponding to, and not limiting to, the embodiments, in which elements having the same reference number designation may be represented as similar elements, unless specifically noted, the drawings in the figures are not to scale.
Fig. 1 is a flowchart of a method for prompting a USB interface to prevent wrong insertion according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for detecting whether an external device is plugged into a USB interface according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for determining whether a type of a USB interface is a master device according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for prompting a USB charging interface for error insertion prevention according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a page reminder when the USB interface is inserted incorrectly by the charger according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a prompt apparatus for preventing a wrong-insertion USB interface according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for prompting a USB interface for error insertion prevention according to an embodiment of the present invention. The method can be applied to electronic equipment which is provided with at least two USB interfaces, and comprises the following steps:
s11, detecting whether an external device is inserted into one of the at least two USB interfaces;
in this embodiment, the USB interface is mainly a Type-C interface, and the Type-C interface is an interface Type that can be applied to both the host device and the external device. The main device can be connected with a plurality of external devices, for example, the main device is a computer, a notebook computer, a tablet computer, and the like. The external devices include various terminal devices such as a mobile phone, an automobile diagnostic apparatus, a charger, an e-book reader, and the like.
The Type-C Type USB interface generally includes both USB OTG and USB Host. USB OTG is a mode introduced by USB2.0, and proposes a concept of a Host negotiation protocol, and OTG (on THE go) allows two devices to negotiate who acts as a Host. The USB OTG port allows the USB device to be used as a master device or a slave device, and the master control chip usually includes only one USB OTG port.
The USB Host port only allows USB devices to be Host devices, and usually the Host chip includes one or more USB Host ports. USB Host USB devices are generally classified into Host (master device) and SLAVE (SLAVE device), and data transfer is performed only when a master device is connected to a SLAVE device, and if the device supports USB Host, it can obtain data from an external USB device. Only one Host exists on a single USB, and the USB controls the output of the whole data bus by the Host end.
Wherein the master device is generally the party providing data, the slave device is generally the party receiving data, and the USB specification requires that power must be provided by the master device. The method provided by the embodiment is mainly used for detecting the USB Host port serving as the main device. For example, when the external device needs to input data to the device currently including the USB interface, if the external device is plugged into the USB Host port, the USB interface should be prompted to plug in an error message.
The at least two USB interfaces may be composed of an OTG-type USB interface and a Host-type USB interface, or may be composed of an OTG-type USB interface and a plurality of Host-type USB interfaces.
In this embodiment, it is mainly detected whether an external device is plugged into the USB interface through a General-purpose input/output (GPIO) port. Specifically, as shown in fig. 2, the detecting whether an external device is inserted into the USB interface includes:
s111, registering interruption based on a first general input/output port;
s112, detecting whether the interruption of the first general input/output port registration is triggered;
if yes, executing the following step S113; if not, the following step S114 is executed.
S113, determining that external equipment is inserted into the USB interface;
and S114, no external equipment is inserted into the USB interface.
The first general input/output port is a newly added pin arranged on the chip and has a GPIO function, and the first general input/output port can be a USB _ ID specifically and is used for detecting whether an external device is plugged into or pulled out of a USB interface.
It will be appreciated that when a device needs to request a service, an interrupt signal may be initiated, typically connected to the interrupt controller for further processing by the interrupt controller. The interrupt controller is responsible for collecting interrupts initiated by an interrupt source, which may be the first gpio/o port, when registering an interrupt based on the first gpio/o port, i.e. initiating an interrupt by the first gpio/o port. The processor is a component for finally responding to the interrupt, and controls and manages each interrupt in the system through programming operation of the programmable interrupt controller, when the interrupt controller finally judges that one interrupt can be processed, the interrupt controller informs one or more processors to process the interrupt according to the preset setting, but at last, only one processor generally responds to the interrupt request, whether the interrupt registered by the first general input/output port is triggered or not can be detected according to the responded interrupt request, if the processor responds to the interrupt registered by the first GPIO, the interrupt is triggered, at this moment, it is determined that an external device is inserted into the USB interface, otherwise, no external device is inserted into the USB interface.
If it is detected that the external device is inserted into the USB interface according to the above method, the following step S12 is executed.
S12, acquiring the type of the external equipment;
in this embodiment, the types of the external devices mainly include a master device and a slave device. The master device may be connected to a plurality of slave devices, for example, the USB interface of the computer is a USB master device, and may be connected to other slave devices such as a USB disk, a USB mouse, a keyboard, a USB network card, and a charger connected to a USB data line. The master device is used for sending commands, and the slave device is used for receiving commands or answering the commands.
And acquiring the type of the external device, namely judging whether the external device is a master device or a slave device. In this embodiment, mainly determining whether an external device plugged into a USB interface is a master device or a slave device according to a level of the first general input/output port includes: acquiring the level of the first general input/output port, and determining that the external equipment is the main equipment when the level is high; and when the level is low level, determining that the external equipment is slave equipment. When an external device is plugged into the USB interface, level conversion can exist in a first universal input/output port, the first universal input/output port is high level, the external device is indicated to have voltage input, and the external device is determined to be a main device. The first general input/output port is at low level, which indicates that the external device has no voltage input, and the external device is determined to be a slave device.
In some embodiments, when the level of the first general purpose input/output port is a low level, the method further comprises: controlling a third general purpose input/output port to be enabled, the third general purpose input/output port being an output interface facing the external device. The third general input/output port is also an additional pin arranged on the chip and has the GPIO function. And if the first general input/output port is at a low level, the third general input/output port is opened to enable, and the third general input/output port can be a USB _ VBUS _ EN pin specifically, so that power can be supplied to the external equipment or data can be transmitted to the external equipment through the third general input/output port.
It should be noted that the default state of the first general purpose input/output port is a high level, that is, the USB _ ID is a high level by default, that is, whether the external device is plugged in or unplugged from the slave device can be detected through the first general purpose input/output port. And if the first general input/output port changes from the default high level to the default low level, determining that the external device is the slave device. Otherwise, the external device is a master device.
S13, when the type of the external equipment is the main equipment, judging whether the type of the USB interface is the main equipment;
after determining that the external device is a master device, further determining a type of a USB interface into which the external device is inserted, that is, determining whether the USB interface is currently a master device or a slave device. In the embodiment, whether the USB interface is the master device or the slave device is judged according to the level condition of the second universal input/output port. Specifically, as shown in fig. 3, the determining whether the type of the USB interface is a master device includes:
s131, registering and interrupting based on a second universal input/output port;
s132, when the interruption of the second general input/output port registration is triggered, acquiring the level of the second general input/output port;
s133, when the level of the second general input/output port is high level, determining that the type of the USB interface is the master device.
The second general input/output port is also an additional pin arranged on the chip and has a GPIO function, the second general input/output port can be a USB _ VBUS _ DET pin specifically, and the second general input/output port is used for detecting level conversion including high level detection and low level detection.
It should be noted that the default state of the second general purpose input/output port is a low level, and when the first general purpose input/output port determines that the first general purpose input/output port is kept at a high level, the third general purpose input/output port is turned off, and the interrupt detection of the second general purpose input/output port is controlled. If the interruption of the second general input/output port is detected and the level of the second general input/output port is kept to be low level in a default state, the reminding function is not triggered, and if the level of the second general input/output port is changed from low level to high level, the reminding function is triggered.
In addition, if the level corresponding to the interrupt detected by the first general input/output port is low level, that is, USB _ ID is low level, the second general input/output port is closed, that is, the interrupt detection of USB _ VBUS _ DET is closed, that is, the reminding function of the external device interface connection error is not triggered.
If it is determined that the type of the USB interface is the master device according to the method described above, the following step S14 is performed. If the type of the USB interface is determined not to be the main device, the USB interface is not prompted to insert an error message, and at this time, the external device serving as the main device can transmit data or provide power for the device including the USB interface.
And S14, prompting the USB interface to insert an error message.
The above-mentioned detection is whether the type of the USB interface is the master device, that is, whether the USB interface is the USB Host interface.
Because the USB interface and the external device inserted into the USB interface are both main devices, which do not meet the requirements of the USB technical specification, the USB interface error insertion reminding message is sent.
The sending of the USB interface insertion error reminding message includes: and receiving a hot plug event, and popping up a USB interface error insertion reminding window according to the hot plug event. The hot plug event may be understood as being sent by the external device, and the master control end including the USB interface receives the hot plug event.
For example, if it is detected that the external device is inserted into the USB Host interface, the Android frame layer of the system is notified by a kobject event, and after the Android frame layer detects the event, an error reminding window pops up.
In some embodiments, if it is detected that the external device is unplugged from the USB interface, the method further comprises: and receiving a hot plug event, and canceling the USB interface insertion error reminding window according to the hot plug event. The hot plug event may also be sent by the external device, when the external device is pulled out, a level shift is generated, and the hot plug event is triggered according to the shifted level. The hot plug event may specifically be a kobject event, and the Android Framework layer of the system is notified through the kobject event, and after the Android Framework layer detects the event, the error reminding window is cancelled.
The embodiment of the invention mainly aims at detecting and reminding the external equipment inserted with the wrong USB Host, and carries out friendly reminding when the external equipment and the USB Host are both main equipment. In other embodiments, the user may be reminded friendly to remind the user that the USB interface and the inserted external device are inserted incorrectly.
According to the prompt method for the anti-misplug USB interface provided by the embodiment of the invention, when the external equipment inserted into the USB interface is detected to be the main equipment and the USB interface is also the main equipment, the fact that the external equipment is misplug with the USB interface is determined, and the prompt message of the USB interface misplug is sent at the moment, so that friendly prompt is carried out on a user.
Referring to fig. 4, fig. 4 is a flowchart of a prompting method for an anti-misplug USB charging interface according to an embodiment of the present invention, where the method may be used to detect whether a USB interface plugged by a user is a correct charging interface, and the method may be applied to an electronic device, where the electronic device includes a plurality of USB interfaces, and the plurality of USB interfaces may all be type-C USB interfaces, which include Host and OTG. When a user needs to charge the electronic equipment, the USB interface on the connected electronic equipment is detected to judge whether the interface of the currently connected charger is inserted wrongly, and if the interface of the charger is inserted wrongly, friendly reminding can be given to the user. Specifically, the method comprises the following steps:
s21, registering interrupts based on the first universal input/output port and the second universal input/output port respectively;
the first general input/output port may be specifically a USB _ ID pin, where the USB _ ID pin is used to detect whether an external device is inserted, and may also detect whether the inserted external device is a master device or a slave device according to a level of the pin. The second general input/output port may be specifically a USB _ VBUS _ DET pin, where the USB _ VBUS _ DET pin is used to detect a change in a level, and determine whether the USB interface is a master device or a slave device according to the change in the level.
S22, detecting whether the interrupt registered by the first general input/output port is triggered or not based on the registered interrupt;
if the interrupt of the first general input/output port registration is triggered, which indicates that the external device is currently detected to be plugged into the USB interface, the following step S23 is executed. If the interrupt of the first general input/output port registration is not triggered, no external equipment is inserted into the USB interface.
S23, detecting whether the first general input/output port is at low level;
if yes, the following step S24 is executed; if not, the following step S25 is executed.
S24, closing the registration interruption of the second universal input/output port, and opening a third universal input/output port to enable so as to supply power to the peripheral equipment;
s25, closing the third universal input/output port enable, and detecting whether the interrupt registered by the second universal input/output port is triggered;
if so, the following step S26 is executed. If the interrupt of the second general input/output port registration is not triggered, the current state may be kept unchanged, for example, whether the interrupt of the second general input/output port registration is triggered or not may be continuously detected.
S26, detecting whether the second general input/output port is at high level;
if so, the following step S27 is executed. If not, the currently inserted USB interface is correct, and normal charging can be carried out.
And S27, sending out prompt information that the USB interface is inserted wrongly by the charger.
The prompt message includes a prompt message that "the USB interface does not support the charging function, and please replace the USB interface if charging is required" is popped up on the interface of the electronic device, and the specific presentation mode is shown in fig. 5, for example.
The detailed process from step S21 to step S27 can refer to the method embodiments, and will not be described herein again.
The method provided by the embodiment of the invention can accurately identify which USB interface on the electronic equipment is used for the charging function, and can carry out friendly reminding on whether the USB interface is inserted by the charger or not, thereby improving the user experience of the user in the charging process by using the USB interface.
The method provided by the embodiment of the invention mainly detects and reminds whether the charger interface is inserted with a wrong USB interface, and the method can be used for detecting whether the charger is inserted with a wrong USB interface or not, detecting MTP (multiple time transfer) equipment and reminding a user whether the currently inserted USB interface supports TP (transport protocol) transmission or not, and if not, popping up 'the USB interface does not support a data transmission function and please replace the USB interface'. The MTP device is equivalent to a master device for a main control chip of a motherboard, and the MTP device includes a device for transmitting media files, for example, the MTP device includes various types of smart phones, digital cameras, and the like. The MTP device may also provide a power supply, which is suitable for the above detection logic, and in the specific implementation, after the main control chip establishes communication with the USB device, it is distinguished by the corresponding USB protocol,
referring to fig. 6, fig. 6 is a flowchart illustrating a prompt device for preventing a wrong USB interface from being plugged according to an embodiment of the present invention. The device can be applied to electronic equipment which is provided with at least two USB interfaces, and the device 30 comprises a detection module 31, an acquisition module 32, a judgment module 33 and a sending module 34.
The detecting module 31 is configured to detect whether an external device is inserted into one of the at least two USB interfaces; the obtaining module 32 is configured to obtain a type of an external device if the external device is inserted into the USB interface; the judging module 33 is configured to judge whether the type of the USB interface is a master device when the type of the external device is the master device; the sending module 34 is configured to prompt the USB interface to insert an error message if the type of the USB interface is the master device.
The detection module 31 is specifically configured to: registering an interrupt based on a first general purpose input/output port; detecting whether an interrupt of the first general input/output port registration is triggered; and if so, determining that external equipment is inserted into the USB interface, otherwise, determining that no external equipment is inserted into the USB interface.
The obtaining module 32 is specifically configured to obtain a level of the first general input/output port if an external device is plugged into the USB interface, and determine that the external device is a master device when the level is a high level; and when the level is low level, determining that the external equipment is slave equipment. When the level of the first general input/output port is low level, the device further comprises a control module, wherein the control module is used for controlling enabling of a third general input/output port, and the third general input/output port is an output interface facing the external equipment.
The determining module 33 is specifically configured to register an interrupt based on a second general input/output port when the type of the external device is a master device; when the interruption of the second general input/output port registration is triggered, acquiring the level of the second general input/output port; and when the level of the second general input/output port is high level, determining that the type of the USB interface is the master device.
The sending module 34 is specifically configured to receive a hot plug event if the type of the USB interface is the master device, and pop up a USB interface misplug reminding window according to the hot plug event.
The USB interface comprises a charger interface, an MTP equipment interface and the like. The prompting device for preventing the wrong insertion of the USB interface provided by the embodiment of the invention can prompt whether the charger is inserted into the wrong USB interface or not and can also detect whether the MTP equipment is accurately inserted into the corresponding USB interface or not.
It should be noted that the above prompt apparatus for an anti-misplug USB interface can execute the prompt method for an anti-misplug USB interface provided in the embodiments of the present invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in the embodiment of the device for prompting an error-insertion-proof USB interface, reference may be made to the method for prompting an error-insertion-proof USB interface provided in the embodiment of the present invention.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device is configured to execute the method for prompting the USB interface for error insertion prevention in the foregoing embodiment. The electronic device 40 includes one or more processors 41 and memory 42. Fig. 7 illustrates an example of one processor 41.
The processor 41 and the memory 42 may be connected by a bus or other means, and fig. 7 illustrates the connection by a bus as an example.
The memory 42, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the method for prompting a USB interface for error insertion prevention in the embodiment of the present invention. The processor 41 executes various functional applications and data processing of the prompting device of the error-insertion-proof USB interface by running the nonvolatile software program, instructions and modules stored in the memory 42, that is, the functions of the prompting method of the error-insertion-proof USB interface provided by the above method embodiment and the various modules of the prompting device embodiment of the error-insertion-proof USB interface are realized.
The memory 42 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 42 may optionally include memory located remotely from processor 41, which may be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The program instructions/modules are stored in the memory 42 and, when executed by the one or more processors 41, perform the method for prompting a misplug prevention USB interface in any of the method embodiments described above.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
In one embodiment, a non-volatile computer storage medium is also provided, which stores computer-executable instructions that are executed by one or more processors, such as one of the processors 41 in fig. 7, so that the one or more processors can execute the method for prompting an error-insertion-proof USB interface in any of the above method embodiments.
In one embodiment, a computer program product is further provided, which includes a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions, which, when executed by the electronic device, cause the electronic device to perform the method for prompting an error-insertion-proof USB interface in any of the above-mentioned method embodiments.
The above-described embodiments of the apparatus or device are merely illustrative, wherein the unit modules described as separate parts may or may not be physically separate, and the parts displayed as module units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions substantially or contributing to the related art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A prompt method for preventing wrong insertion of a USB interface is applied to electronic equipment, and the electronic equipment is provided with at least two USB interfaces and is characterized by comprising the following steps:
detecting whether an external device is inserted into one of the at least two USB interfaces;
if yes, acquiring the type of the external equipment;
when the type of the external equipment is the main equipment, judging whether the type of the USB interface is the main equipment or not;
and if the type of the USB interface is the main equipment, prompting the USB interface to insert an error message.
2. The method of claim 1, wherein the detecting whether the external device is plugged into one of the at least two USB interfaces comprises:
registering an interrupt based on a first general purpose input/output port;
detecting whether an interrupt of the first general input/output port registration is triggered;
and if so, determining that external equipment is inserted into the USB interface, otherwise, determining that no external equipment is inserted into the USB interface.
3. The method of claim 2, wherein the obtaining the type of the external device comprises:
acquiring the level of the first general input/output port, and determining that the external equipment is the main equipment when the level is high; and when the level is low level, determining that the external equipment is slave equipment.
4. The method of claim 3, wherein when the level of the first general purpose input/output port is low, the method further comprises:
controlling a third general purpose input/output port to be enabled, the third general purpose input/output port being an output interface facing the external device.
5. The method according to any one of claims 1 to 4, wherein the determining whether the type of the USB interface is a master device comprises:
registering the interrupt based on the second general input/output port;
when the interruption of the second general input/output port registration is triggered, acquiring the level of the second general input/output port;
and when the level of the second general input/output port is high level, determining that the type of the USB interface is the master device.
6. The method of claim 5, wherein prompting the USB interface for an error insertion message comprises:
and receiving a hot plug event, and popping up a USB interface error insertion reminding window according to the hot plug event.
7. The method of claim 6, wherein the USB interface comprises a charger interface, an MTP device interface.
8. The utility model provides a suggestion device of mistake proofing USB interface of inserting, is applied to electronic equipment, electronic equipment is equipped with two at least USB interfaces, its characterized in that, the device includes:
the detection module is used for detecting whether external equipment is inserted into one of the at least two USB interfaces;
the acquisition module is used for acquiring the type of the external equipment if the external equipment is in the preset type;
the judging module is used for judging whether the type of the USB interface is the main equipment or not when the type of the external equipment is the main equipment;
and the sending module is used for prompting the USB interface to insert an error message if the type of the USB interface is the main equipment.
9. An electronic device, comprising:
at least one USB interface;
a first universal input/output port, a second universal input/output port, and a third universal input/output port coupled to the at least one USB interface;
the processor is in communication connection with the USB interface;
a memory communicatively coupled to the processor;
wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of prompting a misplug-proof USB interface of any one of claims 1 to 7 in accordance with the first general purpose input/output port, the second general purpose input/output port, and the third general purpose input/output port.
10. A non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by an electronic device, cause the electronic device to perform the method of prompting an error-insertion-proof USB interface of any one of claims 1 to 7.
CN202011445135.0A 2020-12-08 2020-12-08 Method and device for prompting anti-misplug USB interface and electronic equipment Pending CN112579500A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011445135.0A CN112579500A (en) 2020-12-08 2020-12-08 Method and device for prompting anti-misplug USB interface and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011445135.0A CN112579500A (en) 2020-12-08 2020-12-08 Method and device for prompting anti-misplug USB interface and electronic equipment

Publications (1)

Publication Number Publication Date
CN112579500A true CN112579500A (en) 2021-03-30

Family

ID=75131119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011445135.0A Pending CN112579500A (en) 2020-12-08 2020-12-08 Method and device for prompting anti-misplug USB interface and electronic equipment

Country Status (1)

Country Link
CN (1) CN112579500A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113199888A (en) * 2021-05-06 2021-08-03 天津市中环电子计算机有限公司 Industrial computer USB interface silk-screen identification method with signal source information
CN114116546A (en) * 2021-11-19 2022-03-01 Oppo广东移动通信有限公司 Device unplugging reporting method and device, computer readable medium and electronic device

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038785A1 (en) * 2005-08-15 2007-02-15 Research In Motion Limited Universal peripheral connector
CN101339542A (en) * 2008-06-04 2009-01-07 炬才微电子(深圳)有限公司 Data transmission device, control circuit chip and operation mode control method
CN102750248A (en) * 2012-06-21 2012-10-24 中兴通讯股份有限公司 USB (Universal Serial Bus) equipment working mode switching method and USB equipment
CN102938034A (en) * 2012-10-26 2013-02-20 飞天诚信科技股份有限公司 Working method for conversion device
CN103024195A (en) * 2012-12-27 2013-04-03 青岛海信移动通信技术股份有限公司 Smart mobile terminal and implementation method of charging of smart mobile terminal
US20130132629A1 (en) * 2011-11-23 2013-05-23 Peng-Fei Lin Apparatus of storage medium for interfacing both host and mobile device
CN103279410A (en) * 2013-04-10 2013-09-04 苏州三星电子电脑有限公司 Externally-connected device prompt device and method thereof
CN103294626A (en) * 2012-09-24 2013-09-11 天津思博科科技发展有限公司 Design of USB dual-mode interface equipment for UART acquisition terminal
CN104021101A (en) * 2014-05-09 2014-09-03 深圳市汇川控制技术有限公司 USB interface system and implementation method based on LPC1768 platform
CN104317761A (en) * 2014-10-27 2015-01-28 飞天诚信科技股份有限公司 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment
CN105975038A (en) * 2016-04-27 2016-09-28 北京小米移动软件有限公司 Prompt method and device of charging port detection result
CN106155967A (en) * 2015-04-23 2016-11-23 中兴通讯股份有限公司 The circuit of USB interface multiplexing, method and apparatus
CN205786933U (en) * 2016-07-19 2016-12-07 湖北广兴通信科技有限公司 One kind of multiple style interface testing moulds
CN108475245A (en) * 2016-12-20 2018-08-31 华为技术有限公司 The recognition methods of PnP device and electronic equipment
CN109032984A (en) * 2018-05-31 2018-12-18 广州吉欧电子科技有限公司 A kind of method and USB OTG equipment of multiplexing USB interface
CN110413547A (en) * 2018-04-28 2019-11-05 鸿富锦精密电子(重庆)有限公司 The communication system of interface control unit and the application interface control unit
CN111213293A (en) * 2017-10-12 2020-05-29 深圳传音通讯有限公司 Control method and control device for signal switching of intelligent equipment
CN111339007A (en) * 2020-02-28 2020-06-26 深圳市广和通无线股份有限公司 USB device control method and device, computer device and storage medium
CN210895119U (en) * 2019-10-18 2020-06-30 深圳市道通科技股份有限公司 Interface circuit and automobile diagnosis equipment thereof
CN111698366A (en) * 2020-05-08 2020-09-22 北京连山时代科技有限公司 Mobile phone hardware extension mode based on USB interface

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038785A1 (en) * 2005-08-15 2007-02-15 Research In Motion Limited Universal peripheral connector
CN101339542A (en) * 2008-06-04 2009-01-07 炬才微电子(深圳)有限公司 Data transmission device, control circuit chip and operation mode control method
US20130132629A1 (en) * 2011-11-23 2013-05-23 Peng-Fei Lin Apparatus of storage medium for interfacing both host and mobile device
CN102750248A (en) * 2012-06-21 2012-10-24 中兴通讯股份有限公司 USB (Universal Serial Bus) equipment working mode switching method and USB equipment
CN103294626A (en) * 2012-09-24 2013-09-11 天津思博科科技发展有限公司 Design of USB dual-mode interface equipment for UART acquisition terminal
CN102938034A (en) * 2012-10-26 2013-02-20 飞天诚信科技股份有限公司 Working method for conversion device
CN103024195A (en) * 2012-12-27 2013-04-03 青岛海信移动通信技术股份有限公司 Smart mobile terminal and implementation method of charging of smart mobile terminal
CN103279410A (en) * 2013-04-10 2013-09-04 苏州三星电子电脑有限公司 Externally-connected device prompt device and method thereof
CN104021101A (en) * 2014-05-09 2014-09-03 深圳市汇川控制技术有限公司 USB interface system and implementation method based on LPC1768 platform
CN104317761A (en) * 2014-10-27 2015-01-28 飞天诚信科技股份有限公司 Multi-interface mobile security equipment with power management and operation method of multi-interface mobile security equipment
CN106155967A (en) * 2015-04-23 2016-11-23 中兴通讯股份有限公司 The circuit of USB interface multiplexing, method and apparatus
CN105975038A (en) * 2016-04-27 2016-09-28 北京小米移动软件有限公司 Prompt method and device of charging port detection result
CN205786933U (en) * 2016-07-19 2016-12-07 湖北广兴通信科技有限公司 One kind of multiple style interface testing moulds
CN108475245A (en) * 2016-12-20 2018-08-31 华为技术有限公司 The recognition methods of PnP device and electronic equipment
CN111213293A (en) * 2017-10-12 2020-05-29 深圳传音通讯有限公司 Control method and control device for signal switching of intelligent equipment
CN110413547A (en) * 2018-04-28 2019-11-05 鸿富锦精密电子(重庆)有限公司 The communication system of interface control unit and the application interface control unit
CN109032984A (en) * 2018-05-31 2018-12-18 广州吉欧电子科技有限公司 A kind of method and USB OTG equipment of multiplexing USB interface
CN210895119U (en) * 2019-10-18 2020-06-30 深圳市道通科技股份有限公司 Interface circuit and automobile diagnosis equipment thereof
CN111339007A (en) * 2020-02-28 2020-06-26 深圳市广和通无线股份有限公司 USB device control method and device, computer device and storage medium
CN111698366A (en) * 2020-05-08 2020-09-22 北京连山时代科技有限公司 Mobile phone hardware extension mode based on USB interface

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113199888A (en) * 2021-05-06 2021-08-03 天津市中环电子计算机有限公司 Industrial computer USB interface silk-screen identification method with signal source information
CN114116546A (en) * 2021-11-19 2022-03-01 Oppo广东移动通信有限公司 Device unplugging reporting method and device, computer readable medium and electronic device

Similar Documents

Publication Publication Date Title
US10664434B2 (en) USB type-C adapter module and activating method for the same
US9804859B2 (en) Re-enumeration of USB 3.0 compatible devices
EP2584471A1 (en) Method and terminal for selecting internal circuit according to USB interface status
WO2013168289A1 (en) Electronic device and control method therefor
US20150156089A1 (en) Data communication interface
US10412207B2 (en) Mobile terminal, power adapter, and upgrade method thereof
CN112579500A (en) Method and device for prompting anti-misplug USB interface and electronic equipment
US10025351B2 (en) System for controlling peripherals connected to a docking station
CN108920397B (en) Device identification method and device, storage medium and electronic device
US20130290746A1 (en) System, apparatus, and method of performing charging operation in host mode
CN103618356A (en) Charging system for mobile terminal and charging method thereof
CN107003974B (en) Interface detection method and device
US20120306455A1 (en) Method and system for determining whether a portable device is charging
US20100082846A1 (en) Usb device and method for connecting the usb device with usb host
US20200117633A1 (en) Methods and apparatus to enable status change detection in a low power mode of a microcontroller unit
CN109478176A (en) A kind of methods, devices and systems of USB Type-C port device identification opposite equip.
US9817778B2 (en) Electronic device and method for communicating with USB device
CN108924325B (en) Data processing method and related device
US20170116146A1 (en) Control method and control device for a mobile terminal
CN109560581B (en) Charging processing method, charging processing circuit, electronic device, and storage medium
CN108121434B (en) Clock control method of display interface, mobile terminal and storage medium
US11394225B2 (en) Method and apparatus for changing impedance of terminal included in connector
CN107391157B (en) Mobile terminal and method for identifying mobile storage device
CN103686323A (en) Multiprocessor communication method and system
CN112214433B (en) Terminal device, control method thereof, auxiliary device, and 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