A USB low-power consumption control method and system based on communication behavior prediction

By predicting the communication behavior and activity of USB devices and using state switching rules to control the USB interface, the problem of high power consumption of USB interfaces is solved and the battery life of devices is improved.

CN120743085BActive Publication Date: 2026-01-27XIAMEN UNISOC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511249716.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2026-01-27
Estimated Expiration
2045-09-03

AI Technical Summary

Technical Problem

USB ports consume a lot of power due to a lot of interaction after a device is connected, which affects the device's battery life.

Method used

By predicting communication behavior, identifying the target device type and activity level, and using state switching rules to control the sleep and wake-up states of the USB interface, including active state, shallow sleep, deep sleep and ready state, the system also controls physical layer module and power domain information.

Benefits of technology

Reduce unnecessary communication, lower power consumption, and increase device battery life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743085B_ABST
    Figure CN120743085B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a USB low-power consumption control method and system based on communication behavior prediction, comprising: obtaining communication data connected with a target USB interface; identifying a target type corresponding to the target device according to the communication data through a preset type identification model; obtaining data packet transceiving information of the target device; calculating an activity probability of the target device according to the data packet transceiving information and a pre-created activity model; identifying a target activity level corresponding to the target device according to the activity probability and an activity probability range corresponding to different preset activity levels; and performing communication control on the target USB interface according to the target type and the target activity level and a pre-set state switching rule, wherein the state switching rule comprises a switching rule between an active state, a light sleep state, a deep sleep state and a preparation state. The method of the present application can reduce communication and lower power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of operating mode control technology, and in particular to a USB low-power control method and system based on communication behavior prediction. Background Technology

[0002] USB (Universal Serial Bus) interfaces are widely used in modern electronic devices, encompassing functions such as data transfer, device charging, and power supply. Especially in mobile devices, laptops, IoT terminals, and wearable devices, the USB interface not only provides a communication channel but also handles tasks such as power supply, protocol handshake, and peripheral management. However, because the master device performs a significant amount of interaction with the slave device after connecting via USB, power consumption is relatively high. This can impact battery life, particularly for devices like laptops. Summary of the Invention

[0003] The purpose of this application is to provide a USB low-power control method and system based on communication behavior prediction, in order to solve the problem of high power consumption of USB interfaces. The specific technical solution is as follows:

[0004] A first aspect of this application provides a USB low-power control method based on communication behavior prediction, applied to a host device, wherein the host device is connected to a target device via a target USB interface; the method includes:

[0005] Acquire communication data connected to the target USB interface; identify the target type of the target device based on the communication data using a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power-only type;

[0006] Obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity;

[0007] Based on the target type, the target activity level, and pre-defined state switching rules, communication control is performed on the target USB interface. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. Communication control of the target USB interface includes: controlling the physical layer PHY module switch, and controlling one or more of power domain information and clock domain gating information.

[0008] In one possible implementation, the step of controlling the communication of the target USB interface based on the target type, the target activity level, and pre-defined state switching rules includes:

[0009] When the target activity level is medium active and the target type is periodic or low-frequency continuous connection, the state of the target USB interface is adjusted to shallow sleep and clock data is stopped from being sent to the target device.

[0010] When the target activity level is low activity and the target type is burst-type or power-only type, the state of the target USB interface is adjusted to deep sleep and the physical layer PHY of the target USB interface is powered off.

[0011] In one possible implementation, after obtaining the data packet transmission and reception information of the target device, the method further includes:

[0012] Identify the transmit and receive information of the target USB interface;

[0013] When a handshake data packet, an interrupt signal, or a level signal is detected, power and clock data transmission are restored for the target USB interface, the PHY is initialized, and the handshake protocol is synchronized.

[0014] In one possible implementation, calculating the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model includes:

[0015] By using a preset time window, the number of data packets sent and received can be counted for multiple time periods.

