Electronic device, insertion detection method and readable storage medium

By using signal transmitting and receiving devices in electronic devices to identify the cause of interface interruption, electrical corrosion problems are avoided and interface reliability and communication efficiency are improved.

CN115277894BActive Publication Date: 2024-11-22VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210702009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2024-11-22
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

In the prior art, the interface of an electronic device is prone to contact with conductive liquid when detecting external devices, resulting in electrical corrosion caused by continuous operation of CC polling detection, resulting in abnormal interface function.

Method used

By setting up a signal transmitting device, a signal transmission channel and a signal receiving device in the electronic device, the signal transmission and reflection are used to identify the cause of the interface interruption. If the signal is reflected back within the preset time period, CC will be turned on to detect the external device type; otherwise, Turn off CC to avoid electrical corrosion.

Benefits of technology

It effectively avoids electrical corrosion caused by contact with conductive liquids on the interface, improves the reliability of the interface, and ensures that electronic devices can communicate with external devices in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115277894B_ABST
    Figure CN115277894B_ABST
Patent Text Reader

Abstract

The present application provides an electronic device, an insertion detection method and a readable storage medium, which belong to the field of electronic technology. The electronic device includes: an interface, a signal transmitting device, a signal transmission channel and a signal receiving device; wherein the interface can be inserted into an external device; the first end of the signal transmission channel is connected to the signal transmitting device, the second end is connected to the signal receiving device, and the third end is provided with an opening, and the opening and the interface are provided on the same side of the electronic device; when the interface is inserted into the external device, the signal transmitting device transmits a first signal, and the first signal is reflected by the external device and returns to the signal receiving device, and the configuration channel of the interface is turned on.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of electronic technology, and in particular to an electronic device, an insertion detection method, and a readable storage medium. Background Art

[0002] As electronic devices become more and more versatile, users have increasing demands for electronic device memory and charging. To meet the above demands, an interface can be provided on the electronic device so that the electronic device can be connected to an external device such as a charger or storage device through the interface to achieve energy or data transmission.

[0003] In the prior art, the type of external device plugged into the interface can be detected by continuously running the configuration channel (CC) polling detection. However, the interface of the electronic device is usually exposed, making it easy for the interface to come into contact with conductive liquids such as sweat and oil. If the interface comes into contact with conductive liquids, then continuously running the CC polling detection will cause electrical corrosion, which can easily cause abnormal interface function. Summary of the invention

[0004] The embodiments of the present application provide an electronic device, an insertion detection method and a readable storage medium, which can solve the problem in the prior art that the interface contacts a conductive liquid and continuously runs CC polling detection, causing electrical corrosion and resulting in abnormal interface function.

[0005] To solve the above problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides an electronic device, comprising: an interface, a signal transmitting device, a signal transmission channel, and a signal receiving device; wherein the interface can be inserted into an external device; a first end of the signal transmission channel is connected to the signal transmitting device, a second end is connected to the signal receiving device, and a third end is provided with an opening, and the opening and the interface are provided on the same side of the electronic device;

[0007] When the interface is plugged into the external device, the signal transmitting device transmits a first signal, and the first signal is reflected by the external device and then returns to the signal receiving device, and the configuration channel of the interface is opened.

[0008] In a second aspect, an embodiment of the present application further provides an insertion detection device, which is applied to the electronic device described in the first aspect, comprising:

[0009] In the case where the interruption of the interface is triggered, an insertion detection is performed, wherein the insertion detection includes: controlling the signal transmitting device to transmit a signal; determining whether the signal receiving device receives the signal within a preset time period;

[0010] According to the detection result of the insertion detection, controlling the working state of the configuration channel of the interface;

[0011] Wherein, when the detection result is that the signal receiving device receives the signal within the preset time period, the working state is on; when the detection result is that the signal receiving device does not receive the signal within the preset time period, the working state is off.

[0012] In a third aspect, an embodiment of the present application further provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the insertion detection method as described in the second aspect.

[0013] In a fourth aspect, an embodiment of the present application further provides a readable storage medium having a program or instruction stored thereon, wherein the program or instruction, when executed by a processor, implements the insertion detection method as described in the second aspect.

[0014] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the second aspect.

[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the second aspect.

[0016] In an embodiment of the present application, an electronic device is provided with a signal transmitting device, a signal transmission channel and a signal receiving device, wherein the first end of the signal transmission channel is connected to the signal transmitting device, the second end is connected to the signal receiving device, and the third end is provided with an opening, and the opening and the interface into which an external device can be inserted are provided on the same side of the electronic device. In this way, the electronic device can transmit a signal through the signal transmitting device, and the signal receiving device receives the signal to identify the reason why the interruption of the interface is triggered. Specifically, if the signal transmitted by the signal transmitting device is reflected back to the signal receiving device within a preset time length, it can be identified that the reason why the interruption of the interface is triggered is that the interface is inserted into an external device, and the CC can be turned on at this time to detect the type of the inserted external device; otherwise, it can be identified that the reason why the interruption of the interface is triggered is that the interface contacts a conductive liquid, and the CC can be turned off at this time, thereby avoiding electrical corrosion caused by CC polling detection, and further improving the reliability of the interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1a It is one of the structural diagrams of the electronic device provided in the embodiment of the present application;

[0019] Figure 1b This is the second structural diagram of the electronic device provided in the embodiment of the present application;

[0020] Figure 2 is a schematic diagram of a sound signal provided in an embodiment of the present application;

[0021] Figure 3 is a flow chart of an insertion detection method provided in an embodiment of the present application;

[0022] Figure 4 This is the second structural diagram of the electronic device provided in the embodiment of the present application;

[0023] Figure 5 This is the third structural diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0026] For ease of understanding, some contents involved in the embodiments of the present application are described below:

[0027] In order to prevent the problem of electrical corrosion and avoid misjudgment, the electronic device can add an insertion detection function. When an external device is detected to be inserted, CC polling detection is turned on. In the prior art, functional pins (pins) with interrupt and analog-to-digital converter (ADC) functions are used, or detection circuits are directly added to perform insertion detection, which is costly.

[0028] When performing insertion detection through a functional pin with interrupt and ADC functions, the ADC can distinguish between an interrupt trigger caused by a general micro-short circuit and an interrupt trigger caused by inserting an OTG device (ADC can identify impedance to make a judgment). However, there are the following problems: there must be a pin that can satisfy both the insertion interrupt function and the ADC function, which is a relatively strict requirement and difficult to meet; when the impedance is small after a short circuit or water ingress, it is impossible to distinguish whether it is caused by a short circuit or the insertion of an OTG (On-The-Go) device. In this case, the CC pin will continuously send out pulse signals, which can easily lead to electrical corrosion.

[0029] In order to solve the above problems, the embodiment of the present application sets a signal transmitting device, a signal transmission channel and a signal receiving device in the electronic device, wherein the first end of the signal transmission channel is connected to the signal transmitting device, the second end is connected to the signal receiving device, and the third end is provided with an opening, and the opening and the interface that can be inserted into the external device are provided on the same side of the electronic device, so that the signal transmitting device transmits a signal, and the signal receiving device receives the signal to identify the reason why the interruption of the interface is triggered. When it is identified that the reason for the interruption is the insertion of an external device, the CC is turned on to detect the type of the inserted external device; when it is identified that the reason for the interruption of the interface is that the interface is in contact with a conductive liquid, the CC is turned off, thereby avoiding electrical corrosion caused by CC polling detection, and further improving the reliability of the interface.

[0030] The embodiments of the present application are described in detail below through some embodiments and their application scenarios in conjunction with the accompanying drawings.

[0031] In an embodiment of the present application, the electronic device includes an interface, a signal transmitting device, a signal transmission channel and a signal receiving device.

[0032] The interface can be inserted into an external device, and the external device can be a charger or an OTG device, etc.

[0033] The first end of the signal transmission channel is connected to the signal transmitting device, the second end is connected to the signal receiving device, and the third end is provided with an opening. In specific implementation, the signal transmitting device is used to transmit a signal, and the signal transmitted by the signal transmitting device is transmitted from the electronic device through the outlet of the signal transmission channel, and after reflection, the signal is reflected back to the signal receiving device through the outlet of the signal transmission channel.

[0034] The interface and the opening are arranged on the same side of the electronic device. In this way, if the interface is inserted into an external device, the signal emitted by the signal transmitting device can be reflected back to the outlet by the external device after being emitted through the outlet, and detected by the signal receiving device, thereby achieving accurate insertion detection. At this time, the CC of the interface can be turned on to identify the type of external device inserted into the interface. Therefore, in an embodiment of the present application, when the interface is inserted into the external device, the signal transmitting device emits a first signal, and the first signal is reflected by the external device and returns to the signal receiving device, and the configuration channel of the interface is turned on.

[0035] The electronic device of the embodiment of the present application can realize accurate insertion detection of the interface through the signal transmitting device and the signal receiving device, thereby avoiding the electrical corrosion caused by the interface being interrupted due to contact with conductive materials and turning on the CC to perform polling detection, thereby improving the reliability of the interface.

[0036] In some embodiments, when the interruption of the interface is triggered, the signal transmitting device transmits a second signal, and the second signal is not reflected back to the signal receiving device within a preset time period, and the configuration channel of the interface is closed.

[0037] The preset duration is used to represent the maximum duration of the sound signal emitted from the signal emitting device, reflected by the external device inserted into the interface, and received by the signal receiving device. The starting time of the preset duration is the time when the signal emitting device emits the current signal.

[0038] It is worth noting that the second signal is not reflected back to the signal receiving device within the preset time period, which includes the following two situations: situation 1, the second signal is not reflected back to the signal receiving device; situation 2, the second signal is reflected back to the signal receiving device, but not reflected back to the signal receiving device within the preset time period.

[0039] For case 1, the interruption of the interface is most likely caused by the interface coming into contact with dust, sweat, oil or water, and no external device is plugged into the interface. To avoid electrical corrosion caused by CC polling detection, you can turn off CC.

[0040] For situation two, the second signal is most likely reflected by an object that is not plugged into the interface but is located near the interface to the signal receiving device. The interruption of the interface is most likely triggered by the interface coming into contact with dust, sweat, oil or water. The interface is not plugged into an external device. In order to avoid electrical corrosion caused by performing CC polling detection, CC can be turned off.

[0041] In specific implementation, shutting down the CC of the interface may specifically include: stopping power supply to the chip of the interface; or not performing CC polling detection. In this way, electrical corrosion can be avoided, thereby improving the reliability of the interface.

[0042] Through the above-mentioned method, the electrical corrosion caused by the interruption triggered by the interface contacting the conductive material and opening the CC to perform polling detection can be avoided, thereby improving the reliability of the interface.

[0043] After the interruption of the electronic device identification interface is triggered by the interface contacting a conductive material, if CC is always closed, and the interruption caused by dust, sweat, oil or water always exists, even if an external device is plugged in later, the electronic device will not be able to perform CC polling detection in time, resulting in the electronic device being unable to communicate with the external device in time. To avoid the above situation, in some embodiments, when the interruption of the interface does not disappear, the signal transmitting device transmits a third signal, and the third signal is reflected back to the signal receiving device within the preset time, and the configuration channel of the interface is turned on.

[0044] In this embodiment, the electronic device can continue to perform the insertion detection of the interface through the signal transmitting device and the signal receiving device after the interruption of the identification interface is triggered by the interface contacting the conductive material. In this way, even if the interruption triggered by the conductive material continues to exist, the electronic device can detect whether there is an external device inserted into the interface by performing insertion polling detection. In the case of detecting that an external device is inserted into the interface, CC polling detection can be performed immediately, so that the electronic device can communicate with the external device in time, thereby improving the reliability of the interface.

[0045] In the embodiment of the present application, the interface may be a Universal Serial Bus (USB) interface, a lightning interface, or a Type-C interface, and the embodiment of the present application does not limit the type of interface.

[0046] In some embodiments, the signal emitting device may be a sound signal emitting device or a light signal emitting device, that is, the signal emitted by the signal emitting device may be a sound signal or a light signal.

[0047] It can be understood that the type of the signal receiving device matches the type of the signal transmitting device, such as: if the signal transmitting device is a sound signal transmitting device, then the signal receiving device can be a sound signal receiving device; if the signal transmitting device is an optical signal transmitting device, then the signal receiving device can be an optical signal receiving device.

[0048] In order to avoid the signal emitted by the signal emitting device from interfering with the user. In the case where the signal emitted by the signal emitting device is a sound signal, the frequency of the sound signal emitted by the signal emitting device can be set outside the hearing range of the human ear, such as the sound signal can be an ultrasonic signal, and the frequency can exceed 20 kilohertz (KHz), but is not limited thereto. In the case where the signal emitted by the signal emitting device is a light signal, the light signal emitted by the signal emitting device can be set outside the visible range of the human eye, such as the light signal can be an infrared light signal, etc.

[0049] In the embodiment of the present application, the transmission signal and the reflection signal can be transmitted through the same signal transmission channel or through different signal transmission channels. The specific decision can be made based on actual conditions, and the embodiment of the present application does not limit this.

[0050] For easier understanding, see Figure 1a to Figure 1b .exist Figure 1a and Figure 1b In the embodiment, the electronic device 10 includes a housing 11, an interface 12, a signal transmitting device 13, a signal transmission channel and a signal receiving device 14. The interface 12 is arranged on the housing 11, and the signal transmitting device 13, the signal transmission channel and the signal receiving device 14 are arranged inside the housing 11.

[0051] exist Figure 1a In the embodiment, the signal transmission channel includes a first signal transmission channel 151 and a second signal transmission channel 152. One end of the first signal transmission channel 151 is connected to the signal transmitting device 13, and the other end is provided with a first opening 1511; one end of the second signal transmission channel 152 is connected to the signal receiving device 14, and the other end is provided with a second opening 1521; the first opening 1511 and the second opening 1512 are respectively provided on both sides of the interface 12.

[0052] exist Figure 1a In the embodiment, since the first opening 1511 and the second opening 1521 are arranged on both sides of the interface 12, the signal emitted by the signal emitting device 13 is emitted from the electronic device through the first opening 1511 of the first signal transmission channel 151, and after being reflected by the external device 20, it can be accurately reflected back to the signal receiving device 14 through the second opening 1521 of the second signal transmission channel 152, thereby improving the reliability of insertion detection.

