A power management method, device and computer readable storage medium

By introducing the power management subsystem monitoring and matching event processing module in the vehicle-mounted embedded system, the wake-up lock and the transmission of power status information are generated, and the portability and maintainability problems caused by the dispersion of power management operations in the prior art are solved, and the portability and maintainability problems are realized. The unified management of vehicle terminal power supply and system stability improvement are achieved.

CN115476795BActive Publication Date: 2024-12-06JINGWEI HIRAIN (TIANJIN) RES&DEV CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211190887.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2024-12-06
Estimated Expiration
2042-09-28

AI Technical Summary

Technical Problem

In the existing vehicle-mounted embedded system, power management operations are scattered in multiple modules, which leads to other modules that require the hardware platform to take over the work of non-existent modules, resulting in frequent modification of software codes, reducing the system's portability and maintainability. sex.

Method used

The power management subsystem monitors the input events to be processed, finds matching target event processing modules, generates wake-up locks and transmits power status information, ensures that the target event processing module prevents the system from sleeping when the service is not processed, and realizes unified management of the power supply of the vehicle terminal , reduce software code modification.

Benefits of technology

It improves the portability and maintainability of the vehicle-mounted embedded system, reduces the coupling and error probability between modules, and enhances the timeliness and stability of power management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115476795B_ABST
    Figure CN115476795B_ABST
Patent Text Reader

Abstract

The present application discloses a power management method, device and computer-readable storage medium, which relate to the field of vehicle technology. The method includes: when the power management subsystem monitors the pending input event of the input device node, controlling the power management subsystem to be in the target power state; searching for the target event processing module matching the pending input event in at least one event processing module associated with the power management subsystem; the power management subsystem receives the wake-up request of the target event processing module; in response to the wake-up request, generating and saving the wake-up lock of the target event processing module in the power management subsystem; controlling the power management subsystem to transmit the power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state. It is possible to uniformly manage the power supply of the vehicle terminal, reduce the modification of the software code, and thus improve the portability of the vehicle embedded system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of vehicle technology, and in particular, relates to a power management method, device and computer-readable storage medium. Background Art

[0002] On-board power management can monitor the power consumption of each electrical device in the vehicle and allocate it reasonably to improve the vehicle's starting performance and extend the battery life. However, in existing on-board embedded systems, various operations for on-board power management are generally scattered among various modules. Each module obtains the power management events that it needs to pay attention to and performs the power management operations that it is responsible for. Multiple modules jointly manage the power of the entire system. When the hardware platform changes, for example, a module may no longer exist. In order to realize the complete power management function, other modules need to take over the work of the non-existent modules, resulting in modifications to the software codes of various modules in the entire on-board embedded system, reducing the portability of the entire system. Summary of the invention

[0003] The embodiments of the present application provide a power management method, apparatus and related equipment, which can uniformly manage the power of a vehicle-mounted terminal, reduce the modification of the software code of each event processing module, and thus improve the portability of the vehicle-mounted embedded system.

[0004] In a first aspect, an embodiment of the present application provides a power management method, the method comprising:

[0005] When the power management subsystem monitors a pending input event of an input device node, the power management subsystem is controlled to be in a target power state, where the target power state is used to indicate that the power management subsystem enters sleep or is awakened;

[0006] Searching for a target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, wherein each of the event processing modules is used to process at least one input event;

[0007] The power management subsystem receives a wake-up request from the target event processing module;

[0008] In response to the wake-up request, generating and saving a wake-up lock of the target event processing module in the power management subsystem, wherein the wake-up lock is used to prevent the power management subsystem from entering sleep mode if the target event processing module has not completed processing the corresponding service;

[0009] The power management subsystem is controlled to transmit power status information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power status, wherein the power status information is used to indicate the target power status.

[0010] In a second aspect, an embodiment of the present application provides a power management device, the device comprising:

[0011] A control module, used for controlling the power management subsystem to be in a target power state when the power management subsystem monitors a pending input event of an input device node, wherein the target power state is used to indicate that the power management subsystem enters sleep or is awakened;

[0012] A search module, configured to search for a target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, wherein each of the event processing modules is configured to process at least one input event;

[0013] A first receiving module, used for the power management subsystem to receive a wake-up request from the target event processing module;