[0016] The active probability is obtained by weighting and summing the data packets received and sent in each time period using an exponentially weighted average algorithm based on the attenuation factor corresponding to each time period.

[0017] In one possible implementation, the step of acquiring communication data connected to the target USB interface and identifying the target type corresponding to the target device based on the communication data using a preset type identification model includes:

[0018] Obtain the arrival time, size, direction of transmission, type of transmission, power supply status, and electrical connection status of the data packets to the target USB interface;

[0019] By using a preset lightweight decision tree or Kmeas, the target type corresponding to the target device can be identified based on the data packet arrival time, data packet size, transmission direction, transmission type, interface power supply status, and electrical connection status.

[0020] A second aspect of this application provides a USB low-power control device based on communication behavior prediction, applied to a host device, wherein the host device is connected to a target device via a target USB interface; the device includes:

[0021] The type determination module is used to acquire communication data connected to the target USB interface; and to identify the target type of the target device according to the communication data through a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power supply only.

[0022] An activity determination module is used to obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; and identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity.

[0023] The state switching module is used to perform communication control on the target USB interface according to the target type, the target activity level, and the preset state switching rules. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. The communication control on the target USB interface includes controlling the physical layer PHY module switch and controlling one or more of power domain information and clock domain gating information.

[0024] In one possible implementation, the state switching module is specifically used to adjust the state of the target USB interface to shallow sleep and stop sending clock data to the target device when the target activity level is medium active and the target type is periodic or low-frequency continuous connection; and to adjust the state of the target USB interface to deep sleep and power off the physical layer PHY of the target USB interface when the target activity level is low active and the target type is bursty or power-only.

[0025] In one possible implementation, an information identification module is used to identify the transmit and receive information of the target USB interface;

[0026] The state recovery module is used to restore power and clock data transmission for the target USB interface, initialize the PHY, and synchronize the handshake protocol when one of the handshake data packet, interrupt signal, and level signal is detected.

[0027] In one possible implementation, the activity determination module is specifically used to count the number of data packets sent and received in multiple time periods through a preset time window; and to obtain the activity probability by weighting and summing the data packets sent and received in each time period according to the attenuation factor corresponding to each time period and the number of data packets sent and received in each time period through an exponential weighted average algorithm.

[0028] In one possible implementation, the type determination module is specifically used to obtain the arrival time, size, transmission direction, transmission type, power supply status, and electrical connection status of the data packet to the target USB interface; and to identify the target type of the target device based on the arrival time, size, transmission direction, transmission type, power supply status, and electrical connection status of the data packet by using a preset lightweight decision tree or Kmeas.

[0029] Another aspect of the embodiments of this application also provides an electronic device, including:

[0030] Memory, used to store computer programs;

[0031] When the processor executes a program stored in memory, it implements any of the above-mentioned USB low-power control methods based on communication behavior prediction.

[0032] In another aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the above-described USB low-power control methods based on communication behavior prediction.

[0033] In another aspect of the embodiments of this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the above-described USB low-power control methods based on communication behavior prediction.

[0034] Beneficial effects of the embodiments in this application:

[0035] This application provides a USB low-power control method and system based on communication behavior prediction. The method is applied to a host device, which is connected to a target device via a target USB interface. The method includes: acquiring communication data connected to the target USB interface; identifying the target type of the target device based on the communication data using a preset type identification model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power-only; acquiring data packet transmission and reception information of the target device; calculating the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; identifying the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity; performing communication control on the target USB interface based on the target type, the target activity level, and preset state switching rules, wherein the state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state; and performing communication control on the target USB interface including: controlling the physical layer PHY module switch and controlling one or more of power domain information and clock domain gating information. By means of the method in this application embodiment, after acquiring communication data connected to the target USB interface, the type of the device can be determined by the acquired communication data, and the activity level of the slave device can be determined by the data packet transmission and reception information. In this way, communication control is performed on the target USB interface according to the target type, the target activity level, and the preset state switching rules, thereby reducing unnecessary communication with the slave device and reducing power consumption.