[0053] exist Figure 1bIn the embodiment, the signal transmission channel includes a third signal transmission channel 153 ; wherein a first end of the third signal transmission channel 153 is connected to the signal transmitting device 13 , a second end is connected to the signal processing device 14 , and an opening 1531 is provided at the third end.

[0054] exist Figure 1b In the embodiment, the signal transmitted by the signal transmitting device 13 is transmitted from the electronic device through the third outlet 1531 of the third signal transmission channel 153, and after reflection, is reflected back to the signal receiving device 14 through the third outlet 1531 of the third signal transmission channel 153. In this way, the number of signal transmission channels of the electronic device can be reduced, thereby reducing the cost of insertion detection.

[0055] It should be noted that for Figure 1b In order to prevent the signal emitted by the signal transmitting device 13 from directly entering the signal receiving device 14 without reflection, resulting in false detection of insertion, the electronic device can control the signal receiving device 14 to enter the signal receiving state only after ensuring that the signal emitted by the signal transmitting device 13 is emitted from the third outlet 1531, such as: after the signal transmitting device 13 transmits the signal, wait for a first time length before controlling the signal receiving device 14 to enter the signal receiving state, and the first time length is the maximum time length of the signal passing through the third signal transmission channel 151. In this way, confusion between the transmitted signal and the reflected signal can be avoided, so that the signal receiving device receives the reflected signal.

[0056] In the embodiment of the present application, the signal transmitting device, the signal transmission channel and the signal receiving device can be devices specially provided for insertion detection, or they can be devices originally provided in the electronic device. That is, insertion detection can be achieved by reusing the original devices of the electronic device, thereby reducing the cost of insertion detection.

[0057] In some embodiments, when the signal transmitting device is a sound signal transmitting device, the first signal transmission channel may be an audio channel (speaker-Box), and the second signal transmission channel (mic) may be a microphone channel. Accordingly, the first opening is the first opening of the speaker-Box, the second opening is the mic port, and the signal transmitting device may be a speaker.

[0058] When multiplexing the audio speaker channel and the mic channel, consider that the insertion detection may be performed during the process of playing music, watching videos, or recording. To prevent the insertion detection from affecting the audio and video playback or recording, such as Figure 2As shown, the sound signal output by the signal transmitting device can be controlled to be a narrow pulse signal, for example, a pulse signal with a width of 5 microseconds (us) or less is sent, which occupies a time gap for transmission. Because its pulse is very narrow and the frequency is not within the hearing range of the human ear, it will basically not affect the normal audio and video playback and recording.

[0059] In the embodiment of the present application, due to the short distance, the transmission power required for the sound signal will be smaller. Taking each 5us pulse as an example, the standard power consumption of the power amplifier is 1 watt (W), then the approximate power consumption for each detection is: 1W*5 / 1000000=5*10 -3 Milliwatts (mW) can basically be ignored.

[0060] In some embodiments, when the signal emitting device is an optical signal emitting device, the signal emitting device is an infrared light emitting device, and the first signal transmission channel may be an infrared light emitting channel.

[0061] In practical applications, the electronic device may be a mobile phone, a tablet computer (Tablet Personal Computer), a laptop computer (Laptop Computer) or a notebook computer, a personal digital assistant (Personal Digital Assistant, PDA), a handheld computer, a netbook, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a mobile Internet device (Mobile Internet Device, MID), augmented reality (augmentedreality, AR) / virtual reality (Virtual Reality, VR) equipment, a robot, a wearable device (WearableDevice), a vehicle-mounted equipment (VUE), a pedestrian terminal (PUE), a smart home (home appliances with wireless communication functions, such as refrigerators, televisions, washing machines or furniture, etc.) and other terminal side devices. Wearable devices include: smart watches, smart bracelets, smart headphones, smart glasses, smart jewelry (smart bracelets, smart bracelets, smart rings, smart necklaces, smart anklets, smart anklets, etc.), smart wristbands, smart clothing, game consoles, etc.

[0062] See also Figure 3 , Figure 3 It is a flow chart of the insertion detection method provided in an embodiment of the present application. Figure 3 The insertion detection method shown can be applied to the electronic device of the embodiment of the present application. Figure 3 As shown, the insertion detection method may include the following steps:

[0063] Step 301: When the interruption of the interface is triggered, perform insertion detection, the insertion detection comprising: controlling the signal transmitting device to transmit a signal; and determining whether the signal receiving device receives the signal within a preset time period.

