CN116700815A - Hardware resource control method, electronic device and readable storage medium - Google Patents

Hardware resource control method, electronic device and readable storage medium Download PDF

Info

Publication number
CN116700815A
CN116700815A CN202211295998.3A CN202211295998A CN116700815A CN 116700815 A CN116700815 A CN 116700815A CN 202211295998 A CN202211295998 A CN 202211295998A CN 116700815 A CN116700815 A CN 116700815A
Authority
CN
China
Prior art keywords
temperature sensor
color temperature
application
power
flag bit
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.)
Granted
Application number
CN202211295998.3A
Other languages
Chinese (zh)
Other versions
CN116700815B (en
Inventor
罗润发
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211295998.3A priority Critical patent/CN116700815B/en
Publication of CN116700815A publication Critical patent/CN116700815A/en
Application granted granted Critical
Publication of CN116700815B publication Critical patent/CN116700815B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

The application relates to the technical field of hardware resource control, and provides a hardware resource control method, a device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: based on a call request of a display process to a color temperature sensor of the electronic equipment, a call request of a camera process to the color temperature sensor, and a first flag bit for controlling the color temperature sensor to be electrified or electrified, wherein the value of the first flag bit is used for indicating the number of processes which currently call the color temperature sensor; after the color temperature sensor is controlled to be electrified or powered off, the value of the first zone bit is updated, so that whether an application process using the color temperature sensor exists currently or not is determined according to the first zone bit, and the power off is not directly carried out when the application process using the color temperature sensor exists, so that other application processes are ensured to normally use the color temperature sensor.

Description

Hardware resource control method, electronic device and readable storage medium
Technical Field
The present application relates to the field of hardware resource control technologies, and in particular, to a method and apparatus for controlling hardware resources, an electronic device, and a readable storage medium.
Background
In current electronic devices, the color temperature sensor is generally adapted to a specific process, and data of the color temperature sensor can be acquired or controlled inside the process. However, the existing scheme has the problems that the control mode of the coloring temperature sensor is not flexible enough and the use experience is poor.
Disclosure of Invention
The application provides a hardware resource control method, a device, electronic equipment and a readable storage medium, and aims to avoid the defect that a color temperature sensor is inflexible in control mode and poor in use experience.
In a first aspect, the present application provides a hardware resource control method, including:
receiving a first operation of a user;
in response to the first operation, starting a display process;
receiving a second operation of a user for a camera application of the electronic device;
responding to the second operation, and starting a camera process;
based on a call request of the display process to a color temperature sensor of the electronic equipment, a call request of the camera process to the color temperature sensor, and a first flag bit for controlling the power-on or power-off of the color temperature sensor, wherein the value of the first flag bit is used for indicating the number of processes which have currently called the color temperature sensor;
And after the color temperature sensor is controlled to be electrified or powered off, updating the value of the first zone bit.
In one possible implementation manner, a type of a call request of the display process or the camera process to a color temperature sensor of the electronic device is obtained;
when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor, and the first flag bit is 0, powering on the color temperature sensor is controlled;
and when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor, and the first flag bit is not 0, maintaining the powering-on state of the color temperature sensor, and not executing the powering-on process.
In one possible implementation manner, after the type of the call request of the display process or the camera process to the color temperature sensor of the electronic device is obtained, the method further includes:
when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first flag bit is 1, controlling the color temperature sensor to be powered down;
And when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first zone bit is an integer greater than 1, maintaining the powering-on state of the color temperature sensor, and not executing the powering-down process.
In one possible implementation manner, after the color temperature sensor is controlled to be powered on or powered off, updating the value of the first flag bit includes:
after the color temperature sensor is controlled to be electrified, adding 1 to the value of the first zone bit;
and after the color temperature sensor is controlled to be powered down, subtracting 1 from the value of the first zone bit.
In a possible implementation manner, after the updating the value of the first flag bit, the method further includes:
monitoring a first use state of the color temperature sensor after controlling the color temperature sensor to be powered on;
when the first use state of the color temperature sensor is a power-on abnormal state, determining that the color temperature sensor fails to be powered on;
and subtracting 1 from the first zone bit after the power-on failure of the color temperature sensor.
In a possible implementation manner, after the updating the value of the first flag bit, the method further includes:
Monitoring a second use state of the color temperature sensor after controlling the color temperature sensor to be powered down;
when the second use state of the color temperature sensor is detected to be a power-down abnormal state, determining that the color temperature sensor fails to power down;
and after the color temperature sensor fails to be powered down, adding 1 to the first flag bit.
In one possible implementation, the method further includes:
acquiring a call request of each application process to the color temperature sensor;
matching the calling request of each application process to the color temperature sensor with a preset request parameter list, wherein the preset notification parameter list comprises all application process information capable of calling the color temperature sensor;
and determining the number of processes which are currently called for the color temperature sensor according to the matching result.
In one possible implementation, the first operation is a power-on operation.
In one possible implementation, the second operation is an operation to launch the camera application.
In a second aspect, the present application provides a hardware resource control device, including:
the receiving module is used for receiving a first operation of a user;
the starting module is used for responding to the first operation and starting a display process;
The receiving module is further used for receiving a second operation of a user on a camera application of the electronic equipment;
the starting module is further used for responding to the second operation and starting a camera process;
the control module is used for controlling the color temperature sensor to be electrified or electrified based on a calling request of the display process to the color temperature sensor of the electronic equipment and a calling request of the camera process to the color temperature sensor, and a first zone bit, wherein the value of the first zone bit is used for indicating the number of processes which currently call the color temperature sensor;
and the updating module is used for updating the value of the first zone bit after controlling the color temperature sensor to be electrified or powered off.
In a third aspect, the present application provides an electronic device, comprising:
one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions that, when executed by the electronic device, cause the electronic device to perform the hardware resource control method as described in the first aspect or any of the possible implementations of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, causes the processor to perform the hardware resource control method as described in the first aspect or any of the possible implementation manners of the first aspect.
In a fifth aspect, the present application provides a chip, the chip comprising a processor and a data interface, the processor reading instructions stored on a memory through the data interface, performing the hardware resource control method of the first aspect or any one of the possible implementation manners of the first aspect.
Optionally, as a possible implementation manner, the chip may further include a memory, where the memory stores instructions, and the processor is configured to execute the instructions stored on the memory, where the instructions, when executed, are configured to perform the hardware resource control method of the first aspect or any one of the possible implementation manners of the first aspect.
Drawings
FIG. 1 is a schematic scene diagram of prior art application process processing;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
FIG. 3 is a block diagram of a software architecture of an electronic device according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a hardware resource control method according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating a hardware resource control method according to another embodiment of the present application;
FIG. 6 is a schematic diagram of a hardware resource control method according to another embodiment of the present application;
FIG. 7 is a state machine diagram of a hardware resource control method according to another embodiment of the present application;
fig. 8 is a control flow diagram of a hardware resource control method according to another embodiment of the present application;
fig. 9 is a block diagram illustrating a hardware resource control method according to another embodiment of the present application.
Detailed Description
The terms first, second, third and the like in the description and in the claims and in the drawings are used for distinguishing between different objects and not for limiting the specified order.
In embodiments of the application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
For clarity and brevity of the following description of the embodiments, a brief description of an implementation scheme of hardware resource control is first given:
at present, the LCD dimming needs to acquire the reported value of the color temperature sensor of the rear-mounted color sensor, and the current color temperature sensor value reporting is adapted to a Camera Cam process (also called as a Camera process) only, and does not have the capability of simultaneously being compatible with two or more processes to use the same device. The existing scheme can lead to the Cam process and the Display process to adopt the same parameter control device, when the two processes use the device at the same time, a certain process closing can lead to the device to be directly powered down, as shown in fig. 1, fig. 1 is a schematic scene diagram of the prior art processing on the application process, when the camera flash process and the Display process simultaneously access the same hardware device, the specific flow of calling the color temperature sensor is that the camera flash process of the Cam process accesses the flash to enable the flash-enable node, the color temperature sensor color sensor function is used by the flash-enable node to control the hardware device, the Cam process and the Display process access the color temperature sensor through the color temperature sensor color hardware layer function, and then the color temperature sensor is controlled by the color temperature sensor function when the camera flash process and the Display process simultaneously access the same hardware device, but the color temperature sensor is used by the camera flash process and the Display process simultaneously, if the two processes simultaneously use the flash-enable the color temperature sensor to control the hardware device, the color temperature sensor is directly closed, and if the color temperature sensor is used by the camera flash-enable the color temperature sensor, and the color temperature sensor can be directly closed when the two processes simultaneously, for example, the color temperature sensor is used by the normal process is caused.
Based on the problems in the above technical solution, the present application provides a hardware resource control method, by receiving a first operation of a user; in response to the first operation, starting a display process; receiving a second operation of a user for a camera application of the electronic device; responding to the second operation, and starting a camera process; based on a call request of the display process to a color temperature sensor of the electronic equipment, a call request of the camera process to the color temperature sensor, and a first flag bit for controlling the power-on or power-off of the color temperature sensor, wherein the value of the first flag bit is used for indicating the number of processes which have currently called the color temperature sensor; after the color temperature sensor is controlled to be electrified or powered off, the value of the first zone bit is updated, so that whether an application process using the color temperature sensor exists currently or not is determined according to the first zone bit, and the power off is not directly carried out when the application process using the color temperature sensor exists, so that other application processes are ensured to normally use the color temperature sensor. The hardware resource control method can be applied to electronic devices such as mobile phones, tablet computers, desktop computers, laptops, notebook computers, ultra-mobile personal computers (UMPC), handheld computers, netbooks, personal digital assistants (Personal Digital Assistant, PDA), wearable electronic devices, smart watches and the like. The structure of the electronic device to which the hardware resource control method is applied may be as shown in fig. 2.
As shown in fig. 2, fig. 2 is a diagram showing an example of the composition of an electronic device according to the present application, the electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (universal serial bus, USB) interface 230, a charge management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, keys 290, a motor 291, an indicator 292, a camera 293, a display 294, and a subscriber identity module (subscriber identification module, SIM) card interface 295. The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, a barometric sensor 280C, a magnetic sensor 280D, an acceleration sensor 280E, a distance sensor 280F, a proximity sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, and the like.
It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200. In other embodiments, the electronic device 200 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 210 may include one or more processing units such as, for example: the processor 210 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the electronic device 200, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 210 for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may hold instructions or data that the processor 210 has just used or recycled. If the processor 210 needs to reuse the instruction or data, it may be called directly from the memory. Repeated accesses are avoided and the latency of the processor 210 is reduced, thereby improving the efficiency of the system.
In some embodiments, processor 210 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
It should be understood that the connection relationship between the modules illustrated in this embodiment is only illustrative, and does not limit the structure of the electronic device 200. In other embodiments of the present application, the electronic device 200 may also employ different interfacing manners, or a combination of interfacing manners, as in the above embodiments.
The wireless communication function of the electronic device 200 can be implemented by the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, a modem processor, a baseband processor, and the like.
The wireless communication module 260 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied on the electronic device 200. The wireless communication module 260 may be one or more devices that integrate at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 210. The wireless communication module 260 may also receive a signal to be transmitted from the processor 210, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 250 of electronic device 200 are coupled, and antenna 2 and wireless communication module 260 are coupled, such that electronic device 200 may communicate with a network and other devices via wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 200 implements display functions through a GPU, a display screen 294, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or change display information.
A series of graphical user interfaces (graphical user interface, GUIs), which are all home screens of the electronic device 200, may be displayed on the display 294 of the electronic device 200. In general, the size of the display 294 of the electronic device 200 is fixed and only limited controls can be displayed in the display 294 of the electronic device 200. A control is a GUI element that is a software component contained within an application program that controls all data processed by the application program and interactive operations on that data, and a user can interact with the control by direct manipulation (direct manipulation) to read or edit information about the application program. In general, controls may include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and the like. For example, in an embodiment of the present application, the display 291 may display virtual keys (one-key arrangement, start arrangement, scene arrangement).
The electronic device 200 may implement a photographing function through an ISP, a camera 293, a video codec, a GPU, a display 294, an application processor, and the like.
The electronic device 200 may implement audio functions through an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an ear-headphone interface 270D, an application processor, and the like. Such as music playing, recording, etc.
In addition, an operating system is run on the components. Such as the hong Monte System, the iOS operating system, the Android open source operating system, the Windows operating system, and the like. An operating application may be installed on the operating system.
Fig. 3 is a software structural block diagram of an electronic device according to an embodiment of the present application.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments of the present application, the software architecture of the electronic device includes at least three layers, from top to bottom, an application layer, an application framework layer, and a hardware abstraction layer.
The application layer may include a series of application packages. These application packages may include camera, gallery, calendar, talk, map, navigation, WLAN, bluetooth, music, video, short message, etc. applications.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions. As shown in FIG. 3, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like. The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is for providing communication functions of the electronic device. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
The hardware abstraction layer is an interface layer between the operating system kernel and the hardware circuitry of the electronic device 200, which aims to abstract the hardware. In some embodiments of the present application, the hardware abstraction layer includes a process type judging module, an activating module, a waiting time control module, a voting control module, and a data storage module.
The process type judging module, namely the color-enabling-type module, is used for determining the application process of the current control hardware device by adopting a parameter distinguishing mode. For example, the color-enable-type receives the accessed application process, adjusts the receiving node of the received parameter, divides the received node area, uses the first 2 bytes to receive cam_enable, uses the middle 2 bytes to receive lcd_enable, or uses the last 2 bytes to receive flash_enable, and compares the received parameter with the parameter list to determine the application process currently controlling the hardware device.
The activating module is used for activating the functions of the hardware devices, for example, the functions of the hardware devices are packaged into the activating module, and the cross-layer color temperature sensor is controlled through the activating module.
The waiting time control module, namely the wTime module, is used for controlling different application processes to call the state refreshing interval time of the color temperature sensor, and the power consumption of the system is reduced by controlling the state refreshing frequency of the color temperature sensor.
The color temperature sensor calling module, namely the color enabling module, is used for calling the color temperature sensor.
The voting control module, namely the enable_store module, is used for controlling the running state of the color temperature sensor through voting control logic.
The data storage module, namely the data module, is used for storing the number of identified application processes using the color temperature sensor.
For easy understanding, the following embodiments of the present application will take the electronic device 200 having the structure shown in fig. 2 and fig. 3 as an example, and the hardware resource control method provided by the embodiments of the present application will be specifically described with reference to the accompanying drawings and application scenarios.
Fig. 4 is a flowchart illustrating a hardware resource control method according to an embodiment of the present application.
As shown in fig. 4, the above hardware resource control method may include:
Step S10: a first operation of a user is received.
It should be noted that the first operation is a power-on operation, for example, the user clicks the power key to open the screen, and the power-on operation may be performed in other manners, which is not limited in this embodiment.
Step S20: and responding to the first operation, and starting a display process.
In this embodiment, the display process is a display process of a display screen, for example, after a user clicks a power key to open the screen, the display process of the display screen is started.
Step S30: a second operation of a user for a camera application of the electronic device is received.
In this embodiment, the second operation is an operation of starting the camera application, which may be a touch operation of opening the camera application, for example, the user clicks a camera icon on a desktop of the mobile phone, or may open the camera application in other manners, which is not limited in this embodiment.
Step S40: and responding to the second operation, and starting a camera process.
Step S50: and controlling the color temperature sensor to be electrified or powered off based on a call request of the display process to the color temperature sensor of the electronic equipment and a call request of the camera process to the color temperature sensor, wherein the value of the first flag bit is used for indicating the number of processes which have currently called the color temperature sensor.
It can be understood that, the call request of the display process to the color temperature sensor of the electronic device may be a request to power up the color temperature sensor, or may be a request to power down the color temperature sensor, and similarly, the call request of the camera process to the color temperature sensor may be a request to power up the color temperature sensor, or may be a request to power down the color temperature sensor, for example, a request lcd_enable of the display process to power up the color temperature sensor of the electronic device, a request lcd_disable of the display process to power down the color temperature sensor of the electronic device, a request cam_enable of the camera process to power up the color temperature sensor of the electronic device, a value of a first flag bit is used to indicate that the color temperature sensor is currently invoked, for example, when the first flag bit is 0, indicates that there is no application process to invoke the color temperature sensor, when the first flag bit is 1, the display process invokes the color temperature sensor is currently invoked, and when the first flag bit is 1, the first flag bit is invoked by 2, and so on indicates that the color temperature sensor is invoked by analogy.
Step S60: and after the color temperature sensor is controlled to be electrified or powered off, updating the value of the first zone bit.
It should be noted that, in a general case, no matter whether there is any other application process currently using the color temperature sensor, if there is any application process currently using the color temperature sensor to power down, power down processing is performed on the color temperature sensor, so that other application processes cannot use the color temperature sensor, where an operation state of the color temperature sensor may be power up or power down processing of the color temperature sensor, and other types of processing may also be included.
The application determines whether other application processes currently use the color temperature sensor through the number of application processes, and when the number of application processes is larger than 1, the color temperature sensor is not powered down by the other application processes currently use the color temperature sensor, and when the number of application processes is equal to 1, the color temperature sensor is powered down by the other application processes currently not used by the color temperature sensor, so that the problem that the color temperature sensor cannot be used by the other application processes due to the power down condition is avoided.
In one possible implementation manner, when the color temperature sensor is powered on, if the number of application processes is greater than or equal to 1, it is indicated that the current application process is using the color temperature sensor, and if the number of application processes is less than 1, it is indicated that the current application process is not using the color temperature sensor, and then the color temperature sensor can be powered on, so that the power on process is not needed to be continued when the color temperature sensor is already using the application process, and the power on process is performed again when the application process is not using the color temperature sensor, thereby improving the processing efficiency of the system.
In the specific implementation, when the color_enable node receives an enable message, firstly judging the value of a flag bit, if the value is 0, indicating that the color temperature sensor is not used in a process, and the color temperature sensor is in a power-down state, so that the color temperature sensor is powered on later, and the value of the flag bit is +1 after the power-on is successful; if the value is not 0, the color temperature sensor is used by one or more processes, the color temperature sensor is in a power-on state, then power-on operation is not performed again, and only the bit value of +1 is used for realizing the real-time updating of the first bit, so that the flexible control of the temperature sensor is improved.
In this embodiment, by receiving a first operation of a user; in response to the first operation, starting a display process; receiving a second operation of a user for a camera application of the electronic device; responding to the second operation, and starting a camera process; based on a call request of the display process to a color temperature sensor of the electronic equipment, a call request of the camera process to the color temperature sensor, and a first flag bit for controlling the power-on or power-off of the color temperature sensor, wherein the value of the first flag bit is used for indicating the number of processes which have currently called the color temperature sensor; after the color temperature sensor is controlled to be electrified or powered off, the value of the first zone bit is updated, so that whether an application process using the color temperature sensor exists currently or not is determined according to the first zone bit, and the power off is not directly carried out when the application process using the color temperature sensor exists, so that other application processes are ensured to normally use the color temperature sensor.
Fig. 5 is a flowchart of a hardware resource control method according to another embodiment of the present application, as shown in fig. 5, where the above hardware resource control method is based on the first embodiment, and the step S50 includes:
Step S501 is to acquire a type of a call request of the display process or the camera process to the color temperature sensor of the electronic device.
It should be noted that, the type of the call request for the color temperature sensor of the electronic device may be a cam_enable, lcd_enable, flash_enable, or cam_disable, or lcd_ disable, flash _disable request, that is, the color temperature sensor power-up request and the color temperature sensor power-down request, and may further include other types of call request types for the color temperature sensor, which is not limited in this embodiment.
In this embodiment, a voting control logic is used to determine whether the color temperature sensor executes a power-on or power-off process, where the voting control logic is implemented in an enable_store function, and the main logic is as follows: 1. according to the received parameters cam_enable and LCD_enable, confirming which process is currently using the device, and storing information into data; 2. defining global int type variable, recording the number of processes of the currently used device, and when receiving an enable request, judging whether a process uses the device, if so, only counting by +1, and not actually performing the current flow; when no process is used currently, the power-on flow is called after the count of +1, and when the power-on fails, the count is carried out by-1, and a result is returned; 3. when receiving a disable request, judging how many processes are using the device, if the count is 1, namely, only the current process is in use, preferentially counting-1, then performing actual power-down operation, and if the power-down fails, counting +1 again and returning a result; if the number is greater than 1, the count is only-1, and the actual power-down function is not called.
In this embodiment, on the basis of the number of application processes, a current call request is further determined, whether the color temperature sensor performs a power-on or power-off process is determined according to the current call request, when the current call request is a cam_enable or lcd_enable request, it is determined that the current color temperature sensor is required to perform the power-on process, when the current call request is a cam_disable or lcd_disable request, it is determined that the current color temperature sensor is required to perform the power-off process, and according to the current call request and the number of application processes indicated by the flag bit, the color temperature sensor is controlled to perform the power-on or power-off process, thereby ensuring flexible call to the color temperature sensor.
Step S502, when the type of the call request of the display process or the camera process to the color temperature sensor is a type of powering on the color temperature sensor, and the first flag bit is 0, controlling the color temperature sensor to be powered on.
It should be noted that, when the type of the call request of the display process or the camera process to the color temperature sensor is a power-on type of the color temperature sensor, and the first flag bit is 0, it is indicated that no application process currently uses the color temperature sensor, in this case, since the current application process is indicated to use the color temperature sensor and no other application process uses the color temperature sensor when the enable request is received, the number of application processes currently used to use the color temperature sensor is increased based on the number of application processes counted originally, that is, the number of application processes is increased, and the color temperature sensor is controlled to execute a power-up process, for example, when the first flag bit is 0, the enable request is received, the first flag bit +1 is obtained, the first flag bit is 1, and the color temperature sensor is controlled to execute the power-up process.
In step S503, when the type of the call request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor, and the first flag bit is not 0, the power-on state of the color temperature sensor is maintained, and the power-on process is not executed any more.
It should be noted that, when the type of the call request of the display process or the camera process to the color temperature sensor is a power-on type of the color temperature sensor, and the first flag bit is greater than 0, it is indicated that the current existing application process is using the color temperature sensor, in this case, since the current application process needs to use the color temperature sensor when the current application process receives the enable request, the number of application processes is increased on the basis of the number of application processes counted originally, that is, the number of application processes is increased, and the color temperature sensor is controlled to keep a power-on state, for example, when the first flag bit is 1, the first flag bit +1 is received, so that the first flag bit is 2, and the color temperature sensor is controlled to keep a power-on state, so that the current process is not actually performed, the repeated power-on operation is avoided, and the efficiency of system processing is improved.
In one possible implementation manner, after the step S501, the method further includes:
and when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first flag bit is 1, controlling the color temperature sensor to be powered down.
It can be understood that when the type of the call request of the display process or the camera process to the color temperature sensor is a power-down type, i.e. disable type, of the color temperature sensor, and the first flag bit is equal to 1, it indicates that only the current application process is using the color temperature sensor, in this case, since the current application process is controlled to execute the power-down process by the color temperature sensor when the disable request is received, it is indicated that the current application process is subtracting the number of application processes that are currently using the color temperature sensor on the basis of the number of application processes counted originally, i.e. the number of application processes is reduced, and the color temperature sensor is controlled to execute the power-down process, for example, when the first flag bit is 1, the disable request is received, the first flag bit-1 is obtained, and the color temperature sensor is controlled to execute the power-down process, and since the current application process is determined to be using the color temperature sensor through the current call request and the number of application processes, the current application process is prevented from affecting the use of other applications when executing the power-down process, and the other applications can be prevented from executing the power-down process, thereby using the color temperature sensor normally.
And when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first zone bit is an integer greater than 1, maintaining the powering-on state of the color temperature sensor, and not executing the powering-down process.
It should be noted that, when the type of the call request of the display process or the camera process to the color temperature sensor is the down type, that is, the disable type, and the first flag bit is an integer greater than 1, it is indicated that there are other application processes currently using the color temperature sensor, in this case, since the current application process controls the color temperature sensor to execute the down current process to affect the normal use of other application processes when receiving the disable request, it is indicated that the current application process is controlled by the current application process to execute the down current process, so that the current application process to be used currently is subtracted from the number of application processes counted originally, that is, the number of application processes is reduced, and the color temperature sensor is controlled to keep the power-on state, and the actual power-on function is not called, for example, when the first flag bit is 3, the disable request is received, the first flag bit-1 is obtained, and the actual power-on function is not called, and since the current application process is determined whether there is a used device or not through the current application process number is executed, the current application process is ensured to be used when executing the down current application process, thereby other applications can be prevented from affecting the normal use of the color temperature sensor.
In one possible implementation manner, the step S60 includes:
after the color temperature sensor is controlled to be electrified, adding 1 to the value of the first zone bit; after the color temperature sensor is controlled to be powered down, the value of the first flag bit is reduced by 1, for example, when the first flag bit is 1, the first flag bit +1 is obtained by receiving an enable request, when the first flag bit is 3, the first flag bit-1 is obtained by receiving a disable request, and the first flag bit is 2.
In one possible implementation manner, after the updating the value of the first flag bit, the method further includes:
monitoring a first use state of the color temperature sensor after controlling the color temperature sensor to be powered on; when the first use state of the color temperature sensor is a power-on abnormal state, determining that the color temperature sensor fails to be powered on; and subtracting 1 from the first zone bit after the power-on failure of the color temperature sensor.
In this embodiment, the power failure may determine whether the color temperature sensor is power failure by monitoring a communication state with the color temperature sensor and an operation state of the color temperature sensor, when the power failure occurs, the number of application processes of the color temperature sensor is reduced, and a power failure result is returned, for example, when the first flag bit is 0, the first flag bit +1 is received when an enable request is received, the updated first number is 1, and when the power failure occurs, the updated flag bit-1 is updated again to obtain the updated first number 0, so that real-time update of the number of application processes is ensured, thereby improving accuracy of hardware resource control.
In one possible implementation manner, after the updating the value of the first flag bit, the method further includes: monitoring a second use state of the color temperature sensor after controlling the color temperature sensor to be powered down; when the second use state of the color temperature sensor is detected to be a power-down abnormal state, determining that the color temperature sensor fails to power down; and after the color temperature sensor fails to be powered down, adding 1 to the first flag bit.
In this embodiment, the power-down failure may determine whether the color temperature sensor fails to power down by monitoring a communication state with the color temperature sensor and an operation state of the color temperature sensor, when the power-down fails, increase the number of application processes of the color temperature sensor, ensure the number of application processes, and return a power-down failure result, for example, when the first flag bit is 1, the first flag bit-1 is obtained after receiving the disable request, and when the power-down fails, the first flag bit +1 is obtained after being updated again is 1, so as to ensure real-time update of the number of application processes, thereby improving accuracy of hardware resource control.
In one possible implementation, the method further includes: acquiring a call request of each application process to the color temperature sensor; matching the calling request of each application process to the color temperature sensor with a preset request parameter list, wherein the preset notification parameter list comprises all application process information capable of calling the color temperature sensor; and determining the number of processes which are currently called for the color temperature sensor according to the matching result.
In this embodiment, two processes or more processes control and use devices simultaneously, and to coordinate and control the two processes or more processes, a common part of an independent process needs to be found, and in this scenario, the most suitable common part is a device driver.
In the device driver, a plurality of device nodes are usually generated, and the device nodes are used as isolation between the kernel and the upper layer. These nodes will typically include enable representation to control device enablement, data representation to retrieve device data, and so on. Meanwhile, the receiving process parameters are character string types and are obtained through driver function analysis.
It should be noted that, the preset request parameter list includes a list of parameters of cam_enable, lcd_enable, flash_enable or cam_disable, lcd_ disable, flash _disable, and other parameters, which are not limited in this embodiment, and the application process of the current calling color temperature sensor is determined by matching with the process parameters recorded in the preset request parameter list, and the current calling color temperature sensor process is indicated by adopting a parameter distinguishing manner in this embodiment. The specific parameter list adopts an enumeration type:
in a specific implementation, process parameters of an application process using a color temperature sensor are matched with a preset request parameter list to obtain the number of processes which have called the color temperature sensor currently, for example, process parameters cam_enable and lcd_enable of the application process using the color temperature sensor are used to confirm which process is currently using a device, so that identification of the application process using the color temperature sensor currently is realized, a frame diagram is shown in fig. 6, the frame diagram is marked with a rough part, the type using the color temperature sensor is performed by adding a function parameter en-type on the basis of an original basic frame, and paths of other application processes are added on the basis of an original Cam and color_enable, so that all application processes passing through Linux R/W can call the color temperature sensor through the paths to the color_enable, the running state of the color temperature sensor is obtained through the color_enable, and the running state of the color temperature sensor is fed back. After the color temperature sensor is controlled to be powered on or powered off based on the zone bit, the method further comprises the following steps: setting waiting time for calling the color temperature sensor by the display process or the camera process respectively; monitoring the current use state of the color temperature sensor according to the waiting time; and determining whether the color temperature sensor is normally used according to the current use state.
In one possible implementation, a use state of a current color temperature sensor and a current call request are obtained; determining the actual running state of the color temperature sensor according to the using state of the current color temperature sensor and a current calling request query state machine table, wherein the query state machine table comprises the corresponding relation among the using state of the color temperature sensor, the calling request and the actual running state of the color temperature sensor; and controlling the color temperature sensor to operate according to the actual operation state.
In this embodiment, the current use states of the color temperature sensor may be Cam on, LCD on, cam off, and LCD off, which respectively indicate that the camera process calls the color temperature sensor to power up, the display process calls the color temperature sensor to power up, the camera process calls the color temperature sensor to power down, the display process calls the color temperature sensor to power down, and may also include the use states of other application processes using the color temperature sensor.
In a specific implementation, for example, when the use state of the current color temperature sensor is Cam on or LCD on and the current call request is cam_enable, it is indicated that the current existing application process is using the color temperature sensor, in this case, power-on processing is not required to be performed according to the cam_enable request, only the signal quantity counted by the process using the color temperature sensor by the application process is adjusted, when the use state of the current color temperature sensor is Cam on or LCD off and the current call request is cam_disable, it is indicated that only the current application process is using the color temperature sensor, in this case, power-off processing can be performed on the color temperature sensor, so that power-on and power-off operations on the color temperature sensor are performed according to the use state of the current color temperature sensor by the application process and the control request of the current color temperature sensor, and the purpose of effectively controlling the color temperature sensor is achieved.
In the corresponding code implementation, a switch-case mode is adopted, and an actual control flow is decided according to the value of the current process counting semaphore according to the issued parameter serving as a case condition, so that the function that two or more processes control the same device is realized. The embodiment is now described as a control flow of two processes, when a plurality of processes are the same in basic mechanism, the instruction and the state expansion need to be modified, so that the control flow is better compatible for the use of the processes, as shown in a control flow diagram in fig. 8, for example, the initial state of the color temperature sensor is in an off state, that is, the control parameters of the color temperature sensor used by the application process are cam_disable and lcd_disable, when the use of lcd_enable is received, the use state of the color temperature sensor is adjusted to Cam off and LCD on, and when the use of cam_enable is received, the use state of the color temperature sensor is adjusted to Cam on and LCD on.
The hardware resource control method according to the embodiment of the present application is described in detail below with reference to fig. 9. The process shown in fig. 9 includes steps S101 to S1092, which are described in detail below, respectively.
S101, a process type judging module acquires call requests of all application processes to the color temperature sensor;
s102, a process type judging module matches the calling request of each application process to the color temperature sensor with a preset request parameter list.
In S102, the preset notification parameter list includes all application process information that can call the color temperature sensor;
s103, determining the number of processes which are currently called by the color temperature sensor according to the matching result by a process type judging module;
s104: the process type judging module sends the number of the current application processes using the color temperature sensor to the data storage module;
after 104, the data storage module may execute step S1041 after receiving the number of currently used color temperature sensor application processes sent by the process type determining module.
S1041, a data storage module determines a first zone bit according to the number of the current application processes using the color temperature sensor and stores the first zone bit;
S105, a voting control module acquires the type of a call request of the display process or the camera process to a color temperature sensor of the electronic equipment, and acquires a first flag bit from the data storage module;
s1061, when the type of a call request of the display process or the camera process to the color temperature sensor is a power-on type of the color temperature sensor and the first flag bit is 0, the voting control module sends a power-on instruction of the color temperature sensor to the color temperature sensor;
s1062, the color temperature sensor is powered on according to the power-on instruction and sends a first flag bit updating instruction to the data storage module;
s1063, the data storage module adds 1 to the value of the first zone bit according to a first zone bit updating instruction;
s1064, after the color temperature sensor is powered on, detecting whether the power on is successful, and when the power on is unsuccessful, sending a flag bit update instruction to the data storage module;
s1065, the data storage module subtracts 1 from the value of the first flag bit.
S1071, when the type of a call request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor and the first flag bit is not 0, the voting control module sends a state of keeping the powering on of the color temperature sensor to the color temperature sensor;
S1072, the color temperature sensor keeps a power-on state, and a first flag bit update instruction is sent to the data storage module;
and S1073, the data storage module adds 1 to the value of the first flag bit.
S1081, when the type of the call request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor and the first flag bit is 1, the voting control module sends a power-down instruction of the color temperature sensor to the color temperature sensor;
s1082, powering down the color temperature sensor, and sending a first flag bit update instruction to the data storage module;
s1083, the data storage module subtracts 1 from the value of the first flag bit.
S1084, after the color temperature sensor is powered down, detecting whether the power down is successful, and when the power down is unsuccessful, sending a flag bit update instruction to the data storage module;
s1085, the data storage module adds 1 to the value of the first flag bit.
S1091, when the type of a call request of the display process or the camera process to the color temperature sensor is a power-down type of the color temperature sensor and the first zone bit is an integer greater than 1, the voting control module keeps a power-up state instruction of the color temperature sensor to the color temperature sensor;
S1092, keeping the color temperature sensor powered on, and sending a first flag bit update instruction to a data storage module;
and S1093, the data storage module subtracts 1 from the value of the first flag bit.
The color-enabling-type module obtains process parameters corresponding to an application process; and matching the process parameters with a preset request parameter list to obtain a target application process using the color temperature sensor, storing the target application process in data, and recording the number of processes of the current device according to a defined global int-type variable by an enable_store function, and determining the number of application processes of the color temperature sensor according to the number of the target application processes.
It can be understood that the control logic up-shift scheme can also be adopted, namely, the bottom driver is still adopted to realize the process counting, but an interface for controlling the addition and subtraction of the process counting semaphore variable is provided for the upper layer; meanwhile, the driver process count semaphore and the data are reported together, and a path for the upper layer process to acquire the actual calling number of the bottom layer is opened. And then judging when the upper process calls the device interface, and ensuring that only the first process is actually electrically operated when the lower driver calls the enable for multiple times to enable the device, wherein the specific logic is as follows: 1. when the device needs to enable the device, the process counting semaphore is set to 0, the enable interface is directly called, and then an interface of the counting semaphore +1 is called to control the bottom layer semaphore; 2. after each frame of data is reported, analyzing the corresponding value of the counting semaphore, and maintaining a global variable at the current calling layer to store the value of the semaphore; 3. before the power-down interface is called, firstly judging the semaphore, if only the current process is in use, calling the power-down interface, otherwise, only calling the interface of the semaphore-1 to control the bottom semaphore, and not performing actual power-down operation.
The alternative scheme is to move up the scheme of the voting mechanism and realize control logic at the upper layer of each calling device, so that each process using the same device needs to realize the process logic to solve the scene problem.
It should be understood that the electronic device herein is embodied in the form of functional modules. The term "module" herein may be implemented in software and/or hardware, and is not specifically limited thereto. For example, a "module" may be a software program, a hardware circuit, or a combination of both that implements the functionality described above. The hardware circuitry may include application specific integrated circuits (application specificintegrated circuit, ASICs), electronic circuits, processors (e.g., shared, proprietary, or group processors, etc.) and memory for executing one or more software or firmware programs, merged logic circuits, and/or other suitable components that support the described functions.
The present application also provides an electronic device including: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions that, when executed by the electronic device, cause the electronic device to perform the hardware resource control method as described in the first aspect or any of the possible implementations of the first aspect.
The application also provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, causes the processor to perform the hardware resource control method as described in the first aspect or any of the possible implementation manners of the first aspect.
The present application also provides a chip comprising a processor and a data interface, the processor reading instructions stored on a memory through the data interface, performing the hardware resource control method of the first aspect or any one of the possible implementation manners of the first aspect.
Optionally, the chip may further comprise a memory, in which instructions are stored, the processor being configured to execute the instructions stored on the memory, the processor being configured to perform the hardware resource control method of the first aspect or any one of the possible implementations of the first aspect when the instructions are executed.
The memory may be read-only memory (ROM), other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM) or other types of dynamic storage devices that can store information and instructions, electrically erasable programmable read-only memory (electrica llyerasable programmable read-only memory, EEPROM), compact disc read-only memory (compact disc read-only memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media, or any other magnetic storage device that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, etc.
In the embodiment of the application, "and/or" describes the association relation of the association objects, which means that three relations can exist, for example, a and/or B, and can mean that a exists alone, a exists together with B, and B exists alone. Wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of the following" and the like means any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
Those of ordinary skill in the art will appreciate that the various elements and algorithm steps described in the embodiments disclosed herein can be implemented as a combination of electronic hardware, computer software, and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In several embodiments provided by the present application, any of the functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely exemplary embodiments of the present application, and any person skilled in the art may easily conceive of changes or substitutions within the technical scope of the present application, which should be covered by the present application. The protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A method for controlling hardware resources, the method being applied to an electronic device, the method comprising:
receiving a first operation of a user;
in response to the first operation, starting a display process;
receiving a second operation of a user for a camera application of the electronic device;
responding to the second operation, and starting a camera process;
based on a call request of the display process to a color temperature sensor of the electronic equipment, a call request of the camera process to the color temperature sensor, and a first flag bit for controlling the power-on or power-off of the color temperature sensor, wherein the value of the first flag bit is used for indicating the number of processes which have currently called the color temperature sensor;
and after the color temperature sensor is controlled to be electrified or powered off, updating the value of the first zone bit.
2. The hardware resource control method of claim 1, wherein the controlling the powering up or powering down of the color temperature sensor based on the call request of the display process to the color temperature sensor of the electronic device and the call request of the camera process to the color temperature sensor, and the first flag bit, comprises:
acquiring the type of a call request of the display process or the camera process to a color temperature sensor of the electronic equipment;
when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor, and the first flag bit is 0, powering on the color temperature sensor is controlled;
and when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering on the color temperature sensor, and the first flag bit is not 0, maintaining the powering-on state of the color temperature sensor, and not executing the powering-on process.
3. The hardware resource control method of claim 2, wherein after the obtaining the type of the call request of the display process or the camera process to the color temperature sensor of the electronic device, the method further comprises:
When the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first flag bit is 1, controlling the color temperature sensor to be powered down;
and when the type of the calling request of the display process or the camera process to the color temperature sensor is the type of powering down the color temperature sensor, and the first zone bit is an integer greater than 1, maintaining the powering-on state of the color temperature sensor, and not executing the powering-down process.
4. The hardware resource control method of claim 3, wherein updating the value of the first flag bit after controlling the color temperature sensor to be powered on or powered off comprises:
after the color temperature sensor is controlled to be electrified, adding 1 to the value of the first zone bit;
and after the color temperature sensor is controlled to be powered down, subtracting 1 from the value of the first zone bit.
5. The hardware resource control method of claim 4, wherein after updating the value of the first flag bit, the method further comprises:
monitoring a first use state of the color temperature sensor after controlling the color temperature sensor to be powered on;
When the first use state of the color temperature sensor is a power-on abnormal state, determining that the color temperature sensor fails to be powered on;
and subtracting 1 from the first zone bit after the power-on failure of the color temperature sensor.
6. The hardware resource control method of claim 4, wherein after updating the value of the first flag bit, the method further comprises:
monitoring a second use state of the color temperature sensor after controlling the color temperature sensor to be powered down;
when the second use state of the color temperature sensor is detected to be a power-down abnormal state, determining that the color temperature sensor fails to power down;
and after the color temperature sensor fails to be powered down, adding 1 to the first flag bit.
7. The hardware resource control method of any of claims 1 to 6, wherein the method further comprises:
acquiring a call request of each application process to the color temperature sensor;
matching the calling request of each application process to the color temperature sensor with a preset request parameter list, wherein the preset notification parameter list comprises all application process information capable of calling the color temperature sensor;
And determining the number of processes which are currently called for the color temperature sensor according to the matching result.
8. The hardware resource control method of any one of claims 1 to 6 wherein the first operation is a power-on operation.
9. The hardware resource control method of any one of claims 1 to 6, wherein the second operation is an operation to launch the camera application.
10. An electronic device, comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, which when executed by the electronic device, cause the electronic device to perform the hardware resource control method of any of claims 1-9.
11. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, causes the processor to execute the hardware resource control method of any one of claims 1 to 9.
CN202211295998.3A 2022-10-21 2022-10-21 Hardware resource control method, electronic device and readable storage medium Active CN116700815B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211295998.3A CN116700815B (en) 2022-10-21 2022-10-21 Hardware resource control method, electronic device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211295998.3A CN116700815B (en) 2022-10-21 2022-10-21 Hardware resource control method, electronic device and readable storage medium

Publications (2)

Publication Number Publication Date
CN116700815A true CN116700815A (en) 2023-09-05
CN116700815B CN116700815B (en) 2024-04-26

Family

ID=87832783

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211295998.3A Active CN116700815B (en) 2022-10-21 2022-10-21 Hardware resource control method, electronic device and readable storage medium

Country Status (1)

Country Link
CN (1) CN116700815B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778641A (en) * 2021-08-09 2021-12-10 荣耀终端有限公司 Method for controlling camera, electronic device and computer readable storage medium
CN113899448A (en) * 2020-06-22 2022-01-07 北京小米移动软件有限公司 Electronic equipment, ambient light color temperature measuring method and device and storage medium
CN114490010A (en) * 2020-10-27 2022-05-13 华为技术有限公司 Resource operation control method, electronic device, chip and readable storage medium
CN114625525A (en) * 2020-12-14 2022-06-14 华为技术有限公司 Resource control method and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113899448A (en) * 2020-06-22 2022-01-07 北京小米移动软件有限公司 Electronic equipment, ambient light color temperature measuring method and device and storage medium
CN114490010A (en) * 2020-10-27 2022-05-13 华为技术有限公司 Resource operation control method, electronic device, chip and readable storage medium
CN114625525A (en) * 2020-12-14 2022-06-14 华为技术有限公司 Resource control method and equipment
CN113778641A (en) * 2021-08-09 2021-12-10 荣耀终端有限公司 Method for controlling camera, electronic device and computer readable storage medium

Also Published As

Publication number Publication date
CN116700815B (en) 2024-04-26

Similar Documents

Publication Publication Date Title
KR102148948B1 (en) Multi tasking method of electronic apparatus and electronic apparatus thereof
US10631361B2 (en) Method and apparatus for providing user with information received by electronic device
KR102187255B1 (en) Display method of electronic apparatus and electronic appparatus thereof
EP3712742A1 (en) Electronic device and method for configuring display thereof
CN112055424B (en) Electronic device and method for switching electronic device
US10198057B2 (en) Electronic device and method for measuring position change
CN107800865B (en) Electronic device and method for displaying time information in low power state
CN103631580B (en) Method and device for generating theme icon
KR102157858B1 (en) Apparatas and method for reducing a power consumption in an electronic device
US20170265079A1 (en) Electronic device and method for acquiring biometric information thereof
US20180032195A1 (en) Method of processing touch events and electronic device adapted thereto
KR20150066876A (en) Method for controlling an user interface and an electronic device
KR20150051078A (en) Lock screen display method of electronic apparatus and electronic appparatus thereof
CN114153621A (en) System process regulation and control method and device, electronic equipment and readable storage medium
US10237087B2 (en) Method for controlling transmission speed and electronic device thereof
CN111191227B (en) Method and device for preventing malicious code from executing
KR20150085996A (en) Method and apparatus for shifting display drive frequency for avoiding noise of electronic sensor module
KR20170114468A (en) Electronic device and control method using audio components thereof
CN116700815B (en) Hardware resource control method, electronic device and readable storage medium
CN111897726B (en) Abnormality positioning method, abnormality positioning device, storage medium and mobile terminal
CN116156044A (en) Equipment cooperation method and related device
CN107256151A (en) Processing method, device and the terminal of page rendering
CN111625283A (en) Hardware updating method, device, system and computer readable storage medium
CN113760164A (en) Display device and response method of control operation thereof
CN115017473B (en) Authorization method and electronic equipment

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
GR01 Patent grant
GR01 Patent grant