[0036] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0038] Figure 1 A schematic flowchart of a USB low-power control method based on communication behavior prediction provided in an embodiment of this application;

[0039] Figure 2 This is a schematic diagram of a process for calculating the activity probability provided in an embodiment of this application;

[0040] Figure 3A schematic diagram of a USB low-power control device based on communication behavior prediction provided in an embodiment of this application;

[0041] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0043] A first aspect of this application provides a USB low-power control method based on communication behavior prediction, applied to a host device, wherein the host device is connected to a target device via a target USB interface; see also Figure 1 , Figure 1 A flowchart illustrating a USB low-power control method based on communication behavior prediction provided in this application embodiment, the method comprising:

[0044] Step S11: Obtain communication data connected to the target USB interface; identify the target type of the target device according to the communication data using a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power-only.

[0045] Step S12: Obtain the data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity and high activity.

[0046] Step S13: Based on the target type, the target activity level, and the preset state switching rules, perform communication control on the target USB interface. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. Performing communication control on the target USB interface includes: controlling the PHY (physical layer) module switch, and controlling one or more of power domain information and clock domain gating information.

[0047] Corresponding to step S11 above, the method of this application embodiment is applied to a master device, which is connected to a target device through a target USB interface. Specifically, this can be implemented through the master device. The slave device is connected to the master device through a USB interface on the master device. The master device can perform communication control of the USB interface by detecting the data information of the USB interface and / or the relevant information of the slave device. In this application embodiment, obtaining communication data connected to the target USB interface can involve obtaining information such as the arrival time of data packets, data packet size, transmission direction, transmission type, interface power supply status, and electrical connection status of the target USB interface. When identifying the target activity level corresponding to the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, identification can be performed using a pre-created decision tree or network model. For example, a lightweight decision tree or K-means clustering algorithm can be used to automatically classify device communication behavior, facilitating the execution of differentiated low-power strategies. The target type is one of periodic, bursty, low-frequency continuous connection, and power-only. In this application embodiment, obtaining communication data connected to the target USB interface and identifying the target type corresponding to the target device can be performed by identifying the device type using pre-acquired data. After obtaining the identification results, the device type of the device can be marked or stored.

[0048] Corresponding to step S12 above, in this embodiment of the application, obtaining the data packet transmission and reception information of the target device can involve obtaining the data packet transmission and reception information of the target device over a current period of time, specifically including information such as the number and time of transmitted and received data packets. When calculating the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model, a weighted summation method can be used to calculate the corresponding activity probability using preset weights. When identifying the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, the target activity level is one of low activity, medium activity, and high activity. Therefore, an activity probability range corresponding to different activity levels can be preset, thereby allowing the determination of the activity level based on this probability range.

[0049] Corresponding to step S13 above, in this embodiment of the application, when controlling the communication of the target USB interface according to the target type, the target activity level, and the pre-set state switching rules, different device types and different activity levels can be pre-set with corresponding switching rules. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. During rule switching, matching and switching can be performed using the corresponding switching rules. In actual use, energy saving can be achieved through the control of sending and receiving related information during switching. Controlling the communication of the target USB interface includes controlling the physical layer PHY module switch, controlling one or more of power domain information and clock domain gating information. For example, power consumption can be reduced by turning off the PHY module switch, controlling the power domain, or stopping clock domain gating transmission.

[0050] As can be seen, by using the method of this application embodiment, after obtaining the communication data connected to the target USB interface, the type of the device can be determined by the obtained communication data, and the activity level of the slave device can be determined by the data packet sending and receiving information. Thus, based on the target type, the target activity level, and the preset state switching rules, communication control is performed on the target USB interface to reduce unnecessary communication with the slave device and reduce power consumption.

[0051] In one possible implementation, the communication control of the target USB interface based on the target type, the target activity level, and pre-set state switching rules includes: when the target activity level is medium active and the target type is periodic or low-frequency continuous connection, adjusting the state of the target USB interface to shallow sleep and stopping the transmission of clock data to the target device; when the target activity level is low active and the target type is bursty or power-only, adjusting the state of the target USB interface to deep sleep and powering off the physical layer PHY of the target USB interface. In this embodiment, multiple switching rules can be pre-set; the above switching rules are merely a few superior switching rules obtained experimentally. In one example, a multi-state power consumption control state machine can be constructed, with the states defined as follows:

[0052]

[0053] When the target activity level is medium active and the target type is periodic or low-frequency continuous connection, the state is switched from S0 to S1, some clock modules are turned off, and the monitoring and fast wake-up capabilities are retained; when the target activity level is low active and the target type is bursty or power-only, the state is switched from S1 to S2, the PHY is powered off, and only the minimum wake-up detection module is retained.

[0054] In one possible implementation, after acquiring the data packet transmission and reception information of the target device, the method further includes: identifying the transmission and reception information of the target USB interface; when a handshake data packet, interrupt signal, or level signal is detected, restoring power and clock data transmission for the target USB interface, initializing the PHY, and synchronizing the handshake protocol. Specifically, wake-up events such as handshake packets, interrupt signals, and level changes of the target USB interface can be detected, thereby determining whether the device needs to be woken up, and switching the state from S2 / S1 to S3 to restore power, clock, initialize the PHY, and synchronize the handshake protocol. In one example, when the transmission and reception information of the target USB interface is identified and it is found that initialization is complete, the state can be switched from S3 to S0, enabling normal communication of all functional modules.

[0055] In one possible implementation, the step of calculating the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model is described in [reference needed]. Figure 2 ,include:

[0056] Step S21: Statistical analysis of the number of data packets sent and received over multiple time periods using a preset time window;

[0057] Step S22: The active probability is obtained by weighting and summing the data packets received and sent in each time period using an exponentially weighted average algorithm based on the attenuation factor corresponding to each time period and the number of data packets received and sent in each time period.

[0058] In the embodiments of the present application, the corresponding time window can be set according to the actual situation. In one example, the time window can be 60s, and the number of multiple time periods can also be set according to the actual situation. In one example, the number of time periods can be 6, and each time period is 10s. When performing weighted summation according to the attenuation factor corresponding to each time period and the number of data packet transmissions and receptions in each time period through the exponentially weighted moving average algorithm, different weights can be set for different time periods. Generally, the weight of the time period closer to the current moment is larger, and the weight of the farther time period is smaller. When calculating, methods such as weighted summation can be used. In one example, it can be calculated through the exponentially weighted moving average algorithm. The specific calculation formula can be: P_active = α * count_6 + α(1 - α) * count_5 +... + α(1 - α)^5 * count_1; where α is the attenuation factor (0.3 - 0.6), and the output is the predicted current active probability P_active, and count_6, count_5... count_1 represent different time periods. In a specific example, the steps for calculating the active probability may include: Step 1: Sliding window statistics; set the total window T = 60s, divided into 6 sub-windows (every 10 seconds), and count the number of data packets count_i in each sub-window. Step 2: Exponentially weighted moving average algorithm (EWMA), P_active = α * count_6 + α(1 - α) * count_5 +... + α(1 - α)^5 * count_1, where α is the attenuation factor (0.3 - 0.6), and the output is the predicted current active probability P_active. Thus, the corresponding active level can be determined through the active probability range corresponding to different activity levels. Specifically, the activity level classification: If P_active < Threshold_low (low activity) → predicted as the low active state; if Threshold_low ≤ P_active ≤ Threshold_high (high activity) → medium active; if P_active > Threshold_high → high active, prohibit sleep; thus, it can be realized to guide the state machine to switch.

[0059] In one possible implementation, acquiring communication data connected to the target USB interface and identifying the target type of the target device based on the communication data using a preset type identification model includes: acquiring the data packet arrival time, data packet size, transmission direction, transmission type, interface power supply status, and electrical connection status of the target USB interface; and identifying the target type of the target device based on the data packet arrival time, data packet size, transmission direction, transmission type, interface power supply status, and electrical connection status using a preset lightweight decision tree or Kmeas clustering algorithm (an unsupervised learning algorithm). In this embodiment, the target type may include periodic, bursty, low-frequency continuous connection, and power-only types. In a specific example, periodic type has a stable communication interval and a small average data volume, such as a mouse or sensor; bursty type has long periods without communication but occasional bursts of large amounts of data, such as external storage; low-frequency continuous connection type has long-term connection but extremely low communication frequency, such as the ADB (Android Debug Bridge) debug port; and power-only type has almost no communication and only provides power, such as a USB-C (USB Type-C, a USB interface form factor standard) power supply module.

[0060] To illustrate the solutions of the embodiments of this application, the following description is provided in conjunction with a specific embodiment, including:

[0061] 1. Communication data acquisition module; used to acquire communication behavior characteristic data from the USB controller or protocol stack layer, including: data packet arrival time (timestamp), data packet size, transmission direction (IN / OUT, input / output), transmission type (control, interrupt, batch, synchronous), interface power supply status, electrical connection status. All acquired information is cached in the local buffer for subsequent modules to read and analyze.

[0062] 2. Communication Behavior Pattern Recognition Module: By statistically analyzing the collected data, the module identifies the communication behavior characteristics of connected devices and determines whether a device belongs to one of the following four types: Periodic devices: stable communication intervals and small average data volume, such as mice and sensors; Bursting devices: long periods without communication, with occasional bursts of large amounts of data, such as external storage; Low-frequency continuous connection devices: long-term connection but extremely low communication frequency, such as ADB debugging ports; Power-only devices: almost no communication, only power supply, such as USB-C power modules. The pattern recognition uses lightweight decision trees or K-means clustering algorithms to automatically classify device communication behavior, facilitating the execution of differentiated low-power strategies.

[0063] 3. Communication Activity Probability Prediction Module; This module uses historical communication frequency modeling to predict short-term communication activity. Details are as follows:

[0064] Step 1: Sliding window statistics; Set the total window T = 60s, divided into 6 sub - windows (every 10 seconds); Count the number of data packets count_i in each sub - window.

[0065] Step 2: Exponentially Weighted Moving Average (EWMA) algorithm; P_active = α * count_6+α(1 - α) * count_5+... + α(1 - α)^5 * count_1; where α is the decay factor (0.3 - 0.6), and the output is the predicted current active probability P_active.

[0066] Step 3: Activity grading; If P_active < Threshold_low → predict as low - active state; If Threshold_low ≤ P_active ≤ Threshold_high → medium - active; If P_active > Threshold_high → high - active, prohibit sleep; This module serves as the source of decision - making core parameters to guide the state machine switching.

[0067] 4. State decision and sleep control module (state machine); Construct a multi - state power consumption control state machine, and the state definitions are as follows:

[0068]

[0069] State transition rules: [[ID=十六进制数]] [[ID=十六进制数]]

[0070] From S0 → S1: The communication activity is predicted as medium, and the device behavior is periodic or low - frequency.

[0071] From S1 → S2: The activity is predicted as low, and the behavior is power - only or burst - type.

[0072] From S2 / S1 → S3: Detect wake - up events such as handshake packets, interrupt signals, and level changes.

[0073] From S3 → S0: Automatically jump after initialization is completed.

[0074] The state transition is triggered every 30 seconds, and it is decided whether to transfer according to the latest algorithm results and historical states.

[0075] 5. State execution module; This module executes state control commands, specifically including: controlling the PHY module switch, reducing current consumption, controlling power domain / clock domain gating, restoring and initializing the PHY after wake - up, reconstructing the data link. All actions are completed through software - hardware cooperation, supporting driver program calls or firmware configuration.