[0064] In specific implementation, the interruption of the interface may be triggered by the insertion of an external device into the interface, or it may be triggered by the interface coming into contact with dust, sweat, oil, water, and other substances. Therefore, to avoid electrical corrosion, an insertion test may be performed before performing CC polling detection. When it is detected that the interruption is triggered by an external device, the CC of the interface is turned on and CC polling detection is performed to detect the type of the inserted external device; otherwise, the CC of the interface may be turned off and CC polling detection may not be performed to avoid electrical corrosion caused by performing CC polling detection, thereby improving the reliability of the interface.

[0065] In the embodiment of the present application, the insertion detection may include: a signal sending operation and a reflected signal detection operation.

[0066] In a specific implementation, after detecting the interrupt signal of the interface, the signal transmitting device can be controlled to transmit the signal, and the signal receiving device can determine whether a reflected signal of the signal is detected.

[0067] If the signal receiving device does not detect the reflected signal of the signal, it means that the interface is not plugged into an external device, and the interruption of the interface is most likely triggered by the interface coming into contact with dust, sweat, oil, water or other substances. In order to avoid electrical corrosion caused by performing CC polling detection, CC polling detection may not be performed.

[0068] In the case where the signal receiving device detects the reflected signal of the signal, there is a possibility that the signal may be reflected by an object that is not inserted into the interface but is located near the interface. To avoid false detection, the transmission time of the signal and the reception time of the reflected signal can be further recorded. In this way, it can be determined whether the object reflecting the signal is an external device inserted into the interface based on the transmission time of the signal and the reception time of its reflected signal.

[0069] In one implementation, a preset duration can be pre-set, and the preset duration is used to represent the maximum duration of the signal output from the signal transmitting device, reflected by the external device inserted into the interface, and received by the signal receiving device. In this implementation, the electronic device can compare the recorded transmission time of the signal and the time interval between the reception time of its reflected signal with the preset duration, and determine whether the object reflecting the signal is the external device inserted into the interface based on the comparison result.

[0070] In another implementation, a preset distance value may be set, and the preset distance value is used to represent the maximum distance value between the external device inserted into the interface and the interface. In this implementation, the electronic device may determine the distance value between the object reflecting the signal and the interface based on the recorded emission time of the signal and the reception time of its reflected signal. Afterwards, the distance value is compared with the preset distance value, and based on the comparison result, it is determined whether the object reflecting the signal is the external device inserted into the interface.

[0071] If the time interval is greater than the preset time length, or the distance value is greater than the preset distance value, it means that the object reflecting the signal is most likely an object that is not inserted into the interface but is located near the interface. In this case, the interruption of the interface is most likely caused by the interface contacting dust, sweat, oil or water and other substances. In order to avoid electrical corrosion caused by performing CC polling detection, CC polling detection can be omitted.

[0072] If the time interval is less than or equal to the preset time length, or the distance value is less than or equal to the preset distance value, it means that the object reflecting the signal is most likely an external device plugged into the interface. In this case, the interruption of the interface is most likely triggered by the external device plugged into the interface, and CC polling detection is performed to detect the type of the inserted external device.

[0073] Step 302: Control the working state of the configuration channel of the interface according to the detection result of the insertion detection.

[0074] Wherein, when the detection result is that the signal receiving device receives the signal within the preset time period, the working state is on; when the detection result is that the signal receiving device does not receive the signal within the preset time period, the working state is off.

[0075] When the detection result is that the signal receiving device receives the signal within the preset time period, it means that the interrupt triggering reason is most likely that the interface is plugged into an external device. Therefore, CC can be enabled to perform CC polling detection.

[0076] When the detection result is that the signal receiving device does not receive the signal within the preset time period, it means that the interrupt triggering reason is most likely that the interface contacts the conductive material, and therefore, the CC can be closed to avoid electrical corrosion.

[0077] The insertion detection method of this embodiment can realize insertion detection by controlling the signal transmitting device to transmit the signal and controlling the signal receiving device to receive the signal after detecting the interrupt signal of the interface. If the signal receiving device does not receive the reflected signal of the signal within the preset time after the signal is transmitted, it can be determined that the interrupt is not triggered by the OTG device, and the CC is turned off, thereby avoiding the electrical corrosion caused by CC polling detection, and further improving the reliability of the interface. If the signal receiving device receives the reflected signal of the signal within the preset time after the signal is transmitted, it can be determined that the interruption of the interface is triggered by the insertion of an external device into the interface, and the electronic device can perform CC polling detection to identify the type of external device inserted into the interface, thereby realizing effective interaction with the external device, thereby improving the accuracy of the interface.

[0078] If the detection result of the insertion detection is that the signal receiving device does not receive the signal within the preset time, it means that the interruption of the interface is most likely triggered by the interface contacting dust, sweat, oil or water. In order to improve the reliability of the interface, in one implementation, a prompt message can be output to prompt the user to clean the interface. That is:

[0079] After performing the insertion detection, the method may further include:

[0080] When the detection result of the insertion detection does not satisfy the first condition, a prompt message is output, where the prompt message is used to prompt to clean up the interface.

[0081] In specific implementation, the prompt information may include at least one of the following: visual prompt information, tactile prompt information, and auditory prompt information. For example, the electronic device may display a prompt information for prompting the cleanup interface on the screen, but is not limited thereto.

[0082] In addition, it can be seen from the above content that when the detection result of the insertion detection is that the signal receiving device does not receive the signal within the preset time, the electronic device turns off the CC and does not perform CC polling detection. In this way, if the interruption caused by dust, sweat, oil or water always exists, even if an external device is inserted later, the electronic device cannot perform CC polling detection in time, resulting in the electronic device being unable to communicate with the external device in time.

[0083] To avoid the above situation, in some embodiments, when the detection result is that the signal receiving device does not receive the signal within the preset time period, after performing the insertion detection, the method further includes:

[0084] Perform insert polling detection;

[0085] When the first condition is met, stopping the insertion polling detection;

[0086] The first condition includes any one of the following:

[0087] The detection result of the first insertion detection in the insertion polling detection is: the signal receiving device receives the signal within the preset time length;

[0088] The said interruption disappears;

[0089] The power level of the electronic device is less than a preset power level.

[0090] In this embodiment, the electronic device may perform insertion polling detection when the detection result of the insertion detection is that the signal receiving device does not receive the signal within the preset time period, that is, perform insertion detection at a certain detection frequency.

[0091] In this way, even if the interrupt signal always exists, the electronic device can detect whether an external device is plugged into the interface by performing insertion polling detection. When an external device is detected to be plugged into the interface, CC polling detection can be performed immediately, so that the electronic device can communicate with the external device in time, thereby improving the reliability of the interface.

[0092] In specific implementation, the detection frequency of the insertion detection can satisfy: when the user inserts the external device into the interface, the insertion detection can be performed at least once, so that the reliability of the insertion detection can be guaranteed.

[0093] The stop conditions of the insertion detection may include: a) the detection result of the insertion detection in the insertion polling detection is: the signal receiving device receives the signal within the preset time length; b) the interrupt signal disappears; c) the power of the electronic device is less than the preset power.

[0094] For a), it means that an external device is connected to the socket. The electronic device can stop the insertion polling detection and perform CC polling detection, so that the electronic device can communicate with the external device in time, thereby improving the reliability of the interface.

[0095] For b), it means that dust, sweat, oil or water in the interface have been cleared, and the electronic device can stop insertion polling detection and perform insertion detection the next time an interrupt signal from the interface is detected to determine the cause of the interrupt trigger.

[0096] For c), in order to save power of the electronic device, the insertion polling detection can be stopped to improve the overall reliability of the electronic device.

[0097] In some embodiments, performing the insertion polling detection may include:

[0098] Performing an insertion polling detection according to a first polling frequency;

[0099] When the number of polling times of the insertion detection reaches a preset number, the insertion polling detection is performed according to a second polling frequency, wherein the second polling frequency is less than the first polling frequency.

[0100] The first detection frequency may satisfy: when a user inserts an external device into an interface, the user may perform insertion detection at least once. Further, the second detection frequency may also satisfy the above condition, or may not satisfy it.

[0101] In this way, by reducing the polling frequency of the insertion detection, the power consumption of the electronic device can be reduced, thereby improving the overall use reliability of the electronic device.

[0102] In some embodiments, after performing the insertion polling detection according to the second polling frequency, the method further includes:

[0103] receiving a first input;

[0104] In response to the first input, CC polling detection is performed.

[0105] That is, in this embodiment, after reducing the polling frequency of insertion detection, the manual OTG function or manual OTG mode can be turned on. In specific implementation, the first input can be a touch input, a voice input, a gesture input, etc. For example, the touch input can be a click input or a long press input of a target control displayed by the electronic device by the user, and the target control can be used to trigger the electronic device to perform CC polling detection.

[0106] In this embodiment, since the electronic device can be triggered to perform CC polling detection by user input, the risk of missed detection of the inserted device can be further reduced, thereby reducing the possibility of interface function failure and improving the reliability of the interface.

[0107] It should be noted that the various optional implementation modes introduced in the embodiments of the present application can be implemented in combination with each other or separately if they do not conflict with each other, and the embodiments of the present application are not limited to this.

[0108] For easier understanding, examples are given below.

[0109] In the following examples, the signal transmitting device is taken as a sound signal transmitting device for example.

[0110] The insertion detection method of this example can be based on the existing audio channel (speaker-Box), by sending ultrasonic signals (signals exceeding 20KHz), and then the mic hole receives the reflected signal to detect the size (reflected signals will only be received if the size exceeds a certain size) and the distance of the inserted object. In this way, the cause of the trigger interruption caused by micro short circuit and water ingress can be identified. If the size and distance of the object are met, then the CC identification OTG function is enabled.

