Embedded firmware key definition data modification method, device, medium and equipment
By realizing user permission verification, real-time key status check and debounce processing in the embedded system, the problem of lack of permission verification and feedback mechanism during the modification of key function in the existing technology is solved, and the security and reliability of the system are improved.
Patent Information
- Application Number
- CN202411857195.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In the prior art, the key function modification process lacks user permission verification, real-time key status check and feedback mechanism, resulting in poor flexibility, cumbersome operation and high risk of incorrect operation.
By loading the user interface on the upper computer and verifying the user permissions, a modification request command is generated and sent to the lower computer. The lower computer performs verification of key number and user permissions, checks the key status in real time and uses the debounce algorithm to filter the noise signal, and finally confirms the modification results on the upper computer and provides feedback.
Ensure that only users with specific permissions can make changes to sensitive keys, which improves the security of the system; through real-time inspection and debounce processing, ensures that the physical status of the keys is stable and avoids the occurrence of misoperation; provide detailed modification results and error information, which improves user experience and system reliability.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded systems, and in particular to a method, device, medium and equipment for modifying key definition data of embedded firmware. Background Art
[0002] With the development of embedded system technology, key function definition is increasingly used in embedded systems, especially in the fields of human-computer interaction devices such as industrial control panels and home electronic devices. The traditional key function configuration method is usually to directly define the function of the key by writing firmware code, or to select through a simple menu interface. However, with the increase in system complexity and the diversification of user needs, the key function definition and management methods in the prior art have gradually exposed shortcomings such as poor flexibility and cumbersome operation. In particular, most of the existing key function modification methods rely on fixed function mapping tables, lack a dynamic management mechanism for user permissions, and cannot provide sufficient feedback and error handling mechanisms during the key function modification process.
[0003] The shortcomings of the existing technology are mainly manifested in the following aspects: first, the key function modification process lacks a user authority verification mechanism, and it is impossible to effectively restrict functions for different user authority levels; second, most of the existing key function modification methods use static mapping tables, which cannot dynamically adjust the key function mapping, resulting in insufficient flexibility and adaptability of the system. In addition, the feedback mechanism of the existing system after the key function is modified is relatively simple, and it is unable to provide detailed modification results and error information, which is easy to cause user misoperation or system function failure. Summary of the invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides an embedded firmware key definition data modification method to solve the problem of lack of user authority verification, key status real-time inspection and feedback mechanism in the key function modification process in the prior art.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a method for modifying key definition data of an embedded firmware, comprising:
[0008] Start the host computer, load the user interface, and the user enters the login information and performs permission verification to obtain the permission verification result;
[0009] When the permission verification is passed, the corresponding modification request instruction is generated and sent to the lower computer;
[0010] The lower computer receives and parses the key function modification request instruction and verifies the legitimacy of the key number and user authority;
[0011] Based on the verification result, check the button status in the current button mapping table;
[0012] According to the key status check result, the corresponding key function modification operation is performed to generate a new key mapping table state;
[0013] The lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful.
[0014] As a preferred solution of the embedded firmware key definition data modification method of the present invention, wherein: starting the host computer, loading the user interface, the user inputs the login information and performs the authority verification, and obtaining the authority verification result includes the following steps:
[0015] Initialize the communication channel between the upper computer and the lower computer, start the upper computer program, load the user interface and display the user login window;
[0016] Collect the login information entered by the user in the login window, format and encrypt it, and send it to the lower computer as an encrypted data packet;
[0017] After receiving the encrypted data packet sent by the upper computer, the lower computer decrypts the data and compares it with the data in the internal permission database to verify the user's permission;
[0018] When the permission verification is passed, the user's permission level is obtained and returned to the host computer;
[0019] When the permission verification fails, the lower computer returns the error information to the upper computer;
[0020] The host computer receives the permission verification result, extracts the verification status and user permission level, and loads the corresponding interface and function according to the returned permission level.
[0021] As a preferred solution of the embedded firmware key definition data modification method of the present invention, when the authority verification is passed, generating a corresponding modification request instruction and sending the instruction to the lower computer includes the following steps:
[0022] After the upper computer receives the permission level returned by the lower computer, it determines the content of the key function mapping table to be loaded according to the permission level;
[0023] The upper computer sends a request to the lower computer through the communication channel to obtain the key function mapping table that needs to be loaded;
[0024] After the key mapping table is loaded, the user can view the numbers and current functions of all keys through the interface and select the key numbers and function modes that need to be modified;
[0025] Generate a key function modification request instruction based on the selected key number and function mode. The expression is:
[0026] ;
[0027] Among them, C represents the key function modification instruction, Indicates Button number, Indicates key function mode, n represents the total number of keys selected by the user, Indicates the key quantity index;
[0028] The key function modification request instruction is sent to the lower computer through the communication channel.
[0029] As a preferred solution of the embedded firmware key definition data modification method of the present invention, wherein: the lower computer receives and parses the key function modification request instruction, and verifies the legitimacy of the key number and user authority, including the following steps:
[0030] After receiving the key function modification request instruction, the lower computer extracts the key number, function mode and new function definition;
[0031] According to the set number of keys, check whether the key number is within a reasonable range and verify whether the function mode is a legal value. The expression is:
[0032] ;
[0033] in, Indicates the dynamically adjusted key number range. Indicates the maximum key number range supported by the device. Indicates the current key number range. represents the adjustment factor;
[0034] Based on the legitimacy check results, the user permission level provided by the host computer is compared with the corresponding button function modification permission requirements to verify whether the current user has the authority to modify the button.
[0035] As a preferred solution of the embedded firmware key definition data modification method of the present invention, wherein: based on the verification result, checking the key status in the current key mapping table includes the following steps:
[0036] After parsing the instruction and passing the legality verification, the lower computer reads the current key status information from the key function mapping table;
[0037] Use software debounce algorithm to detect the current key status information read;
[0038] When a change in the state of a button is detected, the debounce time window is started to filter out the noise signal caused by mechanical jitter. The expression is:
[0039] ;
[0040] in, Indicates the length of the debounce window after dynamic adjustment. Indicates the initial debounce window length, indicates the key state change rate, Indicates the sensitivity of the debounce window to the rate of change. Indicates the rate of change of the button state;
[0041] After the debounce time window ends, record whether the physical state of the key is stable. The expression is:
[0042] ;
[0043] Among them, A represents the stability index of the key state, Indicates the state of the key at the tth time, Indicates that the key is times, T represents the total number of detections in the debounce window, and t represents the detection number index;
[0044] After confirming that the physical state of the button is stable, check whether the functional state of the button is normal.
[0045] As a preferred solution of the embedded firmware key definition data modification method of the present invention, wherein: according to the key state check result, executing the corresponding key function modification operation to generate a new key mapping table state includes the following steps:
[0046] According to the result of the button function status check, determine whether the main function or the backup function needs to be modified;
[0047] When the main function status is normal and the user chooses to modify the main function, the main function definition data is updated;
[0048] When the main function fails, it automatically switches to the backup function and updates the corresponding backup function definition data;
[0049] The new key function definition is written into the corresponding field of the mapping table, the key status is updated, and an updated key mapping table is obtained.
[0050] As a preferred solution of the embedded firmware key definition data modification method of the present invention, wherein: the lower computer returns the new key mapping table status to the upper computer, and confirming whether the modification is successful includes the following steps:
[0051] Based on the modified button function and the updated button mapping list, determine whether the button function modification is successful;
[0052] When the button function is modified successfully, a success feedback message is generated and returned to the host computer;
[0053] When the key function modification fails, a failure feedback message is generated and the failure reason is fed back to the host computer;
[0054] After receiving the feedback information, the host computer parses the data and displays it to the user.
[0055] In a second aspect, the present invention provides an embedded firmware key definition data modification device, comprising:
[0056] The permission verification module starts the host computer, loads the user interface, and the user enters the login information and performs permission verification to obtain the permission verification result;
[0057] The instruction generation module generates the corresponding modification request instruction when the permission verification is passed, and sends the instruction to the lower computer;
[0058] Instruction parsing module: the lower computer receives and parses the key function modification request instruction, and verifies the legitimacy of the key number and user authority;
[0059] A mapping check module checks the button status in the current button mapping table based on the verification result;
[0060] The function modification module performs corresponding key function modification operations according to the key state check result and generates a new key mapping table state;
[0061] Feedback module: The lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful.
[0062] In a third aspect, the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the embedded firmware key definition data modification method as described in the first aspect of the present invention is implemented.
[0063] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the embedded firmware key definition data modification method as described in the first aspect of the present invention is implemented.
[0064] The beneficial effects of the present invention are as follows: by loading the user interface on the upper computer and verifying the user authority, the corresponding key functions can be loaded according to different authority levels, ensuring that only users with specific authority can change sensitive keys, thereby improving the security of the system; by implementing real-time inspection and debouncing algorithm of the key state on the lower computer, the stability of the physical state of the key is ensured, and the noise signal generated by mechanical jitter is filtered out when the key function is modified, avoiding the occurrence of misoperation; when the key function modification is completed, the system will return the modification result to the upper computer to confirm whether the modification is successful, and generate corresponding feedback information to prompt the user whether the modification is successful and the possible causes of the error. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0066] Figure 1 This is a flow chart of the embedded firmware key definition data modification method in Example 1.
[0067] Figure 2 This is a schematic diagram of the permission level verification in Example 1. DETAILED DESCRIPTION
[0068] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0069] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0070] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0071] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, provides an embedded firmware key definition data modification method, comprising the following steps:
[0072] S1. Start the host computer, load the user interface, and the user enters the login information and performs permission verification to obtain the permission verification result.
[0073] S1.1. Initialize the communication channel between the upper computer and the lower computer, start the upper computer program, load the user interface and display the user login window.
[0074] Specifically, the user interface includes a common user interface, an administrator interface, and a super administrator interface.
[0075] Normal user interface: Ordinary users are only allowed to view the current definition of key functions and cannot modify them.
[0076] Administrator interface: allows administrators to modify the definition of all buttons, including key button functions. Administrators can modify the primary and backup functions of buttons.
[0077] Super administrator interface: The super administrator has the highest authority. In addition to being able to modify the definitions of all buttons, he can also modify the default button functions at the system level.
[0078] S1.2. Collect the login information entered by the user in the login window, format and encrypt it, form an encrypted data packet and send it to the lower computer; after the lower computer receives the encrypted data packet sent by the upper computer, it decrypts the data and compares it with the data in the internal permission database to verify the user's permissions; when the permission verification passes, the user's permission level is obtained and the permission level is returned to the upper computer; when the permission verification fails, the lower computer returns an error message to the upper computer; the upper computer receives the permission verification result, extracts the verification status and user permission level, and loads the corresponding interface and function according to the returned permission level.
[0079] S2. When the authority verification is passed, a corresponding modification request instruction is generated and sent to the lower computer.
[0080] S2.1. After the upper computer receives the permission level returned by the lower computer, it determines the content of the key function mapping table to be loaded according to the permission level; the upper computer sends a request to the lower computer through the communication channel to obtain the key function mapping table to be loaded; after the key mapping table is loaded, the user views the number and current function of all keys through the interface, and selects the key number and function mode that need to be modified.
[0081] Specifically, the user selects the button number to be modified according to the permission level. The specific operations are as follows:
[0082] Interface interaction: Provide a drop-down list or table, and the user can select the button number to be modified by clicking the specific button number.
[0083] Permission check: When a user selects a key number, first check whether the user has permission to modify the key. For example, if the user is a normal user and selects a restricted key, a prompt should pop up: "No permission to modify". If the user is an administrator or super administrator, allow them to continue.
[0084] S2.2. Generate a key function modification request instruction based on the selected key number and function mode. The expression is:
[0085] ;
[0086] Among them, C represents the key function modification instruction, Indicates Button number, Indicates key function mode, n represents the total number of keys selected by the user, Indicates the key quantity index;
[0087] Specifically, when the function mode selection dialog box pops up, the user can choose to modify the following function modes:
[0088] Primary function (for example, a function that turns a device on or off).
[0089] Alternate Function 1 (for example, an alternate operation such as a device reset).
[0090] Backup function 2 (e.g. emergency stop function).
[0091] Modification request instructions include:
[0092] Button number: indicates the button number selected by the user, such as button 2.
[0093] Function mode: indicates the main function or backup function, such as the main function is 0, the backup function 1 is 1, and the backup function 2 is 2.
[0094] New function definition: The name of the new function entered by the user, such as "Start Device".
[0095] S3. The lower computer receives and parses the key function modification request instruction and verifies the legitimacy of the key number and user authority.
[0096] After receiving the key function modification request instruction, the lower computer extracts the key number, function mode and new function definition;
[0097] According to the set number of keys, check whether the key number is within a reasonable range and verify whether the function mode is a legal value. The expression is:
[0098] ;
[0099] in, Indicates the dynamically adjusted key number range. Indicates the maximum key number range supported by the device. Indicates the current key number range. represents the adjustment factor;
[0100] Based on the legitimacy check results, the user permission level provided by the host computer is compared with the corresponding button function modification permission requirements to verify whether the current user has the authority to modify the button.
[0101] Specifically, according to the user authority level provided by the host computer, the corresponding key function modification authority requirement is compared to verify whether the current user has the authority to modify the key, including the following:
[0102] Ordinary users (authorization level 1) can only view the button functions but cannot modify them;
[0103] Administrators (authority level 2) can modify the primary and backup functions of ordinary buttons;
[0104] Super administrators (authority level 3) can modify the functions of all buttons, including system key buttons.
[0105] S4. Based on the verification result, check the button status in the current button mapping table.
[0106] After parsing the instruction and passing the legality verification, the lower computer reads the current key status information from the key function mapping table; and uses the software debouncing algorithm to detect the read current key status information.
[0107] It should be noted that the present invention adopts a more intelligent software de-bouncing algorithm, which can start the de-bouncing time window according to the change of the key state, and judge whether the physical state of the key is stable after the de-bouncing time ends. The de-bouncing design based on the time window can effectively filter out the noise signal caused by mechanical jitter, ensure the accuracy of key reading, and reduce the occurrence of misoperation.
[0108] When a change in the state of a button is detected, the debounce time window is started to filter out the noise signal caused by mechanical jitter. The expression is:
[0109] ;
[0110] in, Indicates the length of the debounce window after dynamic adjustment. Indicates the initial debounce window length, indicates the key state change rate, Indicates the sensitivity of the debounce window to the rate of change. Indicates the rate of change of the button state;
[0111] After the debounce time window ends, record whether the physical state of the key is stable. The expression is:
[0112] ;
[0113] Among them, A represents the stability index of the key state, Indicates the state of the key at the tth time, Indicates that the key is times, T represents the total number of detections in the debounce window, and t represents the detection number index;
[0114] After confirming that the physical state of the button is stable, check whether the functional state of the button is normal.
[0115] It should be noted that the design of the startup de-bouncing time window can ensure that the key state will not be disturbed by the jitter signal within a period of time, and ensure that the key function modification operation is performed under the premise that the physical state of the key is stable. By dynamically adjusting the time length of the de-bouncing window, it can adapt to the physical characteristics of key operations in different environments.
[0116] S5. According to the key status check result, a corresponding key function modification operation is performed to generate a new key mapping table state.
[0117] According to the result of the button function status check, determine whether it is the main function or the backup function that needs to be modified; when the main function status is normal and the user chooses to modify the main function, update the main function definition data; when the main function fails, automatically switch to the backup function and update the corresponding backup function definition data; write the new button function definition into the corresponding field of the mapping table, update the button status, and obtain the updated button mapping table.
[0118] Further, it is determined whether the main function or the backup function needs to be modified, as follows:
[0119] If the main function status of the current button is normal, the user is allowed to modify the main function directly.
[0120] The main function fails, but the backup function 1 is normal: If the main function fails but the backup function 1 is normal, it will automatically switch to the backup function 1 and allow the user to modify the backup function 1.
[0121] The main function and backup function 1 fail, and backup function 2 is normal: If both the main function and backup function 1 fail, it will automatically switch to backup function 2, and the user is allowed to modify backup function 2.
[0122] All functions fail: If the main function, backup function 1 and backup function 2 all fail, the user is prompted that the key function is unavailable and the operation is terminated.
[0123] S6. The lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful.
[0124] Based on the modified button function and the updated button mapping list, determine whether the button function modification is successful; when the button function modification is successful, generate success feedback information and return it to the host computer; when the button function modification fails, generate failure feedback information and feed back the failure reason to the host computer; after receiving the feedback information, the host computer parses the data and displays it to the user.
[0125] Specifically, the reasons for failure may include the following:
[0126] Insufficient permissions: The user does not have sufficient permissions to modify the button function.
[0127] Illegal data: The key function definition data entered does not meet the requirements.
[0128] Function failure: Both the main function and the backup function are invalid and cannot be modified.
[0129] This embodiment also provides an embedded firmware key definition data modification device, including:
[0130] The permission verification module starts the upper computer and loads the user interface. The user enters the login information and performs permission verification to obtain the permission verification result; the instruction generation module generates the corresponding modification request instruction when the permission verification is passed, and sends the instruction to the lower computer; the instruction parsing module, the lower computer receives and parses the key function modification request instruction, verifies the legitimacy of the key number and user authority; the mapping check module checks the key status in the current key mapping table based on the verification result; the function modification module executes the corresponding key function modification operation according to the key status check result and generates a new key mapping table status; the feedback module, the lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful.
[0131] This embodiment also provides a computer device, which is suitable for the embedded firmware key definition data modification method, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the embedded firmware key definition data modification method proposed in the above embodiment.
[0132] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0133] The present embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for modifying embedded firmware key definition data proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0134] In summary, the present invention can load corresponding key functions according to different permission levels by loading the user interface and verifying the user authority on the upper computer, thereby ensuring that only users with specific permissions can change sensitive keys, thereby improving the security of the system; by implementing real-time inspection and debouncing algorithm of the key state on the lower computer, the stability of the physical state of the key is ensured, and the noise signal generated by mechanical jitter is filtered out when the key function is modified to avoid the occurrence of misoperation; when the key function modification is completed, the system will return the modification result to the upper computer to confirm whether the modification is successful, and generate corresponding feedback information to prompt the user whether the modification is successful and the possible causes of the error.
[0135] Example 2, referring to Table 1, is the second example of the present invention. To further verify the technical solution of the present invention, experimental simulation data of the embedded firmware key definition data modification method are provided.
[0136] Based on the embedded firmware button definition data modification method, the actual operation of modifying the button function of a complex embedded system is simulated. In order to verify the effectiveness of the present invention, an embedded system with multi-function buttons is selected for testing. The system includes 10 buttons, each of which has two modes: main function and backup function. The system operator modifies the button function through the host computer. The modification process involves authority verification, button status monitoring, debounce processing, and real-time update of button functions.
[0137] First, start the host computer and load the user interface. After the user enters the login information, a communication channel is established between the host computer and the slave computer. The user login information is encrypted and transmitted to the slave computer, which decrypts it and compares it with the permission database. In this experiment, three permission levels are set: administrator, operator, and visitor. The number of key functions that can be modified by users with different permissions is different. The administrator can modify all 10 keys, the operator can only modify 5 keys, and the visitor has no modification permission, as shown in Table 1:
[0138] Table 1 User login and authority verification data table
[0139]
[0140] After the authority verification, the corresponding key function mapping table is loaded according to the user's authority level. The user interface displays the numbers and current function status of all 10 keys. The user can select the key to be modified and enter a new function definition. For example, the administrator chooses to modify the main function of key 1. After entering the new function definition, the upper computer generates a modification request instruction and sends it to the lower computer through the communication channel. After the lower computer receives the key function modification request instruction, it first extracts the key number, function mode and new function definition. Through the legality check, the key number range and authority matching are verified. Next, the system reads the current key status information from the key mapping table, and uses the software debouncing algorithm to detect the key signal to ensure that the key state is stable before performing the modification operation. The debouncing process starts a 100 millisecond time window to filter out the noise signal caused by mechanical jitter, as shown in Table 2 below:
[0141] Table 2 Key function mapping loading and key status check simulation data
[0142]
[0143] When the button status is stable, the system checks the button function status to determine whether the function mode to be modified is the main function or the backup function, and updates the corresponding field data in the button mapping table. After the modification is completed, the lower computer returns the updated button mapping table to the upper computer and generates a successful feedback message. After receiving the feedback message, the upper computer parses the data and displays the modification results on the user interface, as shown in Table 3 below:
[0144] Table 3 Key function modification and feedback data record table
[0145]
[0146] As can be seen from the table data, the present invention strictly distinguishes the scope of authority of administrators, operators and visitors, ensuring that key modification operations comply with user authority. Administrators can modify all keys, operators can only modify specified keys, and visitors have no modification authority. The physical state of the key and the de-jitter processing time ensure that the function of the key can be modified only after the physical state is stable, preventing misoperation caused by key jitter. This improves the reliability of the system. The modification of key functions is achieved through the update of the mapping table, and the main function and backup function of the key can be dynamically adjusted according to user requests. The feedback delay is short, and the user can see the modification results in a short time, indicating that the communication efficiency between the upper and lower computers is high and can meet the real-time requirements.
[0147] In summary, the table data clearly demonstrates the advantages of the present invention in the process of modifying button functions, namely, through strict authority control, intelligent debouncing processing and efficient button status feedback, the security, stability and user experience of the system are significantly improved.
[0148] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for modifying key definition data of an embedded firmware, characterized in that: include, Start the host computer, load the user interface, and the user enters the login information and performs permission verification to obtain the permission verification result; When the permission verification is passed, the corresponding modification request instruction is generated and sent to the lower computer; The lower computer receives and parses the key function modification request instruction and verifies the legitimacy of the key number and user authority; Based on the verification result, check the button status in the current button mapping table; According to the key status check result, the corresponding key function modification operation is performed to generate a new key mapping table state; The lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful; Among them, starting the host computer, loading the user interface, the user enters the login information and performs permission verification, and obtaining the permission verification result includes the following steps: Initialize the communication channel between the upper computer and the lower computer, start the upper computer program, load the user interface and display the user login window; Collect the login information entered by the user in the login window, format and encrypt it, and send it to the lower computer as an encrypted data packet; After receiving the encrypted data packet sent by the upper computer, the lower computer decrypts the data and compares it with the data in the internal permission database to verify the user's permission; When the permission verification is passed, the user's permission level is obtained and returned to the host computer; When the permission verification fails, the lower computer returns the error information to the upper computer; The host computer receives the permission verification result, extracts the verification status and user permission level, and loads the corresponding interface and function according to the returned permission level; Among them, when the authority verification is passed, generating a corresponding modification request instruction and sending the instruction to the lower computer includes the following steps: After the upper computer receives the permission level returned by the lower computer, it determines the content of the key function mapping table to be loaded according to the permission level; The upper computer sends a request to the lower computer through the communication channel to obtain the key function mapping table that needs to be loaded; After the key mapping table is loaded, the user can view the numbers and current functions of all keys through the interface and select the key numbers and function modes that need to be modified; Generate a key function modification request instruction based on the selected key number and function mode. The expression is: ; in, Indicates the key function modification instruction. Indicates Button number, Indicates Key function modes, Indicates the total number of keys selected by the user. Indicates the key quantity index; The key function modification request instruction is sent to the lower computer through the communication channel.
2. The method for modifying key definition data of embedded firmware according to claim 1, characterized in that: The lower computer receives and parses the key function modification request instruction, and verifies the legitimacy of the key number and user authority, including the following steps: After receiving the key function modification request instruction, the lower computer extracts the key number and function mode; According to the set number of keys, check whether the key number is within a reasonable range and verify whether the function mode is a legal value. The expression is: ; in, Indicates the dynamically adjusted key number range. Indicates the maximum key number range supported by the device. Indicates the current key number range. represents the adjustment factor; Based on the legitimacy check results, the user permission level provided by the host computer is compared with the corresponding button function modification permission requirements to verify whether the current user has the authority to modify the button.
3. The method for modifying key definition data of embedded firmware according to claim 2, characterized in that: Based on the verification result, checking the button status in the current button mapping table includes the following steps: After parsing the instruction and passing the legality verification, the lower computer reads the current key status information from the key function mapping table; Use software debounce algorithm to detect the current key status information read; When a change in the state of a button is detected, the debounce time window is started to filter out the noise signal caused by mechanical jitter. The expression is: ; in, Indicates the length of the debounce window after dynamic adjustment. Indicates the initial debounce window length, indicates the key state change rate, Indicates the sensitivity of the debounce window to the rate of change. Indicates the rate of change of the button state; After the debounce time window ends, record whether the physical state of the key is stable. The expression is: ; Among them, A represents the stability index of the key state, Indicates the state of the key at the tth time, Indicates that the key is times, T represents the total number of detections in the debounce window, and t represents the detection number index; After confirming that the physical state of the button is stable, check whether the functional state of the button is normal.
4. The method for modifying key definition data of embedded firmware according to claim 3, characterized in that: According to the key status check result, the corresponding key function modification operation is performed to generate a new key mapping table state, including the following steps: According to the result of the button function status check, determine whether the main function or the backup function needs to be modified; When the main function status is normal and the user chooses to modify the main function, the main function definition data is updated; When the main function fails, it automatically switches to the backup function and updates the corresponding backup function definition data; The new key function definition is written into the corresponding field of the mapping table, the key status is updated, and an updated key mapping table is obtained.
5. The method for modifying key definition data of embedded firmware according to claim 4, characterized in that: The lower computer returns the new key mapping table status to the upper computer. Confirming whether the modification is successful includes the following steps: Based on the modified button function and the updated button mapping list, determine whether the button function modification is successful; When the button function is modified successfully, a success feedback message is generated and returned to the host computer; When the key function modification fails, a failure feedback message is generated and the failure reason is fed back to the host computer; After receiving the feedback information, the host computer parses the data and displays it to the user.
6. An embedded firmware key definition data modification device, based on the embedded firmware key definition data modification method according to any one of claims 1 to 5, characterized in that: include, The permission verification module starts the host computer, loads the user interface, and the user enters the login information and performs permission verification to obtain the permission verification result; The instruction generation module generates the corresponding modification request instruction when the permission verification is passed, and sends the instruction to the lower computer; Instruction parsing module: the lower computer receives and parses the key function modification request instruction, and verifies the legitimacy of the key number and user authority; A mapping check module checks the button status in the current button mapping table based on the verification result; The function modification module performs corresponding key function modification operations according to the key state check result and generates a new key mapping table state; Feedback module: The lower computer returns the new key mapping table status to the upper computer to confirm whether the modification is successful.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the embedded firmware key definition data modification method described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the embedded firmware key definition data modification method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Embedded system authority management method and system
CN110457892A
Key simulation method and device based on USB module, equipment and storage medium
CN111625108A
Multi-factor login authentication method and device of industrial control PLC system and PLC system
CN116346415A