[0076] It should be noted that the "十六进制数" in the translation of line 15 is just a placeholder for the original text's tag which seems to be in a wrong format in the source. If it's not a placeholder and has a specific meaning, more context is needed for accurate translation.A second aspect of this application provides a USB low-power control device based on communication behavior prediction, applied to a host device, wherein the host device is connected to a target device via a target USB interface; see also Figure 3 The device includes:

[0077] The type determination module 301 is used to acquire communication data connected to the target USB interface; and to identify the target type corresponding to the target device according to the communication data through a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection and power supply only.

[0078] The activity determination module 302 is used to obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; and identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity.

[0079] The state switching module 303 is used to perform communication control on the target USB interface according to the target type, the target activity level, and the preset state switching rules, wherein the state switching rules include switching rules between active state, shallow sleep, deep sleep and ready state.

[0080] In one possible implementation, the state switching module is specifically used to adjust the state of the target USB interface to shallow sleep and stop sending clock data to the target device when the target activity level is medium active and the target type is periodic or low-frequency continuous connection; and to adjust the state of the target USB interface to deep sleep and power off the physical layer PHY of the target USB interface when the target activity level is low active and the target type is bursty or power-only.

[0081] In one possible implementation, an information identification module is used to identify the transmit and receive information of the target USB interface;

[0082] The state recovery module is used to restore power and clock data transmission for the target USB interface, initialize the PHY, and synchronize the handshake protocol when one of the handshake data packet, interrupt signal, and level signal is detected.

[0083] In one possible implementation, the activity determination module is specifically used to count the number of data packets sent and received in multiple time periods through a preset time window; and to obtain the activity probability by weighting and summing the data packets sent and received in each time period according to the attenuation factor corresponding to each time period and the number of data packets sent and received in each time period through an exponential weighted average algorithm.

[0084] In one possible implementation, the type determination module is specifically used to obtain the arrival time, size, transmission direction, transmission type, power supply status, and electrical connection status of the data packet to the target USB interface; and to identify the target type of the target device based on the arrival time, size, transmission direction, transmission type, power supply status, and electrical connection status of the data packet by using a preset lightweight decision tree or Kmeas.

[0085] As can be seen, the device of this application embodiment, after acquiring communication data connected to the target USB interface, can determine the type of the device through the acquired communication data, and can determine the activity level of the slave device through data packet transmission and reception information. Thus, based on the target type, the target activity level, and the preset state switching rules, communication control is performed on the target USB interface to reduce unnecessary communication with the slave device and reduce power consumption.

[0086] This application also provides an electronic device, such as... Figure 4 As shown, it includes:

[0087] Memory 401 is used to store computer programs;

[0088] When processor 402 executes the program stored in memory 401, it performs the following steps:

[0089] Acquire communication data connected to the target USB interface; identify the target type of the target device based on the communication data using a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power-only type;

[0090] Obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity;

[0091] Based on the target type and the target activity level, as well as the preset state switching rules, the target USB interface is subjected to communication control. The state switching rules include switching rules between active state, shallow sleep, deep sleep and ready state.

[0092] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0093] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0094] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0095] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be 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, or discrete hardware components.

[0096] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described USB low-power control methods based on communication behavior prediction.

[0097] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the USB low-power control methods based on communication behavior prediction in the above embodiments.

[0098] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and 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 instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0099] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0100] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the embodiments for apparatus, electronic devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0101] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A USB low-power control method based on communication behavior prediction, characterized in that, The method is applied to a host device, which is connected to a target device via a target USB interface; the method includes: Acquire communication data connected to the target USB interface; identify the target type of the target device based on the communication data using a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power-only type; Obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity; Based on the target type, the target activity level, and pre-defined state switching rules, communication control is performed on the target USB interface. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. Communication control of the target USB interface includes: controlling the physical layer PHY module switch, and controlling one or more of power domain information and clock domain gating information. The step of calculating the activity probability of the target device based on the data packet transmission and reception information and the pre-created activity model includes: statistically analyzing the number of data packets transmitted and received in multiple time periods through a preset time window; and obtaining the activity probability by weighting and summing the data packets transmitted and received in each time period using an exponential weighted average algorithm based on the attenuation factor corresponding to each time period and the number of data packets transmitted and received in each time period. The step of controlling the communication of the target USB interface according to the target type, the target activity level, and the preset state switching rules includes: when the target activity level is medium active and the target type is periodic or low-frequency continuous connection type, adjusting the state of the target USB interface to shallow sleep and stopping the transmission of clock data to the target device; when the target activity level is low active and the target type is bursty or power-only type, adjusting the state of the target USB interface to deep sleep and powering off the physical layer PHY of the target USB interface.

2. The method according to claim 1, characterized in that, After obtaining the data packet transmission and reception information of the target device, the method further includes: Identify the transmit and receive information of the target USB interface; When a handshake data packet, an interrupt signal, or a level signal is detected, power and clock data transmission are restored for the target USB interface, the PHY is initialized, and the handshake protocol is synchronized.

3. The method according to claim 1, characterized in that, The step of acquiring communication data connected to the target USB interface and identifying the target type of the target device based on the communication data using a preset type recognition model includes: Obtain the arrival time, size, direction of transmission, type of transmission, power supply status, and electrical connection status of the data packets to the target USB interface; By using a preset lightweight decision tree or Kmeas, the target type corresponding to the target device can be identified based on the data packet arrival time, data packet size, transmission direction, transmission type, interface power supply status, and electrical connection status.

4. A USB low-power control device based on communication behavior prediction, characterized in that, Applied to a host device, wherein the host device is connected to a target device via a target USB interface; the device includes: The type determination module is used to acquire communication data connected to the target USB interface; and to identify the target type of the target device according to the communication data through a preset type recognition model, wherein the target type is one of periodic, burst, low-frequency continuous connection, and power supply only. An activity determination module is used to obtain data packet transmission and reception information of the target device; calculate the activity probability of the target device based on the data packet transmission and reception information and a pre-created activity model; and identify the target activity level of the target device based on the activity probability and the activity probability range corresponding to different preset activity levels, wherein the target activity level is one of low activity, medium activity, and high activity. The state switching module is used to perform communication control on the target USB interface according to the target type, the target activity level, and pre-set state switching rules. The state switching rules include switching rules between active state, shallow sleep, deep sleep, and ready state. The communication control on the target USB interface includes: controlling the physical layer PHY module switch, and controlling one or more of power domain information and clock domain gating information. The activity determination module is specifically used to count the number of data packets sent and received in multiple time periods through a preset time window; and to obtain the activity probability by weighting and summing the data packets sent and received in each time period according to the attenuation factor corresponding to each time period and the number of data packets sent and received in each time period through an exponential weighted average algorithm. The state switching module is specifically used to adjust the state of the target USB interface to shallow sleep and stop sending clock data to the target device when the target activity level is medium active and the target type is periodic or low-frequency continuous connection; and to adjust the state of the target USB interface to deep sleep and power off the physical layer PHY of the target USB interface when the target activity level is low active and the target type is bursty or power-only.

5. The apparatus according to claim 4, characterized in that, The device further includes: An information recognition module is used to identify the transmit and receive information of the target USB interface; The state recovery module is used to restore power and clock data transmission for the target USB interface, initialize the PHY, and synchronize the handshake protocol when one of the handshake data packet, interrupt signal, and level signal is detected.

6. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method of any one of claims 1-3.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains a computer program that, when executed by a processor, implements the method described in any one of claims 1-3.

Citation Information

Patent Citations

  • Apparatus and method for controlling USB switching circuit in portable terminal

    CN101727428A

  • State adjustment strategy determination method and device, equipment and computer storage medium

    CN119136286A