[0014] A generating module, configured to generate and save a wake-up lock of the target event processing module in the power management subsystem in response to the wake-up request, wherein the wake-up lock is used to prevent the power management subsystem from entering sleep mode if the target event processing module has not completed processing the corresponding service;

[0015] A transmission module is used to control the power management subsystem to transmit power status information to the target event processing module so that the target event processing module performs corresponding processing according to the target power status, wherein the power status information is used to indicate the target power status.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the power management method as described in any one of the above is implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored; when the computer program instructions are executed by a processor, the power management method as described in any one of the above is implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any power management method as described above.

[0019] In a sixth aspect, an embodiment of the present application provides a vehicle, the vehicle comprising: an electronic device, the electronic device being used to implement the power management method as described in any one of the above.

[0020] The power management method, device and related equipment of the embodiment of the present application monitor the input device node in the vehicle terminal through the power management subsystem, and when the power management subsystem monitors the input event to be processed, the power management subsystem is controlled to be in the target power state, and then the target event processing module matching the input event to be processed is searched in at least one event processing module associated with the power management subsystem, and in response to the wake-up request of the target event processing module, the wake-up lock of the target event processing module is generated and saved in the power management subsystem, so as to prevent the power management subsystem from entering sleep when the target event processing module has not processed the corresponding business, and finally control the power management subsystem to transmit the power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state, wherein when the target event processing module processes the input event to be processed, the power management subsystem can be prevented from entering sleep. The power of the vehicle terminal can be uniformly managed, and the modification of the software code of each event processing module can be reduced, thereby improving the portability of the vehicle embedded system. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0022] Figure 1 is a flowchart of a power management method provided in an embodiment of the present application;

[0023] Figure 2 is a schematic diagram of the relationship between power supply states provided in an embodiment of the present application;

[0024] Figure 3 This is a schematic diagram of the wake-up lock application process provided by an embodiment of the present application;

[0025] Figure 4 This is a schematic diagram of the process of monitoring the ignition button status event provided by an embodiment of the present application;

[0026] Figure 5 is a schematic diagram of the structure of a power management device provided in an embodiment of the present application;

[0027] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0029] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0030] In the related art, various operations of vehicle power management are generally scattered among various event processing modules. Each module obtains the power management events that it needs to pay attention to and performs the power management operations that it is responsible for. Multiple modules jointly complete the power management of the entire vehicle embedded system. However, this method will have the following problems:

[0031] 1) Each module obtains the power management events that it needs to pay attention to. When the hardware platform changes, a module may no longer exist. In order to realize the complete power management function, other modules need to take over the work of the non-existent modules. As a result, the software code of each module in the entire vehicle embedded system is modified, which reduces the portability of the entire system.

[0032] 2) For the reporting of the same power management event, the reported power management event information may not be resident. Therefore, if there are multiple modules in the system that pay attention to the power management event information at the same time, one of the modules needs to obtain the power management event information and then pass the power management event information to other modules, which increases the coupling between the modules and reduces the timeliness of the processing of the power management event information. It may also cause timing problems in the processing of the power management event;

[0033] 3) Since multiple modules need to work together to complete the power management of the entire vehicle embedded system, many intermediate links are added, which increases the probability of errors in the power management method and increases the instability of the system power management strategy to a certain extent;

[0034] 4) Since the power management method is coupled between multiple modules, the difficulty of troubleshooting is increased. As a result, a series of modifications to the system are made after the troubleshooting is completed, which reduces the maintainability of the entire system.

[0035] In order to solve the problems in the prior art, the embodiments of the present application provide a power management method, apparatus and related equipment. The power management method provided by the embodiments of the present application is first introduced below.

[0036] Figure 1 FIG. 1 is a flow chart of a power management method provided by an embodiment of the present application. Figure 1 As shown, a power management method provided in an embodiment of the present application may include steps S101 to S103.

[0037] S101 . When the power management subsystem monitors an input event to be processed of an input device node, the power management subsystem is controlled to be in a target power state.

[0038] S102: Search for a target event processing module that matches the input event to be processed in at least one event processing module associated with the power management subsystem.

[0039] S103: The power management subsystem receives a wake-up request from a target event processing module.

[0040] S104: In response to the wake-up request, generate and save a wake-up lock of the target event processing module in the power management subsystem.

[0041] S105 , controlling the power management subsystem to transmit the power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state.

[0042] The power management method of the embodiment of the present application monitors the input device node in the vehicle terminal through the power management subsystem, and when the power management subsystem monitors the input event to be processed, controls the power management subsystem to be in the target power state, and then searches for the target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, generates and saves the wake-up lock of the target event processing module in the power management subsystem in response to the wake-up request of the target event processing module, so as to prevent the power management subsystem from entering sleep when the target event processing module has not processed the corresponding business, and finally controls the power management subsystem to transmit the power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state, wherein when the target event processing module processes the input event to be processed, the power management subsystem can be prevented from entering sleep. The power of the vehicle terminal can be uniformly managed, and the modification of the software code of each event processing module can be reduced, thereby improving the portability of the vehicle embedded system.

[0043] In S101, the power management subsystem is a subsystem in the vehicle-mounted embedded system of the vehicle-mounted terminal, which can read the input event information of the vehicle-mounted terminal, switch the power state of the vehicle-mounted terminal power module, and pass the input event information to the associated event processing module, thereby realizing the power management of the vehicle-mounted terminal. The power management subsystem can be specifically applied to the power management module.

[0044] The above-mentioned input device node may be an electronic device connected to a network and sends, receives or forwards information through a communication channel.

[0045] The above target power state can be used to characterize whether the power management subsystem enters sleep or wakes up, such as Figure 2 As shown, it can be specifically divided into four power states: ready to wake up state, wake up state, ready to sleep state and sleep state. Among them, when the vehicle embedded system is started, the power management subsystem is in the ready to wake up state. Accurately dividing the power state can ensure that each event processing module performs corresponding business processing operations under different power states. Of course, the power state in this embodiment is not limited to the above four states, and can also be other customized states, which are not specifically limited here.

[0046] Exemplarily, when the power management subsystem monitors the pending input events of the input device node, the power management subsystem is controlled to be in the target power state. The power management subsystem may switch from the ready-to-wake-up state to the awake state after obtaining the event that the ignition button state is ON. Alternatively, the power management subsystem may switch the power state from the awake state to the ready-to-sleep state when the ignition button is released, that is, when the state of the ignition button changes from ON to OFF.

[0047] In S102, each of the above event processing modules is used to process at least one input event.

[0048] The above-mentioned searching for the target event processing module that matches the input event to be processed in at least one event processing module associated with the power management subsystem may be searching for the target input event whose registered event information matches the unique identification information of the input event to be processed among the input events registered in the power management subsystem, and determining the event processing module that has a matching relationship with the target input event as the target event processing module in at least one event processing module associated with the power management subsystem.

[0049] In S103, the wake-up request is a request sent by the target event processing module to keep the power management subsystem in the wake-up state.

[0050] In S104, the wake-up lock is used to prevent the power management subsystem from entering sleep mode when the target event processing module has not completed processing the corresponding service.

[0051] Some event processing modules in the vehicle embedded system, such as the mobile network management module and the remote control module, need to ensure that the power management subsystem does not perform operations that put the vehicle embedded system into sleep mode while processing their own business. Therefore, they need to apply for their own wake-up lock wakelock from the power management subsystem.

[0052] like Figure 3 As shown, taking the mobile network management module and the remote control module applying for a wake-up lock as an example, the following steps may be included:

[0053] S301, calling the interface to apply for a wake-up lock;

[0054] S302: receiving a request for a wake-up lock;

[0055] S303: Generate a unique wake-up lock for each module and save it.

[0056] The mobile network management module and the remote control module call a unified interface acquireWakelock() provided by a power management subsystem, and use the Dbus communication method to realize cross-process communication with the power management subsystem, and convey the request for applying for a wake-up lock to the power management subsystem. When multiple modules apply for a wake-up lock, any module does not need to pay attention to the behavior of applying for a wake-up lock by other modules, and does not need to coordinate with other modules. The power management subsystem will handle the request for applying for a wake-up lock in the same way within itself. Dbus communication is an existing cross-process communication method, which will not be introduced in detail here.

[0057] When the power management subsystem receives a wake-up request from other modules, it generates a universally unique identifier (UUID) for each request as a wake-up lock for each module. This wake-up lock is unique and will not be repeated.