[0111] This method can avoid the strict requirement of insertion detection (needing a functional pin with ADC detection or adding a circuit to detect impedance and voltage); at the same time, it can also determine that a larger object has been inserted by requiring the object to be of a certain size to reflect, thereby preventing corrosion problems caused by CC continuously sending pulses.

[0112] There are two modes for the power consumption of pulse detection:

[0113] One is normal triggering, that is, it is triggered by an external device plugged into the interface, so there is no need for polling, so the power consumption will be relatively low and can be ignored.

[0114] For the interruption caused by internal corrosion, because the interruption always exists, and if it is ignored, it will not be recognized when the OTG device is inserted, so polling is required. Although the speaker-Box will not have corrosion problems, if it is polled all the time, the power consumption will be high. At this time, the interface notifies the user to clean up the interface. If the user has not been able to release the trigger state, then increase the scanning time interval and turn on the manual OTG function synchronously. When it is in low power, switch directly to manual OTG mode. Due to the short distance, the required transmission power will be smaller. Taking a 5us pulse as an example, the standard power consumption of the amplifier is 1W, then the approximate power consumption of each detection is: 1W*5 / 1000000=5*10-3mW, which can be basically ignored.

[0115] In this example, the insertion detection method is as follows Figure 1aAs shown; first, the audio speaker channel port is used to transmit ultrasonic signals (the current ultrasonic signal generally detects a distance of about tens of centimeters, and the accuracy can also reach the um level), and then the mic hole is used as the signal receiving channel. When the user inserts other peripherals such as the OTG head, the USB port will be interrupted due to the insertion of the object, but it is impossible to distinguish whether the interruption is caused by water ingress or micro short circuit. At this time, the ultrasonic signal is emitted outward through the speaker port. The ultrasonic signal detects whether there is an object near the USB port, and the distance from the object to the USB port is generally less than 1cm. If the object is detected and meets the range, then CC output is performed. CC detects the type of inserted object by outputting pulse signals. If there is an insertion interruption, but no object is detected, then the USB port is short-circuited due to water ingress or other reasons. At this time, the user can be reminded to clean the USB port and turn off CC to avoid electrical corrosion caused by CC continuously outputting electrical signals.

[0116] When there is a trigger signal due to corrosion or other reasons, but no object is detected, because it is always in the triggered state, when an OTG device is really inserted, CC may not detect it. In order to solve such problems caused by short circuits and other reasons, the audio speaker channel and the mic port are polled to detect the inserted device. Because it is difficult for impurities to enter the speaker channel, there will be no corrosion problem. This problem can be solved, and the user is notified to clean the port. Once the trigger signal disappears (notifying the user to clean or for other reasons), the speaker will no longer poll. If there is no change in the polling, the manual OTG function is turned on by default, and the scanning frequency is reduced. When the battery is low, it will no longer scan and directly switch to manual OTG switch mode.

[0117] Because the audio speaker channel and mic channel are multiplexed, if music or recording is being played, it is possible that music cannot be played or recorded during detection. To address this issue, a special requirement can be made for the signal sent by the speaker, that is, only send narrow pulse signals, such as sending pulse signals with a width of 5us or less, and sending them in time gaps. Because their pulses are very narrow and the frequency is not within the hearing range of the human ear, it will basically not affect normal music playback and recording.

[0118] The insertion detection method of the embodiment of the present application can solve the two original problems. First, for the trigger detection of the interface, it is not necessary to have an interrupt function pin with ADC or add a detection circuit as before, which becomes simpler here; secondly, when an interrupt trigger caused by other substances or corrosion occurs, the approximate type of trigger can also be identified, and the CC will not be output all the time due to false triggering, causing corrosion problems. This method can be extended to the detection of other peripheral interfaces or other types of devices on the USB port. It can not only simplify the complexity and cost of the circuit, but also identify the approximate type range. It should be noted that the insertion detection method provided in the embodiment of the present application can be executed by an insertion detection device, or a control module in the insertion detection device for executing the insertion detection method. In the embodiment of the present application, the insertion detection device provided in the embodiment of the present application is taken as an example to execute the insertion detection method by the insertion detection device.

[0119] Optional, such as Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a program or instruction stored in the memory 402 and executable on the processor 401. When the program or instruction is executed by the processor 401, each process of the above-mentioned insertion detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0120] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0121] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0122] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 5010 and other components.

[0123] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 150 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0124] The processor 5010 is used for:

[0125] In the case where the interruption of the interface is triggered, an insertion detection is performed, wherein the insertion detection includes: controlling the signal transmitting device to transmit a signal; determining whether the signal receiving device receives the signal within a preset time period;

[0126] According to the detection result of the insertion detection, controlling the working state of the configuration channel of the interface;

