Method and device for calling hardware configuration by driving program, medium and equipment

By obtaining and updating the hardware configuration of electronic devices, the problem of poor compatibility between drivers and hardware is solved, and higher driver reusability and update efficiency are achieved.

CN119336407APending Publication Date: 2025-01-21GUANGDONG KETYOO INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411385042.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the prior art, the drivers of electronic devices have poor compatibility with hardware and low reusability, resulting in the need of the user to rewrite the driver code when hardware changes.

Method used

By obtaining the function code collection of the target hardware, the corresponding relationship between the pre -storage function code and the hardware configuration, the configuration of the target hardware, and updating the hardware configuration of the driver call.

Benefits of technology

It improves the compatibility and reuse of the driver and hardware, so that the driver can directly write the new hardware without the user's manual writing, reducing the complexity of the driver update.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336407A_ABST
    Figure CN119336407A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for calling hardware configuration by a driver, a medium and equipment, the method and the device are applied to electronic equipment, the electronic equipment comprises target hardware, and the method comprises the following steps: acquiring a first function code set of the target hardware; obtaining target hardware configuration corresponding to the first function code set according to a pre-stored corresponding relationship between function codes and hardware configuration; and according to the target hardware configuration, updating the hardware configuration called by a driving program of the electronic equipment. According to the method, the compatibility of the driving program and hardware can be improved, and the reusability of the driving program is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of driver program calling hardware configuration, and in particular to a method, apparatus, medium and device for driver program calling hardware configuration. Background Art

[0002] Many functions of electronic devices are realized by running drivers to drive the hardware. When the hardware of an electronic device changes, the original driver of the electronic device often cannot drive the new hardware. At this time, the user needs to rewrite the corresponding driver according to the new hardware. Therefore, in the prior art, the driver of the electronic device has technical defects such as poor compatibility with the hardware and low reusability. Summary of the invention

[0003] The purpose of this application is to overcome the shortcomings and deficiencies in the prior art and to provide a method, apparatus, medium and device for a driver to call hardware configuration, which can improve the compatibility of the driver and hardware and enhance the reusability of the driver.

[0004] A first aspect of an embodiment of the present application provides a method for updating a hardware configuration by program invocation, which is applied to an electronic device, wherein the electronic device includes target hardware, including:

[0005] Obtain a first function code set of target hardware;

[0006] According to the pre-stored correspondence between the function code and the hardware configuration, obtaining the target hardware configuration corresponding to the first function code set;

[0007] The hardware configuration called by the driver of the electronic device is updated according to the target hardware configuration.

[0008] A second aspect of an embodiment of the present application provides a hardware configuration update device called by a program, which is applied to an electronic device, wherein the electronic device includes target hardware, including:

[0009] A first function code set acquisition module, used to acquire a first function code set of target hardware;

[0010] A target hardware configuration acquisition module, used to acquire the target hardware configuration corresponding to the first function code set according to the pre-stored correspondence between the function code and the hardware configuration;

[0011] An execution module, configured to update a hardware configuration called by a driver of the electronic device according to the target hardware configuration;

[0012] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the hardware configuration update method called by the program as described above are implemented.

[0013] The fourth aspect of an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein when the processor executes the computer program, the steps of the hardware configuration update method called by the program as described above are implemented.

[0014] Compared with the related art, the present application obtains the target hardware configuration corresponding to the first function code set of the target hardware based on the correspondence between the pre-stored function code and the hardware configuration, and then updates the hardware configuration called by the driver of the electronic device based on the target hardware configuration, so that the driver after the updated hardware configuration can smoothly drive the target hardware, and there is no need for the user to rewrite the program code corresponding to the target hardware, which can avoid directly writing and modifying the source code of the driver, thereby improving the compatibility of the driver with the hardware and the reusability of the driver.

[0015] In order to provide a clearer understanding of the present application, the specific implementation of the present application will be described below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flowchart of a method for updating a hardware configuration called by a program according to an embodiment of the present application.

[0017] Figure 2 This is a flowchart of S31-S32 of a method for updating a hardware configuration called by a program according to an embodiment of the present application.

[0018] Figure 3 A schematic diagram of module connections of a hardware configuration updating device called by a program according to an embodiment of the present application.

[0019] 100. A hardware configuration updating device called by a program; 101. A first function code set acquisition module; 102. A target hardware configuration acquisition module; 103. An execution module. DETAILED DESCRIPTION

[0020] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0021] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present application.

[0022] When the following description relates to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. The singular forms of "a", "said" and "the" used in the present application and the appended claims are also intended to include the majority form, unless the context clearly indicates other meanings. The words "if" / "if" used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0023] In addition, in the description of this application, unless otherwise specified, "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0024] See also Figure 1 , which is a flowchart of a program-called hardware configuration update method of an embodiment of the present application. The method is applied to an electronic device, and the electronic device includes target hardware.

[0025] The electronic device may be a smart home device, such as a smart lock, a clothes drying machine, a remote control, etc. The target hardware refers to the electronic device, which may be a WIFI component, a lock switch component, a motor component, a lighting component, etc.

[0026] The hardware configuration update methods called by the program include:

[0027] S1: Obtain the first function code set of the target hardware.

[0028] The first function code set is a set of function codes corresponding to the target hardware input by the user, and the function code is a code used to drive the hardware to perform functional behavior, usually expressed in hexadecimal. Specifically, the first function code set includes at least one function code corresponding to the target hardware. The first function code set can be obtained by the following steps:

[0029] The first function code set is obtained according to the multiple function codes corresponding to the target hardware input by the user, wherein the multiple function codes corresponding to the target hardware input by the user may be function codes typed by the user, function codes recognized by an image recognition function, or function codes read from a file recording the function codes of the target hardware.

[0030] S2: According to the pre-stored correspondence between the function code and the hardware configuration, obtaining the target hardware configuration corresponding to the first function code set.

[0031] The correspondence between the function code and the hardware configuration can be pre-stored in the data storage of the electronic device. The more function codes in the first function code set, the more accurate the target hardware configuration is, and the target hardware configuration refers to the configuration information including the hardware input configuration and the hardware output configuration of the hardware. The hardware of the same type but different models may have different corresponding hardware input configurations and hardware output configurations. For example, different types of WIFI components may have different corresponding hardware input configurations and hardware output configurations, and different types of lighting components may have different corresponding hardware input configurations and hardware output configurations.

[0032] S3: updating the hardware configuration called by the driver of the electronic device according to the target hardware configuration.

[0033] Wherein, updating the hardware configuration called by the driver of the electronic device may be to re-determine the called hardware configuration from multiple initial hardware configurations recorded by the driver, or to replace and update the initial hardware configuration of the driver. Multiple initial hardware configurations refer to configuration information of multiple hardware recorded in the driver.

[0034] Compared with the related art, the present application obtains the target hardware configuration corresponding to the first function code set of the target hardware based on the correspondence between the pre-stored function code and the hardware configuration, and then updates the hardware configuration called by the driver of the electronic device based on the target hardware configuration, so that the driver after the updated hardware configuration can smoothly drive the target hardware, and there is no need for the user to rewrite the program code corresponding to the target hardware, which can avoid directly writing and modifying the source code of the driver, thereby improving the compatibility of the driver with the hardware and the reusability of the driver.

[0035] See also Figure 2 In a feasible embodiment, the step of S3: updating the hardware configuration called by the driver of the electronic device comprises:

[0036] S311: Acquire multiple initial hardware configurations of the initial hardware from the driver.

[0037] S312: Determine an initial hardware configuration that is the same as the target hardware configuration as the hardware configuration called by the driver to update the hardware configuration called by the driver.

[0038] Specifically, when the hardware of an electronic device changes, the hardware configuration originally called by the driver may not correspond to the new hardware. At this time, it is necessary to determine the new hardware configuration called by the driver from multiple initial hardware configurations recorded by the driver based on the target hardware configuration corresponding to the first function code set.

[0039] In this embodiment, by determining a new hardware configuration called by the driver, the driver can smoothly drive the target hardware, thereby improving the driver's compatibility with the hardware and the driver's reusability.

[0040] In a feasible embodiment, the step of S3: updating the driver of the electronic device according to the target hardware configuration includes:

[0041] S321: Obtaining initial hardware configuration of initial hardware from the driver;

[0042] S322: Update the initial hardware configuration according to the target hardware configuration.

[0043] The initial hardware configuration includes a plurality of initial configuration information; and the target hardware configuration includes a plurality of target configuration information.

[0044] Step S322 may include:

[0045] S3221: Obtain the information location of each of the initial configuration information in the driver.

[0046] The information location refers to the code location of the initial configuration information in the program code of the driver. Optionally, the initial configuration information may be concentrated in one code location of the program code of the driver, or distributed in multiple code locations of the program code of the driver.

[0047] S3222: According to the information position, each of the target configuration information replaces each of the initial configuration information.

[0048] Among them, both the target configuration information and the initial configuration information have configuration information attributes. For example, the power input port of the target configuration information and the power input port of the initial configuration information belong to the same configuration information attribute. According to the information position, the target configuration information can be replaced with the initial configuration information of the same configuration information attribute to update the initial hardware configuration according to the target hardware configuration.

[0049] In this embodiment, the target hardware configuration is used to replace the initial hardware configuration to update the driver so that the driver can successfully drive the target hardware. Moreover, since the configuration modification can be automatically replaced and modified according to the information location, and since the replacement modification does not affect the source code of the driver, the driver's compatibility with the hardware and the driver's reusability are improved, and the driver's update efficiency and convenience can also be improved.

[0050] In a feasible embodiment, after the step of S1: obtaining the first function code set of the target hardware, the method includes:

[0051] S11: Obtain the code position of each initial function code in the driver program.

[0052] The code position refers to the code position of the initial function code in the program code of the driver. Optionally, the initial function code can be concentrated in one code position of the program code of the driver, or can be distributed in multiple code positions of the program code of the driver.

[0053] S12: According to the code position, replace each of the initial function codes with a function code in the first function code set.

[0054] Among them, the function codes in the first function code set and the initial function code both have function code attributes. For example, the startup function code in the first function code set and the startup function code of the initial function code belong to the same function code attribute. According to the code position, the function code in the first function code set can be replaced with the initial function code of the same function code attribute.

[0055] In the program code of some drivers, the initial function codes may be directly distributed and edited in different code pages or code positions, which results in a time-consuming and easy omission when the function codes in the program code need to be modified. However, directly replacing each initial function code in the driver with the function code in the first function code set according to the code position can improve the updating efficiency and comprehensiveness of the function code of the driver.

[0056] In this embodiment, the function code in the driver can be updated more efficiently and comprehensively through the code position.

[0057] In a feasible embodiment, after the step of S2: acquiring the target hardware configuration corresponding to the first function code set according to the pre-stored correspondence between the function code and the hardware configuration, the step further includes:

[0058] S21: Acquire a second function code set corresponding to the target hardware configuration according to the correspondence between the function code and the hardware configuration.

[0059] The second function code set is a function code set obtained based on a plurality of function codes corresponding to the target hardware configuration pre-stored in the data memory of the electronic device. It can be understood that the difference between the first function code set and the second function code set is that the first function code set is a set of function codes input by the user in real time, and the second function code set is a set of function codes pre-stored in the data memory corresponding to the target hardware configuration.

[0060] S22: If the number of function codes in the second function code set is less than the number of function codes in the first function code set, update the second function code set according to the function codes in the first function code set to update the correspondence between the function codes and the hardware configurations.

[0061] Among them, when the number of function codes in the second function code set is less than the number of function codes in the first function code set, it means that there are new function codes in the first function code set relative to the second function code set. At this time, updating the second function code set according to the first function code set can improve the accuracy of the correspondence between the function code and the hardware configuration.

[0062] See also Figure 3 The second embodiment of the present application provides a program-invoked hardware configuration updating device 100, which is applied to an electronic device, wherein the electronic device includes target hardware, and the device includes:

[0063] A first function code set acquisition module 101 is used to acquire a first function code set of target hardware;

[0064] The target hardware configuration acquisition module 102 is used to acquire the target hardware configuration corresponding to the first function code set according to the pre-stored correspondence between the function code and the hardware configuration;

[0065] An execution module, configured to update the hardware configuration called by the driver of the electronic device according to the target hardware configuration 103;

[0066] It should be noted that the program-invoked hardware configuration update device 100 provided in the second embodiment of the present application only uses the division of the above-mentioned functional modules as an example when executing the program-invoked hardware configuration update method. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the program-invoked hardware configuration update device 100 provided in the second embodiment of the present application and the program-invoked hardware configuration update method of the first embodiment of the present application belong to the same concept. The implementation process thereof is detailed in the method embodiment and will not be repeated here.

[0067] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the hardware configuration update method called by the program as described above are implemented.

[0068] The fourth aspect of an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein when the processor executes the computer program, the steps of the hardware configuration update method called by the program as described above are implemented.

[0069] The device embodiments described above are merely illustrative, wherein the components described as separate parts may or may not be physically separated, and the parts displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application. Ordinary technicians in this field can understand and implement it without creative work.

[0070] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0071] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the function selected in the process. Figure 1 A process or multiple processes and / or boxes Figure 1function selected in a box or multiple boxes.

[0072] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 steps for the function selected in a box or multiple boxes.

[0073] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0074] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0075] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other identification random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0076] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0077] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for updating hardware configuration called by a program, characterized in that: Applied to an electronic device, the electronic device includes target hardware, and the method includes: Obtain a first function code set of target hardware; According to the pre-stored correspondence between the function code and the hardware configuration, obtaining the target hardware configuration corresponding to the first function code set; The hardware configuration called by the driver of the electronic device is updated according to the target hardware configuration.

2. The method for updating hardware configuration called by a program according to claim 1, characterized in that: The step of obtaining a first function code set of the target hardware includes: The first function code set is obtained according to a plurality of function codes corresponding to the target hardware input by a user.

3. The method for updating hardware configuration called by a program according to claim 1, characterized in that: The step of updating the driver of the electronic device according to the target hardware configuration comprises: From the driver, obtain multiple initial hardware configurations of the initial hardware; An initial hardware configuration that is the same as the target hardware configuration is determined as the hardware configuration called by the driver program to update the hardware configuration called by the driver program.

4. The method for updating hardware configuration by program call according to claim 1, characterized in that: The step of updating the driver of the electronic device according to the target hardware configuration comprises: From the driver, obtain the initial hardware configuration of the initial hardware; The initial hardware configuration is updated according to the target hardware configuration.

5. The method for updating hardware configuration by program call according to claim 4, characterized in that: The initial hardware configuration includes a plurality of initial configuration information; the target hardware configuration includes a plurality of target configuration information; The step of updating the initial hardware configuration based on the target hardware configuration includes: Obtaining the information location of each of the initial configuration information in the driver; According to the information position, each of the target configuration information replaces each of the initial configuration information.

6. The method for updating hardware configuration called by a program according to claim 1, characterized in that: After the step of obtaining the first function code set of the target hardware, the method further comprises: Obtaining the code position of each initial function code in the driver program; According to the code position, the function codes in the first function code set replace the initial function codes.

7. The method for updating hardware configuration called by a program according to claim 1, characterized in that: After the step of obtaining the target hardware configuration corresponding to the first function code set according to the pre-stored correspondence between the function code and the hardware configuration, the method further includes: According to the correspondence between the function code and the hardware configuration, obtaining a second function code set corresponding to the target hardware configuration; If the number of function codes in the second function code set is less than the number of function codes in the first function code set, the second function code set is updated according to the function codes in the first function code set to update the correspondence between the function codes and the hardware configurations.

8. A hardware configuration update device called by a program, characterized in that: Applied to an electronic device, the electronic device includes target hardware, and the device includes: A first function code set acquisition module, used to acquire a first function code set of target hardware; A target hardware configuration acquisition module, used to acquire the target hardware configuration corresponding to the first function code set according to the pre-stored correspondence between the function code and the hardware configuration; The execution module is used to update the hardware configuration called by the driver of the electronic device according to the target hardware configuration.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the hardware configuration updating method called by the program according to any one of claims 1 to 7 are implemented.

10. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable by the processor, wherein when the processor executes the computer program, the steps of the hardware configuration updating method called by the program as claimed in any one of claims 1 to 7 are implemented.