[0058] After the power management subsystem generates a unique wake-up lock corresponding to a module, it calls the Dbus communication method, getSender(), to obtain the unique name corresponding to this module. At the same time, there is a map type variable mWakelock in the power management subsystem. This variable includes two parts, key and key value. The power management subsystem saves the unique name of other modules obtained to the key part inside mWakelock, and saves the unique wake-up lock generated for other modules to the key value part inside mWakelock, thus realizing the one-to-one preservation of the event processing module name and the event processing module wake-up lock.

[0059] In this embodiment, the system is prevented from sleeping by applying for a wake-up lock from the power management subsystem, which simplifies the operation process of preventing the vehicle embedded system from sleeping when the event processing module has not completed the execution of the corresponding business.

[0060] In S105, the power state information is used to indicate the target power state.

[0061] The controlling the power management subsystem to transmit the power status information to the target event processing module may be that the controlling the power management subsystem transmits the power status information to the target event processing module by registering a callback function in the event information.

[0062] Exemplarily, the above-mentioned target event processing module performs corresponding processing according to the target power state. It can be that when the vehicle ignition button is pressed, the power management subsystem obtains the pending input event with the ignition button state being ON, and the target power state enters the awake state from the ready-to-wake-up state, the power management subsystem passes in a string type parameter "RESUMED" (i.e., power state information) representing the target power state by executing the callback function registered for the pending input event, and transmits the power state information to each associated event processing module. Each event processing module knows that the power state of the power management subsystem has entered the awake state based on the passed-in "RESUMED", and performs corresponding operations in the awake state. For example, when the vehicle-mounted CAN network management module (i.e., one of the event processing modules) receives the "RESUMED" parameter passed into the callback function by the power management subsystem, it knows that the power state of the power management subsystem has entered the awake state at this time, and will perform the operation of opening the CAN network.

[0063] Alternatively, when the ignition button is released, that is, the state of the ignition button changes from ON to OFF (a new pending input event), and the power management subsystem switches the power state from the awake state to the ready-to-sleep state, the power management subsystem executes the callback function registered for the pending input event, and passes a string type parameter "SUSPENDED" of the target power state in the callback function. The associated event processing modules know that the power state has now entered the ready-to-sleep state based on the passed "SUSPENDED", and the power management subsystem is about to start sleeping. Each event processing module starts to complete the operations to be performed before sleeping. For example, when the vehicle-mounted CAN network management module receives the "SUSPENDED" parameter passed into the callback function by the power management subsystem, it knows that the power state has entered the ready-to-sleep state and will execute the operation of shutting down the CAN network.

[0064] In order to facilitate the understanding of the power management method in the embodiment of the present application, the actual application process of the power management method is explained by taking the event of monitoring the ignition key status as an example. Figure 4 As shown, the details are as follows:

[0065] S401, monitoring ignition button status events;

[0066] S402, processing the ignition button status event;

[0067] S403, prepare to switch the power state;

[0068] S404, notifying other modules of the ignition key status event.

[0069] As an implementation of the present application, in order to reduce the coupling between the event processing modules and realize the cross-process communication between the power management subsystem and the event processing modules, before the above S101, the following steps may also be included:

[0070] Receiving registration event information sent by at least one event processing module through the power management subsystem;

[0071] The power management subsystem is controlled to execute the registration operation associated with the event processing module based on the registration event information of each event processing module.

[0072] The above-mentioned registration event information is associated with at least one input event.

[0073] The above registration operation is used to establish a matching relationship between the event processing module and at least one input event in the power management subsystem.

[0074] The above-mentioned registration event information received by the power management subsystem from at least one event processing module may be that each event processing module transmits a name parameter of each input event to the power management subsystem, and the content of the name parameter is used to uniquely identify the registered input event.

[0075] The above-mentioned control power management subsystem performs registration operations associated with the event processing modules based on the registration event information of each event processing module, which may be to call a unified interface registerBroadcast(const std::string&name), perform a unified encapsulation of Dbus communication, realize cross-process communication with the power management subsystem through Dbus communication, and register at least one input event of at least one event processing module with the power management subsystem. Encapsulating the registered power management events into a unified interface can facilitate the use of the interface, and at the same time make the registration of power events unified, which can improve the maintainability of the system.

