A hardware control method, electronic device, storage medium and program product

By acquiring the target software's on/off control requests, the power on and off of the hardware is dynamically controlled, resolving performance and functional issues caused by overlapping hardware operating frequency ranges. This enables the hardware to operate normally within its respective frequency range, avoiding the impact of frequency offset.

CN122268979APending Publication Date: 2026-06-23BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2024-12-20
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Overlapping operating frequency ranges between different hardware components can affect performance and functionality. Existing technologies avoid conflicting frequency ranges by pre-limiting the operating frequency range of hardware, but this leads to a decrease in the accuracy of performance test data and cannot cope with dynamic shifts in frequency range.

Method used

The system obtains the on/off control request from the target software for the first hardware, turns on the first hardware and turns off the second hardware whose operating frequency range overlaps with its own, and achieves dynamic control of the hardware through the hardware abstraction layer.

Benefits of technology

This ensures that the hardware operates within its own frequency range without additional restrictions, resolves the potential problems caused by dynamic offsets in the hardware's operating frequency range, and avoids conflicts between hardware components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122268979A_ABST
    Figure CN122268979A_ABST
Patent Text Reader

Abstract

One or more embodiments of the present specification provide a hardware control method, an electronic device, a storage medium and a program product, the method comprising: obtaining a switch control request initiated by target software for a first hardware, the first hardware and a second hardware having an overlapping conflict frequency interval in a working frequency range; in the case that the switch control request is used to indicate turning on the first hardware, turning on the first hardware and turning off the second hardware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of computer technology, and more particularly to a hardware control method, electronic device, storage medium, and program product. Background Technology

[0002] Each piece of hardware has a corresponding operating frequency range. However, when the operating frequency ranges of different hardware overlap and multiple hardware devices operate within overlapping conflicting frequency ranges, the performance and functionality of these multiple hardware devices will be affected to varying degrees. Therefore, how to solve the hardware problems caused by overlapping operating frequency ranges has become an urgent issue for the industry.

[0003] In related technologies, hardware whose operating frequency ranges may overlap is typically pre-limited to proactively avoid conflicting frequency intervals and resolve the aforementioned issues. However, this method makes it difficult for the corresponding hardware to cover the conflicting frequency intervals during debugging and other processes, leading to a decrease in the accuracy of the corresponding performance test data. Furthermore, considering the influence of factors such as usage time, temperature, and equipment aging, the operating frequency range of the hardware can dynamically shift, rendering the aforementioned method of pre-limiting the hardware's operating frequency range ineffective. Summary of the Invention

[0004] In view of the above, one or more embodiments of this specification provide the following technical solutions:

[0005] According to a first aspect of one or more embodiments of this specification, a hardware control method is provided, comprising:

[0006] The target software initiates a switch control request for the first hardware, where the operating frequency ranges of the first hardware and the second hardware overlap and conflict frequency ranges.

[0007] When the switch control request is used to instruct the first hardware to be turned on, the first hardware is turned on and the second hardware is turned off.

[0008] According to a second aspect of one or more embodiments of this specification, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in the first aspect by executing the executable instructions.

[0009] According to a third aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect.

[0010] According to a fourth aspect of one or more embodiments of this specification, a computer program product is provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the method as described in the first aspect.

[0011] As can be seen from the above embodiments, this specification can obtain the switch control request initiated by the target software for the first hardware, and when the switch control request indicates that the first hardware be turned on, the first hardware is turned on, and the second hardware whose operating frequency range overlaps with that of the first hardware is turned off. Since the second hardware is turned off, even if the first hardware operates within the operating frequency range corresponding to the aforementioned conflicting frequency range, its performance or functionality will not be affected by the second hardware. In summary, this method ensures that the hardware can operate without additional restrictions within its respective operating frequency range, and also naturally solves the potential problems caused by dynamic shifts in the operating frequency range of the hardware. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of the architecture of a hardware control system provided in an exemplary embodiment.

[0013] Figure 2 This is a flowchart illustrating a hardware control method provided in an exemplary embodiment.

[0014] Figure 3 This is a schematic diagram of an exemplary embodiment of controlling an ultrasonic signal in a handset.

[0015] Figure 4 This is a flowchart illustrating another hardware shutdown method provided in an exemplary embodiment.

[0016] Figure 5 This is a block diagram of a hardware control device provided in an exemplary embodiment.

[0017] Figure 6 This is a schematic diagram of the structure of a hardware control device provided in an exemplary embodiment. Detailed Implementation

[0018] Figure 1 This is a schematic diagram of the architecture of a hardware control system provided in an exemplary embodiment. For example... Figure 1As shown, the system consists of three layers: application layer 12, hardware abstraction layer 14, and hardware layer 16. These layers describe the software-to-hardware organizational structure of a computer system on the same device. Each layer has its specific functions and responsibilities. The devices described can be mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses and smartwatches), etc., but this specification does not impose any limitations on these.

[0019] Application layer 12 contains all user programs and services. These programs are directly user-facing and used to perform specific tasks, such as word processing, web browsing, and gaming. During system operation, the target software in application layer 12 can initiate switch control requests to the first hardware in hardware layer 16 to instruct it to turn on or off. This target software can be system software or application software; this specification does not impose any restrictions on this.

[0020] The Hardware Abstraction Layer (HAL) 14 serves as an intermediary layer connecting the software in the Hardware Layer 16 and the Application Layer 12. Its purpose is to hide the specific implementation details of the hardware and provide a unified and simplified programming interface for the upper-layer software. During system operation, the HAL 14 can receive a switch control request initiated by the target software for the first hardware in the Hardware Layer 16. If the switch control request indicates that the first hardware should be turned on, the HAL 14 will turn on the first hardware and turn off the second hardware in the Hardware Layer 16.

[0021] Hardware layer 16, as the lowest layer of the device, can include at least the physical hardware, including the first hardware and the second hardware, with overlapping conflicting frequency ranges between them. The physical hardware can include: wireless network adapters: such as Wi-Fi modules, Bluetooth modules, and Zigbee modules, which enable the device to communicate wirelessly and connect to the internet or other wireless devices; audio and video devices: such as cameras, speakers, and microphones, used to capture and play audio and video content; peripheral devices: such as radio frequency identification (RFID) readers, keyboards, mice, monitors, printers, and scanners, which extend the computer's functionality and provide more input / output options; sensors: such as accelerometers, gyroscopes, light sensors, temperature and humidity sensors, and ultrasonic sensors, which monitor environmental conditions or device status and feed the data back to the system for further processing; and independent components set within the circuitry, such as oscillators and microcontroller clocks. Furthermore, the hardware layer can also encompass the computer's core components, such as the Central Processing Unit (CPU), Random Access Memory (RAM), storage devices (such as Hard Disk Drives (HDDs) or Solid State Drives (SSDs), and the power management unit. These core components constitute the system's computing and storage foundation, ensuring the effective management and allocation of computing resources. In short, the hardware layer is the foundation of the entire computer system. It not only provides the physical platform required for the operation of upper-layer software but also provides a unified interface to the application layer 12 through the hardware abstraction layer 14. This design simplifies the complex interaction between hardware and software. During system operation, the first hardware component in the hardware layer 16 can be enabled based on the hardware abstraction layer, and the second hardware component can be disabled based on the hardware abstraction layer. Of course, the first hardware component can also be disabled based on the hardware abstraction layer, and the second hardware component can be enabled based on the hardware abstraction layer; this specification does not impose any restrictions on this.

[0022] It should be noted that in the actual implementation, an operating system layer exists between the hardware abstraction layer 14 and the hardware layer 16. As an intermediary between the application software and the hardware, it manages system resources and provides services to the application software, making software development easier for developers. Based on this, the aforementioned upper-layer software can be understood as the application software of the application layer 12 or the operating system corresponding to the aforementioned operating system layer. Furthermore, the hardware abstraction layer 14, as an intermediate layer, can be further interpreted as both including hardware operations and serving the upper-layer application software or operating system. Therefore, the hardware abstraction layer 14 cannot be simply and directly regarded as an independent layer at the same level as the hardware layer and the application layer. It is a special intermediate layer, and its position and function may differ in different system architectures. For example, in embedded systems, the functionality of the hardware abstraction layer 14 can be integrated into the operating system kernel, i.e., the aforementioned operating system layer serves as the de facto hardware abstraction layer 14. In other cases, the hardware abstraction layer 14 may be part of the operating system or exist as an independent component; this specification does not impose any restrictions on this.

[0023] Figure 2 This is a flowchart illustrating a hardware control method provided in an exemplary embodiment of this specification. Figure 2 As shown, the method includes:

[0024] Step S202: Obtain the switch control request initiated by the target software for the first hardware, where the operating frequency ranges of the first hardware and the second hardware have overlapping conflict frequency ranges.

[0025] When a user uses the target software and the software involves the first hardware during its operation, the target software can initiate a switch control request for the first hardware. This request is then obtained by the hardware abstraction layer corresponding to the target software. This switch control request can be further divided into an on control request and a off control request. The on control request can be used to instruct the first hardware to be turned on, and the off control request can be used to instruct the first hardware to be turned off. As mentioned earlier, considering that there is actually an operating system layer between the abstraction layer and the hardware layer, the process by which the hardware abstraction layer corresponding to the target software obtains the switch control request can be implemented either by the target software directly calling the interface provided by the hardware abstraction layer, or by the target software first calling the wrapped interface provided by the operating system layer, and then the operating system layer calling the interface provided by the hardware abstraction layer. Developers can design according to actual needs, and this specification does not impose any restrictions on this.

[0026] The operating frequency ranges of the first and second hardware devices overlap and conflict with each other. This means that when the operating frequencies of the first and second hardware devices are within conflicting frequency ranges, they will conflict with each other, negatively impacting performance and functionality to varying degrees. Specifically, the operating frequency ranges of the first and second hardware devices can be either the driving electrical signal frequency range or the energy output frequency range corresponding to their respective hardware. In other words, the formation of the aforementioned conflicting frequency range includes at least one of the following: the driving electrical signal frequency range of the first hardware device can conflict with the driving electrical signal frequency range of the second hardware device; the driving electrical signal frequency range of the first hardware device can conflict with the energy output frequency range of the second hardware device; and the energy output frequency range of the second hardware device can also conflict with the energy output frequency range of the first hardware device. Furthermore, the energy in the aforementioned energy output frequency can be, for example, sound energy output from a handset, light energy output from an LED or flashlight, or electromagnetic waves output from a Wi-Fi or Bluetooth module. Each form of energy output has its specific frequency range. The aforementioned driving electrical signal frequency is the electrical signal frequency required to drive the corresponding hardware in the circuit, where the electrical signal can be, for example, an oscillator, a clock signal, or other control signal. Furthermore, the so-called operating frequency range can be defined as the range of values ​​formed by two frequency numbers of different sizes, or it can be defined as the range of values ​​formed by two frequency numbers of the same size. In this case, the operating frequency range is equivalent to a fixed value.

[0027] Of course, the overlap of the operating frequency ranges of the first hardware and the second hardware can be further classified. For example, if the operating frequency range of the first hardware is completely within the operating frequency range of the second hardware, then the entire operating frequency range of the first hardware can be understood as the aforementioned conflicting frequency interval. Or, if the operating frequency ranges of the first hardware and the second hardware intersect, then the frequency intersection of the two can be understood as the aforementioned conflicting frequency interval.

[0028] For example, consider a mobile device like a smartphone, which is equipped with both an earpiece and a gyroscope. The earpiece, as an audio signal transmitter, can emit audio within the human audible range (20 Hz to 20,000 Hz) and ultrasonic signals above 20,000 Hz. When this ultrasonic signal comes into contact with the user's head, an air gesture, or an object requiring precise distance, it is reflected and received by the corresponding ultrasonic receiver. The receiver analyzes the distance to the object and performs targeted actions. For instance, the screen automatically turns off when the phone is close to the ear to prevent accidental touches and save power. Alternatively, the user can control the phone via air gestures, such as answering calls, changing songs, or taking photos. For ease of explanation below, this manual will refer to these ultrasonic-based capabilities collectively as ultrasonic distance sensing functionality. The gyroscope measures and reports changes in the device's angular velocity, enabling features such as automatic screen orientation adjustment, augmented reality (AR), and optical image stabilization (OIS) for cameras. Assuming the gyroscope's operating frequency range is entirely within the earpiece's operating frequency range, when the earpiece emits an ultrasonic signal, its energy output frequency falls within a conflicting frequency range that overlaps with the gyroscope's driving electrical signal frequency range. In other words, the ultrasonic signal frequency conflicts with the circuit signal frequency driving the earpiece. To put it another way, if a user activates OIS (Optical Image Stabilization) in a camera while simultaneously using the earpiece's ultrasonic distance sensing function, OIS will fail, leading to blurry photos or videos due to hand tremors or other slight movements. Furthermore, the accuracy of the distance results obtained from the ultrasonic distance sensing will be significantly reduced. In short, the earpiece and gyroscope using ultrasonic distance sensing can be understood as a pair of hardware components with conflicting operating frequency ranges. Similarly, there are also corresponding conflicting frequency ranges between ultrasonic sensors and gyroscopes specifically used for transmitting and receiving ultrasonic waves, wireless network modules and Bluetooth modules, RFID readers and Zifeng modules, near-field communication modules and oscillators, and ultrasonic sensors and microcontroller clocks. The only difference lies in the different frequency types corresponding to their respective operating frequency ranges, which are not restricted in this specification.

[0029] It is understandable that, for example, the aforementioned wireless network module and the aforementioned Bluetooth module, etc., usually do not interfere with each other in actual scenarios. This is because they use methods such as different protocols, shielding and filtering to reduce the degree of interference, or achieve coexistence indirectly through time slicing and other mechanisms. However, they may still have interference problems in scenarios such as high-density environments. Therefore, for such hardware, the solution proposed in this application for the conflict frequency range between hardware still has advantages in terms of cost and effectiveness in specific scenarios.

[0030] In addition to the second hardware mentioned above, there may be one or more other hardware components that have conflicting frequency ranges that overlap with the operating frequency range of the first hardware. These components can be disabled in the next step of this manual.

[0031] Step S204: If the switch control request is used to instruct the first hardware to be turned on, turn on the first hardware and turn off the second hardware.

[0032] After successfully obtaining the switch control request initiated for the first hardware at the hardware abstraction layer corresponding to the target software, the subsequent overall execution strategy can be determined based on the type of switch control request. For example, if the switch control request is used to indicate that the first hardware is turned on, the first hardware can be turned on and the second hardware can be turned off based on the hardware abstraction layer, thereby avoiding conflicts between the first hardware and the second hardware due to being in the conflict frequency range. Or, if the switch control request is used to indicate that the first hardware is turned off, the first hardware can be turned off and the second hardware can be turned on based on the hardware abstraction layer, thereby preventing the second hardware from being unusable by other software.

[0033] In one embodiment, the hardware abstraction layer may include a first hardware abstraction layer corresponding to a first hardware, a second hardware abstraction layer corresponding to a second hardware, and a third hardware abstraction layer corresponding to the target software. The first, second, and third hardware abstraction layers can be the same type of hardware abstraction layer, or they can be different types of hardware abstraction layers. Alternatively, two of the hardware layers can be the same type of hardware abstraction layer, and the remaining hardware layers can be different types of hardware abstraction layers; this specification does not impose any limitations on this. Based on this, a first control interface for the first hardware can be called through the third hardware abstraction layer to request the first hardware abstraction layer to enable the first hardware, and a second control interface for the second hardware can be called through the third hardware abstraction layer to request the second hardware abstraction layer to disable the second hardware. The first control interface can be used to turn the first hardware on or off, and the second control interface can be used to turn the first hardware on or off. Both the first and second control interfaces can be configured in a hardware abstraction layer that is independent of the first, second and third hardware abstraction layers, such as the Sensor Control Plane Hardware Abstraction Layer (sensor hal) provided by the Android system, so as to facilitate the unified management of each control interface.

[0034] Taking the aforementioned first control interface as an example, without pre-setting any hardware abstraction layer to be ignored, the first control interface can be called by any hardware abstraction layer, allowing any hardware abstraction layer to quickly control the first hardware through the first control interface. The following example... Figure 3 Taking a mobile device as an example, suppose that the first hardware is a gyroscope 310, the second hardware is an earpiece 312, the first hardware abstraction layer and the third hardware abstraction layer both correspond to the camera hardware abstraction layer (Camera HAL) 304, and the second hardware abstraction layer corresponds to the audio hardware abstraction layer (Audio HAL) 308. When the camera software 302 is opened and the OIS (Optical Image Stabilization) function is activated, the camera software 302 can call the interface of the corresponding camera hardware abstraction layer 304 to enable the gyroscope required for the OIS function. Simultaneously, after receiving the switch control request corresponding to the interface call operation, the camera hardware abstraction layer 304 can, on one hand, call the gyroscope control interface in the sensor control plane hardware abstraction layer 306 for the gyroscope hardware configuration, thereby enabling the gyroscope 310 through the corresponding hardware driver. On the other hand, the camera hardware abstraction layer 304 can, for example, use an inter-process communication (IPC) interface to notify the audio hardware abstraction layer 308 to call the earpiece control interface in the sensor control plane hardware abstraction layer 306 for the earpiece 312 hardware configuration, thereby disabling the earpiece 312 through the corresponding hardware driver. The communication interface between different hardware abstraction layers can indicate whether the corresponding hardware is turned on or off by transmitting different parameters. For example, it is specified that transmitting "RECEIVER-Mute=1" in the communication interface indicates that the earpiece 312 is turned on, and transmitting "Receiver-Mute=0" indicates that the earpiece 312 is turned off.

[0035] Combining the operating frequency ranges of the first and second hardware mentioned above, which can be the driving electrical signal frequency range or energy output frequency range of their respective hardware, the specific execution method of the above shutdown operation can be determined according to the different operating frequency ranges.

[0036] In one embodiment, when the operating frequency range of the second hardware is within the driving signal frequency range, the hardware abstraction layer can shut down the second hardware by stopping the driving of the second hardware. In this case, the second hardware is completely shut down and cannot function properly until the driving is resumed. In this embodiment, shutting down the second hardware can be defined as disabling it. Disabling and enabling are different from turning on and off; the former is a prerequisite for the latter. For example, when the second hardware is disabled, even if other software initiates a switch control request to try to turn it on, the second hardware will remain in a closed state and cannot be turned on. When the second hardware is enabled, other software can initiate a switch control request to turn the second hardware on or off normally.

[0037] In another embodiment, when the operating frequency range of the second hardware is within the energy output frequency range, the hardware abstraction layer, in addition to shutting down the second hardware by stopping the drive in the previous embodiment, can also refuse to execute energy output operations in the corresponding conflicting frequency range within the operating frequency range of the second hardware. This ensures that the second hardware operates normally in the non-conflicting frequency range while avoiding conflict with the first hardware whose operating frequency is in the conflicting frequency range. Still using... Figure 3 For example, assuming the second hardware is the earpiece 312, the second method in this embodiment is equivalent to adding an ultrasonic algorithm engine for shielding the ultrasonic frequency of the earpiece to the specific implementation of the earpiece control interface in the sensor control plane hardware abstraction layer 306. When the audio hardware abstraction layer 308 calls the earpiece control interface to turn off the earpiece 312, the ultrasonic algorithm engine will implement the corresponding turn-off command as shielding the ultrasonic frequency of the earpiece.

[0038] It is understandable that the above-mentioned activation operation can be regarded as the reverse operation of the corresponding deactivation operation in different operating frequency ranges. The relevant technical principles are the same, and this manual will not elaborate further.

[0039] Since the frequency range of the driving electrical signal is usually set to a fixed parameter when the corresponding hardware is manufactured, it is difficult to further divide the conflicting frequency range or the non-conflicting frequency range. Therefore, it is difficult to achieve the behavior of refusing to perform the energy output operation corresponding to the conflicting frequency range in the operating frequency range of the second hardware, similar to the behavior in the previous embodiment.

[0040] Considering the subsequent impact of the shutdown operation, this manual, on the one hand, in scenarios where only one foreground software is specified (such as mobile phones), can make "opening the target software as the foreground software" one of the necessary conditions for initiating the aforementioned switch control request. This avoids situations where the user device is multitasking with multiple software applications simultaneously, and the foreground software is shut down due to arbitrary switch control requests from background software, thus affecting the user experience. The necessary condition for initiating the aforementioned switch control request may also include the user performing preset clicks, voice commands, gestures, etc., within the target software. On the other hand, the actions of "switching the target software from the foreground to the background software" and / or "exiting the target software" can be used as triggering conditions for initiating the aforementioned shutdown control request. This avoids situations where the user device is multitasking with multiple software applications simultaneously, and the foreground software shuts down the corresponding hardware through a switch control request and then switches to the background software, resulting in the hardware not being turned on in time, thus affecting other foreground software that needs to have that hardware turned on.

[0041] Furthermore, the solution in this specification can also maintain a global status flag in the hardware abstraction layer corresponding to the second hardware to indicate whether the second hardware is turned off. This global status flag is updated when the second hardware is turned off, so that it indicates the second hardware has been turned off. Based on this, the hardware abstraction layer can obtain the switch control request initiated for the second hardware and the global status flag for the second hardware, and cancel the processing operation of the switch control request initiated for the second hardware if the global status flag indicates that the second hardware is turned off. This is consistent with the effect of making "opening the target software as foreground software" one of the necessary conditions for initiating the switch control request, but its advantage lies in its lower implementation difficulty and applicability to situations where multiple foreground software exist simultaneously.

[0042] It is understandable that, in addition to the second hardware mentioned above, theoretically all hardware can be configured with a one-to-one global status identifier to ensure that diverse functional judgments can be achieved based on the shutdown or startup logic of different hardware.

[0043] Based on global status indicators, this manual can also address situations where the target software crashes due to abnormal errors.

[0044] In one embodiment, if the target software experiences an abnormal restart, a global status identifier of the second hardware can be obtained, and it can be determined whether the global status identifier indicates that the second hardware has been shut down. If the determination result is yes, it means that the target software did not promptly reopen the previously shut-down second hardware before the abnormal shutdown. Therefore, the global status identifier can be updated to indicate that the second hardware has been turned on, and the startup operation for the second hardware can be performed again. If the determination result is no, it means that the target software had already reopened the previously shut-down second hardware before the abnormal shutdown. Therefore, no additional operation is required, and the second hardware can be turned on normally.

[0045] The following is combined with Figure 4 The process of the hardware shutdown method will be further described. For example... Figure 4 As shown, this method protects the following steps:

[0046] Step S402: Open the camera software and activate the OIS (Optical Image Stabilization) function.

[0047] In one embodiment, assuming that a mobile phone device running the Android system has two devices, a gyroscope and an earpiece, when the phone opens the camera software and activates the OIS (Optical Image Stabilization) function in the software, the phone needs to activate the gyroscope required for the OIS function and avoid the earpiece emitting ultrasonic signals whose operating frequency range conflicts with that of the gyroscope.

[0048] In step S404, the camera hardware abstraction layer notifies the audio hardware abstraction layer to specify a shutdown operation for the earpiece by calling the elliptic_notify_audio_hal interface.

[0049] In one embodiment, since the camera software corresponds to the camera hardware abstraction layer and the earpiece corresponds to the audio hardware abstraction layer, the camera hardware abstraction layer logically needs to notify the audio hardware abstraction layer to handle the cancellation operation for the earpiece through the inter-process communication interface elliptic_notify_audio_hal. The communication content of elliptic_notify_audio_hal is "Receiver-Mute=0".

[0050] In step S406, the audio hardware abstraction layer turns off the earpiece by calling the earpiece control interface in the sensor hal.

[0051] In one embodiment, the audio hardware abstraction layer stops the circuitry from driving the earpiece by calling the earpiece control interface in the sensor hal.

[0052] Step S408: Set a global status flag to indicate that the earpiece is turned off.

[0053] In one embodiment, a global status flag “Receiver-Mute-Statusv=turn” can be set to indicate that the earpiece is turned off, ensuring that even if the camera software restarts abnormally, it can still be confirmed whether the earpiece was turned off before the restart.

[0054] Please refer to Figure 5 A hardware control method can be applied to, for example... Figure 5 The device shown is used to implement the technical solution described in this specification. The hardware control device may include:

[0055] The request acquisition unit 502 is used to acquire the switch control request initiated by the target software for the first hardware, wherein the operating frequency ranges of the first hardware and the second hardware have overlapping conflict frequency ranges.

[0056] A first hardware control unit 504 is configured to turn on the first hardware and turn off the second hardware when the switch control request instructs the first hardware to be turned on.

[0057] Optionally, the operating frequency ranges of the first hardware and the second hardware are respectively the driving electrical signal frequency range or the energy output frequency range of their respective hardware.

[0058] Optionally, the first hardware control unit 504 is specifically used for:

[0059] When the operating frequency range of the second hardware is within the frequency range of the driving electrical signal, stop driving the second hardware;

[0060] If the operating frequency range of the second hardware is within the energy output frequency range, stop driving the second hardware, or refuse to perform energy output operations corresponding to the conflicting frequency interval within the operating frequency range of the second hardware.

[0061] Optionally, the first hardware control unit 504 is specifically used for:

[0062] The first control interface for the first hardware is called through the third hardware abstraction layer corresponding to the target software to request the first hardware abstraction layer corresponding to the first hardware to enable the first hardware.

[0063] The target software calls the second control interface for the second hardware through the third hardware abstraction layer corresponding to the target hardware, in order to request the second hardware abstraction layer corresponding to the second hardware to shut down the second hardware.

[0064] Optionally, the hardware abstraction layer corresponding to the second hardware maintains a global state flag to indicate whether the second hardware is turned off.

[0065] The first hardware control unit 504 is specifically configured to: shut down the second hardware and update the global status identifier so that it can be used to indicate that the second hardware is shut down;

[0066] The device further includes: an identification determination unit, configured to acquire the switch control request initiated for the second hardware and the global status identifier; and, if the global status identifier indicates that the second hardware is turned off, to cancel the processing operation of the switch control request initiated for the second hardware.

[0067] Optionally, the device further includes:

[0068] The software restart unit is used to obtain the global status identifier and determine whether the global status identifier indicates that the second hardware has been shut down when the target software restarts abnormally.

[0069] If the determination result is yes, update the global state identifier so that it can be used to indicate that the second hardware is turned on, and turn on the second hardware.

[0070] Optionally, the device further includes:

[0071] A second hardware control unit is configured to shut down the first hardware and turn on the second hardware when the switch control request instructs the first hardware to be turned off.

[0072] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments of the relevant methods, and will not be elaborated upon here.

[0073] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0074] Based on the same concept as the methods described above, this specification also provides a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.

[0075] Based on the same concept as the methods described above, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.

[0076] Figure 6 This is a schematic block diagram illustrating an electronic device according to embodiments of the present disclosure. For example, the electronic device 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0077] Reference Figure 6 The electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.

[0078] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.

[0079] Memory 604 is configured to store various types of data to support the operation of electronic device 600. Examples of such data include instructions for any application software or method operating on electronic device 600, contact data, phone book data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0080] Power supply component 606 provides power to various components of electronic device 600. Power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.

[0081] Multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0082] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.

[0083] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0084] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 can detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or a component of electronic device 600, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0085] Communication component 616 is configured to facilitate wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, 4G LTE, 9G NR, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0086] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described in any of the above embodiments.

[0087] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0088] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This specification is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0089] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A hardware control method, characterized by, The method includes: The target software initiates a switch control request for the first hardware, where the operating frequency ranges of the first hardware and the second hardware overlap and conflict frequency ranges. When the switch control request is used to instruct the first hardware to be turned on, the first hardware is turned on and the second hardware is turned off.

2. The method of claim 1, wherein, The operating frequency ranges of the first hardware and the second hardware correspond to the driving electrical signal frequency range or the energy output frequency range of their respective hardware.

3. The method of claim 2, wherein, The step of shutting down the second hardware includes: When the operating frequency range of the second hardware is within the frequency range of the driving electrical signal, stop driving the second hardware; If the operating frequency range of the second hardware is within the energy output frequency range, stop driving the second hardware, or refuse to perform energy output operations corresponding to the conflicting frequency interval within the operating frequency range of the second hardware.

4. The method of claim 1, wherein, The step of turning on the first hardware and turning off the second hardware includes: The first control interface for the first hardware is called through the third hardware abstraction layer corresponding to the target software to request the first hardware abstraction layer corresponding to the first hardware to enable the first hardware. The target software calls the second control interface for the second hardware through the third hardware abstraction layer corresponding to the target hardware, in order to request the second hardware abstraction layer corresponding to the second hardware to shut down the second hardware.

5. The method of claim 1, wherein, The hardware abstraction layer corresponding to the second hardware maintains a global state flag to indicate whether the second hardware is turned off; The step of shutting down the second hardware includes: shutting down the second hardware and updating the global state identifier so that it can be used to indicate that the second hardware has been shut down; The method further includes: acquiring the switch control request initiated for the second hardware and the global status identifier; and canceling the processing operation of the switch control request initiated for the second hardware if the global status identifier indicates that the second hardware is turned off.

6. The method of claim 5, wherein, The method further includes: In the event of an abnormal restart of the target software, the global status identifier is obtained, and it is determined whether the global status identifier indicates that the second hardware has been shut down. If the determination result is yes, update the global state identifier so that it can be used to indicate that the second hardware is turned on, and turn on the second hardware.

7. The method of claim 1, wherein, The method further includes: When the switch control request is used to instruct the first hardware to be turned off, the first hardware is turned off and the second hardware is turned on.

8. The method of claim 1, wherein, The first hardware and the second hardware are respectively hardware from any combination of the following: earpiece and gyroscope, ultrasonic sensor and gyroscope, wireless network module and Bluetooth module, radio frequency identification reader and Zifeng module, near field communication module and oscillator, ultrasonic sensor and microcontroller clock; the first hardware and the second hardware are different from each other.

9. An electronic device, comprising: include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method as described in any one of claims 1-7 by executing the executable instructions.

10. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-7.

11. A computer program product, characterised in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-7.