CN113810240B - Communication protocol analysis method, device and computer readable storage medium - Google Patents

Communication protocol analysis method, device and computer readable storage medium Download PDF

Info

Publication number
CN113810240B
CN113810240B CN202010544871.5A CN202010544871A CN113810240B CN 113810240 B CN113810240 B CN 113810240B CN 202010544871 A CN202010544871 A CN 202010544871A CN 113810240 B CN113810240 B CN 113810240B
Authority
CN
China
Prior art keywords
protocol
waveform
type
signal
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010544871.5A
Other languages
Chinese (zh)
Other versions
CN113810240A (en
Inventor
孙长宇
陈朝喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202010544871.5A priority Critical patent/CN113810240B/en
Publication of CN113810240A publication Critical patent/CN113810240A/en
Application granted granted Critical
Publication of CN113810240B publication Critical patent/CN113810240B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2218/00Aspects of pattern recognition specially adapted for signal processing
    • G06F2218/08Feature extraction
    • G06F2218/10Feature extraction by analysing the shape of a waveform, e.g. extracting parameters relating to peaks

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The present disclosure relates to a communication protocol parsing method, apparatus and computer readable storage medium, the method comprising: acquiring a waveform image of a protocol to be analyzed; determining the protocol type of the protocol to be analyzed; determining the signal type of the waveform signal in the waveform image according to the protocol type; and analyzing the waveform image according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information. Therefore, the protocol to be analyzed can be analyzed based on the waveform image, and compared with the analysis performed by devices such as an oscilloscope and the like in the related technology, the application range of the communication protocol analysis method can be effectively widened, the waveform signal characteristics of the protocol to be analyzed can be obtained, the data content transmitted by the waveform signal can be obtained, and the use by a user is facilitated. And the technical requirements of users for viewing the protocol analysis record can be effectively reduced, and the process of communication protocol analysis is simplified.

Description

Communication protocol analysis method, device and computer readable storage medium
Technical Field
The present disclosure relates to the field of communications, and in particular, to a method and an apparatus for analyzing a communication protocol, and a computer-readable storage medium.
Background
In the related art, the analysis of the communication protocol mainly depends on equipment such as an oscilloscope and a decoding instrument, and the equipment can be limited to be used in a laboratory and can be used only by paying corresponding cost. In addition, when the communication protocol is analyzed based on the equipment, the technical requirements on technical personnel are high, and the application range is limited.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides a method and an apparatus for analyzing a communication protocol, and a computer-readable storage medium.
According to a first aspect of the embodiments of the present disclosure, a method for analyzing a communication protocol is provided, including:
acquiring a waveform image of a protocol to be analyzed;
determining the protocol type of the protocol to be analyzed;
determining the signal type of the waveform signal in the waveform image according to the protocol type;
and analyzing the waveform image according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information.
Optionally, the method further comprises:
checking the protocol characteristic information according to a communication protocol standard corresponding to the protocol type;
and when the protocol characteristic information is determined to be abnormal, adding abnormal information corresponding to the protocol characteristic information into the protocol analysis record.
Optionally, the method further comprises:
according to the abnormal information corresponding to the protocol feature information, inquiring a solution corresponding to the abnormal information;
and in the case that the solution is inquired, outputting the solution.
Optionally, the determining the protocol type of the protocol to be parsed includes:
displaying a protocol type selection interface, wherein a plurality of candidate protocol types are displayed in the protocol type selection interface;
and responding to a protocol type selection instruction triggered by the user on the protocol type selection interface, and determining the protocol type indicated by the protocol type selection instruction as the protocol type of the protocol to be analyzed.
Optionally, the determining the protocol type of the protocol to be parsed includes:
extracting protocol type characteristic information corresponding to the waveform image;
and matching the protocol type characteristic information with preset protocol type characteristic information, and determining the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
Optionally, the acquiring a waveform image of a protocol to be analyzed includes:
acquiring the waveform image output by a waveform data display device;
or acquiring a shot waveform image segment, and performing image splicing processing on the waveform image segment to obtain the waveform image.
Optionally, the determining, according to the protocol type, a signal type of a waveform signal in the waveform image includes:
displaying a signal type selection interface, wherein the signal type selection interface comprises a waveform signal and a candidate signal type corresponding to the waveform signal, and the candidate signal type is a signal type corresponding to the protocol type;
in response to a signal type selection instruction of a user for each waveform signal in the signal type selection interface, determining a signal type indicated by the signal type selection instruction as a signal type of the waveform data.
Optionally, the analyzing the waveform image according to the signal type to generate a protocol analysis record includes:
determining electrical characteristics and timing characteristics of the waveform signals corresponding to the signal types in the waveform image;
determining the protocol feature information based on the electrical feature and the timing feature.
Optionally, the protocol feature information comprises at least one of: level amplitude information, rising edge time, falling edge time, setup time, hold time.
Optionally, the analyzing the waveform image according to the signal type to generate a protocol analysis record includes:
determining binary data corresponding to the waveform signal in the waveform image;
and determining the waveform data decoding information according to the binary data.
Optionally, the waveform data decoding information comprises at least one of: access address, register address, read-write operation type, read-write data content information.
According to a second aspect of the embodiments of the present disclosure, there is provided a communication protocol analysis apparatus, including:
the acquisition module is configured to acquire a waveform image of a protocol to be analyzed;
a first determining module configured to determine a protocol type of the protocol to be resolved;
a second determination module configured to determine a signal type of the waveform signal in the waveform image according to the protocol type;
the generating module is configured to analyze the waveform image according to the signal type and generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information.
Optionally, the apparatus further comprises:
the verification module is configured to verify the protocol characteristic information according to a communication protocol standard corresponding to the protocol type;
and the adding module is configured to add the abnormal information corresponding to the protocol characteristic information into the protocol analysis record when the protocol characteristic information is determined to be abnormal.
Optionally, the apparatus further comprises:
the query module is configured to query a solution corresponding to the abnormal information according to the abnormal information corresponding to the protocol feature information;
an output module configured to output the solution if the solution is queried.
Optionally, the first determining module includes:
the first display submodule is configured to display a protocol type selection interface, wherein a plurality of candidate protocol types are displayed in the protocol type selection interface;
the first determining submodule is configured to respond to a protocol type selection instruction triggered by a user on the protocol type selection interface, and determine the protocol type indicated by the protocol type selection instruction as the protocol type of the protocol to be analyzed.
Optionally, the first determining module includes:
the extraction submodule is configured to extract the protocol type characteristic information corresponding to the waveform image;
and the second determining submodule is configured to match the protocol type characteristic information with preset protocol type characteristic information, and determine the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
Optionally, the obtaining module includes:
a first acquisition sub-module configured to acquire the waveform image output by the waveform data display device;
or the second acquisition sub-module is configured to acquire the shot waveform image segment and perform image stitching processing on the waveform image segment to obtain the waveform image.
Optionally, the second determining module includes:
the second display submodule is configured to display a signal type selection interface, wherein the signal type selection interface comprises a waveform signal and a candidate signal type corresponding to the waveform signal, and the candidate signal type is a signal type corresponding to the protocol type;
a third determining sub-module configured to determine, in response to a signal type selection instruction for each of the waveform signals in the signal type selection interface by a user, a signal type indicated by the signal type selection instruction as a signal type of the waveform data.
Optionally, the generating module includes:
a fourth determination submodule configured to determine an electrical characteristic and a timing characteristic of the waveform signal corresponding to the signal type in the waveform image;
a fifth determination submodule configured to determine the protocol feature information from the electrical feature and the timing feature.
Optionally, the protocol feature information comprises at least one of: level amplitude information, rising edge time, falling edge time, setup time, hold time.
Optionally, the generating module includes:
a sixth determining sub-module configured to determine binary data corresponding to the waveform signal in the waveform image;
a seventh determining sub-module configured to determine the waveform data decoding information from the binary data.
Optionally, the waveform data decoding information comprises at least one of: access address, register address, read-write operation type, read-write data content information.
According to a third aspect of the embodiments of the present disclosure, there is provided a communication protocol parsing apparatus, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a waveform image of a protocol to be analyzed;
determining the protocol type of the protocol to be analyzed;
determining the signal type of the waveform signal in the waveform image according to the protocol type;
and analyzing the waveform image according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, on which computer program instructions are stored, which when executed by a processor, implement the steps of the communication protocol parsing method according to any one of the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the technical scheme, a waveform image of a protocol to be analyzed is acquired, a protocol type of the protocol to be analyzed is determined, and a signal type of a waveform signal in the waveform image is determined according to the protocol type, so that the waveform image is analyzed according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information. Therefore, by the technical scheme, the protocol to be analyzed can be analyzed based on the waveform image of the protocol to be analyzed, compared with the analysis performed by devices such as an oscilloscope and the like in the related technology, the application range of the communication protocol analysis method can be effectively widened, the protocol to be analyzed is analyzed based on image identification, the obtained protocol analysis record can comprise protocol characteristic information and waveform data decoding information, not only can the waveform signal characteristics of the protocol to be analyzed be obtained, but also the data content transmitted by the waveform signal can be obtained, and the use by a user is facilitated. The technical requirements of users for viewing the protocol analysis record can be effectively reduced, and the use permission does not need to be acquired, so that the communication protocol analysis cost can be reduced, the communication protocol analysis flow is simplified, and the use experience of the users is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flowchart illustrating a communication protocol parsing method according to an example embodiment.
FIG. 2 is a diagram illustrating a waveform image of a protocol to be resolved, according to an example embodiment.
FIG. 3 is a schematic diagram illustrating a protocol type selection interface in accordance with an exemplary embodiment.
Fig. 4A and 4B are schematic diagrams of a signal type selection interface shown according to an example embodiment.
Fig. 5 is a block diagram illustrating a communication protocol parsing apparatus according to an example embodiment.
Fig. 6 is a block diagram illustrating a communication protocol parsing apparatus according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating a communication protocol parsing method according to an exemplary embodiment, where as shown in fig. 1, the method may include the following steps:
in step 11, a waveform image of the protocol to be resolved is acquired. The waveform image is an image formed by an electrical signal generated in the communication process, and may be a waveform image displayed in an oscilloscope, for example.
In step 12, the protocol type of the protocol to be resolved is determined.
The protocol type that can be analyzed in the embodiments of the present disclosure may include, but is not limited to, any one of the following: I2C, I S, SPI, MIPI. The I2C (Inter-Integrated Circuit) is a bidirectional two-wire synchronous Serial bus, the I2S (Inter-IC Sound, integrated Circuit built-in audio bus) is a bus standard established for audio data transmission between digital audio devices, the SPI (Serial Peripheral Interface) is a high-speed full-duplex synchronous communication bus, and the MIPI (Mobile Industry Processor Interface) is an open standard and specification established for Mobile application processors.
Since the protocols of different protocol types include different signal types and protocol standards, in this step, before performing protocol analysis, the protocol type of the protocol to be analyzed needs to be determined, so as to analyze the protocol according to the protocol type.
In step 13, the signal type of the waveform signal in the waveform image is determined according to the protocol type.
The signal types corresponding to different protocol types are different, for example, the I2C protocol corresponds to two signal types, which are an SDA data signal and an SCL clock signal. The SPI protocol corresponds to four signal types, namely an enable signal, a clock signal, a serial data input signal, and a serial data output signal. Therefore, when the protocol type of the protocol data to be analyzed is determined, the signal type of the waveform signal in the waveform image can be further determined, so that the subsequent protocol analysis process is facilitated.
It should be noted that the waveform image of the protocol to be analyzed includes each waveform signal corresponding to the protocol to be analyzed, where one waveform signal may be displayed in one waveform image, and multiple waveform signals may also be displayed in one waveform image.
In step 14, the waveform image is analyzed according to the signal type, and a protocol analysis record is generated, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information.
For example, as shown in fig. 2, if the waveform image is a waveform image of a protocol to be analyzed, it is determined through the above steps that the protocol type of the protocol to be analyzed is I2C, where the waveform signal a is a data signal, and the waveform signal B is a clock signal, and the waveform image may be analyzed according to the data signal and the clock signal, so as to generate a protocol analysis record. The waveform data decoding information is used for representing the data content of the waveform data actually transmitted.
As an example, according to the communication protocol standard, in the I2C protocol, the start condition is generated when the SDA jumps from high to low while the SCL is at high, and the stop condition is generated when the SDA jumps from low to high while the SCL is at high. Therefore, the corresponding waveform signal can be analyzed according to each signal type, so that the waveform image can be analyzed. For example, as shown in fig. 2, after the SDA signal and the SCL signal are determined, the start condition and the end condition of the protocol to be analyzed may be determined, and the corresponding valid data may be obtained, so as to implement protocol analysis, for example, by performing image recognition on the SCL signal, determining the frequency or period of the clock signal, that is, obtaining according to the lattice interval in the SCL signal. The waveform image can be identified based on an AI image identification method in the related art, and features in the waveform image are extracted, so that the extracted features and a standard of a protocol type are analyzed.
In the technical scheme, a waveform image of a protocol to be analyzed is obtained, the protocol type of the protocol to be analyzed is determined, and the signal type of a waveform signal in the waveform image is determined according to the protocol type, so that the waveform image is analyzed according to the signal type, and a protocol analysis record is generated, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information. Therefore, by the technical scheme, the protocol to be analyzed can be analyzed based on the waveform image of the protocol to be analyzed, compared with the analysis performed by devices such as an oscilloscope and the like in the related technology, the application range of the communication protocol analysis method can be effectively widened, the protocol to be analyzed is analyzed based on image identification, the obtained protocol analysis record can comprise protocol characteristic information and waveform data decoding information, not only can the waveform signal characteristics of the protocol to be analyzed be obtained, but also the data content transmitted by the waveform signal can be obtained, and the use by a user is facilitated. The technical requirements of users for viewing the protocol analysis record can be effectively reduced, and the use permission does not need to be acquired, so that the communication protocol analysis cost can be reduced, the communication protocol analysis flow is simplified, and the use experience of the users is improved.
In order to make those skilled in the art more understand the technical solutions provided by the embodiments of the present invention, the following detailed descriptions are provided for the above steps.
Optionally, in step 11, an exemplary implementation of acquiring a waveform image of a protocol to be resolved is as follows, and the step may include:
as an example, the waveform image output by the waveform data display device is acquired. For example, the waveform data display device may be an oscilloscope, and for example, a waveform image of a protocol to be analyzed may be generated and output by the oscilloscope, so that protocol analysis may be performed based on the waveform image output by the oscilloscope.
Or, as another example, if the generated waveform image of the protocol to be analyzed does not support output, or the output process is cumbersome, the displayed waveform of the protocol to be analyzed may be captured by an image capturing device such as a mobile phone or a camera, so that the image obtained by capturing the waveform image is determined as the waveform image.
Or, as another example, since the waveform of the protocol may be long, the acquisition of the entire waveform may not be completed by one image capturing. In this embodiment, a captured waveform image segment may be acquired, and the waveform image may be obtained by performing image stitching processing on the waveform image segment. The waveform image segment can be spliced by adopting the existing image splicing technology, and when the splicing is successful, the obtained spliced image is determined as the waveform image. If the splicing is not successful, a prompt message can be output to prompt the user that the current waveform image acquisition fails, the image can be shot again, and the like.
Therefore, by the technical scheme, the multi-source waveform image acquisition can be supported in the communication protocol analysis method provided by the disclosure, so that the application range of the communication protocol analysis method can be effectively widened. And moreover, a plurality of waveform image segments can be spliced to obtain a waveform image, so that the operation process of a user is simplified, the automation level of communication protocol analysis is improved, and the use by the user is facilitated.
Optionally, in step 12, an exemplary implementation manner of determining the protocol type of the protocol to be resolved is as follows, and the step may include:
a protocol type selection interface is displayed, wherein a plurality of candidate protocol types are displayed in the protocol type selection interface, the candidate protocol types are protocol types capable of performing protocol analysis currently, the protocol types can be preset according to actual use scenes, as shown in fig. 3, the protocol type selection interface displays four candidate protocol types, i.e., I2C, I S, SPI, and MIPI.
And responding to a protocol type selection instruction triggered by the user on the protocol type selection interface, and determining the protocol type indicated by the protocol type selection instruction as the protocol type of the protocol to be analyzed.
In this embodiment, a user may select a protocol type of a protocol to be resolved that the user wants to perform protocol resolution, for example, if the protocol type that the user wants to perform protocol resolution is an I2C protocol, the user may select the I2C protocol in a protocol type selection interface, and trigger a protocol type selection instruction by submitting an operation, and determine, in response to the protocol type selection instruction, the I2C protocol indicated by the protocol type selection instruction as the protocol type of the protocol to be resolved. Illustratively, the user may reselect through a reset operation.
By the technical scheme, the protocol type capable of being analyzed can be prompted for the user by displaying the protocol type selection interface, so that the user can confirm the protocol type of the protocol to be analyzed, the accuracy of the protocol type is ensured, and the accuracy of an analysis result obtained by analyzing the communication protocol subsequently is improved.
Optionally, in step 12, another exemplary implementation manner of determining the protocol type of the protocol to be resolved is as follows, and the step may include:
and extracting protocol type characteristic information corresponding to the waveform image, wherein the protocol type characteristic information is characteristic information for uniquely characterizing a protocol type. Illustratively, the protocol type characteristic information may be the number of waveform signals corresponding to the waveform image, transition characteristics of the waveform signals, clock characteristics, and the like, for example, the number of waveform signals may be determined by extracting the waveform signals in the waveform image; and determining the jump characteristic of the waveform signal and the like by counting the times of converting the waveform from high level to low level or converting the low level to high level in the waveform signal. The protocol type feature information may be set according to an actual usage scenario, and is not limited herein.
And matching the protocol type characteristic information with preset protocol type characteristic information, and determining the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
For example, the characteristic analysis may be performed in advance on each protocol type, and in the protocol types that can be currently subjected to the protocol analysis, the preset protocol type characteristic information corresponding to the I2C protocol is: the protocol type corresponds to two waveform signals, and when the number of the waveform signals in the extracted protocol type feature information based on the waveform image is 2, it is determined that the extracted protocol type feature information is successfully matched with the preset protocol type feature information, and the protocol type corresponding to the protocol to be analyzed can be determined as the I2C protocol. The determination of the characteristic information of other protocol types may be preset according to the protocol standard of the protocol type, and is not described herein again.
Therefore, by the technical scheme, the protocol type characteristic information is obtained by extracting the characteristics of the waveform signal in the waveform image, the protocol type of the protocol to be analyzed can be automatically determined, the operation of a user is further simplified, the automation level of the communication protocol analysis method is improved, and the use by the user is facilitated.
Alternatively, in step 13, according to the protocol type, an exemplary implementation of determining the signal type of the waveform signal in the waveform image is as follows, and the step may include:
and displaying a signal type selection interface, wherein the signal type selection interface comprises a waveform signal and a candidate signal type corresponding to the waveform signal, and the candidate signal type is a signal type corresponding to the protocol type.
Illustratively, as shown in fig. 4A, a schematic diagram of a signal type selection interface in the present disclosure is shown. In an embodiment, if a waveform image only includes a waveform signal, the waveform signal and each candidate signal type may be displayed in the signal type selection interface. Taking the I2C protocol as an example, the candidate signal types include a data signal and a clock signal, and each waveform signal can be displayed separately as shown in fig. 4A.
In another embodiment, a waveform image may include a plurality of waveform signals, and each waveform image and its corresponding waveform signal and each candidate signal type may be displayed in the signal type selection interface, as shown in fig. 4B.
In response to a signal type selection instruction of a user for each waveform signal in the signal type selection interface, determining a signal type indicated by the signal type selection instruction as a signal type of the waveform data.
As an example, as shown in fig. 4A, when the user selects the data signal for the waveform signal a and the user selects the clock signal for the waveform signal B, the signal type selection instruction may be triggered by the commit operation, so as to determine the signal type of each waveform signal. Illustratively, the user may reselect through a reset operation.
As another example, for a signal type uniquely existing in a protocol, after a user has selected the signal type, the signal type is set to be non-selectable in a selection type of a subsequent waveform signal, for example, in fig. 4B, after the user selects the signal type of the waveform signal a as a data signal, when the signal type of the waveform signal B is selected, the data signal is not selectable (identified by a hatched frame in fig. 4B), so that an influence of repeatedly selecting the signal type on a protocol analysis result can be effectively avoided, not only can an operation of the user be effectively simplified, but also accuracy of the signal type can be ensured to a certain extent, and stability of a communication protocol analysis method can be improved.
Optionally, in step 14, the waveform image is parsed according to the signal type, and an exemplary implementation manner of generating a protocol parsing record is as follows, and the step may include:
and determining the electrical characteristics and the time sequence characteristics of the waveform signals corresponding to the signal types in the waveform image. The waveform image may be identified by an image identification method, for example, inflection points, peak values, valley values, etc. in the waveform image are determined.
Determining the protocol feature information based on the electrical feature and the timing feature. Optionally, the protocol feature information comprises at least one of: level amplitude information, rising edge time, falling edge time, setup time, hold time.
For example, level amplitude information may be determined from peaks and valleys identified in the waveform image, and a time corresponding to a rise from a low level to a high level, i.e., a rising edge time, etc., may be determined by an inflection point. The falling edge time is determined in a similar manner and will not be described herein. Wherein, the setup time refers to the time required for data to be unstable to be stable before the clock edge comes; the holding time refers to the time for holding the data after the data is stabilized, so that the establishment time and the holding time can be determined by high-low level conversion in the waveform image and a protocol standard through AI image identification, which is not described herein again.
Optionally, in step 14, the analyzing the waveform image according to the signal type, and generating a protocol analysis record in an exemplary implementation manner is as follows, and the step may include:
and determining binary data corresponding to the waveform signal in the waveform image. Binary data corresponding to the waveform signal may be determined by switching high and low levels in the waveform image, where the setting of the high and low levels and the correspondence between the binary data may be determined according to a specific protocol standard, which is not limited by this disclosure.
And determining the waveform data decoding information according to the binary data. Optionally, the waveform data decoding information comprises at least one of: access address, register address, read-write operation type, read-write data content information. Determining an access address, a register address, a read-write operation type, and read-write data content information according to binary data is a conventional technique in the art, and is not described herein again.
Therefore, by the technical scheme, the protocol characteristic information of the protocol to be analyzed and the content information corresponding to the waveform data can be comprehensively and comprehensively analyzed based on the waveform image, the efficiency and the accuracy of protocol analysis are improved, and the user experience is improved.
In an actual use scenario, a technician is generally required to analyze problems and risks existing in the protocol according to an analysis result of the oscilloscope, on one hand, the technical requirement on the technician is high, and manual workload is required, and on the other hand, analysis errors are easily caused in manual analysis. Accordingly, the present disclosure also provides the following embodiments.
Optionally, the method further comprises:
checking the protocol characteristic information according to a communication protocol standard corresponding to the protocol type;
and when the protocol characteristic information is determined to be abnormal, adding abnormal information corresponding to the protocol characteristic information into the protocol analysis record.
The communication protocol standard can be analyzed to determine the verification standard of the protocol characteristic information corresponding to the communication protocol standard, such as a safety range, a risk range, an error range, and the like of a level amplitude, a risk range of a rising edge time, and the like. For example, taking the I2C protocol as an example, the rising edge time in the determined protocol feature information is 500ns, and the abnormal range in the corresponding verification standard is that the rising edge time is greater than 400 ns. And if the level amplitude information is in the corresponding error range, determining that the level amplitude information is abnormal.
Therefore, by the technical scheme, the protocol characteristic information of the protocol to be analyzed can be automatically verified, so that manual analysis by a user is not needed, the accuracy of a verification result is improved, and meanwhile, the manual workload can be effectively reduced. Therefore, the user can determine the abnormal information in the protocol to be analyzed only by checking the protocol analysis record, so that the user can know the abnormal information in time and the influence on data transmission based on the protocol is avoided.
Optionally, when determining that the protocol feature information is abnormal, the type of the abnormality may be further determined, in the above example, if the rising edge time corresponding to the protocol to be resolved is in the risk range, the type of the abnormality may be determined as a risk item, and if the level amplitude information corresponding to the protocol to be resolved is in the error range, the type of the abnormality may be determined as an error item, and the type of the abnormality is added to the protocol resolution record. Therefore, the user can identify the error item and the risk item in the abnormity, and the processing sequence of each abnormal item is convenient to select.
Optionally, the method further comprises:
inquiring a solution corresponding to the abnormal information according to the abnormal information corresponding to the protocol characteristic information;
and in the case that the solution is inquired, outputting the solution.
In order to facilitate timely and accurate processing of the abnormal information, a corresponding solution may be correspondingly set for the abnormal information that has occurred, and the solution may be stored. Therefore, when the abnormal information is determined subsequently, whether a corresponding solution exists can be inquired according to the abnormal information, and the solution can be output when the solution is inquired.
For example, the solution may include a reason for generating the abnormal information, a problem caused by the abnormal information, and a countermeasure corresponding to the abnormal information. For example, when it is determined that the rising edge time corresponding to the protocol to be analyzed is in the risk range, a solution may be queried according to the abnormal information, for example, the query may be performed in a manner of keyword matching, or the query may be performed through the abnormal type. And outputting the solution when the solution corresponding to the abnormal information is inquired. For example, in the queried solution, the reason for generating the abnormal information is that the pull-up resistance of the SCL on the I2C bus is too large or the capacitive value of the trace is too large, the problem caused by the abnormal information is that the clock identification of the slave sensor is wrong, and the countermeasure corresponding to the abnormal information is to reduce the resistance value of the pull-up resistance or reduce the trace of the path, so that the user can process the abnormal information based on the solution.
Therefore, according to the technical scheme, when the abnormal information is determined according to the protocol characteristic information, the solution corresponding to the abnormal information is output, so that a prompt can be given for a user to know the abnormal information, the user can conveniently and accurately process the abnormal information in time, and the accuracy of subsequent communication protocol analysis and the stability of data transmission based on the communication protocol are ensured.
Optionally, the present disclosure also provides the following embodiments. In this embodiment, a user may analyze and upload a solution, for example, the user may trigger a solution setting instruction through a solution setting page, and then a solution corresponding to the solution setting instruction and exception information may be stored in association in response to the solution setting instruction. Therefore, under the condition that the solutions are not inquired, the abnormal information can be shared to other users on line, so that the other users can set the corresponding solutions, and when the abnormal information is received, the solutions and the abnormal information can be shared based on the abnormal information uploading solutions, so that the integrity and the comprehensiveness of the solutions in the database are improved.
The present disclosure further provides a communication protocol analyzing apparatus, as shown in fig. 5, the apparatus 10 includes:
an obtaining module 100 configured to obtain a waveform image of a protocol to be analyzed;
a first determining module 200 configured to determine a protocol type of the protocol to be parsed;
a second determining module 300 configured to determine a signal type of the waveform signal in the waveform image according to the protocol type;
a generating module 400 configured to parse the waveform image according to the signal type, and generate a protocol parsing record, where the protocol parsing record includes protocol feature information and waveform data decoding information.
Optionally, the apparatus further comprises:
the verification module is configured to verify the protocol characteristic information according to a communication protocol standard corresponding to the protocol type;
the adding module is configured to add the abnormal information corresponding to the protocol feature information to the protocol analysis record when the protocol feature information is determined to be abnormal.
Optionally, the apparatus further comprises:
the query module is configured to query a solution corresponding to the abnormal information according to the abnormal information corresponding to the protocol feature information;
an output module configured to output the solution if the solution is queried.
Optionally, the first determining module includes:
the first display submodule is configured to display a protocol type selection interface, wherein a plurality of candidate protocol types are displayed in the protocol type selection interface;
the first determining submodule is configured to respond to a protocol type selection instruction triggered by a user on the protocol type selection interface, and determine the protocol type indicated by the protocol type selection instruction as the protocol type of the protocol to be analyzed.
Optionally, the first determining module includes:
the extraction submodule is configured to extract the protocol type characteristic information corresponding to the waveform image;
and the second determining submodule is configured to match the protocol type characteristic information with preset protocol type characteristic information, and determine the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
Optionally, the obtaining module includes:
a first acquisition sub-module configured to acquire the waveform image output by the waveform data display device;
or, the second obtaining sub-module is configured to obtain the captured waveform image segment, and perform image stitching processing on the waveform image segment to obtain the waveform image.
Optionally, the second determining module includes:
the second display submodule is configured to display a signal type selection interface, wherein the signal type selection interface comprises a waveform signal and a candidate signal type corresponding to the waveform signal, and the candidate signal type is a signal type corresponding to the protocol type;
a third determining sub-module configured to determine, in response to a signal type selection instruction for each of the waveform signals in the signal type selection interface by a user, a signal type indicated by the signal type selection instruction as a signal type of the waveform data.
Optionally, the generating module includes:
a fourth determination submodule configured to determine an electrical characteristic and a timing characteristic of the waveform signal corresponding to the signal type in the waveform image;
a fifth determination submodule configured to determine the protocol feature information from the electrical feature and the timing feature.
Optionally, the protocol feature information comprises at least one of: level amplitude information, rising edge time, falling edge time, setup time, hold time.
Optionally, the generating module includes:
a sixth determining sub-module configured to determine binary data corresponding to the waveform signal in the waveform image;
a seventh determining sub-module configured to determine the waveform data decoding information from the binary data.
Optionally, the waveform data decoding information comprises at least one of: access address, register address, read-write operation type, read-write data content information.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present disclosure also provides a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the communication protocol parsing method provided by the present disclosure.
Fig. 6 is a block diagram illustrating a communication protocol parsing apparatus 800 according to an example embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, the apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the communication protocol parsing method described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 806 provides power to the various components of device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, audio component 810 includes a Microphone (MIC) configured to receive external audio signals when apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed status of the device 800, the relative positioning of components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in the temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described communication protocol parsing method.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the communication protocol parsing method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned communication protocol parsing method when executed by the programmable apparatus.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (11)

1. A method for analyzing a communication protocol, comprising:
acquiring a waveform image of a protocol to be analyzed;
determining the protocol type of the protocol to be analyzed;
determining the signal type of the waveform signal in the waveform image according to the protocol type;
analyzing the waveform image according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information;
the protocol characteristic information is determined by the following method:
determining electrical characteristics and timing characteristics of the waveform signals corresponding to the signal types in the waveform image;
determining the protocol feature information according to the electrical features and the timing features;
wherein the determining the protocol type of the protocol to be analyzed includes:
extracting protocol type characteristic information corresponding to the waveform image;
and matching the protocol type characteristic information with preset protocol type characteristic information, and determining the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
2. The method of claim 1, further comprising:
checking the protocol characteristic information according to a communication protocol standard corresponding to the protocol type;
and when the protocol characteristic information is determined to be abnormal, adding abnormal information corresponding to the protocol characteristic information into the protocol analysis record.
3. The method of claim 2, further comprising:
according to the abnormal information corresponding to the protocol feature information, inquiring a solution corresponding to the abnormal information;
and in the case of inquiring the solution, outputting the solution.
4. The method of claim 1, wherein the obtaining a waveform image of a protocol to be resolved comprises:
acquiring the waveform image output by a waveform data display device;
or acquiring a shot waveform image segment, and performing image splicing processing on the waveform image segment to obtain the waveform image.
5. The method of claim 1, wherein determining the signal type of the waveform signal in the waveform image according to the protocol type comprises:
displaying a signal type selection interface, wherein the signal type selection interface comprises a waveform signal and a candidate signal type corresponding to the waveform signal, and the candidate signal type is a signal type corresponding to the protocol type;
in response to a signal type selection instruction of a user for each waveform signal in the signal type selection interface, determining a signal type indicated by the signal type selection instruction as a signal type of the waveform data.
6. The method of claim 1, wherein the protocol feature information comprises at least one of: level amplitude information, rising edge time, falling edge time, setup time, hold time.
7. The method of claim 1, wherein said parsing the waveform image according to the signal type to generate a protocol parse record comprises:
determining binary data corresponding to the waveform signal in the waveform image;
and determining the waveform data decoding information according to the binary data.
8. The method of claim 7, wherein the waveform data decoding information comprises at least one of: access address, register address, read-write operation type, and read-write data content information.
9. A communication protocol parsing apparatus, comprising:
the acquisition module is configured to acquire a waveform image of a protocol to be analyzed;
a first determining module configured to determine a protocol type of the protocol to be parsed;
a second determination module configured to determine a signal type of the waveform signal in the waveform image according to the protocol type;
the generating module is configured to analyze the waveform image according to the signal type and generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information;
the generation module comprises:
a fourth determination sub-module configured to determine electrical and timing characteristics of the waveform signal corresponding to the signal type in the waveform image;
a fifth determination submodule configured to determine the protocol feature information from the electrical feature and the timing feature;
wherein the first determining module comprises:
the extraction submodule is configured to extract the protocol type characteristic information corresponding to the waveform image;
and the second determining submodule is configured to match the protocol type characteristic information with preset protocol type characteristic information, and determine the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
10. A communication protocol parsing apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a waveform image of a protocol to be analyzed;
determining the protocol type of the protocol to be analyzed;
determining the signal type of the waveform signal in the waveform image according to the protocol type;
analyzing the waveform image according to the signal type to generate a protocol analysis record, wherein the protocol analysis record comprises protocol characteristic information and waveform data decoding information;
wherein the protocol feature information is determined by:
determining electrical characteristics and timing characteristics of the waveform signals corresponding to the signal types in the waveform image;
determining the protocol feature information according to the electrical feature and the timing feature;
wherein, the determining the protocol type of the protocol to be analyzed includes:
extracting protocol type characteristic information corresponding to the waveform image;
and matching the protocol type characteristic information with preset protocol type characteristic information, and determining the protocol type corresponding to the successfully matched preset protocol type characteristic information as the protocol type corresponding to the protocol to be analyzed.
11. A computer-readable storage medium, on which computer program instructions are stored, which program instructions, when executed by a processor, carry out the steps of the method according to any one of claims 1 to 8.
CN202010544871.5A 2020-06-15 2020-06-15 Communication protocol analysis method, device and computer readable storage medium Active CN113810240B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010544871.5A CN113810240B (en) 2020-06-15 2020-06-15 Communication protocol analysis method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010544871.5A CN113810240B (en) 2020-06-15 2020-06-15 Communication protocol analysis method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113810240A CN113810240A (en) 2021-12-17
CN113810240B true CN113810240B (en) 2023-04-18

Family

ID=78944211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010544871.5A Active CN113810240B (en) 2020-06-15 2020-06-15 Communication protocol analysis method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113810240B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115422090B (en) * 2022-11-02 2023-03-21 紫光同芯微电子有限公司 Pattern generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105678234A (en) * 2015-12-30 2016-06-15 浪潮(北京)电子信息产业有限公司 Eye pattern automatic analysis method and apparatus
CN105866501A (en) * 2016-04-29 2016-08-17 优利德科技(中国)有限公司 Method and device for protocol decoding analysis based on oscilloscope
CN109117408A (en) * 2018-06-26 2019-01-01 电子科技大学 Serial protocol signal creating method based on signal generator

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7610516B2 (en) * 2006-04-20 2009-10-27 Sai Pong Siu Recording analog characteristics of data from a data line in a protocol analyzer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105678234A (en) * 2015-12-30 2016-06-15 浪潮(北京)电子信息产业有限公司 Eye pattern automatic analysis method and apparatus
CN105866501A (en) * 2016-04-29 2016-08-17 优利德科技(中国)有限公司 Method and device for protocol decoding analysis based on oscilloscope
CN109117408A (en) * 2018-06-26 2019-01-01 电子科技大学 Serial protocol signal creating method based on signal generator

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
模拟示波器波形胶片数字化判读系统的研制;宋纪文等;《核电子学与探测技术》;20060120(第01期);正文第1-6节 *

Also Published As

Publication number Publication date
CN113810240A (en) 2021-12-17

Similar Documents

Publication Publication Date Title
CN110941942B (en) Circuit schematic diagram inspection method, device and system
RU2669063C2 (en) Method and device for image acquisition
CN111221733B (en) Information processing method, device, mobile terminal and storage medium
CN105306931A (en) Smart TV anomaly detection method and device
CN106919629B (en) Method and device for realizing information screening in group chat
CN111274131A (en) Interface testing method and device, electronic equipment and storage medium
US11388652B2 (en) Method and apparatus for indicating position of cell-defining synchronization signal block and searching for the same, and base station
CN111209195B (en) Method and device for generating test case
CN111061452A (en) Voice control method and device of user interface
CN113810240B (en) Communication protocol analysis method, device and computer readable storage medium
CN112559309B (en) Page performance acquisition algorithm adjusting method and device
CN116069612A (en) Abnormality positioning method and device and electronic equipment
CN106790683B (en) Network data display method and device based on mobile terminal
CN111782508B (en) Automatic test method, device, electronic equipment and storage medium
CN105550260A (en) Picture display method and device
CN111079421B (en) Text information word segmentation processing method, device, terminal and storage medium
CN112416751A (en) Processing method and device for interface automation test and storage medium
CN109992503B (en) Automatic testing method and device
CN107368278B (en) Information processing method and device
CN112383661B (en) Mobile terminal automatic test method and device, electronic equipment and storage medium
CN106446827B (en) Iris recognition function detection method and device
CN115098390A (en) Automatic testing method and device, storage medium and electronic equipment
CN104933107A (en) Searching method of push message and searching device of push message
CN111061633B (en) Webpage first screen time detection method, device, terminal and medium
CN111240927B (en) Method, device and storage medium for detecting time consumption of method in program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant