Self-adaptive hardware abstraction layer configuration method and system based on hardware feature fingerprints
By collecting multi-dimensional feature information of hardware devices to construct hardware feature fingerprints, determining HAL strategies and configuring unified interfaces, the compatibility issues of HAL in diverse operating systems and hardware ecosystems are solved, and automatic adaptation and 'plug and play' of adaptive hardware abstraction layers are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID INFORMATION & TELECOMM GRP CO LTD
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-10
AI Technical Summary
Existing HAL technology lacks automatic recognition and adaptation capabilities when facing diverse operating systems and hardware ecosystems, resulting in poor compatibility, high maintenance costs, and difficulty in achieving 'plug and play'.
By collecting multi-dimensional feature information of hardware devices, a hardware feature fingerprint is constructed, and a HAL strategy is determined based on the feature fingerprint to achieve unified interface configuration and encapsulation, forming an adaptive hardware abstraction layer configuration system.
It enables automatic identification and adaptive configuration of hardware devices, improves cross-platform development compatibility and reduces maintenance complexity, and supports 'plug and play' functionality.
Smart Images

Figure CN121833362A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to an adaptive hardware abstraction layer configuration method and system based on hardware feature fingerprints. Background Technology
[0002] The Hardware Abstraction Layer (HAL), as a crucial intermediate layer connecting the operating system and application layer, has evolved with the development of the Internet of Things (IoT), embedded systems, and cloud computing, moving from early decentralized kernel drivers towards modularity and standardization. However, existing HALs generally rely on pre-configured drivers and interfaces. When connecting new hardware, manual configuration or driver redevelopment is often required, leading to poor compatibility and high maintenance costs. Furthermore, differences in kernel versions, driver support, and interface implementations among different Linux distributions further exacerbate the complexity of cross-platform development. The domestic operating system HarmonyOS also faces challenges in driver compatibility and interface uniformity when adapting to customized devices from different hardware manufacturers. More importantly, traditional HALs lack automatic identification and adaptive capabilities for hardware characteristics, relying solely on basic information such as device IDs to match general configurations. They cannot dynamically optimize abstraction layer behavior based on hardware characteristics and the operating environment, making true "plug-and-play" difficult and severely restricting the system's intelligence and user experience. Therefore, solving the problem of how to achieve automated and intelligent adaptation of the Hardware Abstraction Layer across diverse operating systems and hardware ecosystems to reduce the complexity of cross-platform development and driver compatibility challenges is a critical issue. Summary of the Invention
[0003] The purpose of this invention is to provide an adaptive hardware abstraction layer configuration method and system based on hardware feature fingerprints, which can improve hardware compatibility.
[0004] To achieve the above objectives, embodiments of the present invention provide an adaptive hardware abstraction layer configuration method based on hardware feature fingerprints, comprising: Collect multi-dimensional feature information of hardware devices; A hardware feature fingerprint is constructed based on the multi-dimensional feature information; The HAL strategy is determined based on the hardware feature fingerprint; The interface configuration of each hardware device is determined based on the HAL strategy. The hardware device is encapsulated according to the interface configuration.
[0005] Optionally, multi-dimensional feature information of the hardware device is collected, including: The multi-dimensional feature information is obtained by parsing the node attributes in the device tree, the hardware description entries in the ACPI firmware table, the device attributes exposed by the sysfs virtual file system, and the hardware capability registers in the kernel ioctl or MSR registers.
[0006] Optionally, the multi-dimensional feature information includes at least two of the following: vendor ID, device ID, subsystem ID, function category code, supported interrupt types, DMA capability, and power management characteristics.
[0007] Optionally, a hardware feature fingerprint is constructed based on the multi-dimensional feature information, including: The multi-dimensional feature information is normalized. The result of the normalization operation is processed by a hash algorithm to obtain the hardware feature fingerprint.
[0008] Optionally, determining the HAL strategy based on the hardware feature fingerprint includes: Match the corresponding HAL policy in the preset local policy library based on the hardware feature fingerprint; Determine whether a match can be successfully found. If it is determined that a match cannot be found, a security query is initiated to the cloud policy library.
[0009] Optionally, the HAL strategy includes at least one of the following: the name of the driver module to be loaded, the path to the HAL implementation plugin, the initialization parameter template, performance tuning options, and security access permissions.
[0010] Optionally, the interface configuration includes at least one of I²C, SPI, USB, and a dedicated bus.
[0011] Optionally, the interface configuration of each hardware device is determined according to the HAL strategy, including: Define the semantics of functional operations such as initialization, data reading and writing, status query, event callback, and power management.
[0012] On the other hand, the present invention also provides an adaptive hardware abstraction layer configuration system based on hardware feature fingerprints, the system including a processor configured to perform any of the methods described above.
[0013] Through the above technical solutions, the embodiments of the present invention provide an adaptive hardware abstraction layer configuration method and system based on hardware feature fingerprints. This method and system captures hardware feature fingerprints from multi-dimensional feature information of hardware devices, then determines a unified interface configuration for the hardware devices based on policy matching, and finally encapsulates this interface configuration, achieving standardized operation of unified interfaces for different hardware devices, thereby improving hardware compatibility. Furthermore, based on this method and system, an intelligent HAL framework with self-awareness and decision-making capabilities is constructed. This framework can automatically complete the entire process of hardware identification, feature extraction, policy matching, and interface loading during the initial stage of system operation or when devices are hot-swapped, thus achieving true "plug-and-play" hardware abstraction.
[0014] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0015] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of an adaptive hardware abstraction layer configuration method based on hardware feature fingerprints according to an embodiment of the present invention; Figure 2 This is a flowchart of a method for obtaining a HAL strategy according to an embodiment of the present invention; Figure 3 This is a structural block diagram of an adaptive hardware abstraction layer configuration system based on hardware feature fingerprints according to an embodiment of the present invention. Detailed Implementation
[0016] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0017] It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of this application all comply with relevant laws and regulations. In the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0018] like Figure 1 The diagram shows a flowchart of an adaptive hardware abstraction layer configuration method based on hardware feature fingerprints according to an embodiment of the present invention. Figure 1 In this method, the steps may include: In step S10, multi-dimensional feature information of the hardware device is collected; In step S11, a hardware feature fingerprint is constructed based on multi-dimensional feature information; In step S12, the HAL strategy is determined based on the hardware feature fingerprint; In step S13, the interface configuration of each hardware device is determined according to the HAL strategy; In step S14, the hardware device is encapsulated according to the interface configuration.
[0019] In such Figure 1 In the illustrated method, step S10 can be used to collect multi-dimensional feature information of the hardware device. This multi-dimensional feature information can be in various forms known to those skilled in the art. In one example of the present invention, the multi-dimensional feature information may include at least two of the following: vendor ID, device ID, subsystem ID, function category code, supported interrupt types, DMA capabilities, and power management characteristics. Therefore, the method for obtaining this multi-dimensional feature information in step S10 can be to parse node attributes in the device tree, hardware description entries in the ACPI firmware table, device attributes exposed by the sysfs virtual file system, and hardware capability registers in the kernel ioctl or MSR registers to obtain the multi-dimensional feature information.
[0020] Step S11 can be used to construct a hardware feature fingerprint based on multi-dimensional feature information. This hardware feature fingerprint can represent the multi-dimensional characteristics of the hardware, thereby facilitating the identification of the installed device. The method for generating this hardware feature fingerprint can be of various forms known to those skilled in the art. In one example of the present invention, the method for generating the hardware feature fingerprint can be to first perform a normalization operation on the multi-dimensional feature information, and then process the result of the normalization operation using a hash algorithm to obtain the hardware feature fingerprint. The normalization operation can further include steps of case neutralization, field alignment, and missing value filling. The hash algorithm can be, for example, the SHA-256 algorithm.
[0021] Step S12 can be used to determine the HAL strategy based on hardware feature fingerprints. Specifically, in one example of the present invention, the method for obtaining the HAL strategy may include, for example... Figure 2 The steps shown are described. Figure 2 The method for obtaining the HAL policy may include the following steps: In step S20, the corresponding HAL policy is matched in the preset local policy library according to the hardware feature fingerprint; In step S21, it is determined whether a match can be successfully made. In step S22, if it is determined that a match cannot be successfully found, a security query is initiated to the cloud policy library.
[0022] Furthermore, the specific form of this HAL strategy can be various forms known to those skilled in the art. In one example of the present invention, the HAL strategy may include at least one of the following: the name of the driver module to be loaded, the path to the HAL implementation plugin, the initialization parameter template, performance tuning options, and security access permissions.
[0023] Step S13 can be used to determine the interface configuration of each hardware device based on the HAL strategy. This interface configuration can be at least one of I²C, SPI, USB, and a dedicated bus. Correspondingly, step S13 can further be used to determine the functional operation semantics of initialization, data read / write, status query, event callback, and power management.
[0024] On the other hand, the present invention also provides an adaptive hardware abstraction layer configuration system based on hardware feature fingerprints, the system including a processor configured to perform any of the methods described above. Specifically, the method may include the following steps: In step S10, multi-dimensional feature information of the hardware device is collected; In step S11, a hardware feature fingerprint is constructed based on multi-dimensional feature information; In step S12, the HAL strategy is determined based on the hardware feature fingerprint; In step S13, the interface configuration of each hardware device is determined according to the HAL strategy; In step S14, the hardware device is encapsulated according to the interface configuration.
[0025] In such Figure 1 In the illustrated method, step S10 can be used to collect multi-dimensional feature information of the hardware device. This multi-dimensional feature information can be in various forms known to those skilled in the art. In one example of the present invention, the multi-dimensional feature information may include at least two of the following: vendor ID, device ID, subsystem ID, function category code, supported interrupt types, DMA capabilities, and power management characteristics. Therefore, the method for obtaining this multi-dimensional feature information in step S10 can be to parse node attributes in the device tree, hardware description entries in the ACPI firmware table, device attributes exposed by the sysfs virtual file system, and hardware capability registers in the kernel ioctl or MSR registers to obtain the multi-dimensional feature information.
[0026] Step S11 can be used to construct a hardware feature fingerprint based on multi-dimensional feature information. This hardware feature fingerprint can represent the multi-dimensional characteristics of the hardware, thereby facilitating the identification of the installed device. The method for generating this hardware feature fingerprint can be of various forms known to those skilled in the art. In one example of the present invention, the method for generating the hardware feature fingerprint can be to first perform a normalization operation on the multi-dimensional feature information, and then process the result of the normalization operation using a hash algorithm to obtain the hardware feature fingerprint. The normalization operation can further include steps of case neutralization, field alignment, and missing value filling. The hash algorithm can be, for example, the SHA-256 algorithm.
[0027] Step S12 can be used to determine the HAL strategy based on hardware feature fingerprints. Specifically, in one example of the present invention, the method for obtaining the HAL strategy may include, for example... Figure 2 The steps shown are described. Figure 2 The method for obtaining the HAL policy may include the following steps: In step S20, the corresponding HAL policy is matched in the preset local policy library according to the hardware feature fingerprint; In step S21, it is determined whether a match can be successfully made. In step S22, if it is determined that a match cannot be successfully found, a security query is initiated to the cloud policy library.
[0028] Furthermore, the specific form of this HAL strategy can be various forms known to those skilled in the art. In one example of the present invention, the HAL strategy may include at least one of the following: the name of the driver module to be loaded, the path to the HAL implementation plugin, the initialization parameter template, performance tuning options, and security access permissions.
[0029] Step S13 can be used to determine the interface configuration of each hardware device based on the HAL strategy. This interface configuration can be at least one of I²C, SPI, USB, and a dedicated bus. Correspondingly, step S13 can further be used to determine the functional operation semantics of initialization, data read / write, status query, event callback, and power management.
[0030] Based on this hardware fingerprint-based adaptive hardware abstraction layer configuration system, the corresponding structural block diagram can be as follows: Figure 3 As shown. Based on this... Figure 3The system shown introduces a hardware fingerprinting mechanism and a standardized HAL interface specification, significantly improving the adaptability and deployment efficiency of operating systems such as Linux and HarmonyOS in heterogeneous hardware environments. The system can automatically identify hardware characteristics upon device connection or startup, dynamically loading the optimal HAL implementation without manual intervention, truly achieving "plug and play." This solution effectively solves problems such as traditional HAL reliance on manual configuration, severe driver fragmentation, and poor cross-platform compatibility, significantly reducing hardware adaptation development costs and maintenance complexity. Simultaneously, because all devices adhere to a unified HAL interface specification, upper-layer applications can transparently access various hardware, greatly enhancing the system's portability, stability, and scalability, providing solid foundational software support for multi-device collaborative scenarios such as the Internet of Things and edge computing.
[0031] Through the above technical solutions, the embodiments of the present invention provide an adaptive hardware abstraction layer configuration method and system based on hardware feature fingerprints. The method and system capture hardware feature fingerprints by multi-dimensional feature information of hardware devices, then determine the unified interface configuration of hardware devices according to policy matching, and finally encapsulate based on the interface configuration, thereby realizing the unified interface standardization operation of different hardware devices and improving hardware compatibility.
[0032] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0033] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0034] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0035] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0036] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0037] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0038] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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 types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0039] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0040] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An adaptive hardware abstraction layer configuration method based on hardware feature fingerprints, characterized in that, include: Collect multi-dimensional feature information of hardware devices; A hardware feature fingerprint is constructed based on the multi-dimensional feature information; The HAL strategy is determined based on the hardware feature fingerprint; The interface configuration of each hardware device is determined based on the HAL strategy. The hardware device is encapsulated according to the interface configuration.
2. The method according to claim 1, characterized in that, Collect multi-dimensional feature information of hardware devices, including: The multi-dimensional feature information is obtained by parsing the node attributes in the device tree, the hardware description entries in the ACPI firmware table, the device attributes exposed by the sysfs virtual file system, and the hardware capability registers in the kernel ioctl or MSR registers.
3. The method according to claim 2, characterized in that, The multi-dimensional feature information includes at least two of the following: vendor ID, device ID, subsystem ID, function category code, supported interrupt types, DMA capability, and power management characteristics.
4. The method according to claim 2, characterized in that, Based on the multi-dimensional feature information, a hardware feature fingerprint is constructed, including: The multi-dimensional feature information is normalized. The result of the normalization operation is processed by a hash algorithm to obtain the hardware feature fingerprint.
5. The method according to claim 1, characterized in that, Determining the HAL strategy based on the hardware feature fingerprint includes: Match the corresponding HAL policy in the preset local policy library based on the hardware feature fingerprint; Determine whether a match can be successfully found. If it is determined that a match cannot be found, a security query is initiated to the cloud policy library.
6. The method according to claim 5, characterized in that, The HAL strategy includes at least one of the following: the name of the driver module to be loaded, the path to the HAL implementation plugin, the initialization parameter template, performance tuning options, and security access permissions.
7. The method according to claim 1, characterized in that, The interface configuration includes at least one of I²C, SPI, USB, and a dedicated bus.
8. The method according to claim 1, characterized in that, The interface configuration of each hardware device is determined based on the HAL strategy, including: Define the semantics of functional operations such as initialization, data reading and writing, status query, event callback, and power management.
9. An adaptive hardware abstraction layer configuration system based on hardware feature fingerprints, characterized in that, The system includes a processor configured to perform the method as described in any one of claims 1 to 8.