[0076] Exemplarily, when the remote management module (one of the event processing modules) registers the ignition button status event (one of the input events), the remote management module calls the power management event registration interface registerBroadcast (IG_STATE) to register the input event. The name parameter passed in first is IG_STATE, which is a pre-agreed macro-defined variable of string type, indicating the registration of the ignition button status event; similarly, if the input event registered by the on-board CAN network management module (another event processing module) is a power status event, the name parameter passed in is changed to POWER_STATE, which is also a pre-agreed macro-defined variable of string type, indicating the registration of the power status event.

[0077] In this embodiment, when a module registers a power management event to the power management subsystem, it does not need to pay attention to the registration behavior of other modules or coordinate with other modules, thereby reducing the coupling between the event processing modules and realizing cross-process communication between the power management subsystem and the event processing modules.

[0078] In some embodiments, before the above S102, the following steps may also be included:

[0079] Obtain pending event information of a pending input event, where the pending event information includes unique identification information.

[0080] The above-mentioned event information to be processed may be used to indicate the input event to be processed. Exemplarily, the unique identification information may be a string that is the same as or matches the name parameter in the registration event information.

[0081] The above-mentioned obtaining of the pending event information of the pending input event may be reading the pending event information of the pending input event when the power management subsystem monitors the pending input event of the input device node.

[0082] The above S102 may specifically include the following steps:

[0083] Searching for a target input event in which the registered event information matches the unique identification information of the input event to be processed among the input events registered in the power management subsystem;

[0084] Among at least one event processing module associated with the power management subsystem, an event processing module having a matching relationship with the target input event is determined as a target event processing module.

[0085] In this embodiment, the power management subsystem traverses the registered event information in the registered input events according to the unique identification information of the input event to be processed until an input event matching the unique identification information of the input event to be processed is found, thereby finding the target event processing module in a timely and accurate manner.

[0086] In some embodiments, the registration event information includes a callback function, and the above S103 may specifically include the following steps:

[0087] The power management subsystem is controlled to transmit the power status information to the target event processing module through the callback function in the registered event information.

[0088] The above callback function is another callback parameter passed into the power management subsystem through the registration interface registerBroadcast (BroadcastCallbackFunc callback) when the input event is registered. The function of the callback function is that after the corresponding power management event occurs, the power management subsystem passes the power management event at this time to other modules by calling the callback function; the execution content in the callback function is the specific operation to be performed or the business to be processed by the module after the corresponding power management event occurs.

[0089] After each event processing module registers input events to the power management subsystem through the Dbus communication method, the power management subsystem can obtain the agent corresponding to the event processing module associated with the registered input event through the Dbus communication method. This agent is unique. The Dbus communication method is an existing technology and will not be repeated here. Then there is a map type variable mCallback in the power management subsystem. This variable includes two parts, the key and the key value. The power management subsystem saves the unique agent of each event processing module to the key part inside mCallback, and saves the incoming callback function to the key value part inside mCallback, thus establishing a one-to-one storage of the event processing module agent and the callback function.

[0090] For example, when the remote management module registers the ignition key status event, the corresponding callback function parameter is (std::function<void(const std::string&)> ), the result of the ignition button status event is passed to the callback function in the form of a string data structure. In the callback function, the remote management module performs corresponding remote management operations based on the passed ignition button status event result.

[0091] In this embodiment, since the callback function corresponds to each event processing module one by one, there is no need to coordinate with other modules. Even if the input event information does not reside, it does not need to be transmitted twice, which improves the timeliness of power management to a certain extent.

[0092] In some embodiments, after the power management subsystem is controlled to transmit the power status information to the target event processing module through the callback function in the registered event information, the process may further include controlling the power management subsystem to transmit the event information to be processed to the target event processing module through the callback function in the registered event information. Tracking the input events and power status of each event processing module facilitates troubleshooting by operation and maintenance personnel, thereby improving the maintainability of the vehicle embedded system.

[0093] In some embodiments, in response to the wake-up request, generating and saving a wake-up lock of the target event processing module in the power management subsystem may specifically include the following steps:

[0094] In response to the wake-up request, a wake-up lock of the target event processing module is generated and saved in the power management subsystem through hash transformation.

[0095] The above hash transformation is to transform an input of any length into an output of fixed length through a hash algorithm. Since it is difficult to find the reverse rule of hash transformation, the wake-up lock of each target event processing module is difficult to tamper with and has high security.

[0096] The wake-up lock of the target event processing module generated in the power management subsystem can generate a unique UUID code through a hash transformation method.

[0097] In some embodiments, after the above S103, the following steps may also be included:

[0098] When the target event processing module completes corresponding service processing according to the power state information, the power management subsystem releases the wake-up lock of the target event processing module so that the power state of the power management subsystem can be switched to the sleep state.

[0099] As mentioned above, when the target event processing module completes the corresponding business processing according to the power status information, the power management subsystem releases the wake-up lock of the target event processing module by calling the releaseWakelock() interface, searching for the name of the target event processing module in the mWakelock variable, thereby finding the corresponding wake-up lock and releasing the wake-up lock.

[0100] In this embodiment, the wake-up lock of the corresponding target event processing module is released only when the target event processing module completes the corresponding business processing to ensure the normal operation of the vehicle terminal.

[0101] As another implementation of the present application, in order to accurately monitor the input device node, before the above S101, the following may also be included:

[0102] Opening an input device node in the vehicle-mounted terminal through the power management subsystem, and obtaining a file descriptor of at least one input device node;

[0103] The file descriptors of each input device node are monitored according to the input and output multiplexing mechanism.

[0104] The above file descriptor can be used to represent a reference to a file. It is in the form of a non-negative integer and an index value that can point to the record table of open files for each process maintained by the kernel. When a program opens an existing file or creates a new file, the kernel returns a file descriptor to the process. Each file descriptor corresponds to an open file, so file descriptors are used to access files. Reading and writing files also requires the use of file descriptors to specify the files to be read and written.

[0105] The above-mentioned input and output multiplexing mechanism can buffer the input and output I / O data through the system kernel, and a single process can monitor multiple file descriptors. Once a descriptor is ready (usually read ready or write ready), the program can be notified to perform the corresponding read and write operations. Common input and output multiplexing mechanisms include the Select mechanism, the polling mechanism, and the extensible event notification epoll mechanism.

[0106] The above-mentioned monitoring of the file descriptor of each input device node according to the input-output multiplexing mechanism may be performed by adding the file descriptor to the monitoring of the input-output multiplexing mechanism to implement the monitoring of the input device node.

[0107] In some embodiments, the input-output multiplexing mechanism can be specifically an extensible event notification epoll mechanism, which can significantly improve the system CPU utilization when only a small number of programs are active among a large number of concurrent connections. epoll enters the wait state, waiting for the arrival of a power management event.

[0108] After all event processing modules associated with the pending input event complete their business operations before hibernation, the power management subsystem enters the hibernation state. In the hibernation state, the power management subsystem executes the operation of putting the system into hibernation. By echoing mem> / sys / class / power_sate, mem is written to / sys / class / power_sate, and the system enters hibernation. Wait for the next time the system is started again and re-enters the ready-to-wake-up state.

[0109] Based on the power management method provided in the above embodiment, the present application also provides a specific implementation of a power management device. Please refer to the following embodiment.

[0110] See also Figure 5 The power management device 500 provided in the embodiment of the present application may include: a control module 501, a search module 502, a first receiving module 503, a generation module 504 and a transmission module 505.

[0111] The control module 501 is used to control the power management subsystem to be in a target power state when the power management subsystem monitors a pending input event of an input device node. The target power state is used to indicate that the power management subsystem enters sleep or is awakened.

[0112] The search module 502 is used to search for a target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, wherein each event processing module is used to process at least one input event.

[0113] The first receiving module 503 is used for the power management subsystem to receive a wake-up request from a target event processing module.

[0114] The generation module 504 is used to generate and save a wake-up lock of the target event processing module in the power management subsystem in response to the wake-up request. The wake-up lock is used to prevent the power management subsystem from entering sleep mode when the target event processing module has not completed processing the corresponding business.

[0115] The transmission module 505 is used to control the power management subsystem to transmit the power status information to the target event processing module so that the target event processing module performs corresponding processing according to the target power status, wherein the power status information is used to indicate the target power status.

[0116] In the embodiment of the present application, the input device node in the vehicle terminal is monitored by the power management subsystem, and when the power management subsystem monitors the input event to be processed, the power management subsystem is controlled to be in the target power state, and then the target event processing module matching the input event to be processed is searched in at least one event processing module associated with the power management subsystem, and in response to the wake-up request of the target event processing module, a wake-up lock of the target event processing module is generated and saved in the power management subsystem, so as to prevent the power management subsystem from entering sleep when the target event processing module has not processed the corresponding business, and finally the power management subsystem is controlled to transmit the power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state, wherein when the target event processing module processes the input event to be processed, the power management subsystem can be prevented from entering sleep. The power supply of the vehicle terminal can be uniformly managed, and the modification of the software code of each event processing module can be reduced, thereby improving the portability of the vehicle embedded system.

[0117] As an implementation of the present application, in order to reduce the coupling between the event processing modules and realize cross-process communication between the power management subsystem and the event processing modules, the above-mentioned device 300 may also include:

[0118] A second receiving module, configured to receive registration event information sent by at least one event processing module through the power management subsystem, wherein the registration event information is associated with at least one input event;

[0119] The registration module is used to control the power management subsystem to perform registration operations associated with the event processing modules based on the registration event information of each event processing module. The registration operation is used to establish a matching relationship between the event processing module and at least one input event in the power management subsystem.

[0120] In some embodiments, the apparatus 500 may further include:

[0121] The first acquisition module is used to acquire the to-be-processed event information of the to-be-processed input event, where the to-be-processed event information includes unique identification information, which is used to indicate the to-be-processed input event.

[0122] The above-mentioned search module 502 is specifically used to search for a target input event whose registered event information matches the unique identification information of the input event to be processed among the input events registered in the power management subsystem; and in at least one event processing module associated with the power management subsystem, determine the event processing module that has a matching relationship with the target input event as the target event processing module.

[0123] In some embodiments, the above-mentioned registration event information includes a callback function.

[0124] The transmission module 505 is specifically used to control the power management subsystem to transmit the power status information to the target event processing module through the callback function in the registration event information.

[0125] In some embodiments, the above-mentioned generation module is specifically used to generate and save the wake-up lock of the target event processing module in the power management subsystem through hash transformation in response to the wake-up request.

[0126] In some embodiments, the apparatus 500 may further include:

[0127] The release module is used for the power management subsystem to release the wake-up lock of the target event processing module when the target event processing module completes the corresponding business processing according to the power status information, so that the power status of the power management subsystem can be switched to the sleep state.

[0128] As another implementation of the present application, in order to accurately monitor the input device node, the above-mentioned apparatus 500 may also include:

[0129] A second acquisition module is used to open an input device node in the vehicle-mounted terminal through the power management subsystem to acquire a file descriptor of at least one input device node;

[0130] The monitoring module is used to monitor the file descriptors of each input device node according to the input-output multiplexing mechanism.

[0131] In some embodiments, the above-mentioned input and output multiplexing mechanism may specifically be an extensible event notification epoll mechanism.

[0132] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0133] The electronic device may include a processor 601 and a memory 602 storing computer program instructions.

[0134] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0135] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 602 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory.

[0136] In certain embodiments, the memory 602 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0137] The processor 601 implements any one of the power management methods in the above embodiments by reading and executing computer program instructions stored in the memory 602 .

[0138] In one example, the electronic device may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.

[0139] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0140] Bus 610 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0141] The electronic device can execute the power management method in the embodiment of the present application, thereby realizing the combination Figure 1 and Figure 5 A power management method and apparatus are described.

[0142] In addition, in combination with the power management method in the above embodiments, the present application embodiment can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the power management methods in the above embodiments is implemented.

[0143] In combination with the power management method in the above embodiments, an embodiment of the present application also provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any one of the power management methods in the above embodiments.

[0144] In combination with the power management method in the above embodiments, an embodiment of the present application further provides a vehicle, which includes: an electronic device, which is used to implement any power management method in the above embodiments.

