CN111782285A - Method and medium for dynamically setting wake-up source in user space - Google Patents
Method and medium for dynamically setting wake-up source in user space Download PDFInfo
- Publication number
- CN111782285A CN111782285A CN202010618097.8A CN202010618097A CN111782285A CN 111782285 A CN111782285 A CN 111782285A CN 202010618097 A CN202010618097 A CN 202010618097A CN 111782285 A CN111782285 A CN 111782285A
- Authority
- CN
- China
- Prior art keywords
- source
- wake
- equipment
- user space
- awakening
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4418—Suspend and resume; Hibernate and awake
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Power Sources (AREA)
Abstract
The invention discloses a method and a medium for dynamically setting a wake-up source in a user space, wherein the method comprises the following steps: in a user space, setting and acquiring a wake-up source of equipment by exporting the wake-up source of the equipment; entering equipment tree analysis to obtain an initial awakening source during equipment initialization; setting operation is carried out on part of awakening sources of the equipment when the equipment is in dormancy; when the equipment is recovered, the awakening source of the equipment is recovered to the state when the equipment enters the dormancy state. The technical scheme of the invention provides a flexible and dynamic method for setting the partial wake-up source for the equipment. And exporting a control node in the user space, and controlling a part of wake-up sources of the low-speed equipment to wake up the system.
Description
Technical Field
The present invention relates to a method for setting an os wake-up source, and more particularly, to a method and medium for dynamically setting a wake-up source in a user space.
Background
At present, the wake-up source setting method in the industry is configured through an equipment tree, and the equipment is described to have the function of waking up the source by writing wakeup _ source attributes into the equipment tree. For a device, only one wake-up source can be set, some wake-up sources in the device cannot be set independently, and when the device is in a sleep state, either all wake-up sources are not used as the wake-up sources or all wake-up sources are used as the wake-up sources, and an independently controlled wake-up source control is lacked. The awakening sources cannot be dynamically configured in the user space, and some awakening sources can be fixed after the system is burned to awaken the system and cannot be modified in the operation process of the system.
In some cases, linux operating systems need to dynamically set some sort of wake source:
(1) if a normal linux system needs a certain device as a wake-up source, the device needs to be configured as the wake-up source in a device tree, and a driver is set as the wake-up device by parsing the device tree.
(2) In the standard linux structure, linux only supports setting of one wake-up source of a device, and a method is required to independently set a certain wake-up source in the device, so that the system can be normally awakened by the certain wake-up source of the low-speed device.
The existing wake-up source setting method has the following defects: the wake-up source cannot be dynamically set in the application space, and a plurality of wake-up sources of one device cannot be configured independently.
In the process of platform development, some wake-up sources of the device need to be configured as a wakeable system, while other wake-up sources cannot wake up the system, and dynamically configure the wake-up sources according to different current scenes in a user space.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a method for dynamically setting a wake-up source in a user space, which can provide a flexible and dynamic method for setting a part of wake-up sources for equipment, and derives a control node in the user space to control the part of wake-up sources of low-speed equipment to wake up a system.
The invention also provides a medium for implementing the method for dynamically setting the awakening source in the user space.
The method for dynamically setting the wake-up source in the user space according to the embodiment of the first aspect of the invention comprises the following steps:
entering equipment tree analysis to obtain an initial awakening source during equipment initialization; setting operation is carried out on part of awakening sources of the equipment when the equipment is in dormancy; when the equipment is recovered, recovering the awakening source of the equipment to a state when the equipment enters dormancy; in the user space, the awakening source of the equipment is set and acquired by leading the awakening source of the equipment out.
The method for dynamically setting the awakening source in the user space according to the embodiment of the invention at least has the following beneficial effects:
the method of the embodiment of the invention dynamically performs setting operation on the awakening source in the user space and performs independent configuration on a plurality of awakening sources of one device. The method of the embodiment of the invention can configure some awakening sources of the equipment into the awakenable system and other awakening sources can not awaken the system in the platform development process, and dynamically configure the awakening sources in the user space according to different current scenes.
According to some embodiments of the invention, the initial wake-up source comprises: wakeup _ irq _ charge, wakeup _ irq _ usb, and wakeup _ irq _ over _ current.
According to some embodiments of the present invention, entering device tree parsing to obtain an initial wake-up source during device initialization comprises: loading a kernel module driver; calling a detection function; and analyzing the equipment tree to obtain multiple awakening sources of the equipment.
According to some embodiments of the invention, the method further comprises: and dynamically configuring the awakening source to be turned on or off in a user space.
According to some embodiments of the present invention, entering device tree parsing to obtain an initial wake-up source during device initialization comprises: and calling a probe function in the driver to acquire a wake-up source of the device.
According to some embodiments of the present invention, the setting the partial wake-up source of the device when the device is sleeping comprises: the kernel enters a suspend state; the device enters a suspend state; saving the device context; acquiring multiple awakening sources of equipment; the device part is set to wake up source enable. Wherein suspend state is suspend state.
According to some embodiments of the invention, the restoring, by the device, the wake-up source of the device to the state when entering hibernation includes: the device enters a resume state; acquiring a device awakening source; recovering the device from multiple wake-up sources; the device context is restored. Wherein resume state is the awake state.
According to some embodiments of the invention, the wake-up source of the deriving device comprises: acquiring a device awakening source through a device operator; the device wake source is exported from kernel space to the file system in user space via the sysfs interface. Wherein the device operator is a device operation interface.
According to some embodiments of the invention, the wake-up source of the deriving device comprises: a file system node is provided at the application layer to control the wake source.
A computer readable storage medium according to an embodiment of the second aspect of the invention has stored thereon program instructions that, when executed by a processor, implement the method according to any one of the embodiments of the first aspect of the invention.
All the advantages of the first aspect of the present invention are achieved because the computer-readable storage medium of the embodiment of the present invention stores computer-executable instructions for executing the method for dynamically setting the wake-up source in the user space according to any one of the first aspect of the present invention.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
FIG. 1 is a diagram illustrating a wake-up source of a device in a kernel according to the prior art;
FIG. 2 is a schematic diagram of a wake-up source of a prior art MFD device;
FIG. 3 is a diagram illustrating a user space dynamically configuring multiple wake-up sources of a device according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an embodiment of obtaining an initial wake-up source of a system;
FIG. 5 is a flowchart of a device performing hibernation or resume according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a wake-up source of an export device according to an embodiment of the present invention.
Detailed Description
The conception, the specific structure and the technical effects of the present invention will be clearly and completely described in conjunction with the embodiments and the accompanying drawings to fully understand the objects, the schemes and the effects of the present invention.
Referring to fig. 1, the current wake source setting method in the industry is configured by a device tree, and the function of a device having a wake source is described by writing a wakeup _ source attribute into the device tree. For a device, only one wake-up source can be set, some wake-up sources in the device cannot be set independently, and when the device is in a sleep state, either all wake-up sources are not used as the wake-up sources or all wake-up sources are used as the wake-up sources, and an independently controlled wake-up source control is lacked.
Referring to FIG. 2, in an MFD device, the wake-up of the device takes place in the manner shown in FIG. 1, even if there are multiple devices. The MFD device is, among other things, a multifunction device.
Referring to fig. 3, the technical solution of the embodiment of the present invention provides a method for flexibly and dynamically setting a partial wake-up source for a device, and derives a control node in a user space to control the partial wake-up source of a low-speed device to wake up a system.
The method for dynamically setting the awakening source in the user space comprises the following steps:
in a user space, setting and acquiring a wake-up source of equipment by exporting the wake-up source of the equipment; entering equipment tree analysis to obtain an initial awakening source during equipment initialization; setting operation is carried out on part of awakening sources of the equipment when the equipment is in dormancy; when the equipment is recovered, the awakening source of the equipment is recovered to the state when the equipment enters the dormancy state.
In some embodiments, as shown in fig. 3, a device according to an embodiment of the present invention has multiple wake-up sources, and can dynamically configure whether the wake-up source is turned on or off in the user space.
In some embodiments, the initial wake-up source comprises: wakeup _ irq _ charge, wakeup _ irq _ usb, wakeup _ irq _ over _ current, and the like.
Referring to fig. 4, in some embodiments, entering device tree resolution at device initialization to obtain an initial wake-up source includes: loading a kernel module driver; calling a detection function; and analyzing the equipment tree to obtain the multiple awakening sources of the equipment.
In some embodiments, a probe function in the driver is called to obtain the wake source of the device. The probe function can acquire identification type information and a key data structure (pci ids, usb ids, i2c ids and etc.) of the device, and identify whether the device is the device which the probe function is responsible for driving, and is responsible for completing initialization operation of the device.
Referring to fig. 5, in some embodiments, the setting the partial wake source of the device while the device is sleeping comprises: the kernel enters a suspend state; the device enters a suspend state; saving the device context; acquiring multiple awakening sources of equipment; the device part is set to wake up source enable.
In some embodiments, restoring the wake source of the device to a state when it entered hibernation when the device resumed includes: the device enters a resume state; acquiring a device awakening source; recovering the device from multiple wake-up sources; the device context is restored.
Referring to fig. 6, a wake-up source of an export device includes: acquiring a device awakening source through a device operator; the device wake source is exported from kernel space to the file system in user space via the sysfs interface. A Device operator is a Device operation interface.
In some embodiments, deriving the wake-up source of the device comprises: a file system node is provided at the application layer to control the wake source. .
It should be recognized that the method steps in embodiments of the present invention may be embodied or carried out by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The method may use standard programming techniques. Each program may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language. Furthermore, the program can be run on a programmed application specific integrated circuit for this purpose.
Further, the operations of processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and/or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) collectively executed on one or more processors, by hardware, or combinations thereof. The computer program includes a plurality of instructions executable by one or more processors.
Further, the method may be implemented in any type of android computing platform that is operatively connected to a suitable. Aspects of the invention may be embodied in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, optically read and/or write storage medium, RAM, ROM, or the like, such that it may be read by a programmable computer, which when read by the storage medium or device, is operative to configure and operate the computer to perform the procedures described herein. Further, the machine-readable code, or portions thereof, may be transmitted over a wired or wireless network. The invention described herein includes these and other different types of non-transitory computer-readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The invention may also include the computer itself when programmed according to the methods and techniques described herein.
A computer program can be applied to input data to perform the functions described herein to transform the input data to generate output data that is stored to non-volatile memory. The output information may also be applied to one or more output devices, such as a display. In a preferred embodiment of the invention, the transformed data represents physical and tangible objects, including particular visual depictions of physical and tangible objects produced on a display.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and any modifications, equivalent substitutions, improvements, etc. within the spirit and principle of the present invention should be included in the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention.
Claims (10)
1. A method for dynamically setting a wake-up source in a user space is characterized by comprising the following steps:
entering equipment tree analysis to obtain an initial awakening source during equipment initialization;
setting operation is carried out on part of awakening sources of the equipment when the equipment is in dormancy;
when the equipment is recovered, recovering the awakening source of the equipment to a state of entering dormancy;
in the user space, the awakening source of the equipment is set and acquired by leading the awakening source of the equipment out.
2. The method for dynamically setting wake-up source in user space according to claim 1, wherein the initial wake-up source comprises: wakeup _ irq _ charge, wakeup _ irq _ usb, and wakeup _ irq _ over _ current.
3. The method of claim 1, wherein entering device tree parsing to obtain an initial wake-up source during initialization of the device comprises:
loading a kernel module driver;
calling a detection function;
and analyzing the equipment tree to obtain multiple awakening sources of the equipment.
4. The method for dynamically setting wake-up source in user space according to claim 1, wherein the method further comprises:
and dynamically configuring the on or off of the wake-up source in a user space.
5. The method of claim 1, wherein entering device tree parsing to obtain an initial wake-up source during initialization of the device comprises:
and calling a probe function in the driver to acquire a wake-up source of the device.
6. The method for dynamically setting wake-up source in user space according to claim 1, wherein the setting operation of the partial wake-up source of the device when the device is sleeping comprises:
the kernel enters a suspend state;
the device enters a suspend state;
saving the device context;
acquiring multiple awakening sources of equipment;
the device part is set to wake up source enable.
7. The method for dynamically setting wake-up source in user space according to claim 1, wherein the restoring the wake-up source of the device to the state of entering the sleep state when the device is restored comprises:
the device enters a resume state;
acquiring a device awakening source;
recovering the device from multiple wake-up sources;
the device context is restored.
8. The method for dynamically setting wake-up source in user space according to claim 1, wherein the deriving the wake-up source of the device comprises:
acquiring a device awakening source through a device operator;
the wake-up source of the device is exported from kernel space to the file system in user space through the sysfs interface.
9. The method for dynamically setting wake-up source in user space according to claim 8, wherein the deriving the wake-up source of the device comprises:
a file system node is provided at the application layer to control the wake source.
10. A computer readable storage medium having stored thereon program instructions which, when executed by a processor, implement the method of any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010618097.8A CN111782285A (en) | 2020-06-30 | 2020-06-30 | Method and medium for dynamically setting wake-up source in user space |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010618097.8A CN111782285A (en) | 2020-06-30 | 2020-06-30 | Method and medium for dynamically setting wake-up source in user space |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111782285A true CN111782285A (en) | 2020-10-16 |
Family
ID=72760443
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010618097.8A Pending CN111782285A (en) | 2020-06-30 | 2020-06-30 | Method and medium for dynamically setting wake-up source in user space |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111782285A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112860324A (en) * | 2021-01-29 | 2021-05-28 | 展讯通信(上海)有限公司 | Method and device for debugging LCD |
-
2020
- 2020-06-30 CN CN202010618097.8A patent/CN111782285A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112860324A (en) * | 2021-01-29 | 2021-05-28 | 展讯通信(上海)有限公司 | Method and device for debugging LCD |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109739563B (en) | Terminal control method, device, system and storage medium | |
CN104850435B (en) | Power source management controller and method | |
US20110271268A1 (en) | System and method for updating unified extensible firmware interface setting information | |
US11768768B2 (en) | Memory mapping for hibernation | |
US9658863B2 (en) | Information processing apparatus and control method therefor | |
US9229729B2 (en) | Initializing processor cores in a multiprocessor system | |
JP2015102889A (en) | Method for updating firmware, electronic device, computer and computer program | |
US6725384B1 (en) | Method and apparatus for enabling a wake-up event by modifying a second register to enable a second wake-up event responsive to detecting entry of data in a first register | |
CN106873954B (en) | Method for initializing peripheral device and electronic device using the same | |
TW201525869A (en) | System and method for dual OS memory switching | |
KR102226558B1 (en) | Computer-readable recording having medium customized unified extensible firmware interface driver | |
CN111225434B (en) | Application response method, system, storage medium and communication module | |
TWI464583B (en) | Method of obtaining command for triggering function | |
US20120278542A1 (en) | Computer system and sleep control method thereof | |
CN111782285A (en) | Method and medium for dynamically setting wake-up source in user space | |
CN113672263B (en) | Firmware parameter updating control method and device and electronic equipment | |
TW201624192A (en) | Computer system, adaptable hibernation control module and control method thereof | |
US20200133562A1 (en) | Information processing device, controlling method and program | |
CN114137881B (en) | Chip awakening device, method and medium thereof | |
JP6775651B1 (en) | Information processing equipment, control methods, and programs | |
TW201435567A (en) | Method and device for advanced configuration and power interface (ACPI) sleep-state support using CPU-only reset | |
US7075518B2 (en) | Method for updating a keyboard controller in a notebook computer | |
CN117631793B (en) | Reset method, reset device, computer equipment and storage medium | |
CN113703799B (en) | Computing device and BIOS updating method and medium thereof | |
CN117806924B (en) | Control method and device of indicating device, server and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |