Insertion detection method, device, electronic device and storage medium
By collecting environmental sounds in the type-c interface and performing CC polling detection based on its characteristics, the problem of pin corrosion of the interface in dust or humid environments is solved, avoiding equipment heating and cost increase, improving safety and user experience.
Patent Information
- Application Number
- CN202110886718.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-03
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-08-03
AI Technical Summary
When existing type-c interfaces are used in dusty or humid environments to continuously run CC polling detection, pin corrosion will be accelerated, leading to functional abnormalities, and reducing ground pins to reduce heating problems will increase equipment heating risks and investment costs.
By collecting environmental sounds and obtaining sound characteristics, CC polling detection is performed when the similarity with pre-stored sound characteristics is higher than the preset threshold to determine the type of external device, thus mitigating the pin corrosion problem without adding hardware devices.
It effectively avoids equipment heating problems caused by pin corrosion, reduces investment costs, and improves user experience and safety.
Smart Images

Figure CN113672533B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and specifically relates to an insertion detection method, device, electronic equipment and storage medium. Background Art
[0002] At present, more and more electronic devices are beginning to use type-c interfaces for data and power transmission. Usually, external devices inserted into the type-c interface can be detected by continuously running the configuration channel (CC) polling test. However, if the interface is dusty or wet, then continuously running CC polling detection will accelerate the corrosion of the pins, causing abnormal function of the type-c interface.
[0003] In order to alleviate the pin corrosion problem, in the prior art, one of the ground pins of the type-c socket can be connected to the insertion detection module, and CC polling is enabled when an external device is detected to be inserted.
[0004] However, on the one hand, as the charging power of electronic devices becomes higher and higher, the Type-C interface will reduce a ground pin as a ground loop, which will cause the heating problem of the device to become more and more serious. This will not only affect the user experience, but also pose a risk of safety accidents caused by excessive charging current. On the other hand, the additional insertion detection module will increase the investment cost. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide an insertion detection method, device, electronic device and storage medium, which can solve the problems of equipment heating and high investment cost caused by pin corrosion.
[0006] In a first aspect, an embodiment of the present application provides an insertion detection method, which is applied to an electronic device, wherein the electronic device is provided with an interface, into which an external device can be inserted, the method comprising: collecting ambient sound and obtaining sound features of the ambient sound; when the similarity between the sound features of the ambient sound and pre-stored sound features is higher than a preset threshold, performing a configuration channel CC polling detection; based on the result of the CC polling detection, determining the type of the external device inserted into the interface; wherein the pre-stored sound features are sound features extracted from the sounds of different types of external devices inserted into the interface.
[0007] In the second aspect, the embodiment of the present application provides an insertion detection device, which is applied to an electronic device, and the electronic device is provided with an interface, and the interface can be plugged into an external device, and the device includes: an acquisition module and a processing module. The acquisition module is used to collect environmental sounds and obtain the sound features of the environmental sounds; the processing module is used to perform a configuration channel CC polling detection when the similarity between the sound features of the environmental sounds and the pre-stored sound features is higher than a preset threshold; according to the result of the CC polling detection, the type of the external device plugged into the interface is determined; wherein the pre-stored sound features are sound features extracted from the sounds of different types of external devices plugged into the interface.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes 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 method described in the first aspect.
[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0010] 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 first aspect.
[0011] In an embodiment of the present application, it is possible to collect ambient sound and obtain the sound features of the ambient sound, and when the similarity between the sound features of the ambient sound and the pre-stored sound features is higher than a preset threshold, perform a configuration channel CC polling detection; according to the result of the CC polling detection, determine the type of external device inserted into the interface; wherein the pre-stored sound features are sound features extracted from the sound of different types of external devices inserted into the interface. With this solution, since the sound of an external device inserted into the interface is different from other ambient sounds, when the similarity between the acquired ambient sound and the pre-stored sound features is higher than a preset threshold, it can be determined that an external device is inserted into the interface, and thus the configuration channel polling detection can be started. In this way, the problem of pin corrosion can be alleviated without adding additional hardware devices, thereby avoiding the problem of equipment heating caused by alleviating pin corrosion. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is one of the schematic diagrams of the insertion detection method provided in the embodiment of the present application;
[0013] Figure 2It is a schematic diagram of the plug and socket structure of the insertion detection method provided in an embodiment of the present application;
[0014] Figure 3 This is the second schematic diagram of the insertion detection method provided in the embodiment of the present application;
[0015] Figure 4 This is a connection diagram of a type-c to 3.5mm headphone cable connected to a type-c interface provided by an embodiment of the present application;
[0016] Figure 5 This is the third schematic diagram of the insertion detection method provided in the embodiment of the present application;
[0017] Figure 6 This is the fourth schematic diagram of the insertion detection method provided in the embodiment of the present application;
[0018] Figure 7 is a structural schematic diagram of an insertion detection device provided in an embodiment of the present application;
[0019] Figure 8 It is one of the hardware schematic diagrams of the electronic device provided in the embodiment of the present application;
[0020] Fig. 9 This is the second hardware schematic diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0022] 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.
[0023] The insertion detection method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0024] The insertion detection method provided in the embodiment of the present application can be applied to an electronic device provided with an interface for connecting a microphone and an external device, or a digital signal processor in the electronic device. For example, the interface can be any one of a micro-USB interface, a lightning interface, and a type-c interface. The following takes an electronic device executing the method and the interface being a type-c interface as an example to describe the embodiment of the present application in detail.
[0025] like Figure 1 As shown, an embodiment of the present application provides an insertion detection method, which may include steps 101-103.
[0026] Step 101: Collect environmental sounds and obtain sound features of the environmental sounds.
[0027] Specifically, after the electronic device is turned on and running, it can collect environmental sounds in real time through its own microphone and extract sound features from the collected environmental sounds.
[0028] Alternatively, if Figure 2 As shown in (a) of FIG. 1 , it is a schematic diagram of the structure of the interface plug, and each side of the plug includes a protrusion 21. Figure 2 (b) is a schematic diagram of the structure of the interface socket, and each side of the socket includes a groove 22. During the process of inserting the plug into the socket, the protrusion 21 can slide into the groove 22, thereby generating an insertion sound. Therefore, before executing step 101, the electronic device can first use a microphone to sample the sound signal of the external device inserted into the electronic device interface through different insertion methods, and the number of samples in different scenarios can be greater than or equal to the first threshold. After obtaining the sound sample, the electronic device can extract sound features from each sound sample, and store all the sound features finally extracted in the electronic device to obtain pre-stored sound features.
[0029] That is, the electronic device can collect the sounds of various types of external devices plugged into the interface in advance, extract sound features based on the collected sounds, and store these sound features, thereby obtaining pre-stored sound features. For example, taking the external devices including a charger and headphones as an example, the electronic device can collect the sounds of the charger and headphones plugged into the interface respectively, and then extract the sound features of the charger plugged into the interface and the sound features of the headphones plugged into the interface based on the collected sounds, thereby obtaining pre-stored sound features including the charger sound features and the headphones sound features.
[0030] Optionally, the external device may include a USB data cable and a USB adapter. For example, it may be a Type C data cable or a Type C to 3.5mm headphone jack adapter. The insertion method may include fast insertion, slow insertion, oblique insertion, etc. The first threshold may be 500.
[0031] Step 102: When the similarity between the sound feature of the ambient sound and the pre-stored sound feature is higher than a preset threshold, perform CC polling detection.
[0032] The pre-stored sound features are sound features extracted from the sounds of different types of external devices plugged into the interface.
[0033] After obtaining the sound characteristics of the ambient sound, the electronic device can compare the sound characteristics of the ambient sound with the pre-stored sound characteristics for similarity. If the similarity between the sound characteristics of the ambient sound and the pre-stored sound characteristics is higher than a preset threshold, a CC polling detection is performed to obtain the result of the CC polling detection; if the similarity between the sound characteristics of the ambient sound and the pre-stored sound characteristics is not higher than the preset threshold, new ambient sound collection continues.
[0034] Step 103: Determine the type of the external device plugged into the interface according to the result of the CC polling detection.
[0035] The electronic device includes an interface chip, which may include a CC1 pin and a CC2 pin. The electronic device can detect the voltage and resistance of the CC1 pin and the CC2 pin, and when the voltage of the CC1 pin and the CC2 pin is 0, determine that the external device inserted into the interface is an analog audio device; when the resistance between the CC1 pin and the CC2 pin is within a first preset interval, determine that the external device inserted into the interface is an OTG device; when the voltage between the CC1 pin and the CC2 pin is within a second preset interval, determine that the external device inserted into the interface is a charger or a computer.
[0036] It should be noted that, since the electronic device can determine the type of external device inserted into the interface based on the voltage and resistance between the CC1 pin and the CC2 pin, data or power transmission between the interface and the connector can be achieved based on the type of the external device.
[0037] Optionally, the first preset interval may be (4.59k, 5.61k), and the second preset interval may be (4.5v, 5.5v).
[0038] Optionally, after determining that the external device inserted into the interface is a charger or a computer, the electronic device can also distinguish whether the external device inserted into the interface is a charger or a computer according to USB D+ and D-.
[0039] In the embodiment of the present application, since the sound of an external device plugged into the interface is different from other environmental sounds, when the similarity between the acquired environmental sound and the pre-stored sound feature is higher than a preset threshold, it can be determined that an external device is plugged into the interface, so that the configuration channel polling detection can be started. In this way, the problem of pin corrosion can be alleviated without adding additional hardware devices, thereby avoiding the problem of device heating caused by pin corrosion.
[0040] Alternatively, if Figure 3 As shown, after performing CC polling detection, the above method may further include steps 104-105:
[0041] Step 104: When it is detected that the CC1 pin and the CC2 pin are in a non-working state, the CC1 pin is controlled to output a high level.
[0042] If it is detected that the CC1 pin and the CC2 pin are in a non-working state, that is, the signal output through the CC1 pin and the CC2 pin has not changed, there may be a situation, one is that the adapter is inserted into the interface, but the headset is not connected; the other is a false detection. If the adapter is inserted, the CC polling detection can continue to be performed. If it is a false detection, the CC polling detection can be stopped. In order to distinguish the two situations, the electronic device can control the CC1 pin to output a high level and detect the level of the CC2 pin output.
[0043] Step 105: Determine whether to insert the adapter cable according to the level of the CC2 pin output.
[0044] After controlling the CC1 pin to output a high level, the electronic device can determine whether to insert the adapter cable according to the level output by the CC2 pin. Specifically, if the CC2 pin is at a high level, the electronic device can determine that the external device inserted into the interface is an adapter cable; if the CC2 pin is at a low level, the electronic device can stop executing the configuration channel polling detection and collect new ambient sounds.
[0045] Take the adapter cable from type-c to 3.5mm headphone cable as an example. Figure 4 As shown in the figure, it is a connection diagram of the type-c to 3.5mm headphone cable connected to the type-c interface. The output end of the type C to 3.5mm headphone cable is connected to the CC1 pin and CC2 pin of the type-c interface respectively. When the CC1 pin outputs a high level, if the CC2 pin is also high, it can be determined that the external device inserted into the type-c interface is a transfer cable; if the CC2 pin is low, it means that no external device is connected, so the CC polling detection can be stopped and new environmental sound can be collected again.
[0046] In the embodiment of the present application, since it is possible to control the CC1 pin to output a high level and determine whether the adapter cable is inserted according to the level output by the CC2 pin, on the one hand, it is possible to detect that only the adapter cable is inserted into the interface of the electronic device and no other devices are connected; on the other hand, when the CC2 pin is at a low level, the CC polling detection can be stopped, thereby further delaying the problem of pin corrosion caused by continuously turning on the CC polling detection.
[0047] Alternatively, if Figure 5 As shown, before performing CC polling detection, the above method may further include steps 106-107:
[0048] Step 106: Detect the voltage on the power supply line of the interface.
[0049] In order to prevent the problem of missed detection caused by sound-triggered CC polling detection, the electronic device can first detect the voltage on the power supply line VBUS of the interface before performing CC polling detection.
[0050] Step 107: When the voltage on the power supply line is greater than the target threshold, determine that the external device plugged into the interface is a charger or a computer.
[0051] After the interface is plugged into a charger or a computer, the voltage on VBUS will change. Therefore, after obtaining the voltage on VBUS, if the voltage on VBUS is greater than a target threshold, it can be determined that the external device plugged into the interface is a charger or a computer.
[0052] Optionally, the target threshold may be 5V.
[0053] In the embodiment of the present application, since it is possible to determine whether a charger or a computer is plugged in by detecting the voltage on the power supply line, the risk of missed detection of the inserted device can be reduced, thereby improving the user experience.
[0054] Alternatively, if Figure 6 As shown, after collecting the ambient sound and obtaining the sound features of the ambient sound, the above method may further include steps 108-109:
[0055] Step 108: When the similarity between the sound feature of the ambient sound and the pre-stored sound feature is not higher than a preset threshold, receive a first input.
[0056] Optionally, the first input may be a touch input, a voice input, a gesture input, etc. For example, the touch input may 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 may be used to trigger the electronic device to perform CC polling detection.
[0057] Step 109: In response to the first input, perform CC polling detection.
[0058] For the implementation method of the electronic device performing CC polling detection, please refer to the relevant description in the above step 103, which will not be repeated here.
[0059] In the embodiment of the present application, 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, thereby improving the user experience.
[0060] 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 described by taking the insertion detection device executing the insertion detection method as an example.
[0061] like Figure 7 As shown, an embodiment of the present application also provides an insertion detection device 700, which is applied to an electronic device, and the electronic device is provided with an interface, and the interface can be inserted into an external device. The device 700 includes: an acquisition module 701 and a processing module 702. Among them, the acquisition module 701 can be used to collect environmental sounds and obtain sound features of the environmental sounds. The processing module 702 can be used to perform a configuration channel CC polling detection when the similarity between the sound features of the environmental sounds and the pre-stored sound features is higher than a preset threshold; and according to the result of the CC polling detection, determine the type of external device inserted into the interface; wherein the pre-stored sound features are sound features extracted according to the sounds of different types of external devices inserted into the interface.
[0062] Optionally, the electronic device may include an interface chip, which may include a CC1 pin and a CC2 pin; the processing module 702 may be specifically used to: when the voltage between the CC1 pin and the CC2 pin is 0, determine that the external device inserted into the interface is an analog audio device; when the resistance between the CC1 pin and the CC2 pin is within a first preset interval, determine that the external device inserted into the interface is an OTG device; when the voltage between the CC1 pin and the CC2 pin is within a second preset interval, determine that the external device inserted into the interface is a charger or a computer.
[0063] Optionally, the above-mentioned processing module 702 can also be used for: after executing the configuration channel polling detection, when it is detected that the CC1 pin and the CC2 pin are in a non-working state, controlling the CC1 pin to output a high level; if the CC2 pin is at a high level, determining that the external device inserted into the interface is a adapter cable; if the CC2 pin is at a low level, stopping the CC polling detection and collecting new ambient sounds.
[0064] Optionally, the processing module 702 may also be used to: detect the voltage on the power supply line of the interface before performing CC polling detection; and determine that the external device plugged into the interface is a charger or a computer when the voltage on the power supply line is greater than a target threshold.
[0065] Optionally, continue to refer to Figure 7 The apparatus 700 may further include a receiving module 703. The receiving module 703 may be configured to receive a first input when the similarity between the sound feature of the ambient sound and the pre-stored sound feature is not higher than the preset threshold. The processing module 702 may be configured to perform the CC polling detection in response to the first input.
[0066] In the embodiment of the present application, since the sound of an external device plugged into the interface is different from other environmental sounds, when the similarity between the acquired environmental sound and the pre-stored sound feature is higher than a preset threshold, it can be determined that an external device is plugged into the interface, so that the configuration channel polling detection can be started. In this way, the problem of pin corrosion can be alleviated without adding additional hardware devices, thereby avoiding the problem of device heating caused by pin corrosion.
[0067] The insertion detection device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0068] The insertion detection device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0069] The insertion detection device provided in the embodiment of the present application can achieve Figures 1 to 6 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0070] Alternatively, if Figure 8 As shown, an embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and a program or instruction stored in the memory 802 and executable on the processor 801. When the program or instruction is executed by the processor 801, 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.
[0071] 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.
[0072] Fig. 9 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0073] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0074] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig. 9 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.
[0075] The input unit 104 is used to collect environmental sounds and obtain sound features of the environmental sounds.
[0076] Processor 110 is used to perform CC polling detection when the similarity between the sound feature of the ambient sound and the pre-stored sound feature is higher than a preset threshold; determine the type of external device inserted into the interface according to the result of CC polling detection; wherein the pre-stored sound feature is a sound feature extracted from the sound of different types of external devices inserted into the interface.
[0077] In the embodiment of the present application, since the sound of an external device plugged into the interface is different from other environmental sounds, when the similarity between the acquired environmental sound and the pre-stored sound feature is higher than a preset threshold, it can be determined that an external device is plugged into the interface, so that the configuration channel polling detection can be started. In this way, the problem of pin corrosion can be alleviated without adding additional hardware devices, thereby avoiding the problem of device heating caused by pin corrosion.
[0078] Optionally, the processor 110 is specifically used to: when the voltage between the CC1 pin and the CC2 pin is 0, determine that the external device inserted into the interface is an analog audio device; when the resistance between the CC1 pin and the CC2 pin is within a first preset interval, determine that the external device inserted into the interface is an OTG device; when the voltage between the CC1 pin and the CC2 pin is within a second preset interval, determine that the external device inserted into the interface is a charger or a computer.
[0079] In an embodiment of the present application, the electronic device can determine the type of external device inserted into the interface based on the voltage and resistance between the CC1 pin and the CC2 pin, thereby enabling data or power transmission between the interface and the connector.
[0080] Optionally, the processor 110 is also used to: after performing CC polling detection, when it is detected that the CC1 pin and the CC2 pin are in a non-working state, control the CC1 pin to output a high level; if the CC2 pin is at a high level, determine that the external device inserted into the interface is a adapter cable; if the CC2 pin is at a low level, stop executing the CC polling detection and collect new ambient sounds.
[0081] In the embodiment of the present application, since it is possible to control the CC1 pin to output a high level and determine whether the adapter cable is inserted according to the level output by the CC2 pin, on the one hand, it is possible to detect that only the adapter cable is inserted into the interface of the electronic device and no other devices are connected; on the other hand, when the CC2 pin is at a low level, the CC polling detection can be stopped, thereby further delaying the problem of pin corrosion caused by continuously turning on the CC polling detection.
[0082] Optionally, the processor 110 is further configured to: detect a voltage on a power supply line of the interface before performing CC polling detection; and determine that the external device plugged into the interface is a charger or a computer when the voltage on the power supply line is greater than a target threshold.
[0083] In the embodiment of the present application, since it is possible to determine whether a charger or a computer is plugged in by detecting the voltage on the power supply line, the risk of missed detection of the inserted device can be reduced, thereby improving the user experience.
[0084] Optionally, the user input unit 1007 is used to receive a first input when the similarity between the sound feature of the ambient sound and the pre-stored sound feature is not higher than the preset threshold.
[0085] The processor 110 is specifically configured to perform the CC polling detection in response to the first input.
[0086] In the embodiment of the present application, 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, thereby improving the user experience.
[0087] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 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 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 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 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 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 1010.
[0088] 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.
[0089] 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.
[0090] 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 here.
[0091] 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.
[0092] 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.
[0093] 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 computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0094] 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 insertion detection method, applied to electronic equipment, characterized in that: The electronic device is provided with an interface, the interface can be plugged into an external device, and the method comprises: Collecting environmental sounds and obtaining sound characteristics of the environmental sounds; When the similarity between the sound feature of the environmental sound and the pre-stored sound feature is higher than a preset threshold, performing configuration channel polling detection; Determining the type of the external device plugged into the interface according to the result of the configuration channel polling detection; Wherein, the pre-stored sound features are sound features extracted from the sounds of different types of external devices plugged into the interface; The electronic device comprises an interface chip, and the interface chip comprises a CC1 pin and a CC2 pin; After the configuration channel polling detection is performed, the method further includes: When it is detected that the CC1 pin and the CC2 pin are in a non-working state, controlling the CC1 pin to output a high level; If the CC2 pin is at a high level, it is determined that the external device inserted into the interface is a transfer cable; If the CC2 pin is at a low level, the configuration channel polling detection is stopped and new environmental sounds are collected.
2. The insertion detection method according to claim 1, characterized in that: The step of determining the type of the external device plugged into the interface according to the result of the configuration channel polling detection comprises: When the voltages of the CC1 pin and the CC2 pin are 0, determining that the external device plugged into the interface is an analog audio device; When the resistance between the CC1 pin and the CC2 pin is within a first preset range, determining that the external device inserted into the interface is an OTG device; When the voltage between the CC1 pin and the CC2 pin is within the second preset interval, it is determined that the external device inserted into the interface is a charger or a computer.
3. The insertion detection method according to any one of claims 1 to 2, characterized in that: Before performing the configuration channel polling detection, the method further includes: Detecting the voltage on the power supply line of the interface; When the voltage on the power supply line is greater than a target threshold, it is determined that the external device plugged into the interface is a charger or a computer.
4. The insertion detection method according to any one of claims 1 to 2, characterized in that: After collecting the ambient sound and obtaining the sound features of the ambient sound, the method further includes: In a case where the similarity between the sound feature of the ambient sound and the pre-stored sound feature is not higher than the preset threshold, receiving a first input; In response to the first input, the configuration channel polling detection is performed.
5. An insertion detection device, applied to electronic equipment, characterized in that: The electronic device is provided with an interface, the interface can be inserted into an external device, and the device comprises: an acquisition module and a processing module; The acquisition module is used to collect environmental sounds and obtain sound features of the environmental sounds; The processing module is used to perform configuration channel polling detection when the similarity between the sound feature of the ambient sound and the pre-stored sound feature is higher than a preset threshold; and determine the type of the external device inserted into the interface according to the result of the configuration channel polling detection; Wherein, the pre-stored sound features are sound features extracted from the sounds of different types of external devices plugged into the interface; The electronic device comprises an interface chip, and the interface chip comprises a CC1 pin and a CC2 pin; The processing module is also used for: when it is detected that the CC1 pin and the CC2 pin are in a non-working state, controlling the CC1 pin to output a high level; if the CC2 pin is at a high level, determining that the external device inserted into the interface is a adapter cable; if the CC2 pin is at a low level, stopping the configuration channel polling detection and collecting new environmental sounds.
6. The insertion detection device according to claim 5, characterized in that: The processing module is specifically used for: When the voltages of the CC1 pin and the CC2 pin are 0, determining that the external device plugged into the interface is an analog audio device; When the resistance between the CC1 pin and the CC2 pin is within a first preset range, determining that the external device inserted into the interface is an OTG device; When the voltage between the CC1 pin and the CC2 pin is within the second preset interval, it is determined that the external device inserted into the interface is a charger or a computer.
7. An electronic device, characterized in that: The method comprises a processor, a memory and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the insertion detection method according to any one of claims 1 to 4.
8. A readable storage medium, characterized in that: The readable storage medium stores a program, and when the program is executed by the processor, the steps of the insertion detection method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Device and method for recognizing self-timer, and mobile terminal
CN108646852A
Charging interface device and mobile terminal
CN112165136A
Charging interface circuit and electronic equipment
CN112290639A
Protection method, protection device, electronic equipment, readable storage medium and chip
CN112558741A
Detection method and device, charging box and storage medium
CN113038327A
