A method and device for obtaining topological information of basic input and output system
By automating the traversal of BIOS options to obtain screenshot images and text information, the problem of low efficiency and data loss in BIOS topology information acquisition is solved, achieving efficient and accurate topology information collection.
Patent Information
- Application Number
- CN202310192618.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2043-02-24
AI Technical Summary
In existing technologies, BIOS topology information acquisition is inefficient and prone to data acquisition errors and data loss, especially when maintaining and testing numerous and diverse servers in a server room, which requires a lot of human resources.
By traversing various options in the BIOS, the cursor area and text information in the screenshot image are obtained. OCR technology is used to recognize the text information, and the integrity of the topology information is verified by comparing the screenshot images. A threshold for the number of downlinks is set to reduce the number of screenshots, thereby achieving automated acquisition of topology information.
It improves the efficiency of BIOS topology information acquisition, ensures the accuracy and integrity of the information, reduces the use of human resources, and avoids data loss.
Smart Images

Figure CN116149951B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for acquiring topological information of a basic input and output system. Background Art
[0002] As the core component of the server, the Basic Input Output System (BIOS) records the most important basic input and output programs of computer equipment, the self-test program after power-on, and the system self-starting program. Therefore, the topology information acquisition of BIOS has also become the basis for the operation of the server.
[0003] In the prior art, for a server's BIOS, topological information such as parameters in its options and associations between the options is usually obtained by manually accessing the BIOS setup (ie, Setup) interface when the server is powered on to manually collect information about each option.
[0004] However, this collection method has low efficiency in obtaining topological information, and manual collection is prone to data collection errors and data loss. Especially when there are a large number of servers of different types that need to be maintained and tested in the server room, a lot of human resources are required. Summary of the invention
[0005] The present invention provides a basic input and output system topology information acquisition method, device, electronic equipment and storage medium to solve the problem of low efficiency in acquiring BIOS topology information.
[0006] According to one aspect of the present invention, a method for acquiring topology information of a basic input / output system is provided, comprising:
[0007] Traverse each option of the basic input and output system and obtain the first screenshot image corresponding to the current option;
[0008] Acquire a cursor area in the first screenshot image, and acquire text information of the current option through the cursor area;
[0009] Continue to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed, and obtain the topology information of the basic input and output system according to the text information of each option.
[0010] After obtaining the topology information of the basic input / output system according to the text information of each of the options, the method further includes: comparing the topology information of the basic input / output system with the screenshots corresponding to the options of the basic input / output system; if the topology information of the basic input / output system matches the text information of each option in each of the screenshots, it is determined that the topology information of the basic input / output system passes the verification. By extracting the text of the options in each of the screenshots, the integrity of the obtained BIOS topology information is verified, ensuring the integrity of the BIOS topology information and further improving the accuracy of the obtained topology information.
[0011] The method of continuing to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed, further includes: judging whether the current option is a traversed option based on the text information of the current option and the text information of the traversed options; if it is determined that the current option is an untraversed option, continuing to traverse other options in the current option column to ensure that the traversal of the current option column is complete, and at the same time, it is convenient to record the association relationship between the various options under the same option column; if it is determined that the current option is a traversed option, stopping the traversal of the current option column to avoid performing repeated and invalid traversal operations in the current option column, thereby improving the efficiency of option traversal.
[0012] After stopping the traversal of the current option column, the method includes: traversing the next option in the right row to obtain text information of the next option; judging whether the next option is a traversed option according to the text information of the next option; if it is determined that the next option is an untraversed option, continuing to traverse other options in the option column where the next option is located; if it is determined that the next option is a traversed option, judging whether there is a parent interface; if there is a parent interface, continuing to traverse other options in the parent interface; if there is no parent interface, determining that all options of the basic input and output system have been traversed. After determining that the current option is a traversed option, the option column where the right-row traversal option is located is traversed to achieve traversal and switching of different option columns in an interface, thereby ensuring the integrity of option traversal in the current interface; when determining that the right-row traversal option is a traversed option and there is an upper-level interface, return to the upper-level interface and continue to traverse other options of the upper-level interface, thereby achieving traversal and switching of options in different display level interfaces, and constructing a nested relationship between each option and the sub-interface option; when determining that the right-row traversal option is a traversed option and there is no upper-level interface, it can be determined that all options have been traversed, thereby obtaining complete BIOS topology information, further avoiding the occurrence of data loss.
[0013] After determining that the current option is an untraversed option, it also includes: determining whether the text information of the current option includes a sub-interface identifier; if it is determined that the sub-interface identifier is included, triggering the sub-interface corresponding to the current option, and continuing to traverse the options in the sub-interface; the said continuing to traverse other options in the current option column includes: if it is determined that the sub-interface identifier is not included, continuing to traverse other options in the current option column. This realizes the nesting of traversal of options and sub-interface options, ensures the timely acquisition of complete text information under each option, and at the same time, facilitates the recording of the association between each option and its sub-interface options.
[0014] After traversing each option of the basic input and output system, it also includes: if it is determined that the current option is the first option in the current option column, then obtain the second screenshot image corresponding to the current option, and obtain the text information of each option in the second screenshot image and the number of options; set the threshold of the number of downlinks of the current option column according to the number of options; wherein the number of options is equal to the threshold of the number of downlinks; if it is determined that the current option is not the first option in the current option column, then obtain the number of downlinks corresponding to the current option, and compare the number of downlinks with the threshold of the number of downlinks; if the number of downlinks is less than the threshold of the number of downlinks, continue to traverse other options; if the number of downlinks is greater than or equal to the threshold of the number of downlinks, then obtain the third screenshot image corresponding to the current option, so as to determine whether the current option column has been traversed according to the third screenshot image. It is only necessary to obtain screenshot images at a few option positions to obtain complete BIOS topology information, which greatly reduces the number of screenshots in the screen and further improves the efficiency of obtaining BIOS topology information.
[0015] The method of continuing to traverse other options includes: if the current option includes a sub-interface identifier, continuing to traverse other options; after determining whether the current option column has been traversed, it also includes: if it is determined that the current option column has been traversed, according to the target option including the sub-interface identifier in the current option column, traversing the sub-interface options of each target option in sequence. The traversal of each option column is completed first, so that after completing the traversal of an option column, the topology information of a complete interface can be obtained without waiting for the traversal of other sub-interface options in the interface to be completed, thereby improving the efficiency of obtaining the topology information of each interface.
[0016] According to another aspect of the present invention, there is provided a device for acquiring topology information of a basic input / output system, comprising:
[0017] A screenshot image acquisition module, used to traverse various options of the basic input and output system and obtain a first screenshot image corresponding to the current option;
[0018] A text information acquisition module, used to acquire a cursor area in the first screenshot image, and acquire text information of the current option through the cursor area;
[0019] The topology information acquisition module is used to continue traversing other options of the basic input and output system until all options of the basic input and output system have been traversed, and to acquire the topology information of the basic input and output system according to the text information of each option.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] at least one processor; and
[0022] a memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for acquiring topology information of a basic input and output system described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for obtaining topology information of a basic input / output system described in any embodiment of the present invention when executed.
[0025] The technical solution of the embodiment of the present invention traverses various options of the BIOS and obtains the screenshot image corresponding to each option and the cursor area in the screenshot image, so as to obtain the text information of the current option through the cursor area, and then obtain the topology information of the BIOS based on the text information of each option, thereby realizing automatic traversal and acquisition of BIOS topology information, improving the efficiency of acquiring topology information, saving human resources occupied by information acquisition, and at the same time, ensuring the accuracy of the topology information acquisition results and avoiding the occurrence of data loss.
[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 is a flowchart of a method for acquiring topology information of a basic input / output system provided in accordance with Embodiment 1 of the present invention;
[0029] Figure 2 is a flow chart of a method for acquiring topology information of a basic input / output system provided according to a second embodiment of the present invention;
[0030] Figure 3 is a flowchart of a method for obtaining topology information of a basic input / output system provided in accordance with Embodiment 3 of the present invention;
[0031] Figure 4 is a schematic diagram of the structure of a topology information acquisition device for a basic input / output system provided according to a fourth embodiment of the present invention;
[0032] Figure 5 It is a schematic diagram of the structure of an electronic device for implementing the method for acquiring topology information of a basic input / output system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] Embodiment 1
[0036] Figure 1 This is a flowchart of a method for obtaining topology information of a basic input / output system provided in the first embodiment of the present invention. This embodiment can be applied to obtaining topology information of the BIOS by automatically traversing various options of the BIOS. The method can be executed by a topology information obtaining device of the basic input / output system. The topology information obtaining device of the basic input / output system can be implemented in the form of hardware and / or software. The topology information obtaining device of the basic input / output system is configured in an electronic device such as a management server. Figure 1 As shown, the method includes:
[0037] S101, traversing various options of a basic input and output system, and obtaining a first screenshot image corresponding to a current option.
[0038] After logging into the management server locally, the operation and maintenance personnel can start the KVM (Kernel-based Virtual Machine) virtual machine on the management server, and issue operation and maintenance instructions to the test server in the KVM virtual machine through the communication interface between the management server and the test server, so as to control the test server to power on and enter the BIOS option setting interface, and then traverse the BIOS options of the test server; at the same time, the operation and maintenance personnel can also issue the above operation and maintenance instructions by remotely logging into the management server; among them, the maintenance personnel can use the browser automation testing tool Selenium to remotely log in to the Web (World Wide Web) page of the BMC (Baseboard Management Controller) of the management server.
[0039] After entering the BIOS option setting interface of the test server, in the initial state, the cursor will stay on the first option of the first option column of the main interface, which serves as the starting point for traversing various options; the traversal operation of BIOS options can be completed through the GUI (Graphical User Interface) automation tool PyautoGUI library in the Python language by simulating keyboard and mouse operations; for example, for traversing various options in an option column, the down-stroke traversal action can be performed by triggering the down-stroke key "↓" on the keyboard, that is, moving the cursor to the next option in the current option column; and the main interface of BIOS includes different option columns, and the column switching between different option columns can be performed by triggering the right-stroke key "→" on the keyboard to perform the right-stroke traversal action, that is, moving the cursor to the option of another option column.
[0040] In an embodiment of the present invention, the option column can be used as the first traversal condition, that is, the following traversal actions are used to traverse each option in an option column in turn; when each option is traversed, a corresponding screenshot image is obtained, and the screenshot image includes all the information currently displayed on the screen; wherein, the screenshot operation of the screen can be executed through the ImageGrab module of the Python image processing library.
[0041] S102: Acquire a cursor area in the first screenshot image, and acquire text information of a current option through the cursor area.
[0042] Since the first screenshot image is a capture operation performed when traversing to the current option, the current option in the first screenshot image is located in the highlighted area where the cursor is located. According to the pixel value of each pixel point in the first screenshot image, the highlighted area, that is, the image of the area where the cursor is located, can be directly obtained; wherein, the first screenshot image can be processed by functional modules such as the OpenCV2 library, and the image of the area where the highlighted pixel value is located can be extracted. After obtaining the cursor area, the cursor area can be identified by OCR (Optical Character Recognition) technology to obtain the text information in the image; wherein, the identification of the cursor area can be performed by Pytesseract, an OCR tool of the Python image processing library.
[0043] S103 , continue traversing other options of the basic input output system until all options of the basic input output system have been traversed, and obtain topology information of the basic input output system according to text information of each option.
[0044] As described in the above technical solution, when traversing to each option, the text information of the option can be identified through the cursor area. When all options are traversed, the text information of all options is obtained. At the same time, the association relationship between the options can be determined based on the key operations performed when traversing the options. For example, the options located in the same option column can be determined according to the downward key, and the options located in different option columns can be determined according to the right key.
[0045] Optionally, in an embodiment of the present invention, after obtaining the topology information of the basic input / output system according to the text information of each of the options, it also includes: comparing the topology information of the basic input / output system with the screenshot images corresponding to each of the options of the basic input / output system; if the topology information of the basic input / output system hits the text information of each option in each of the screenshot images, it is determined that the topology information of the basic input / output system has passed the verification.
[0046] Specifically, each screenshot image includes not only the text information of the current option, but also the text information of all or part of the options in the current interface. For example, when the number of options displayed in the current interface is large and not all of them can be displayed on the screen at the same time, some of the options at the front of the sequence will be displayed on the current screen. Therefore, in each screenshot image, by identifying the screenshot image, the text information of multiple options displayed simultaneously in the screenshot image can be directly obtained.
[0047] The topology information of the BIOS is compared with the text information extracted from each screenshot. If the topology information can hit the text information of all options in each screenshot, it means that the topology information has covered every option in all interfaces. Therefore, by extracting the option text in each screenshot, the topology information of the obtained BIOS is checked for integrity, ensuring the integrity of the topology information of the BIOS and further improving the accuracy of the obtained topology information.
[0048] In particular, for screenshots, different options under the same option column may correspond to the same screenshot; for example, an option column includes three options, and the three options are displayed in one interface at the same time. Then, when traversing between the three options, the display content in the three screenshots obtained at the three option positions is the same, and the only difference is that the cursor position is different. Therefore, the option text information extracted from each screenshot is also the same. Therefore, each screenshot image can be deduplicated through image comparison to reduce the number of screen images to be compared and improve the verification efficiency of BIOS topology information.
[0049] Optionally, in an embodiment of the present invention, after obtaining the text information of the current option, it also includes: judging whether the current option is a traversed option based on the text information of the current option and the text information of the traversed options; if it is determined that the current option is an untraversed option, continuing to traverse other options in the current option column; if it is determined that the current option is a traversed option, stopping the traversal of the current option column.
[0050] Specifically, for an option column, after traversing each option through the downward traversal operation, if the last option of the option column is traversed, and then the downward traversal operation is continued, it will jump back to the first option of the option column; therefore, the text information of the current option is compared with the text information of the traversed options. If the current text information has not been obtained, the current option is an untraversed option, so continue to traverse downward to obtain other options of the option column to ensure that the traversal of the current option column is complete. At the same time, it is convenient to record the association relationship between the options under the same option column.
[0051] If the current text information has been obtained, the current option is a traversed option, indicating that the current option column has been traversed and has jumped back to the first option in the current option column. Therefore, stop traversing the current option column and continue traversing other option columns in the current interface, or when all option columns in the current interface have been traversed, return to the parent menu and continue traversing option columns in other interfaces to avoid repeated and invalid traversal operations in the current option column, thereby improving option traversal efficiency.
[0052] Optionally, in an embodiment of the present invention, after determining that the current option is an untraversed option, it also includes: determining whether the text information of the current option includes a sub-interface identifier; if it is determined that the sub-interface identifier is included, triggering the sub-interface corresponding to the current option, and continuing to traverse the options in the sub-interface; continuing to traverse other options in the current option column includes: if it is determined that the sub-interface identifier is not included, continuing to traverse other options in the current option column.
[0053] Specifically, if the text information of an option contains specific symbolic identifiers, for example, the text starts with the "△" symbol, it indicates that the option has a sub-interface. At this time, the Enter key "Enter" is triggered to trigger the display of the sub-interface of the current option. After the sub-interface is displayed, the cursor stays at the first option in the first option column of the sub-interface, thereby continuing to traverse the options in the sub-interface to achieve nested traversal of options and sub-interface options, ensuring timely acquisition of complete text information under each option, and at the same time, facilitating the recording of the relationship between each option and its sub-interface options; in addition, when the traversal of the current interface is completed, the return key "Esc" is triggered to exit the current interface and return to the parent interface. After returning to the parent interface, the cursor stays at the option position in the parent interface that triggers the sub-interface.
[0054] The technical solution of the embodiment of the present invention traverses various options of the BIOS and obtains the screenshot image corresponding to each option and the cursor area in the screenshot image, so as to obtain the text information of the current option through the cursor area, and then obtain the topology information of the BIOS based on the text information of each option, thereby realizing automatic traversal and acquisition of BIOS topology information, improving the efficiency of acquiring topology information, saving human resources occupied by information acquisition, and at the same time, ensuring the accuracy of the topology information acquisition results and avoiding the occurrence of data loss.
[0055] Embodiment 2
[0056] Figure 2 This is a flowchart of a method for obtaining topological information of a basic input / output system provided by the second embodiment of the present invention. The relationship between this embodiment and the above embodiment is that if the current option is determined to be a traversed option, the next option is traversed to the right to obtain the text information of the next option. Figure 2 As shown, the method includes:
[0057] S201, traverse various options of the basic input and output system, and obtain a first screenshot image corresponding to the current option; execute S201.
[0058] S202, obtaining a cursor area in the first screenshot image, and obtaining text information of the current option through the cursor area; executing S203.
[0059] S203. According to the text information of the current option and the text information of the traversed options, if it is determined that the current option is a traversed option, stop traversing the current option column; and execute S204.
[0060] S204, traverse the next option in the right row to obtain text information of the next option; execute S205.
[0061] After comparing the text information of the current option with the text information of the traversed options, if it is determined that the current option is a traversed option, it means that the options in the current option column have been traversed and have jumped back to the first option in the current option column. At this time, the right row traversal operation is performed by pressing the right row key "→"; if the current interface includes multiple option columns, then after performing the right row traversal, it will jump to the first option in another option column, and the first option in the other option column is obviously an option that has not been traversed. Therefore, if it is determined based on the comparison of the text information that the currently obtained text information has not been obtained, then the current option is at the first option in another option column, and the traversal continues in the option column, thereby realizing the traversal and switching of different option columns in one interface.
[0062] S205. Determine whether the next option is a traversed option based on the text information of the next option; if not, execute S206; if so, execute S207.
[0063] S206, continue traversing other options in the option column where the next option is located; and execute S209.
[0064] S207, determine whether there is a parent interface; if so, execute S208; if not, execute S210.
[0065] As described in the above technical solution, after executing the right row traversal operation by pressing the right row key "→", if the current interface only includes one option column, then after executing the right row traversal, it will not jump to any option and will remain at the current option, and the right row traversal operation will be deemed invalid; if the current interface includes multiple option columns, but the current option column is the last option column (i.e., the rightmost option column), then after executing the right row traversal, it will jump to the first option in the first option column, and whether it still stays at the current option or jumps to the first option in the first option column, it is obvious that they are all options that have been traversed. Therefore, if it is determined based on the comparison of text information that the currently acquired text information has been acquired, it indicates that the options of the last option column in the current interface have been traversed, and thus it is continued to be determined whether there is a parent interface.
[0066] Since the sub-interface is triggered by the enter key "Enter", it is possible to determine whether there is an upper-level interface by judging whether there is a trigger action of the enter key "Enter" on the current interface; if there is a trigger action of the enter key "Enter", it is determined that there is an upper-level interface; if there is no trigger action of the enter key "Enter", it is determined that there is no upper-level interface.
[0067] S208, continue to traverse other options in the upper interface; execute S209.
[0068] S209, continue to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed; execute S211.
[0069] S210, determining that all options of the basic input and output system have been traversed; executing S211.
[0070] S211 . Acquire topology information of the basic input / output system according to the text information of each option.
[0071] The technical solution of the embodiment of the present invention, after determining that the current option is a traversed option, when it is determined through the text information of the right-row traversal option that the right-row traversal option is an untraversed option, the traversal of the option column where the right-row traversal option is located is continued, thereby realizing the traversal switching of different option columns in an interface, ensuring the integrity of the option traversal in the current interface, and when it is determined that the right-row traversal option is a traversed option and there is an upper-level interface, returning to the upper-level interface and continuing to traverse other options of the upper-level interface, thereby realizing the traversal switching of options in different display level interfaces, constructing a nested relationship between each option and the sub-interface option, and when it is determined that the right-row traversal option is a traversed option and there is no upper-level interface, it can be determined that all options have been traversed, thereby obtaining complete BIOS topology information, and further avoiding the occurrence of data loss.
[0072] Embodiment 3
[0073] Figure 3 This is a flowchart of a method for obtaining topology information of a basic input / output system provided in Embodiment 3 of the present invention. In this embodiment of the present invention, a threshold of the number of downlink times is set for each option column. Figure 3 As shown, the method includes:
[0074] S301, traverse various options of the basic input and output system; if it is determined that the current option is the first option in the current option list, execute S302; otherwise, execute S304.
[0075] S302, obtaining a second screenshot image corresponding to the current option, and obtaining text information and the number of options of each option in the second screenshot image; executing S303.
[0076] When each interface is displayed, the cursor is located on the first option in the first option column in the interface, and the display of each interface needs to be triggered by the Enter key "Enter". Therefore, it can be determined that after each Enter key "Enter" is triggered, the cursor must be located at the first option; in addition, for non-first option columns in an interface, the cursor jumps from the first option of the previous option column to the first option of the next option column by triggering the right-row key "→". Therefore, it can also be determined that after each right-row key "→" is triggered, the cursor must be located at the first option.
[0077] S303. Set a threshold of the number of times the current option column is downlinked according to the number of options; wherein the number of options is equal to the threshold of the number of times the current option column is downlinked; and execute S301.
[0078] Assuming that the current option column is option column A, and the number of the first option in option column A is option 1, by recognizing the second screenshot image, the text information of options 1 to 10 in option column A can be directly obtained, and it can be determined that the number of options in the second screenshot image is 10; therefore, the threshold of the number of downlinks is set to 10, that is, in option column A, the screenshot operation will not be performed before the number of downlink traversals reaches 10 times.
[0079] S304, obtaining the number of downlinks corresponding to the current option, and comparing the number of downlinks with the number of downlinks threshold; if the number of downlinks is less than the number of downlinks threshold, executing S305; otherwise, executing S306.
[0080] Since the first option in an option column serves as the traversal starting point of the option column, and other options are traversed in turn through the down-stroke key "↓", after the first option is determined, the options obtained by the down-stroke traversal operations performed thereafter are all non-first options; and after each down-stroke key "↓" is triggered, the cursor will jump once, so when the cursor is located at each option, the down-stroke number corresponding to the current option can be obtained, and the down-stroke number corresponding to the current option can be compared with the down-stroke number threshold according to the set down-stroke number threshold.
[0081] S305, continue to traverse other options downward; execute S306.
[0082] Taking the above technical solution as an example, when the cursor moves downward to option 2 to option 10 in option column A, the number of downward movements are 1 to 9 respectively. Obviously, the number of downward movements has not reached 10. Therefore, when the cursor reaches option 2 to option 10, the downward traversal operation continues to be performed, and the screenshot operation is not performed; in particular, if one or more options among options 1 to option 10 include a sub-interface, in the above one or more options, the sub-interface option traversal of the option continues to be performed, and after the sub-interface option traversal is completed, continue to return to the option position, and the traversal operation in the sub-interface option does not affect the number of downward movements in the current interface.
[0083] S306. Obtain a third screenshot image corresponding to the current option, and determine whether the current option column is traversed completely according to the third screenshot image; and execute S307.
[0084] Taking the above technical solution as an example, the cursor continues to traverse downward from option 10. When the number of downward traversals is equal to 10 times, if option 11 exists, the cursor will jump to option 11; if option 11 does not exist, it will jump back to option 1. Therefore, the text information of the current option in the third screen can be obtained through the third screenshot image obtained when the number of downward traversals is equal to the downward traversal number threshold. If the text information of the current option has not been obtained, it indicates that the current option is option 11. As described in the above technical solution, continue to traverse other options in option column A until jumping back to option 1; if the text information of the current option has been obtained, it indicates that the current option is option 1, that is, the current option column has been traversed. Compared with obtaining a screenshot image at each option position, by setting a downward traversal number threshold and calculating the downward traversal number for each option position, it is only necessary to obtain screenshot images at a few option positions to obtain complete BIOS topology information, which greatly reduces the number of screenshots on the screen and further improves the efficiency of obtaining BIOS topology information.
[0085] Optionally, in an embodiment of the present invention, continuing to traverse other options downward includes: if the current option includes a sub-interface identifier, continuing to traverse other options downward; after determining whether the current option column has been traversed, it also includes: if it is determined that the current option column has been traversed, then according to the target option that includes the sub-interface identifier in the current option column, traversing the sub-interface options of each target option in turn.
[0086] Specifically, since in BIOS, except for the main interface, other interfaces usually only include one option column, the completion of traversal of the option column means the completion of traversal of one interface. Therefore, the traversal of each option column can be completed first, thereby realizing the real-time acquisition of the option text in the current interface, and then the traversal of the sub-interfaces under each option is continued for the options including the sub-interfaces. Compared with the traversal method of nesting sub-interface options in options, each interface can be uniformly generated according to the complete traversal logic only when all interface traversals are completed. The above technical solution is to give priority to the traversal of each option column, thereby completing the topology information acquisition of a complete interface after completing the traversal of one option column, without waiting for the traversal of other sub-interface options in the interface, thereby improving the efficiency of acquiring the topology information of each interface.
[0087] S307 , continue traversing other options of the basic input output system until all options of the basic input output system have been traversed, and obtain topology information of the basic input output system according to text information of each option.
[0088] The technical solution of the embodiment of the present invention obtains the corresponding screenshot image at the first option position of each option column, and obtains the text information of each option in the screenshot image and the number of options, so as to set a downlink number threshold for the option column, and based on the downlink number threshold, when the downlink number reaches the downlink number threshold, obtain the screenshot image again, so that only screenshot images need to be obtained at a few option positions to obtain complete BIOS topology information, which greatly reduces the number of screenshots on the screen and further improves the efficiency of obtaining BIOS topology information.
[0089] Embodiment 4
[0090] Figure 4 : is a structural block diagram of a topology information acquisition device for a basic input / output system provided by a fourth embodiment of the present invention, the device specifically comprises:
[0091] The screenshot image acquisition module 401 is used to traverse various options of the basic input and output system and obtain the first screenshot image corresponding to the current option;
[0092] The text information acquisition module 402 is used to acquire the cursor area in the first screenshot image, and acquire the text information of the current option through the cursor area;
[0093] The topology information acquisition module 403 is used to continue traversing other options of the basic input and output system until all options of the basic input and output system have been traversed, and to acquire the topology information of the basic input and output system according to the text information of each option.
[0094] The technical solution of the embodiment of the present invention traverses various options of the BIOS and obtains the screenshot image corresponding to each option and the cursor area in the screenshot image, so as to obtain the text information of the current option through the cursor area, and then obtain the topology information of the BIOS based on the text information of each option, thereby realizing automatic traversal and acquisition of BIOS topology information, improving the efficiency of acquiring topology information, saving human resources occupied by information acquisition, and at the same time, ensuring the accuracy of the topology information acquisition results and avoiding the occurrence of data loss.
[0095] Optionally, the topology information acquisition device of the basic input and output system further includes:
[0096] The verification execution module is used to compare the topology information of the basic input and output system with the screenshots corresponding to the various options of the basic input and output system; if the topology information of the basic input and output system hits the text information of each option in each of the screenshots, it is determined that the topology information of the basic input and output system passes the verification.
[0097] Optionally, the topology information acquisition module 403 is specifically used to determine whether the current option is a traversed option based on the text information of the current option and the text information of the traversed options; if it is determined that the current option is an untraversed option, continue to traverse other options in the current option column; if it is determined that the current option is a traversed option, stop traversing the current option column.
[0098] Optionally, the topology information acquisition module 403 is also specifically used to traverse the next option in the right row to obtain the text information of the next option; based on the text information of the next option, determine whether the next option is a traversed option; if it is determined that the next option is an untraversed option, continue to traverse other options in the option column where the next option is located; if it is determined that the next option is a traversed option, determine whether there is an upper-level interface; if there is an upper-level interface, continue to traverse other options in the upper-level interface; if there is no upper-level interface, determine that all options of the basic input and output system have been traversed.
[0099] Optionally, the topology information acquisition module 403 is also specifically used to determine whether the text information of the current option includes a sub-interface identifier; if it is determined that the sub-interface identifier is included, the sub-interface corresponding to the current option is triggered, and the options in the sub-interface are continued to be traversed; if it is determined that the sub-interface identifier is not included, other options in the current option column are continued to be traversed.
[0100] Optionally, a traversal execution module is used to obtain a second screenshot image corresponding to the current option if it is determined that the current option is the first option in the current option column, and obtain the text information of each option in the second screenshot image and the number of options; set a downward number threshold for the current option column according to the number of options; wherein the number of options is equal to the downward number threshold; if it is determined that the current option is not the first option in the current option column, obtain the downward number corresponding to the current option, and compare the downward number with the downward number threshold; if the downward number is less than the downward number threshold, continue to traverse other options downward; if the downward number is greater than or equal to the downward number threshold, obtain a third screenshot image corresponding to the current option to determine whether the current option column has been traversed based on the third screenshot image.
[0101] Optionally, a traversal execution module is specifically used to continue traversing other options if the current option includes a sub-interface identifier; if it is determined that the current option column has been traversed, the sub-interface options of each target option including the sub-interface identifier in the current option column are traversed in turn.
[0102] The above device can execute the basic input and output system topology information acquisition method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the basic input and output system topology information acquisition method provided by any embodiment of the present invention.
[0103] Embodiment 5
[0104] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0105] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0106] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0107] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for obtaining topological information of a basic input and output system.
[0108] In some embodiments, the method for obtaining topological information of a basic input-output system can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program can be loaded and / or installed on a heterogeneous hardware accelerator via a ROM and / or a communication unit. When the computer program is loaded into RAM and executed by a processor, one or more steps of the method for obtaining topological information of a basic input-output system described above can be executed. Alternatively, in other embodiments, the processor can be configured to execute the method for obtaining topological information of a basic input-output system by any other appropriate means (e.g., by means of firmware).
[0109] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0111] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] To provide interaction with a user, the systems and techniques described herein may be implemented on a heterogeneous hardware accelerator having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which a user can provide input to the heterogeneous hardware accelerator. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0113] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0114] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0116] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for obtaining topological information of a basic input and output system, It is characterized in that include: Traverse each option of the basic input and output system and obtain the first screenshot image corresponding to the current option; Acquire a cursor area in the first screenshot image, and acquire text information of the current option through the cursor area; Continue to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed, and obtain topology information of the basic input and output system according to text information of each option; The step of continuing to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed completely further includes: According to the text information of the current option and the text information of the traversed options, determine whether the current option is a traversed option; If it is determined that the current option is an untraversed option, continue to traverse other options in the current option column; If it is determined that the current option is a traversed option, stop traversing the current option column; After stopping the traversal of the current option column, include: Traverse the next option in the right row to obtain the text information of the next option; According to the text information of the next option, determining whether the next option is a traversed option; If it is determined that the next option is an untraversed option, continue to traverse other options in the option column where the next option is located; If it is determined that the next option is a traversed option, then determine whether there is a parent interface; If there is a parent interface, continue to traverse other options in the parent interface; If no upper level interface exists, it is determined that all options of the basic input and output system have been traversed.
2. The method according to claim 1, It is characterized in that After acquiring the topology information of the basic input / output system according to the text information of each option, the method further includes: comparing the topology information of the basic input and output system with the screenshot images corresponding to the respective options of the basic input and output system; If the topology information of the basic input and output system matches the text information of each option in each of the screenshot images, it is determined that the topology information of the basic input and output system passes the verification.
3. The method according to claim 1, It is characterized in that After determining that the current option is an untraversed option, it also includes: Determine whether the text information of the current option includes a sub-interface identifier; If it is determined that the sub-interface identifier is included, the sub-interface corresponding to the current option is triggered, and the options in the sub-interface are continued to be traversed; The other options of the current option list are traversed continuously, including: If it is determined that the sub-interface identifier is not included, continue to traverse other options in the current option column.
4. The method according to claim 1, It is characterized in that After going through the various options of the basic input and output system, it also includes: If it is determined that the current option is the first option in the current option list, then obtaining a second screenshot image corresponding to the current option, and obtaining text information and the number of options of each option in the second screenshot image; Setting a threshold of the number of times the current option column is downlinked according to the number of options; wherein the number of options is equal to the threshold of the number of times the current option column is downlinked; If it is determined that the current option is not the first option in the current option list, the number of downlinks corresponding to the current option is obtained, and the number of downlinks is compared with the number of downlinks threshold; If the number of downlinks is less than the downlink number threshold, continue to traverse other options; If the number of downlinks is greater than or equal to the downlink number threshold, a third screenshot image corresponding to the current option is obtained to determine whether the current option column has been traversed according to the third screenshot image.
5. The method according to claim 4, It is characterized in that The further downstream traversal options include: If the current option includes a sub-interface identifier, continue to traverse other options; After determining whether the current option column has been traversed, it also includes: If it is determined that the current option column has been traversed completely, then according to the target options including the sub-interface identifiers in the current option column, the sub-interface options of each target option are traversed in sequence.
6. A device for acquiring topological information of a basic input and output system, It is characterized in that include: A screenshot image acquisition module, used to traverse various options of the basic input and output system and obtain a first screenshot image corresponding to the current option; A text information acquisition module, used to acquire a cursor area in the first screenshot image, and acquire text information of the current option through the cursor area; A topology information acquisition module, used for continuing to traverse other options of the basic input and output system until all options of the basic input and output system have been traversed, and acquiring the topology information of the basic input and output system according to the text information of each option; The topology information acquisition module is specifically used to determine whether the current option is a traversed option based on the text information of the current option and the text information of the traversed options; If it is determined that the current option is an untraversed option, continue to traverse other options in the current option column; If it is determined that the current option is a traversed option, stop traversing the current option column; The topology information acquisition module is further used to traverse the next option in the right row to obtain text information of the next option; According to the text information of the next option, determining whether the next option is a traversed option; If it is determined that the next option is an untraversed option, continue to traverse other options in the option column where the next option is located; If it is determined that the next option is a traversed option, then determine whether there is a parent interface; If there is a parent interface, continue to traverse other options in the parent interface; If no upper level interface exists, it is determined that all options of the basic input and output system have been traversed.
7. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for acquiring topology information of a basic input and output system according to any one of claims 1 to 5.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for acquiring topology information of a basic input / output system according to any one of claims 1 to 5 when executed.