[0127] Wherein, when the detection result is that the signal receiving device receives the signal within the preset time period, the working state is on; when the detection result is that the signal receiving device does not receive the signal within the preset time period, the working state is off.

[0128] In some embodiments, when the detection result is that the signal receiving device does not receive the signal within the preset time period, after performing the insertion detection, the method further includes:

[0129] Perform insert polling detection;

[0130] When the first condition is met, stopping the insertion polling detection;

[0131] The first condition includes any one of the following:

[0132] The detection result of the first insertion detection in the insertion polling detection is: the signal receiving device receives the signal within the preset time length;

[0133] The said interruption disappears;

[0134] The power level of the electronic device is less than a preset power level.

[0135] In some embodiments, performing insertion polling detection includes:

[0136] Performing an insertion polling detection according to a first polling frequency;

[0137] When the number of polling times of the insertion detection reaches a preset number, performing insertion polling detection according to a second polling frequency, wherein the second polling frequency is less than the first polling frequency;

[0138] receiving a first input;

[0139] In response to the first input, a configuration channel of the interface is opened.

[0140] It should be noted that the electronic device of the embodiment of the present application can execute Figure 3 To avoid repetition, the various processes in the method embodiment are not described here.

[0141] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 509 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 5010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 5010.

[0142] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned insertion detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0143] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0144] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned insertion detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated.

[0145] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0146] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0147] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0148] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. An electronic device, characterized in that: include: An interface, a signal transmitting device, a signal transmission channel and a signal receiving device; wherein the interface can be inserted into an external device; a first end of the signal transmission channel is connected to the signal transmitting device, a second end is connected to the signal receiving device, and a third end is provided with an opening, wherein the opening and the interface are provided on the same side of the electronic device; When the interface is plugged into the external device, the signal transmitting device transmits a first signal, and the first signal is reflected by the external device and then returns to the signal receiving device, and the configuration channel of the interface is opened.

2. The electronic device according to claim 1, characterized in that: In the case where the interruption of the interface is triggered, the signal transmitting device transmits a second signal, and the second signal is not reflected back to the signal receiving device within a preset time period, and the configuration channel of the interface is closed.

3. The electronic device according to claim 2, characterized in that: In the case that the interruption of the interface does not disappear, the signal transmitting device transmits a third signal, the third signal is reflected back to the signal receiving device within the preset time period, and the configuration channel of the interface is opened.

4. The electronic device according to claim 1, characterized in that: The signal emitting device is a sound signal emitting device or a light signal emitting device.

5. The electronic device according to claim 1, characterized in that: The signal transmission channel includes a first signal transmission channel and a second signal transmission channel; wherein one end of the first signal transmission channel is connected to the signal transmitting device, and the other end is provided with a first opening; one end of the second signal transmission channel is connected to the signal receiving device, and the other end is provided with a second opening; the first opening and the second opening are respectively provided on both sides of the interface; Alternatively, the signal transmission channel includes a third signal transmission channel; wherein a first end of the third signal transmission channel is connected to the signal transmitting device, a second end is connected to the signal processing device, and a third end is provided with an opening.

6. The electronic device according to claim 5, characterized in that: In the case where the signal transmitting device is a sound signal transmitting device, the first signal transmission channel is an audio channel, and the second signal transmission channel is a microphone channel.

7. An insertion detection method, applied to the electronic device according to any one of claims 1 to 6, characterized in that: include: In the case where the interruption of the interface is triggered, an insertion detection is performed, wherein the insertion detection includes: controlling the signal transmitting device to transmit a signal; determining whether the signal receiving device receives the signal within a preset time period; According to the detection result of the insertion detection, controlling the working state of the configuration channel of the interface; Wherein, when the detection result is that the signal receiving device receives the signal within the preset time period, the working state is on; when the detection result is that the signal receiving device does not receive the signal within the preset time period, the working state is off.

8. The method according to claim 7, characterized in that When the detection result is that the signal receiving device does not receive the signal within the preset time period, after performing the insertion detection, the method further includes: Perform insert polling detection; When the first condition is met, stopping the insertion polling detection; The first condition includes any one of the following: The detection result of the first insertion detection in the insertion polling detection is: the signal receiving device receives the signal within the preset time length; The said interruption disappears; The power level of the electronic device is less than a preset power level.

9. The method according to claim 8, characterized in that The execution of insert polling detection includes: Performing an insertion polling detection according to a first polling frequency; When the number of polling times of the insertion detection reaches a preset number, performing insertion polling detection according to a second polling frequency, wherein the second polling frequency is less than the first polling frequency; receiving a first input; In response to the first input, a configuration channel of the interface is opened.

10. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the insertion detection method as claimed in any one of claims 7 to 9.

11. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the insertion detection method according to any one of claims 7 to 9 are implemented.