[0145] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0146] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0147] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0148] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0149] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A power management method, characterized in that: include: When the power management subsystem monitors a pending input event of an input device node, the power management subsystem is controlled to be in a target power state, where the target power state is used to indicate that the power management subsystem enters sleep or is awakened; Searching for a target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, wherein each of the event processing modules is used to process at least one input event; The power management subsystem receives a wake-up request from the target event processing module; In response to the wake-up request, generating and saving a wake-up lock of the target event processing module in the power management subsystem, wherein the wake-up lock is used to prevent the power management subsystem from entering sleep mode if the target event processing module has not completed processing the corresponding service; Controlling the power management subsystem to transmit power status information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power status, wherein the power status information is used to indicate the target power status; In the case where the power management subsystem monitors a pending input event of an input device node, before controlling the power management subsystem to be in a target power state, it also includes: receiving, through the power management subsystem, registration event information sent by the at least one event processing module, the registration event information being associated with at least one input event; controlling the power management subsystem to perform a registration operation associated with the event processing module based on the registration event information of each of the event processing modules, the registration operation being used to establish a matching relationship between the event processing module and the at least one input event in the power management subsystem.

2. The method according to claim 1, characterized in that Before searching, in at least one event processing module associated with the power management subsystem, for a target event processing module matching the input event to be processed, the method further includes: Acquire the to-be-processed event information of the to-be-processed input event, wherein the to-be-processed event information includes unique identification information, which is used to indicate the to-be-processed input event; The step of searching, in at least one event processing module associated with the power management subsystem, a target event processing module that matches the input event to be processed comprises: Searching, among the input events registered in the power management subsystem, for a target input event whose registered event information matches the unique identification information of the input event to be processed; Among at least one event processing module associated with the power management subsystem, an event processing module having a matching relationship with the target input event is determined as a target event processing module.

3. The method according to claim 1, characterized in that The registration event information includes a callback function, The controlling the power management subsystem to transmit the power state information to the target event processing module includes: The power management subsystem is controlled to transmit the power status information to the target event processing module through the callback function in the registration event information.

4. The method according to claim 1, characterized in that In response to the wake-up request, generating and saving a wake-up lock of the target event processing module in the power management subsystem includes: In response to the wake-up request, a wake-up lock of the target event processing module is generated and saved in the power management subsystem through hash transformation.

5. The method according to claim 1, characterized in that After controlling the power management subsystem to transmit the power state information to the target event processing module, the method further includes: When the target event processing module completes corresponding business processing according to the power state information, the power management subsystem releases the wake-up lock of the target event processing module so that the power state of the power management subsystem can be switched to the sleep state.

6. The method according to claim 1, characterized in that In the case where the power management subsystem monitors the input event to be processed of the input device node, before controlling the power management subsystem to be in the target power state, the method further includes: Opening an input device node in the vehicle-mounted terminal through the power management subsystem, and obtaining a file descriptor of at least one of the input device nodes; The file descriptors of the input device nodes are monitored according to the input-output multiplexing mechanism.

7. The method according to claim 6, characterized in that The input-output multiplexing mechanism is specifically an extensible event notification epoll mechanism.

8. A power management device, characterized in that: The device comprises: A control module, used for controlling the power management subsystem to be in a target power state when the power management subsystem monitors a pending input event of an input device node, wherein the target power state is used to indicate that the power management subsystem enters sleep or is awakened; A search module, configured to search for a target event processing module matching the input event to be processed in at least one event processing module associated with the power management subsystem, wherein each of the event processing modules is configured to process at least one input event; A first receiving module, used for the power management subsystem to receive a wake-up request from the target event processing module; A generating module, configured to generate and save a wake-up lock of the target event processing module in the power management subsystem in response to the wake-up request, wherein the wake-up lock is used to prevent the power management subsystem from entering sleep mode if the target event processing module has not completed processing the corresponding service; a transmission module, used for controlling the power management subsystem to transmit power state information to the target event processing module, so that the target event processing module performs corresponding processing according to the target power state, wherein the power state information is used to indicate the target power state; A second receiving module is used to receive, through the power management subsystem, registration event information sent by the at least one event processing module before controlling the power management subsystem to be in a target power state when the power management subsystem monitors a pending input event of an input device node, wherein the registration event information is associated with at least one input event; A registration module is used to control the power management subsystem to perform a registration operation associated with the event processing module based on the registration event information of each event processing module, and the registration operation is used to establish a matching relationship between the event processing module and the at least one input event in the power management subsystem.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the power management method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Internet-of-Vehicles terminal power control method

    CN108819884A

  • Vehicle control device and method, and vehicle

    CN111361546A

  • Process communication system and method

    CN113382085A

  • Pin configuration method, related device, equipment and readable storage medium

    CN114780166A