Type-c interface exception detection method and device, computer readable storage medium and terminal

By setting up a method to statistically analyze abnormal interruption events within short time intervals in the Type-C interface, the shortcomings of Type-C interface anomaly detection are addressed, enabling accurate identification and timely alerts, thereby improving the security of terminal devices and user experience.

CN117724918BActive Publication Date: 2026-11-27SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311758595.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-19
Publication Date
2026-11-27
Estimated Expiration
2043-12-19

AI Technical Summary

Technical Problem

Existing technologies lack effective detection mechanisms to identify abnormal conditions of the Type-C interface, which may lead to liquid corrosion or dust/foreign objects entering the interface, affecting data transmission and charging functions, and may even damage the terminal.

Method used

By statistically analyzing abnormal interruption events, a first preset time interval is set to be less than the time interval for manually plugging and unplugging the Type-C interface. If the number of abnormal interruption events exceeds a threshold within a second preset time interval, the interface is determined to be abnormal, and a prompt message is sent to remind the user to clean or repair it.

Benefits of technology

Accurately identify abnormal interruption events, avoid misidentifying human plugging and unplugging behavior, detect interface anomalies in a timely manner, improve terminal security, and enhance user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117724918B_ABST
    Figure CN117724918B_ABST
Patent Text Reader

Abstract

A Type-C interface abnormality detection method and device, a computer readable storage medium and a terminal, the method comprising: counting abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, and the first preset time interval is less than a time interval for manually plugging in a connection to the Type-C interface; and if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold, it is determined that the Type-C interface is abnormal. The present solution can accurately detect the abnormal state of the Type-C interface, so as to timely remind the user to clean the interface or repair it.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of anomaly detection technology, and in particular to a method and apparatus for anomaly detection of a Type-C interface, a computer-readable storage medium, and a terminal. Background Technology

[0002] The Type-C (USB Type-C, Universal Serial Bus Type-C interface, hereinafter referred to as Type-C) connection method has been widely used as a universal interface standard for devices due to its advantages such as higher transmission speed, better scalability, bidirectional plug-in design, and support for fast charging.

[0003] Another significant characteristic of the Type-C interface is its smaller size, which results in a smaller distance between the pins, typically less than 0.3 mm. During use, improper handling can easily lead to liquid corrosion or the entry of dust / foreign objects, causing a short circuit. This can affect the device's data transmission and charging capabilities.

[0004] The existing technology lacks a suitable detection mechanism for the above-mentioned abnormal phenomena that may occur with the Type-C interface, which affects the normal use of the terminal and may even damage the terminal in severe cases, causing personal injury and property damage. Summary of the Invention

[0005] The technical problem solved by this invention is how to accurately detect abnormal states of the Type-C interface so as to promptly remind users to clean the interface or perform maintenance.

[0006] To address the aforementioned technical problems, this invention provides a method for detecting Type-C interface anomalies, comprising: counting abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, the first preset time interval being less than the time interval for manually plugging and unplugging the Type-C interface; if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold, then it is determined that an anomaly has been detected in the Type-C interface.

[0007] Optionally, the statistical abnormal interruption event includes: in response to detecting a first interrupt signal, starting a first timer, the duration of which is the first preset time interval; and if a second interrupt signal is detected before the first timer expires, determining that the abnormal interruption event has occurred and statistically analyzing it.

[0008] Optionally, the first interrupt signal includes a connection interrupt signal, used to indicate that a Type-C plug has been detected inserted into the Type-C interface; the second interrupt signal includes a disconnection interrupt signal, used to indicate that a Type-C plug has been detected removed from the Type-C interface.

[0009] Optionally, determining that the abnormal interrupt event has occurred when the first timer expires and a second interrupt signal is detected includes: when the first timer expires, determining whether the counts of the first counter and the second counter are both greater than zero, wherein the first counter is used to count the number of times the first interrupt signal is generated during the first timer's timing period, and the first counter increments by one when the first timer starts; the second counter is used to count the number of times the second interrupt signal is generated during the first timer's timing period; if the determination result shows that the counts of the first counter and the second counter are both greater than zero, then determining that the abnormal interrupt event has occurred.

[0010] Optionally, the first counter and the second counter are cleared after the first timer expires.

[0011] Optionally, determining and counting the occurrence of the abnormal interrupt event includes: determining the occurrence of the abnormal interrupt event at the hardware layer and reporting it to the driver layer; and counting the number of times the abnormal interrupt event is received at the driver layer.

[0012] Optionally, the first preset time interval is 200 milliseconds.

[0013] Optionally, the second preset time interval is 60 seconds, and the preset threshold is 200 times.

[0014] Optionally, the order of magnitude of the first preset time interval is smaller than the order of magnitude of the second preset time interval.

[0015] Optionally, the product of the preset threshold and the first preset time interval is less than the second preset time interval.

[0016] Optionally, the Type-C interface anomaly detection method further includes: sending a prompt message, the prompt message being used to indicate that an anomaly of the Type-C interface has been detected.

[0017] Optionally, the step of sending the prompt message is performed at the application layer.

[0018] Optionally, the Type-C interface anomaly detection method further includes: forcibly setting the operating mode of the Type-C interface to pure charging mode.

[0019] Optionally, before counting abnormal interruption events, the Type-C interface anomaly detection method further includes: disabling the sleep switching function to continuously count abnormal interruption events.

[0020] To address the aforementioned technical problems, this invention also provides a Type-C interface anomaly detection device, comprising: a statistics module for counting abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, the first preset time interval being less than the time interval for manually plugging and unplugging the Type-C interface; and a detection module for determining that a Type-C interface anomaly has been detected if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold.

[0021] To address the aforementioned technical problems, embodiments of the present invention also provide a computer-readable storage medium, which is a non-volatile or non-transient storage medium storing a computer program thereon, characterized in that the computer program is executed by a processor to perform the steps of the above-described method.

[0022] To address the aforementioned technical problems, this invention also provides a terminal, including a memory and a processor. The memory stores a computer program that can run on the processor, and the processor executes the steps of the above-described method when running the computer program.

[0023] Compared with the prior art, the technical solution of the embodiments of the present invention has the following beneficial effects:

[0024] This invention provides a method for detecting anomalies in a Type-C interface, comprising: counting abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, the first preset time interval being less than the time interval for manually plugging and unplugging the Type-C interface; if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold, then it is determined that an anomaly has been detected in the Type-C interface.

[0025] This implementation scheme accurately determines whether an abnormal interruption event has occurred by detecting whether at least one connection interruption signal and at least one disconnection interruption signal are generated within a first preset time interval. The first preset time interval is set to be significantly shorter than the time required for a single manual plugging and unplugging of the Type-C connector. Therefore, it effectively avoids misidentifying the act of manually plugging and unplugging the Type-C connector as an abnormal interruption event, resulting in more accurate identification of abnormal interruption events.

[0026] Furthermore, when the frequency of the abnormal interruption events is too high, there is a risk of damaging the terminal system to which the Type-C interface belongs. This abnormality needs to be detected in a timely manner. Therefore, when the number of abnormal interruption events counted within the second preset time interval exceeds a preset threshold, it can be determined that the frequency of the abnormal interruption events is too high, and an anomaly has been detected in the Type-C interface.

[0027] Furthermore, when a Type-C interface malfunction is detected, a notification message is sent to remind the user to clean the interface or have it repaired promptly to avoid affecting the normal use of the phone. This improves the security of the terminal device and enhances the user experience. Attached Figure Description

[0028] Figure 1 This is a flowchart of a Type-C interface anomaly detection method according to an embodiment of the present invention;

[0029] Figure 2 yes Figure 1 A flowchart of a specific implementation of step S11;

[0030] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S112;

[0031] Figure 4 This is a flowchart of a typical application scenario for Type-C interface anomaly detection in an embodiment of the present invention;

[0032] Figure 5 This is a schematic diagram of the structure of a Type-C interface anomaly detection device according to an embodiment of the present invention;

[0033] Figure 6 This is a schematic diagram of the pin distribution of a Type-C interface provided by the present invention. Detailed Implementation

[0034] As mentioned in the background section, the Type-C interface, as a universal interface standard for devices, has been widely used. Its small size and the closer spacing between pins compared to other interface types make it vulnerable to damage from liquids or the entry of dust / foreign objects, potentially causing a short circuit.

[0035] The adverse consequences of the aforementioned short circuit often include the Type-C port frequently reporting connection / disconnection interrupt signals on the order of milliseconds (ms), which can cause the USB (Universal Serial Bus) controller to hang, the terminal (such as a mobile phone) system to crash and restart repeatedly, and affect the terminal's data transmission and charging functions.

[0036] To address the aforementioned technical problems, this invention provides a method for detecting Type-C interface anomalies, comprising: counting abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, the first preset time interval being less than the time interval for manually plugging and unplugging the Type-C interface; if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold, then it is determined that an anomaly has been detected in the Type-C interface.

[0037] The Type-C interface anomaly detection method provided in this implementation scheme accurately determines whether an abnormal interruption event has occurred by detecting whether at least one connection interruption signal and at least one disconnection interruption signal are generated within a first preset time interval. The first preset time interval is set to be significantly shorter than the time required for a single manual plugging / unplugging of the Type-C connector. Therefore, it effectively avoids misidentifying the act of manually plugging / unplugging the Type-C connector as an abnormal interruption event, resulting in more accurate identification of abnormal interruption events.

[0038] Furthermore, when the frequency of the abnormal interruption events is too high, there is a risk of damaging the terminal system to which the Type-C interface belongs. This abnormality needs to be detected in a timely manner. Therefore, when the number of abnormal interruption events counted within the second preset time interval exceeds a preset threshold, it can be determined that the frequency of the abnormal interruption events is too high, and an anomaly has been detected in the Type-C interface.

[0039] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0040] Figure 1 This is a flowchart of a Type-C interface anomaly detection method according to an embodiment of the present invention.

[0041] This implementation scheme can be applied to the field of anomaly detection technology, such as anomaly detection for Type-C interfaces. The Type-C interface can be set in the terminal for charging and / or data transmission.

[0042] Figure 1 The method shown can be executed by a terminal, which can be various devices with a Type-C interface, such as mobile phones, computers, tablets, etc., but is not limited to these.

[0043] Specifically, refer to Figure 1 The Type-C interface anomaly detection method described in this embodiment may include the following steps:

[0044] Step S11: Count abnormal interruption events, wherein the abnormal interruption event occurs within a first preset time interval, and the first preset time interval is less than the time interval of manually plugging and unplugging the Type-C interface;

[0045] Step S12: If the number of abnormal interruption events counted within the second preset time interval is greater than a preset threshold, then it is determined that the Type-C interface is abnormal.

[0046] Furthermore, the abnormal interruption event could be, for example, an abnormal signal triggered by a short circuit on a pin of the Type-C interface. For example, such as... Figure 6 When the Type-C interface includes a CC pin (detection pin), the CC pin can be used to detect the insertion or removal of the Type-C plug and report the corresponding interrupt signal. Therefore, when the CC pin is short-circuited with other pins, corresponding interrupt signals will be frequently generated even if the Type-C plug is not inserted or removed. If, within a first preset time interval, both an interrupt signal indicating that the Type-C plug has been inserted and an interrupt signal indicating that the Type-C plug has been removed are detected, an abnormal interrupt event is considered to have occurred.

[0047] Furthermore, the first preset time interval can be preset to a value less than the time interval for manually plugging and unplugging the Type-C interface. This allows for the differentiation between interrupt signals representing abnormal interruptions and interrupt signals representing normal plugging and unplugging, leading to more accurate identification of abnormal interruptions.

[0048] Furthermore, the first preset time interval can be, for example, 200 milliseconds. Typically, the time interval for a normal manual plug-in / unplug connection of the Type-C interface is approximately 1000 milliseconds (1 second). In other words, a manual plug-in / unplug connection of the Type-C port cannot be completed within the first preset time interval.

[0049] Furthermore, the second preset time interval and the number of abnormal interruption events can be used to characterize the frequency of abnormal interruption events. When the frequency of abnormal interruption events is too high, that is, when abnormal interruption events occur frequently, it is determined that a Type-C interface abnormality has been detected.

[0050] Furthermore, combined with Figure 2 The process of statistically analyzing abnormal events in step S11 may specifically include:

[0051] Step S111: In response to the detection of the first interrupt signal, start the first timer, the duration of the first timer is the first preset time interval;

[0052] Step S112: If a second interrupt signal is detected before the first timer expires, the abnormal interrupt event is determined to have occurred and is recorded.

[0053] Furthermore, the first interrupt signal is an interrupt signal with a different meaning than the second interrupt signal.

[0054] In some embodiments, the first interrupt signal may include a connection interrupt signal, which indicates that a Type-C plug has been detected inserted into the Type-C interface; the second interrupt signal includes a disconnect interrupt signal, which indicates that a Type-C plug has been detected unplugged from the Type-C interface.

[0055] In some embodiments, the timing method of the first timer may be, for example, counting down the first preset time interval.

[0056] Furthermore, when the first timer expires, the first timer enters a sleep state. When the next first interrupt signal is detected, the first timer restarts its countdown.

[0057] In some embodiments, when a connection interruption signal is detected, the first timer starts and counts a first preset time interval.

[0058] Furthermore, if a disconnection interrupt signal is detected within the first preset time interval, it is determined that an abnormal interruption event has occurred.

[0059] In some embodiments, the determination that an abnormal interruption event has occurred occurs when the first timer expires.

[0060] In one variation, the first interrupt signal can be a disconnect interrupt signal, and the second interrupt signal can be a connection interrupt signal. In this scenario, the first timer is started in response to the generation of the disconnect interrupt signal.

[0061] Further, refer to Figure 3 In step S112, if a second interrupt signal is detected before the first timer expires, it is determined that the abnormal interrupt event has occurred. Specifically, this may include:

[0062] Step S1121: When the first timer expires, determine whether the counts of the first counter and the second counter are both greater than zero. The first counter is used to count the number of times the first interrupt signal is generated during the first timer's timing period. The first counter increments by one when the first timer starts. The second counter is used to count the number of times the second interrupt signal is generated during the first timer's timing period.

[0063] Step 1122: If the judgment result shows that the counts of the first counter and the second counter are both greater than zero, then it is determined that the abnormal interruption event has occurred.

[0064] In one embodiment, if the determination result of step S1121 indicates that the count of either the first counter or the second counter is zero, it is determined that no abnormal interruption event has occurred. Further, step S11 can be re-executed.

[0065] In one specific embodiment, in response to the generation of a first interrupt signal, the first counter is started, and the first counter is used to count the number of times the first interrupt signal is generated within a first preset time interval. Further, during the timing of the first timer, in response to the generation of a second interrupt signal, the second counter is started, and the second counter is used to count the number of times the second interrupt signal is generated before the first timer expires.

[0066] For example, the first interrupt signal can be a connection interrupt signal. When a connection interrupt signal is detected, the corresponding first counter starts and increments by one. During the first timer's timing period, each time a connection interrupt signal is detected, the corresponding first counter increments by one. The second interrupt signal can be a disconnection interrupt signal. When a disconnection interrupt signal is detected, the corresponding second counter starts and increments by one. During the first timer's timing period, each time a disconnection interrupt signal is detected, the corresponding second counter increments by one.

[0067] Furthermore, when the first timer expires, it is determined whether the count results of the first counter and the second counter are both greater than zero. If the result is yes, then the abnormal interruption event is determined to have occurred. This allows the abnormal interruption event to be distinguished from manually plugging and unplugging the Type-C interface, making the detection of abnormal interruptions more accurate.

[0068] In some embodiments, before the first interrupt signal is detected, both the first counter and the second counter can be in a sleep state. After the first interrupt signal is detected, both timers can switch to the working state and the count of the first counter is incremented. Furthermore, during the operation of the first timer, the second counter updates its count result based on whether the second interrupt signal has occurred. Thus, when the first interrupt signal is not detected, the first counter and the second counter can be in a sleep state to reduce terminal power consumption.

[0069] In a variation, the first counter may not be set. In this scenario, in response to the generation of the first interrupt signal, the first timer starts counting, and the second counter is started simultaneously. During the first timer's counting period, the second counter increments by one each time a second interrupt signal is detected. When the first timer expires, it is determined whether the count of the second counter is greater than zero. If the count of the second counter is greater than zero, it can be determined that at least one second interrupt signal and one first interrupt signal occurred during the first timer's counting period. This allows for accurate detection of abnormal interrupt events.

[0070] In some embodiments, multiple first interrupt signals and second interrupt signals may be detected during the first timer's timing period.

[0071] Furthermore, the first counter and the second counter are cleared after the first timer expires.

[0072] Furthermore, the determination and statistics of the occurrence of the abnormal interruption event include:

[0073] The abnormal interrupt event is determined at the hardware layer and reported to the driver layer;

[0074] The number of times the abnormal interruption event is received is counted at the driver layer.

[0075] Specifically, the terminal's operating system may include a multi-layered structure, where different layers perform different functions and cooperate to execute this implementation scheme. For example, the terminal may include a hardware driver layer (hereinafter referred to as the driver layer), a hardware abstraction layer, an application framework layer, and an application layer, each layer being constructed using a software stack approach. The hardware layer may be, for example, a microprocessor, memory, sensors, computing chips, etc. The driver layer may be, for example, the lowest-level software in the system.

[0076] Furthermore, the number of abnormal interruption events received by the driver layer can be used to determine whether the number of abnormal interruption events counted within the second preset time interval is greater than a preset threshold.

[0077] In some embodiments, the second preset time interval may be, for example, 60 seconds, and the preset threshold may be, for example, 200 times. In this scenario, it can be considered that a Type-C interface anomaly is detected when the frequency of abnormal interruption events exceeds 200 times / minute.

[0078] Furthermore, the order of magnitude of the first preset time interval is smaller than that of the second preset time interval. This allows for a more accurate determination of the frequency of abnormal interruption events, preventing sporadic events from affecting the final detection results.

[0079] Furthermore, the product of the preset threshold and the first preset time interval is less than the second preset time interval. Therefore, sufficient abnormal interruption events can be detected within the second preset time interval. Otherwise, even if the frequency of abnormal interruption events is higher than a certain value (e.g., 200 times / minute), the correct detection result cannot be obtained because the second preset time interval is too short.

[0080] Furthermore, the first preset time interval, the second preset time interval, and the preset threshold are all adjustable. The first preset time interval needs to be significantly shorter than the time required for a single manual plug-and-unplug connection of the Type-C interface. As mentioned earlier, the time required for a normal manual plug-and-unplug connection of the Type-C interface is approximately 1000 milliseconds. Furthermore, through repeated experiments by the inventors, the time interval for an abnormal interruption event caused by a pin short circuit in the Type-C interface is approximately 160-180 milliseconds. Therefore, in this embodiment of the invention, the first preset time interval is preferably 200 milliseconds. This ensures that the abnormal interruption event can be detected within the first preset time interval and can be accurately distinguished from an event caused by a single manual plug-and-unplug connection of the Type-C interface.

[0081] Furthermore, the preset time interval and preset threshold can be adjusted according to the first preset time interval, but the product of the preset threshold and the first preset time interval should always be less than the second preset time interval. In this embodiment of the invention, the second preset time interval is preferably 60 seconds, and the preset threshold is preferably 200 times. In this scenario, if the abnormal interruption event occurs continuously within the first preset time interval, the time required to count 200 abnormal interruption events is approximately 40 seconds, which is less than the second preset time interval (60 seconds). Therefore, it can be ensured that enough abnormal interruption events are counted within the second preset time interval, thereby improving the fault tolerance rate of the detection results of the method of the present invention.

[0082] Furthermore, if the number of abnormal interruption events counted within the second preset time interval is greater than a preset threshold (e.g., 200 abnormal interruption events are counted within 60 seconds), then it is determined that a Type-C interface abnormality has been detected.

[0083] In some embodiments, the second preset time interval can be an iterative timer. In other words, a Type-C interface anomaly can be determined as long as the number of abnormal interruption events counted within any consecutive second preset time interval is greater than a preset threshold.

[0084] In some embodiments, in response to determining that an abnormal interruption event has occurred, a second timer may be started, the duration of which is a second preset time interval. When the second timer expires, it is determined whether the count of a second counter has reached a preset threshold. If the determination result is yes, it is determined that a Type-C interface abnormality has been detected.

[0085] In a variation, it can also be determined whether the second timer's count is less than a second preset time interval when the second counter reaches a preset threshold. If the result is yes, then a Type-C interface anomaly is detected. This allows for more timely detection of Type-C interface anomalies, enabling users to be promptly alerted to repair or clean the Type-C interface.

[0086] Furthermore, after executing step S12, the Type-C interface anomaly detection method further includes:

[0087] A notification message is sent to indicate that an error has been detected in the Type-C interface.

[0088] Specifically, the notification message is sent after it is determined that the Type-C interface is abnormal. The content of the notification message may include reminding the user to clean the Type-C interface in a timely manner and to repair it as soon as possible.

[0089] Furthermore, the step of sending the notification message is executed at the application layer. The notification message can be displayed, for example, as a pop-up notification to the user on the terminal's interface.

[0090] Furthermore, after executing step S12, the Type-C interface anomaly detection method further includes:

[0091] The operating mode of the Type-C interface is forced to a pure charging mode to avoid affecting the implementation of other functions. For example, in data transmission mode, a malfunction of the Type-C interface may lead to the loss or corruption of transmitted data.

[0092] Specifically, the step of forcibly setting the operating mode of the Type-C interface to pure charging mode is executed after determining that an abnormality has been detected in the Type-C interface.

[0093] In some embodiments, the two steps described above can be performed simultaneously.

[0094] Furthermore, prior to the statistical abnormal interruption event in step S11, the Type-C interface abnormality detection method further includes:

[0095] Disable the sleep switching function to continuously collect abnormal interruption events.

[0096] Specifically, the Type-C toggle sleep function is used to periodically perform the Type-C interface detection function to reduce power consumption. The detection function can be, for example, detecting the insertion or removal of the Type-C connector via the CC pin. In some applications, when the toggle sleep function is enabled, the Type-C interface detection function is enabled every 500 milliseconds, during which time the detection function is in a sleep state to save power.

[0097] In this embodiment of the invention, the sleep switching function is in a disabled state. This allows for continuous tracking of abnormal interruption events.

[0098] Figure 4 This is a flowchart of a typical application scenario for Type-C interface anomaly detection in an embodiment of the present invention.

[0099] exist Figure 4 In the typical application scenarios shown, the implementation of the Type-C interface anomaly detection method described in this embodiment of the invention may include the following process:

[0100] First, disable the sleep switching function to keep the Type-C interface's detection function continuously enabled. This detection function could be, for example, detecting the insertion or removal of the Type-C connector via the CC pin. Disabling the sleep switching function allows for continuous monitoring and tracking of abnormal interrupt events.

[0101] Further, the first timer is initialized. In some embodiments, the second timer may also be initialized simultaneously.

[0102] Next, it is determined whether a connection interruption signal has been detected. If the determination result is yes, the count of the first counter is incremented by one, and the first timer is started, with a duration of 200 milliseconds; if the determination result is no, no response is made and the system continues to wait for the generation of a connection interruption signal.

[0103] Furthermore, during the timing period of the first timer, it is determined whether a disconnection interrupt signal is detected. If the determination result is yes, the second counter is incremented by one. The second counter can be started in response to the generation of either the connection interrupt signal or the disconnection interrupt signal. If the determination result is no, no response is made and the system continues to wait for the first timer to expire.

[0104] Furthermore, when the first timer expires, it is determined whether the counts of both the first and second counters are greater than zero. If the result is yes, an abnormal interrupt signal is detected and recorded. The action of detecting and recording an abnormal interrupt signal is executed at the driver layer. If the result is no, the first and second counters are cleared, and the system waits for the next connection interrupt signal to be generated to repeat the above steps.

[0105] Furthermore, if the number of abnormal interruption events counted exceeds 200 within 60 seconds, an application-layer error will be reported to the Type-C interface, and a notification message will be sent to remind the user to clean or repair it promptly. Simultaneously, the Type-C interface's operating mode will be forcibly set to pure charging mode to avoid affecting the implementation of other functions. If the number of abnormal interruption events counted is less than or equal to 200 within 60 seconds, no response will be made, and the system will continue to wait for the next connection interruption signal.

[0106] Therefore, the Type-C interface anomaly detection method provided in this implementation scheme accurately determines whether an abnormal interruption event has occurred by detecting whether at least one connection interruption signal and at least one disconnection interruption signal are generated within a first preset time interval. The first preset time interval is set to be significantly shorter than the time required for a single manual plugging / unplugging of the Type-C connector. This effectively avoids misidentifying the act of manually plugging / unplugging the Type-C connector as an abnormal interruption event, resulting in more accurate identification of abnormal interruption events.

[0107] Furthermore, when the frequency of the abnormal interruption events is too high, there is a risk of damaging the terminal system to which the Type-C interface belongs. This abnormality needs to be detected in a timely manner. Therefore, when the number of abnormal interruption events counted within the second preset time interval exceeds a preset threshold, it can be determined that the frequency of the abnormal interruption events is too high, and an anomaly has been detected in the Type-C interface.

[0108] Furthermore, when a Type-C interface malfunction is detected, a notification message is sent to remind the user to clean the interface or have it repaired promptly to avoid affecting the normal use of the phone. This improves the security of the terminal device and enhances the user experience.

[0109] Figure 5 This is a schematic diagram of the structure of a Type-C interface anomaly detection device 2 according to an embodiment of the present invention. Those skilled in the art will understand that the Type-C interface anomaly detection device 2 described in this embodiment can be used to implement the above-mentioned... Figures 1 to 4 The method described in the embodiments is a technical solution.

[0110] refer to Figure 5This invention also provides a Type-C interface anomaly detection device 2, comprising: a statistics module 21, used to count abnormal interruption events, wherein the abnormal interruption events occur within a first preset time interval, the first preset time interval being less than the time interval for manually plugging and unplugging the Type-C interface; and a detection module 22, which determines that a Type-C interface anomaly is detected if the number of abnormal interruption events counted within a second preset time interval is greater than a preset threshold.

[0111] For more information on the working principle and operation mode of the Type-C interface anomaly detection device 2, please refer to the above. Figures 1 to 4 The relevant descriptions in the text will not be repeated here.

[0112] Figure 6 This is a schematic diagram of the internal pin distribution of a Type-C interface. Here, Ai represents the position of the i-th pin on pin A of the Type-C interface, 1 ≤ i ≤ 12, and Bi represents the position of the i-th pin on pin B of the Type-C interface. Figure 6 As can be seen, the pin arrangement on row A is the reverse of the pin arrangement on row B, meaning the pins on rows A and B are symmetrically distributed. Therefore, the Type-C interface can achieve its corresponding function whether connected in the correct orientation or reverse. Specifically, the Vbus pin is the power supply pin for the Type-C interface, GND is the ground pin for the Type-C interface, D+ / D- pins can be used for high-speed communication of the Type-C interface in USB 2.0 scenarios, TX / RX pins can be used for high-speed communication of the Type-C interface in USB 3.0 scenarios, CC1 / CC2 (CC pins) can be used to detect the insertion or removal of the Type-C plug and report the corresponding interrupt signal, and SBU1 / SBU2 (SBU pins) are auxiliary communication pins for the Type-C interface, which can be used to connect external devices such as headphones and speakers.

[0113] according to Figure 6 As shown in the schematic diagram of the internal pin distribution of a Type-C interface, the positional relationship between the pins reveals that the possible short circuits of the CC pin include: short circuit between the CC pin and the Vbus pin, short circuit between the CC pin and the D+ pin, short circuit between the CC pin and the D- pin, short circuit between the CC pin and the GND pin, and short circuit between the CC pin and the TX pin. Since short circuits between the CC pin and the TX pin generally do not cause substantial damage to the terminal, they can be considered as not falling under the Type-C interface anomalies that need to be detected in this implementation scheme.

[0114] To verify the aforementioned beneficial effects achievable by the embodiments of the present invention, the inventors simulated the four possible short circuits of the CC pin within the Type-C interface that need to be detected as abnormal conditions, and conducted experiments using the embodiments of the present invention for detection. The specific experimental methods are as follows:

[0115] Experiment 1: Short-circuit the CC pin and Vbus pin using salt water and detect the short circuit using the method described in this embodiment of the invention;

[0116] Experiment 2: Short-circuit the CC pin and D+ pin using salt water and detect the short circuit using the method described in the embodiments of this invention;

[0117] Experiment 3: Short-circuit the CC pin and D- pin using salt water and detect the short circuit using the method described in the embodiments of this invention;

[0118] Experiment 4: Short-circuit the CC pin and GND pin using salt water and detect the short circuit using the method described in the embodiments of this invention.

[0119] Experimental results show that, using the method described in the embodiments of the present invention, all four experiments accurately detected the Type-C interface anomalies. This demonstrates that the Type-C interface anomaly detection method described in the embodiments of the present invention can accurately identify and detect the Type-C interface anomalies.

[0120] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs the above-described... Figures 1 to 4 The steps of the method described in the illustrated embodiment are as follows. The storage medium may include ROM, RAM, disk, or optical disk, etc. The storage medium may also include non-volatile memory or non-transitory memory, etc.

[0121] This application embodiment also provides a terminal, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it performs the above-described... Figures 1 to 4 The steps of the method described in the illustrated embodiment. The terminal includes, but is not limited to, terminal devices such as mobile phones, computers, and tablet computers.

[0122] It should be understood that in the embodiments of this application, the processor can be a central processing unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0123] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0124] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means.

[0125] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatus, and systems can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0126] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically included separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or in a combination of hardware and software functional units. For example, for various devices or products applied to or integrated into a chip, each module / unit can be implemented using hardware such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware such as circuits; for various devices or products applied to or integrated into a chip module, each module / unit can be implemented using hardware such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.

[0127] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.

[0128] In this application's embodiments, "multiple" refers to two or more. The descriptions of "first," "second," etc., appearing in this application's embodiments are merely illustrative and for distinguishing the described objects; they have no order and do not indicate a specific limitation on the number of devices in this application's embodiments, nor do they constitute any limitation on the embodiments of this application.

[0129] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. A method for detecting anomalies in a Type-C interface, characterized in that, include: Statistical analysis of abnormal interruption events, wherein the abnormal interruption event occurs within a first preset time interval, and the first preset time interval is less than the time interval for manually plugging and unplugging the Type-C interface; If the number of abnormal interruption events counted within the second preset time interval is greater than a preset threshold, then it is determined that an abnormality of the Type-C interface has been detected. The statistical anomaly interruption events include: In response to the detection of a first interrupt signal, a first timer is started, the duration of which is the first preset time interval; If a second interrupt signal is detected before the first timer expires, the abnormal interrupt event is determined to have occurred and is recorded. The order of magnitude of the first preset time interval is smaller than the order of magnitude of the second preset time interval; and / or, the product of the preset threshold and the first preset time interval is smaller than the second preset time interval.

2. The method according to claim 1, characterized in that, The first interrupt signal includes a connection interrupt signal, used to indicate that a Type-C plug has been detected inserted into the Type-C interface; the second interrupt signal includes a disconnect interrupt signal, used to indicate that a Type-C plug has been detected unplugged from the Type-C interface.

3. The method according to claim 1, characterized in that, If a second interrupt signal is detected before the first timer expires, the abnormal interrupt event is determined to have occurred, including: When the first timer expires, it is determined whether the counts of the first counter and the second counter are both greater than zero. The first counter is used to count the number of times the first interrupt signal is generated during the first timer's timing period. The first counter increments by one when the first timer starts. The second counter is used to count the number of times the second interrupt signal is generated during the first timer's timing period. If the determination result shows that the counts of both the first counter and the second counter are greater than zero, then it is determined that the abnormal interruption event has occurred.

4. The method according to claim 3, characterized in that, The first counter and the second counter are cleared after the first timer expires.

5. The method according to claim 1, characterized in that, The determination and statistics of the occurrence of the abnormal interruption event include: The abnormal interrupt event is determined at the hardware layer and reported to the driver layer; The number of times the abnormal interruption event is received is counted at the driver layer.

6. The method according to claim 1, characterized in that, The first preset time interval is 200 milliseconds; and / or, the second preset time interval is 60 seconds, and the preset threshold is 200 times.

7. The method according to claim 1, characterized in that, Also includes: A notification message is sent to indicate that an error has been detected in the Type-C interface.

8. The method according to claim 7, characterized in that, The step of sending the notification message is executed at the application layer.

9. The method according to claim 1, characterized in that, Also includes: Force the operating mode of the Type-C interface to be set to pure charging mode.

10. The method according to claim 1, characterized in that, Before counting abnormal interruption events, the following is also included: Disable the sleep switching function to continuously collect abnormal interruption events.

11. A Type-C interface anomaly detection device, characterized in that, include: The statistics module is used to count abnormal interruption events, wherein the abnormal interruption event occurs within a first preset time interval, and the first preset time interval is less than the time interval for manually plugging and unplugging the Type-C interface; If the number of abnormal interruption events counted within the second preset time interval is greater than a preset threshold, the detection module determines that a Type-C interface abnormality has been detected. The statistical anomaly interruption events include: In response to the detection of a first interrupt signal, a first timer is started, the duration of which is the first preset time interval; If a second interrupt signal is detected before the first timer expires, the abnormal interrupt event is determined to have occurred and is recorded. The order of magnitude of the first preset time interval is smaller than the order of magnitude of the second preset time interval; and / or, the product of the preset threshold and the first preset time interval is smaller than the second preset time interval.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium is a non-volatile or non-transient storage medium that stores a computer program thereon, characterized in that the computer program, when run by a processor, performs the steps of the method according to any one of claims 1 to 10.

13. A terminal comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Communication method between control module and display module and industrial control display device

    CN102945197A

  • Equipment pull-out reporting method and device, computer readable medium and electronic equipment

    CN114116546A