Function verification method and device for universal serial bus host controller
By obtaining and matching the update log information of the universal serial bus host controller, automatically determining the external device type and applying preset policies for function verification, the problem of low efficiency of function verification in the existing technology is solved and efficient automated verification is achieved.
Patent Information
- Application Number
- CN202411360662.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-09-27
AI Technical Summary
In the prior art, the functional verification efficiency of the universal serial bus host controller is low, mainly because it is necessary to manually execute the functional verification steps of each external device and analyze the results.
By obtaining the update log information of the enumeration log, matching the standard type keywords to determine the type of the external device, and selecting a preset function verification strategy based on the type for automated function verification.
Automatic function verification of each universal serial bus external device is realized, which improves verification efficiency and reduces manual intervention.
Smart Images

Figure CN119494092A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for verifying the function of a universal serial bus host controller. Background Art
[0002] Universal Serial Bus (USB) is a widely used serial communication technology. It is mature, has strong interface functions, is highly versatile, and supports a wide range of devices. Therefore, most system-on-chips (SOCs) contain a USB host controller. System-on-chips include simple microcontrollers and complex processors.
[0003] In order to ensure that the Universal Serial Bus host controller works stably and efficiently in various environments, it is necessary to perform functional verification on the Universal Serial Bus host controller. Functional verification mainly includes whether the Universal Serial Bus host controller supports the functional implementation of various Universal Serial Bus peripheral devices. At present, when performing functional verification, each step of the functional verification command for each Universal Serial Bus peripheral device is generally executed manually, and the results of the command execution are manually analyzed, resulting in a relatively low efficiency in the functional verification of Universal Serial Bus peripheral devices. Summary of the invention
[0004] In view of the problems existing in the prior art, the present application provides a method and device for functional verification of a universal serial bus host controller.
[0005] The present application provides a method for functional verification of a universal serial bus host controller, comprising: obtaining update log information of an enumeration log; wherein the update log information includes at least one standard type keyword; matching a plurality of type keywords with the update log information respectively, determining a type keyword matching the standard type keyword as a target type keyword, and determining a type of an external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; determining a target functional verification strategy from a plurality of preset functional verification strategies based on the type of the external universal serial bus device, and performing functional verification on the external universal serial bus device using the functional verification strategy; wherein the preset functional verification strategy corresponds one-to-one to the type of the external universal serial bus device.
[0006] According to a function verification method for a universal serial bus host controller provided by the present application, obtaining update log information of an enumeration log includes: backing up the enumeration log and obtaining a backup enumeration log; comparing the current enumeration log and the backup enumeration log within a specified time interval, and when determining that there is a difference between the current enumeration log and the backup enumeration log, obtaining update log information based on the difference between the current enumeration log and the backup enumeration log.
[0007] According to a function verification method for a universal serial bus host controller provided by the present application, before obtaining the update log information of the enumeration log, the method further includes: backing up the device node directory of the external universal serial bus device to obtain the backup device node directory; wherein the device node directory includes a node keyword, and the node keyword corresponds to the device node information; after determining the type of the external universal serial bus device, the method further includes: obtaining the update device node directory; obtaining a standard node keyword based on the type of the external universal serial bus device, using the standard node keyword to search in the backup device node directory, determining that the node keyword matching the standard node keyword is the first target node keyword, and obtaining the first The backup device node information corresponds to the target node keyword; using the standard node keyword to search in the update device node directory, determining that the node keyword matching the standard node keyword is the second target node keyword, and obtaining the update device node information corresponding to the second target node keyword; comparing the backup device node information with the update device node information, and obtaining the newly added device node information under the node path; obtaining the device node of the external universal serial bus device based on the newly added device node information; using the function verification strategy to perform function verification on the external universal serial bus device, specifically including: using the function verification strategy to perform function verification on the corresponding external universal serial bus device through the device node.
[0008] According to a functional verification method for a universal serial bus host controller provided by the present application, the update log information also includes at least one node keyword, and the node keyword corresponds to the device node name; after determining the type of an external universal serial bus device, the method also includes: obtaining a standard node keyword based on the type of the external universal serial bus device, using the standard node keyword to search in the update log information, determining that the node keyword matching the standard node keyword is a target node keyword, and obtaining the device node name corresponding to the target node keyword; obtaining a device node path based on the type of the external universal serial bus device; wherein the type of the external universal serial bus device corresponds one-to-one to the device node path; obtaining a device node of the external universal serial bus device based on the device node path and the device node name; and performing functional verification on the external universal serial bus device using the functional verification strategy, specifically including: using the functional verification strategy to perform functional verification on the corresponding external universal serial bus device through the device node.
[0009] According to a function verification method for a universal serial bus host controller provided by the present application, the external universal serial bus device is a flash memory disk; the function verification strategy is used to perform function verification on the external universal serial bus device, including: obtaining a verification file, and calculating a verification check value of the verification file; creating a mount directory, and mounting the device node of the flash memory disk to the mount directory; writing the verification file to the mount directory to obtain a write verification file, and calculating a write check value of the write verification file; when the write check value is the same as the verification check value, reading the verification file from the mount directory to obtain a read verification file, and calculating a read check value of the read verification file; when the read check value is the same as the verification check value, determining that the function of the flash memory disk is normal.
[0010] According to a function verification method for a universal serial bus host controller provided by the present application, the external universal serial bus device is a click input device; the function verification strategy is used to perform function verification on the external universal serial bus device, including: backing up event data of the click input device and obtaining input backup event data; monitoring the click input device, and obtaining first monitoring event data when the click input device performs click input and generates an interrupt signal; comparing the first monitoring event data with the input backup event data, and when it is determined that the monitoring event data has new data, backing up the monitoring event data to obtain no-input backup event data; monitoring the click input device, and when the click input device does not perform click input and does not generate an interrupt signal, obtaining second monitoring event data; comparing the second monitoring event data with the no-input backup event data, and when it is determined that the monitoring event data has no new data, determining that the function of the click input device is normal.
[0011] According to a functional verification method for a universal serial bus host controller provided by the present application, the external universal serial bus device is a video input device; the functional verification strategy is used to perform functional verification on the external universal serial bus device, including: obtaining, through a device node of the video input device, a video format supported by the video input device, and each group of video parameter values supported by the video input device under each of the video formats; the video parameters include resolution, frame rate, number of images, and video file volume; according to each video format and each group of video parameter values corresponding to the video format, obtaining a detection video stream from the video input device through the device node; obtaining a detection video parameter value of the detection video stream, and determining that the function of the video input device is normal when the difference between the video monitoring parameter value and the video parameter value is within a preset range.
[0012] According to a function verification method of a universal serial bus host controller provided by the present application, before searching in the update log information by enumerating type keywords, the method further includes: searching in the update log information based on error keywords, and when it is determined that there is no error keyword, performing the step of matching multiple type keywords with the update log information respectively. The present application also provides a function verification device for a universal serial bus host controller, including: an update log information acquisition module, used to obtain update log information of an enumerated log; wherein the update log information includes at least one standard type keyword; a device type identification module, used to match multiple type keywords with the update log information respectively, determine the type keyword matching the standard type keyword as the target type keyword, and determine the type of an external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; a function verification module, used to determine a target function verification strategy from multiple preset function verification strategies based on the type of the external universal serial bus device, and use the function verification strategy to perform function verification on the external universal serial bus device; wherein the preset function verification strategy corresponds to the type of the external universal serial bus device one by one.
[0013] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a function verification method for a universal serial bus host controller as described in any one of the above is implemented.
[0014] Compared with manually performing functional verification of each Universal Serial Bus external device, the functional verification method and device of the Universal Serial Bus host controller provided in the embodiment of the present application obtains the update log information of the enumeration log, determines the target type keyword from multiple type keywords based on the standard type keyword in the update log information to determine the type of the external Universal Serial Bus device, and uses the target functional verification strategy to perform functional verification on the external Universal Serial Bus device. It can automatically verify the function of each Universal Serial Bus external device, thereby improving the verification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1This is one of the flow charts of the function verification method of the universal serial bus host controller provided by this application.
[0017] Figure 2 This is one of the framework schematic diagrams of the function verification method of the universal serial bus host controller provided by this application.
[0018] Figure 3 This is the second framework schematic diagram of the function verification method of the universal serial bus host controller provided by the present application.
[0019] Figure 4 This is the third framework diagram of the function verification method of the universal serial bus host controller provided by this application.
[0020] Figure 5 This is the fourth framework diagram of the function verification method of the universal serial bus host controller provided by the present application.
[0021] Figure 6 This is the fifth framework diagram of the function verification method of the universal serial bus host controller provided by the present application.
[0022] Figure 7 This is the sixth framework diagram of the function verification method of the universal serial bus host controller provided by this application.
[0023] Figure 8 This is the seventh framework diagram of the function verification method of the universal serial bus host controller provided by the present application.
[0024] Fig. 9 This is one of the structural schematic diagrams of the function verification device of the universal serial bus host controller provided by the present application.
[0025] Fig.10 This is the second structural schematic diagram of the function verification device of the universal serial bus host controller provided by the present application.
[0026] Fig.11 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] Combine the following Figure 1-Figure 10The present invention describes a method and device for verifying the function of a universal serial bus host controller. Figure 1 is a flow chart of a function verification method of a universal serial bus host controller provided by the present application, such as Figure 1 As shown, the method includes: Step 101: Obtain update log information of the enumeration log; wherein the update log information includes at least one standard type keyword.
[0029] The enumeration log is a log that records various events and error information during system startup and operation. Various events during operation include identification events of external universal serial bus devices after plugging in external universal serial bus devices and function verification events of external universal serial bus devices. For example, in the Linux operating system, the enumeration log may be a kernel log, and the kernel log may be / var / log / kern.log.
[0030] The update log information is the enumeration log after the external universal serial bus device is inserted, which is the newly added log information compared to the enumeration log before the external universal serial bus device is inserted. Therefore, the inserted external universal serial bus device can be identified and functionally verified based on the update log information. For example, in the Linux operating system, the newly added log information can be extracted and stored in enum.log to obtain the update log information. On this basis, the update log information can also be called a difference log.
[0031] The standard type keyword is a type keyword in the update log information, corresponding to the type of the external universal serial bus device inserted into the universal serial bus host. The update log information may include one standard type keyword or multiple standard type keywords. For example, if a different type of external universal serial bus device is inserted within a specified time interval, the update log information will record the keyword corresponding to the external universal serial bus device as the standard type keyword; if two different types of external universal serial bus devices are inserted within a specified time interval, the update log information will record the keywords corresponding to the two different types of external universal serial bus devices as standard type keywords.
[0032] Step 102: Match multiple type keywords with the update log information respectively, determine the type keyword that matches the standard type keyword as the target type keyword, and determine the type of the external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device.
[0033] The type keyword is a keyword that characterizes the type of an external Universal Serial Bus device. The corresponding type keyword can be pre-set for the external Universal Serial Bus device that needs to be functionally verified according to actual needs. In this way, for external Universal Serial Bus devices of different type ranges, the corresponding type keyword can be obtained before matching, which increases the scalability of the functional verification method of the Universal Serial Bus host controller provided in the embodiment of the present application.
[0034] The type keyword may also be referred to as a device keyword. For example, the type keyword may include mass storage, keyboard, mouse, audio, and camera. The type keyword corresponds to the type of the external universal serial bus device. For example, mass storage corresponds to a flash drive, keyboard corresponds to a keyboard, and so on.
[0035] The external universal serial bus devices for functional verification include a flash drive and a keyboard. The type keyword corresponding to the flash drive is mass storage, and the type keyword corresponding to the keyboard is keyboard. The external universal serial bus device to be verified is inserted into a universal serial bus host. The obtained update log information includes a standard type keyword, and the standard type keyword is keyboard. For example, mass storage and keyboard are matched with the update log information respectively. Mass storage fails to match the standard type keyword, and keyboard successfully matches the standard type keyword. It is determined that keyboard is the target type keyword, and it is determined that the type of the external universal serial bus device is keyboard.
[0036] Step 103: determine a target function verification strategy from a plurality of preset function verification strategies based on the type of the external USB device, and use the function verification strategy to perform function verification on the external USB device; wherein the preset function verification strategy corresponds to the type of the external USB device one by one.
[0037] Exemplarily, the type of the external universal serial bus device and the preset function verification strategy may have a mapping relationship. After determining the type of the external universal serial bus device, the target function verification strategy can be determined from multiple preset function verification strategies through the mapping relationship; the type keyword corresponding to the type of the external universal serial bus device can also be used to search in the name list of multiple preset function verification strategies to obtain the name of the preset function verification strategy containing the type keyword, and the target function verification strategy can be determined from the multiple preset function verification strategies based on the name of the preset function verification strategy, etc.
[0038] Compared with manually performing functional verification of each Universal Serial Bus external device, the functional verification method of the Universal Serial Bus host controller provided in the embodiment of the present application obtains the update log information of the enumeration log, determines the target type keyword from multiple type keywords based on the standard type keyword in the update log information to determine the type of the external Universal Serial Bus device, and uses the target functional verification strategy to perform functional verification on the external Universal Serial Bus device. It can automatically verify the function of each Universal Serial Bus external device, thereby improving the verification efficiency.
[0039] Figure 2 This is one of the framework diagrams of the function verification method of the universal serial bus host controller provided by this application. The preset function verification strategy may include a flash disk function verification strategy, an audio function verification strategy, a video function verification strategy, a keyboard function verification strategy, and a mouse function verification strategy. Figure 2 As shown, based on the above embodiment, after starting the functional verification, waiting for the external Universal Serial Bus device to be inserted, determining the type of the external Universal Serial Bus device, and using the corresponding target functional verification strategy to perform functional verification on the external Universal Serial Bus device, the functional verification result can be output; the functional verification result may include the steps of functional verification and the output of the execution results of each step.
[0040] The steps of the functional verification and the output of the execution results of each step can be recorded in the form of a file. The file may include information such as the type of the universal serial bus device and its device node, whether the functional verification of the universal serial bus device is abnormal, whether the functional verification results of the universal serial bus device require further manual analysis, and the content that requires manual analysis. If the file includes information such as manual analysis and content that requires manual analysis, the functional verification ends after the manual analysis.
[0041] Based on any of the above embodiments, obtaining update log information of the enumeration log includes: backing up the enumeration log to obtain the backup enumeration log; comparing the current enumeration log and the backup enumeration log within a specified time interval, and when determining that there is a difference between the current enumeration log and the backup enumeration log, obtaining update log information based on the difference between the current enumeration log and the backup enumeration log.
[0042] The specified time interval is the time interval for determining whether an external universal serial bus device is plugged into the universal serial bus host after the enumeration log is backed up. The specific specified time interval can be determined according to specific needs and is not further limited here.
[0043] The difference between the current enumeration log and the backup enumeration log may be log information newly added to the current enumeration log based on the backup enumeration log.
[0044] In this embodiment, the enumeration log can be backed up before the external universal serial bus device is inserted into the universal serial bus host, and multiple requests to obtain the current enumeration log can be made within a specified time interval after the enumeration log is backed up. For example, within 30 seconds after the enumeration log is backed up, a request to obtain the current enumeration log is made every 1 second.
[0045] By comparing the current enumeration log and the backup enumeration log, it can be determined whether there is a difference between the current enumeration log and the backup enumeration log. If yes, it is determined that the enumeration log has been updated, and the update log information can be obtained based on the difference between the current enumeration log and the backup enumeration log. If no, it is determined that the enumeration log has not been updated. For example, after 30 seconds after the enumeration log is backed up, if no, the waiting is ended, it is determined that the enumeration log has not been updated, and no external universal serial bus device is inserted into the universal serial bus host, and the function verification is ended.
[0046] After the external universal serial bus device is inserted into the universal serial bus host, if there is a difference between the current enumeration log and the backup enumeration log, by comparing the backup enumeration log and the current enumeration log, the log information newly added to the current enumeration log based on the backup enumeration log is obtained, and the update log information obtained based on the newly added log information is the log information related to the external universal serial bus device. Compared with using the complete enumeration log to perform the function verification of the universal serial bus host controller, in this embodiment, only the log information related to the external universal serial bus device is used to perform the function verification of the universal serial bus host controller, which can reduce the amount of data to be analyzed and improve the efficiency of the function verification.
[0047] Based on any of the above embodiments, before obtaining the update log information of the enumeration log, the method also includes: backing up the device node directory of the external universal serial bus device and obtaining the backup device node directory; wherein the device node directory includes a node keyword, and the node keyword corresponds to the device node information.
[0048] The device node directory is a data structure that stores device nodes. The node key is a common element of the device node of a certain type of external USB device. The device node information is the complete element of the device node of a certain type of external USB device in the USB host.
[0049] Exemplarily, the node keyword may be the common part of the device node name of a certain type of external universal serial bus device, the device node information may be the device node name including the node keyword, and the number of device node names is at least one. Specifically, the node keyword may be event, and the device node information may include eventmouse0, eventmouse1, eventmouse2, etc.
[0050] After determining the type of the external universal serial bus device, the method also includes: obtaining an update device node directory; obtaining a standard node keyword based on the type of the external universal serial bus device, using the standard node keyword to search in the backup device node directory, determining that the node keyword matching the standard node keyword is the first target node keyword, and obtaining backup device node information corresponding to the first target node keyword; using the standard node keyword to search in the update device node directory, determining that the node keyword matching the standard node keyword is the second target node keyword, and obtaining update device node information corresponding to the second target node keyword; comparing the backup device node information and the update device node information to obtain the newly added device node information under the node path; and obtaining the device node of the external universal serial bus device based on the newly added device node information.
[0051] Different from the update log information, the update device node directory is the device node directory obtained after the external universal serial bus device is inserted.
[0052] The standard node keyword is a keyword corresponding to the type of the external universal serial bus device. A mapping relationship may be set between the standard node keyword and the type of the external universal serial bus device, so that the standard node keyword can be directly obtained after the type of the external universal serial bus device is determined. For example, after determining that the external universal serial bus device is a mouse, the standard node keyword event can be obtained; after determining that the external universal serial bus device is a camera, the standard node keyword video can be obtained.
[0053] For example, if the external universal serial bus device is a mouse and the standard node keyword is event, after obtaining the standard node keyword, you can search in the backup device node directory to obtain the device node information including event. You can use the command ls -l / dev / input / event* | awk '{print $NF}'>event to generate an event file, and obtain the backup device node information including event by traversing the event file. The backup device node information may include eventmouse0 and eventmouse1.
[0054] Based on the same method, the updated device node information can be obtained, and the updated device node information may include eventmouse0, eventmouse1, and eventmouse2. By comparing the backup device node information and the updated device node information, the newly added device node information eventmouse2 under the node path can be obtained. Eventmouse2 is the device node name. Based on eventmouse2, the device node of the mouse can be obtained in the device node directory.
[0055] The external universal serial bus device can also be a camera. In this case, the standard node keyword can be video. After obtaining the standard node keyword, you can search in the backup device node directory to obtain device node information including video. You can use the command ls -l / dev / video* | awk '{print $NF}'>video to generate a video file, and obtain the backup device node information including video by traversing the video file. The backup device node information may include video0 and video1.
[0056] Based on the same method, the updated device node information can be obtained, which may include video0, video1, and video2. By comparing the backup device node information and the updated device node information, the newly added device node information video2 under the node path can be obtained. Video2 is the device node name. Based on video2, the device node of the mouse can be obtained in the device node directory.
[0057] The function verification of the external universal serial bus device is performed using the function verification strategy, specifically including: using the function verification strategy, the function verification of the corresponding external universal serial bus device is performed through the device node. The device node is a bridge for the communication between the universal serial bus host and the external universal serial bus device. In this embodiment, by obtaining the standard node keyword, searching in the backup device node directory and the update device node respectively, obtaining the newly added device node information and thus obtaining the device node of the external universal serial bus device, the function verification of the external universal serial bus device can be simply and conveniently performed through the device node.
[0058] Based on any of the above embodiments, before searching in the update log information by enumerating type keywords, the method also includes: searching in the update log information based on error keywords, and when it is determined that there is no error keyword, executing the step of matching multiple type keywords with the update log information respectively.
[0059] The error reporting keyword is a keyword corresponding to the error information, and the error information is information describing the problem that occurs when the external USB device is inserted into the USB host. Exemplarily, the error reporting keyword may include error, failed, etc.
[0060] When the error keyword is a group of English letters, the update log information can be searched by ignoring the case of the error keyword to determine whether the update log information contains the error keyword. For example, grep -i error / enum.log and grep -i failed / enum.log can be used to search the update log information by ignoring the case of the error keyword. If the return value $? is 0, it is determined that the error keyword does not exist. If the return value $? is 1, it is determined that the error keyword exists.
[0061] In some embodiments, when it is determined that an error keyword exists, the function verification of the current external universal serial bus device is terminated.
[0062] In this embodiment, the specific error information corresponding to the error keyword is not obtained. Whether to perform functional verification on the external USB device plugged into the USB host is determined only based on whether the error keyword exists, which reduces the amount of data processed and can improve verification efficiency.
[0063] Specifically, according to the absence of error keywords in the update log information, it can be determined that the external universal serial bus device is successfully inserted into the universal serial bus host, and the function verification of the universal serial bus host controller can be performed based on the update log information. According to the presence of error keywords in the update log information, it can be determined that the external universal serial bus device fails to be inserted into the universal serial bus host, and the function verification of the current external universal serial bus device is terminated, so as to facilitate the function verification of the remaining external universal serial bus devices to be verified, and the verification efficiency can be improved.
[0064] In some embodiments, when it is determined that an error keyword exists, after the functional verification is completed, the specific error information corresponding to the error keyword can be obtained in parallel while performing functional verification of other external universal serial bus devices, and the specific error information can be fed back so that further troubleshooting and repair can be performed based on the specific error information without affecting the verification efficiency.
[0065] Figure 3 This is the second schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by this application. Figure 3As shown, after starting the function verification and backing up the enumeration log, the device node directory can be backed up, and then the external universal serial bus device is waited for to be inserted, and the current enumeration log and the backup enumeration log are compared within the specified time interval to determine whether the enumeration log has been updated. If not, the type of the external universal serial bus device is determined to fail, and the function verification ends; if so, the update log information is obtained. The error keyword is retrieved in the update log information to determine whether the update log information is an error. If so, the type of the external universal serial bus device is determined to fail, and the function verification ends; if not, multiple type keywords are matched with the update log information to determine the type of the external universal serial bus device. After determining the type of the external universal serial bus device, the device node of the external universal serial bus device can be obtained based on the corresponding standard node keyword to complete the external universal serial bus device identification and end the function verification.
[0066] Based on any of the above embodiments, the update log information further includes at least one node keyword, and the node keyword corresponds to the device node name.
[0067] For example, if the node keyword is event and the node device name is eventmouse1, the node keyword corresponds to the device node name; if the node device name is video1, the node keyword does not correspond to the device node name.
[0068] After determining the type of the external universal serial bus device, the method also includes: obtaining a standard node keyword based on the type of the external universal serial bus device, using the standard node keyword to search in the update log information, determining that the node keyword matching the standard node keyword is the target node keyword, and obtaining the device node name corresponding to the target node keyword; obtaining a device node path based on the type of the external universal serial bus device; wherein the type of the external universal serial bus device corresponds to the device node path one by one; and obtaining the device node of the external universal serial bus device based on the device node path and the device node name.
[0069] The update log information is an enumeration log after the external USB device is inserted. The enumeration log records various events during the operation. The device node is the bridge for the USB host to communicate with the external USB device. The device node participates in various events during the operation. Therefore, the device node name of the external USB device is included in the update log information.
[0070] For example, if the external universal serial bus device is a flash drive and the standard node keyword is sd, sd can be used to search in the update log information to obtain sdxn. The x in sdxn can be letters such as a, b, c, and the n in sdxn can be numbers such as 1, 2, 3, etc. For example, if sd is used to search in the update log information to obtain sda1, the device node name of the external universal serial bus device is sda1.
[0071] Exemplarily, the type of the external universal serial bus device and the device node path may have a mapping relationship. After the type of the external universal serial bus device is determined, the corresponding device node path may be acquired through the mapping relationship.
[0072] The function verification of the external universal serial bus device is performed using the function verification strategy, specifically including: using the function verification strategy to perform function verification on the corresponding external universal serial bus device through the device node.
[0073] In this embodiment, by predetermining the correspondence between the type of the external universal serial bus device and the standard node keyword, and predetermining the correspondence between the type of the external universal serial bus device and the device node path of the external universal serial bus device, it is possible to obtain the standard node keyword through the type of the external universal serial bus device after determining the type of the external universal serial bus device, obtain the device node name from the update log information through the standard node keyword, obtain the device node path according to the correspondence between the type of the external universal serial bus device and the device node path, and obtain the device node of the external universal serial bus device according to the device node name and the device node path. In this way, by predetermining the correspondence, the device node of the external universal serial bus device can be obtained only according to the update log information, without processing the device node directory, reducing the amount of data processing, and improving the verification efficiency.
[0074] The specific corresponding relationship can be determined by obtaining historical information, analyzing the historical information, etc., which will not be further explained here. The historical information can include a historical device node directory and a historical enumeration log.
[0075] In some embodiments, after determining that the type of the external universal serial bus device is an audio device, the method further includes: Obtaining an audio device list; the audio device list includes a plurality of content blocks including a content block corresponding to an external universal serial bus audio device, wherein the content block corresponding to the external universal serial bus audio device includes a standard number keyword; Using the number keyword to search in the content block corresponding to the external universal serial bus audio device, obtain the external universal serial bus audio device number corresponding to the standard number keyword matching the number keyword; the external universal serial bus audio device number is the same as the device node number of the external universal serial bus audio device; Gets the device node of an external universal serial bus audio device based on the device node number and the name keyword of the external universal serial bus audio device.
[0076] You can use the aplay -l command to list audio devices, and use the USB Audio keyword to determine the content block corresponding to the external universal serial bus audio device in the audio device list. The aplay -l command can be executed in a terminal such as a command line interface. You can use card to search in the content block to get card m, where m can be 1, 2, 3, etc.; use subdev# to search in the content block to get subdev #n, where n can be 1, 2, 3, etc. m and n are device node numbers.
[0077] The name keyword of the external universal serial bus audio device can be determined according to the needs, and no further limitation is made here. For example, the name keyword of the external universal serial bus audio device can be plughw. Thus, the device node of the external universal serial bus audio device can be obtained as plughw:m,n, such as plughw:1,0.
[0078] Based on any of the above embodiments, the external universal serial bus device is a flash memory disk; the flash memory disk may be a USB flash disk.
[0079] Figure 4 This is the third schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by this application. Figure 4 As shown, after starting the functional verification, the functional verification strategy is used to perform functional verification on the external universal serial bus device, including: obtaining a verification file and calculating the verification check value of the verification file; creating a mount directory and mounting the device node of the flash disk to the mount directory; writing the verification file to the mount directory to obtain a write verification file, and calculating the write check value of the write verification file; when the write check value is the same as the verification check value, reading the verification file from the mount directory to obtain a read verification file, and calculating the read check value of the read verification file; when the read check value is the same as the verification check value, determining that the flash disk is functioning normally.
[0080] The verification file is a file used to determine whether the flash drive functions normally. The verification file can be a randomly generated file with a specified volume, or an existing file obtained from the system within the specified volume range. The specified volume can be 95MB, 100MB, or 105MB, etc. For example, a large file with a volume of 100MB can be randomly generated by using the command dd if= / dev / urandom of= / test.bin bs=1M count=100.
[0081] The verification check value is a value used to determine whether there is data loss in the data transmission process of the file. For example, the verification check value of the verification file can be calculated by a cyclic redundancy check algorithm. For example, the verification check value of the verification file can be calculated by the command crc32 / test.bin. The check value can also be referred to as a file verification result.
[0082] The mount directory is a directory for the device node of the flash disk. For example, the mount directory u can be created by the command mkdir u. Taking the device node of the flash disk as / dev / sda1 as an example, the device node of the flash disk can be mounted to the mount directory by the command mount / dev / sda1 u. Writing the verification file to the mount directory can write the verification file to the flash disk; reading the verification file from the mount directory can read the verification file from the flash disk.
[0083] The method of obtaining the write check value and the read check value is basically the same as the method of obtaining the verification check value, and will not be repeated here.
[0084] Based on any of the above embodiments, the external universal serial bus device is a point-and-click input device; the point-and-click input device may include a mouse, a keyboard, and the like.
[0085] A functional verification strategy is used to perform functional verification on an external universal serial bus device, including: backing up event data of a click input device to obtain input backup event data; monitoring the click input device to obtain first monitoring event data when the click input device executes click input and generates an interrupt signal; comparing the first monitoring event data with the input backup event data to determine if the monitoring event data has new data, then backing up the monitoring event data to obtain no-input backup event data; monitoring the click input device to obtain second monitoring event data when the click input device does not execute click input and does not generate an interrupt signal; comparing the second monitoring event data with the no-input backup event data to determine if the monitoring event data has no new data, then determining that the click input device is functioning normally.
[0086] Event data is information data related to the click input device. For example, if the click input device is a keyboard, the event data may include the specific keys pressed and the order in which the keys are pressed. If the click input device is a mouse, the event data may include the distance the mouse is moved and the speed at which the mouse is moved.
[0087] Exemplarily, the event data may be obtained by using the command hexdump / dev / input / eventn>hexdump.eventn&, and the input backup event data may be obtained by using the command hexdump.eventn.bak.
[0088] The first monitoring event data is event data of the click input device acquired after the interrupt signal is generated.
[0089] By comparing the first monitoring event data with the input backup event data, if the first monitoring event data includes the newly added data, it means that the universal serial bus host controller receives the click input device data, and the function of the click input device is normal during the input process. On the contrary, if the first monitoring event data does not include the newly added data, the function of the click input device is abnormal during the input process.
[0090] The method of backing up the first monitoring event data as non-input backup event data is basically the same as the method of backing up the event data as input backup event data, and will not be described in detail here.
[0091] By comparing the second monitoring event data with the no-input backup event data, if the second monitoring event data does not include the newly added data, it means that the universal serial bus host controller has not received the click input device data, and the function of the click input device is normal during the no-input process. On the contrary, if the second monitoring event data includes the newly added data, the function of the click input device is abnormal during the no-input process.
[0092] In one embodiment, the interrupt signal may be an interrupt occurring on a single-core processor or an interrupt occurring on a multi-core processor. When the interrupt signal is an interrupt occurring on a multi-core processor, it is only necessary to detect that an interrupt occurs on one core to determine that an interrupt signal is generated. For example, cat / proc / interrupts may be used to query interrupts occurring on all processors, and then a host controller keyword hcd, such as xhci_hcd, may be retrieved for further determination.
[0093] Figure 5 This is the fourth schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by the present application. Figure 5 The corresponding click input device is the keyboard. Figure 5As shown, after starting the function verification, the input can be monitored, and the keyboard keys can be tapped to obtain the first monitoring event data. Compare the first monitoring event data with the input backup event data to determine whether there is new data in the first monitoring event data. If not, determine that the keyboard function is abnormal and end the function verification; if so, stop tapping the keyboard keys and obtain the second monitoring event data. Determine whether there is new data in the second monitoring event data. If so, determine that the keyboard function is abnormal and end the function verification; if not, determine that the keyboard function is normal and end the function verification.
[0094] Figure 6 This is the fifth schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by the present application. Figure 6 This corresponds to the case where the click input device is a mouse. Figure 6 and Figure 5 The functional verification shown is basically the same, the main difference is Figure 6 What is monitored is not the keystrokes of the keyboard, but the position of the mouse, which will not be described in detail here. Based on any of the above embodiments, the external universal serial bus device is an audio input device; the audio input device can be a headset or the like.
[0095] Figure 7 This is the sixth schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by this application. Figure 7 As shown, after starting the functional verification, the functional verification strategy can be used to perform functional verification on the external universal serial bus device, including: starting recording to obtain audio information entered by the user; generating an audio file based on the audio information; when it is determined that the audio file is successfully generated, playing the audio file; accepting the audio confirmation operation input by the user, and judging whether the audio in the voice file is clear based on the audio confirmation operation; if so, determining that the function of the audio input device is normal and ending the functional verification; if not, determining that the function of the audio input device is abnormal and ending the functional verification.
[0096] Based on any of the above embodiments, the external universal serial bus device is a video input device; the video input device may be a camera or the like.
[0097] Figure 8 This is the seventh schematic diagram of the framework of the function verification method of the universal serial bus host controller provided by this application. Figure 8As shown, after starting the functional verification, the functional verification strategy can be used to perform functional verification on the external universal serial bus device, including: obtaining the video formats supported by the video input device and each set of video parameter values supported by the video input device under each video format through the device node of the video input device; the video parameters include resolution, frame rate, number of images and video file size; according to each video format and each set of video parameter values corresponding to the video format, obtaining the detection video stream from the video input device through the device node; obtaining the detection video parameter value of the detection video stream, and determining that the function of the video input device is normal when the difference between the video monitoring parameter value and the video parameter value is within a preset range.
[0098] Detecting the video parameter value is to detect the video format and the video parameter value of the video stream.
[0099] Video formats may include YUYV, MJPG, etc. The video input device may support multiple sets of video parameter values in each video format. Taking the video parameters as resolution and frame rate as an example, the video input device may support 720P, 30FPS; 720P, 60FPS; 1080P, 30FPS; 1080P, 60FPS in MJPG. When obtaining the detection video stream from the video input device through the device node, the MJPG format may be obtained accordingly, and the video parameters are 720P, 30FPS; 720P, 60FPS; 1080P, 30FPS; 1080P, 60FPS.
[0100] The v4l2-ctl --list-formats-ext --device= / dev / video2 command can be used to obtain the video formats supported by the video input device and each set of video parameter values supported by the video input device in each video format.
[0101] You can use the command v4l2-ctl to obtain the detection video stream, specify the device node of the video input device through the --device option, set the resolution and video format through the width, height, and pixelformat in --set-fmt-video, set the frame rate through the --set-parm option, set the number of images through the --stream-count option, and specify the output detection video stream through the --stream-to option. This information is stored in the intermediate file, and the video monitoring parameter values are obtained by parsing the intermediate file.
[0102] For example, by searching the keyword dropped buffers, it is possible to determine whether the detected video stream has frame drops and the specific number of frame drops based on whether the difference between the dropped buffers value (the dropped buffers value is the number after dropped buffers) and the set droppedbuffers value of the detected video stream is within a preset range. By comparing whether the difference between the calculated frame rate of the detected video stream (the value before FPS) and the set frame rate is within a preset range, it is possible to determine whether the frame rate is correct.
[0103] In one embodiment, it can be determined whether the video file volume of the detected video stream is 0. If so, it indicates that the detection of video stream capture failed. In the case of successful detection of video stream capture, it is determined whether the file size is correct based on whether the difference between the video file volume and the estimated video file volume is within a preset range. The specific range value of the preset range can be set according to actual needs, and this application does not make further restrictions on this.
[0104] In another embodiment, when the detection video stream is captured successfully and the difference between the video monitoring parameter value and the video parameter value is within a preset range, the detection video stream can be played to receive a confirmation operation input by the user, and based on the user's confirmation operation, it is finally determined whether the function of the video input device is normal.
[0105] In order to specifically illustrate the function of the function verification method of the universal serial bus host controller provided by this embodiment, a specific example is provided below.
[0106] The present application provides a method for verifying the function of a universal serial bus host controller, comprising: Back up the enumeration log and obtain the backup enumeration log; Backing up the device node directory of the external universal serial bus device to obtain the backup device node directory; wherein the device node directory includes a node keyword, and the node keyword corresponds to the device node information; Comparing the current enumeration log with the backup enumeration log within a specified time interval, and if it is determined that there is a difference between the current enumeration log and the backup enumeration log, obtaining update log information based on the difference between the current enumeration log and the backup enumeration log; Matching the multiple type keywords with the update log information respectively, determining the type keyword matching the standard type keyword as the target type keyword, and determining the type of the external universal serial bus device according to the target type keyword; Obtain an update device node directory; obtain a standard node keyword based on the type of the external universal serial bus device, use the standard node keyword to search in the backup device node directory, determine that the node keyword matching the standard node keyword is the first target node keyword, and obtain the backup device node information corresponding to the first target node keyword; use the standard node keyword to search in the update device node directory, determine that the node keyword matching the standard node keyword is the second target node keyword, and obtain the update device node information corresponding to the second target node keyword; Compare the backup device node information with the update device node information to obtain the newly added device node information under the node path; The device node of the external universal serial bus device is obtained based on the newly added device node information; and the function verification strategy is used to perform function verification on the corresponding external universal serial bus device through the device node.
[0107] The function verification device of the universal serial bus host controller provided by the present application is described below. The function verification device of the universal serial bus host controller described below and the function verification method of the universal serial bus host controller described above can be referred to each other.
[0108] Fig. 9 This is one of the structural schematic diagrams of the function verification device of the universal serial bus host controller provided by this application. Fig. 9 As shown, the apparatus includes: an update log information acquisition module 201, which is used to obtain update log information of the enumeration log; wherein the update log information includes at least one standard type keyword; a device type identification module 202, which is used to match multiple type keywords with the update log information respectively, determine the type keyword that matches the standard type keyword as the target type keyword, and determine the type of the external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; a function verification module 203, which is used to determine a target function verification strategy from multiple preset function verification strategies based on the type of the external universal serial bus device, and use the function verification strategy to perform function verification on the external universal serial bus device; wherein the preset function verification strategy corresponds to the type of the external universal serial bus device one by one.
[0109] Based on any of the above embodiments, the update log information acquisition module 201 is specifically used to: back up the enumeration log and obtain the backup enumeration log; compare the current enumeration log and the backup enumeration log within a specified time interval, and when it is determined that there is a difference between the current enumeration log and the backup enumeration log, obtain the update log information based on the difference between the current enumeration log and the backup enumeration log.
[0110] Based on any of the above embodiments, the function verification device of the universal serial bus host controller also includes a device node directory backup module and a device node confirmation module 204; the device node directory backup module is used to back up the device node directory of the external universal serial bus device and obtain the backup device node directory; wherein the device node directory includes a node keyword, and the node keyword corresponds to the device node information; the device node confirmation module 204 is used to obtain the updated device node directory; obtain the standard node keyword based on the type of the external universal serial bus device, use the standard node keyword to search in the backup device node directory, determine the node keyword matching the standard node keyword as the first target node keyword, and obtain the backup device node information corresponding to the first target node keyword; use the standard node keyword to search in the updated device node directory, determine the node keyword matching the standard node keyword as the second target node keyword, and obtain the updated device node information corresponding to the second target node keyword; compare the backup device node information and the updated device node information to obtain the newly added device node information under the node path; obtain the device node of the external universal serial bus device based on the newly added device node information; the function verification module 203 is specifically used to: use the function verification strategy to perform function verification on the corresponding external universal serial bus device through the device node.
[0111] Based on any of the above embodiments, the update log information also includes at least one node keyword, and the node keyword corresponds to the device node name; the device node confirmation module 204 is used to obtain a standard node keyword based on the type of the external universal serial bus device, use the standard node keyword to search in the update log information, determine that the node keyword that matches the standard node keyword is the target node keyword, and obtain the device node name corresponding to the target node keyword; obtain the device node path based on the type of the external universal serial bus device; wherein the type of the external universal serial bus device corresponds to the device node path one by one; obtain the device node of the external universal serial bus device based on the device node path and the device node name; the function verification module 203 is specifically used to: use the function verification strategy to perform function verification on the corresponding external universal serial bus device through the device node.
[0112] Fig.10 This is the second structural diagram of the function verification device of the universal serial bus host controller provided by the present application. Fig.10As shown, the function verification module 203 may include a flash disk function verification unit 2021 for executing the aforementioned flash disk function verification method, a keyboard function verification unit 2022 for the aforementioned keyboard function verification method, a mouse function verification unit 2023 for the aforementioned mouse function verification method, an audio input device function verification unit 2024 for the aforementioned audio input device function verification method, and a video input device function verification unit 2025 for the aforementioned video input device function verification method.
[0113] The function verification device of the USB host controller also includes a verification result output module 205, which is used to output the function verification result after performing function verification on the external USB device; the function verification result may include the function verification steps and the execution result output of each step.
[0114] Based on any of the above embodiments, the external universal serial bus device is a flash drive; as before, the flash drive can also be called a U disk; the function verification module 203 includes a flash drive function verification unit 2021, which is used to: obtain a verification file, and calculate the verification check value of the verification file; create a mount directory, and mount the device node of the flash drive to the mount directory; write the verification file to the mount directory to obtain a write verification file, and calculate the write check value of the write verification file; when the write check value is the same as the verification check value, read the verification file from the mount directory to obtain a read verification file, and calculate the read check value of the read verification file; when the read check value is the same as the verification check value, it is determined that the function of the flash drive is normal.
[0115] Based on any of the above embodiments, the external universal serial bus device is a click input device, and the function verification module 203 includes a click input device function verification unit, which is used to: back up the event data of the click input device and obtain input backup event data; monitor the click input device, and when the click input device executes click input and generates an interrupt signal, obtain first monitoring event data; compare the first monitoring event data with the input backup event data, and when it is determined that the monitoring event data has new data, back up the monitoring event data to obtain no-input backup event data; monitor the click input device, and when the click input device does not execute click input and does not generate an interrupt signal, obtain second monitoring event data; compare the second monitoring event data with the no-input backup event data, and when it is determined that the monitoring event data has no new data, determine that the function of the click input device is normal.
[0116] Exemplarily, the click input device function verification unit may be a keyboard function verification unit 2022, a mouse function verification unit 2023, and the like.
[0117] Based on any of the above embodiments, the external universal serial bus device is a video input device, and the function verification module 203 includes a video input device function verification unit 2025, which is used to: obtain the video format supported by the video input device and each set of video parameter values supported by the video input device under each video format through the device node of the video input device; the video parameters include resolution, frame rate, number of images and video file volume; according to each video format and each set of video parameter values corresponding to the video format, obtain the detection video stream from the video input device through the device node; obtain the detection video parameter value of the detection video stream, and determine that the function of the video input device is normal when the difference between the video monitoring parameter value and the video parameter value is within a preset range.
[0118] Based on any of the above embodiments, the external universal serial bus device is an audio input device, and the function verification module 203 includes an audio input device function verification unit 2024, which is used to: start recording to obtain audio information entered by the user; generate an audio file based on the audio information; when it is determined that the audio file is successfully generated, play the audio file; accept the audio confirmation operation input by the user, and determine whether the audio in the voice file is clear based on the audio confirmation operation; if so, determine that the function of the audio input device is normal and end the function verification; if not, determine that the function of the audio input device is abnormal and end the function verification.
[0119] Based on any of the above embodiments, the functional verification device of the universal serial bus host controller also includes an error verification unit, which is used to search in the update log information based on an error keyword before searching in the update log information by enumerating type keywords, and when it is determined that there is no error keyword, execute the steps of matching multiple type keywords with the update log information respectively.
[0120] Fig.11 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.11As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the function verification method of the universal serial bus host controller, the method comprising: obtaining update log information of the enumeration log; wherein the update log information includes at least one standard type keyword; matching multiple type keywords with the update log information respectively, determining the type keyword matching the standard type keyword as the target type keyword, and determining the type of the external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; determining the target function verification strategy from multiple preset function verification strategies based on the type of the external universal serial bus device, and using the function verification strategy to perform function verification on the external universal serial bus device; wherein the preset function verification strategy corresponds to the type of the external universal serial bus device one by one.
[0121] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0122] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the functional verification method of the universal serial bus host controller provided by the above-mentioned methods, the method comprising: obtaining update log information of an enumeration log; wherein the update log information includes at least one standard type keyword; matching a plurality of type keywords with the update log information respectively, determining the type keyword matching the standard type keyword as a target type keyword, and determining the type of an external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; determining a target functional verification strategy from a plurality of preset functional verification strategies based on the type of the external universal serial bus device, and performing functional verification on the external universal serial bus device using the functional verification strategy; wherein the preset functional verification strategy corresponds one-to-one to the type of the external universal serial bus device.
[0123] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0124] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for verifying the function of a universal serial bus host controller, characterized in that: include: Obtaining update log information of the enumeration log; wherein the update log information includes at least one standard type keyword; Matching a plurality of type keywords with the update log information respectively, determining a type keyword matching the standard type keyword as a target type keyword, and determining a type of an external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; A target function verification strategy is determined from a plurality of preset function verification strategies based on the type of the external universal serial bus device, and the function verification of the external universal serial bus device is performed using the function verification strategy; wherein the preset function verification strategy corresponds to the type of the external universal serial bus device one by one.
2. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: The obtaining of update log information of the enumeration log includes: Back up the enumeration log and obtain the backup enumeration log; The current enumeration log and the backup enumeration log are compared within a specified time interval, and when it is determined that there is a difference between the current enumeration log and the backup enumeration log, update log information is obtained based on the difference between the current enumeration log and the backup enumeration log.
3. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: Before obtaining the update log information of the enumeration log, the method further includes: Backing up the device node directory of the external universal serial bus device to obtain a backup device node directory; wherein the device node directory includes a node keyword, and the node keyword corresponds to the device node information; After determining the type of the external universal serial bus device, the method further includes: Get the updated device node directory; Obtain a standard node keyword based on the type of the external universal serial bus device, use the standard node keyword to search in the backup device node directory, determine that the node keyword matching the standard node keyword is the first target node keyword, and obtain the backup device node information corresponding to the first target node keyword; use the standard node keyword to search in the update device node directory, determine that the node keyword matching the standard node keyword is the second target node keyword, and obtain the update device node information corresponding to the second target node keyword; Compare the backup device node information with the update device node information to obtain the newly added device node information under the node path; Acquire the device node of the external universal serial bus device based on the newly added device node information; Performing function verification on the external universal serial bus device using the function verification strategy specifically includes: The function verification strategy is used to perform function verification on the corresponding external universal serial bus device through the device node.
4. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: The update log information also includes at least one node keyword, and the node keyword corresponds to the device node name; After determining the type of the external universal serial bus device, the method further includes: Obtaining a standard node keyword based on the type of the external universal serial bus device, using the standard node keyword to search the update log information, determining that a node keyword matching the standard node keyword is a target node keyword, and obtaining a device node name corresponding to the target node keyword; Acquire a device node path based on the type of the external universal serial bus device; wherein the type of the external universal serial bus device corresponds to the device node path one by one; Acquire the device node of the external universal serial bus device based on the device node path and the device node name; Performing function verification on the external universal serial bus device using the function verification strategy specifically includes: The function verification strategy is used to perform function verification on the corresponding external universal serial bus device through the device node.
5. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: The external universal serial bus device is a flash drive; Performing function verification on the external universal serial bus device using the function verification strategy includes: Obtaining a verification file and calculating a verification check value of the verification file; Create a mount directory, and mount the device node of the flash disk to the mount directory; Writing the verification file into the mount directory to obtain a write verification file, and calculating a write checksum value of the write verification file; When the write check value is the same as the verification check value, reading a verification file from the mount directory to obtain a read verification file, and calculating a read check value of the read verification file; When the read check value is the same as the verification check value, it is determined that the flash disk functions normally.
6. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: The external universal serial bus device is a point-and-click input device; Performing function verification on the external universal serial bus device using the function verification strategy includes: Backing up the event data of the click input device and acquiring input backup event data; Monitoring the click input device, and acquiring first monitoring event data when the click input device performs click input and generates an interrupt signal; By comparing the first monitoring event data with the input backup event data, if it is determined that the monitoring event data has new data, backing up the monitoring event data to obtain no input backup event data; Monitoring the click input device, and acquiring second monitoring event data when the click input device does not perform click input and does not generate an interrupt signal; By comparing the second monitoring event data with the no-input backup event data and determining that there is no new data in the monitoring event data, it is determined that the function of the click input device is normal.
7. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: The external universal serial bus device is a video input device; Performing function verification on the external universal serial bus device using the function verification strategy includes: Obtaining, through the device node of the video input device, the video formats supported by the video input device and each set of video parameter values supported by the video input device under each of the video formats; the video parameters include resolution, frame rate, number of images and video file volume; According to each video format and each set of video parameter values corresponding to the video format, obtaining a detection video stream from the video input device through the device node; A detection video parameter value of the detection video stream is obtained, and when the difference between the video monitoring parameter value and the video parameter value is within a preset range, it is determined that the function of the video input device is normal.
8. The function verification method of a universal serial bus host controller according to claim 1, characterized in that: Before searching the update log information by using the enumeration type keyword, the method further includes: The update log information is searched based on the error reporting keyword, and when it is determined that the error reporting keyword does not exist, a step of matching a plurality of type keywords with the update log information is performed respectively.
9. A function verification device for a universal serial bus host controller, characterized in that: include: An update log information acquisition module, used to acquire update log information of an enumeration log; wherein the update log information includes at least one standard type keyword; a device type identification module, used to match a plurality of type keywords with the update log information respectively, determine the type keyword matching the standard type keyword as a target type keyword, and determine the type of the external universal serial bus device according to the target type keyword; wherein the target type keyword corresponds to the type of the external universal serial bus device; A function verification module is used to determine a target function verification strategy from a plurality of preset function verification strategies based on the type of the external universal serial bus device, and use the function verification strategy to perform function verification on the external universal serial bus device; wherein the preset function verification strategy corresponds to the type of the external universal serial bus device one by one.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the function verification method of the universal serial bus host controller according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Test case acquiring method and device
CN107957957A
Intelligent testing method and system for solid state disk firmware module
CN114996127A
Abnormal log reporting method and system, terminal equipment and storage medium
CN116909838A
Grayscale routing policy updating method and device, storage medium and electronic equipment
CN117215928A
API gateway production verification method and device, electronic equipment and storage medium
CN117592029A