Reserved variable and constant names – Teledyne LeCroy USB Script Decode Manual User Manual
Page 62

56
C
HAPTER
14
CATC Scripting Language for USB
USB Decoders
When UsbScriptDecodeType=1, the decoding for the colored fields of the trace
display are handled separately from the decoding for the text-based decoding seen
in the decoding dialogs. If this variable is not initialized in a .dec file, this is the
default behavior. The Field Displays are handled through the normal ProcessDa-
ta() script function, whereas the text is handled through either the DataDecode()
or RequestDecode() functions (depending on which one you are trying to decode).
You can
build up formatted output text in a manner which looks a lot like the older script
mechanism this way. It does require some redundant code, however, since this
creates a separate execution path in the script. When using this method for creating
text, the user is essentially building up a text stream which will be retrieved for
display in the Decode Dialog or as a tooltip. An example of this usage is found in
the files in the HubClass directory under Scripts. For comparison with the old
decoding method, you can look at the old hub decoding scripts in the Scripts/
Legacy/Replaced directory. It contains the old version of the Hub and Bluetooth
HCI decoders which have been replaced with new Script Decoder based files.
An alternative method (and the one used for all the MassStorage decoders) is when
UsbScriptDecodeType=2. In these files, there is one main execution path through
ProcessData() which outputs either colored field cells or formatted text, depending
on a context variable named PrepareFldsForDlg. This is passed in as a 0 by the
software when the decoding is occurring in the normal Trace View, and is set to 1
when being called in situations where text decoding is desired by the software. This
is described in detail in earlier chapters. The advantage of this mechanism is that it
is easier to program and there is less redundancy of code. The disadvantage is that
the format of the output is fixed and not flexible. It is currently implemented to
output the decoding fields in simple columns, and the comments/tooltip strings are
provided in the last column whenever the trace view for the transfer is shown in
Expanded mode. In other words, it is not as pretty, but at least you can select the
text and copy it to an editor, etc.
Reserved Variable and Constant Names
The following names are reserved for use in the Script Decoding Files. (These are
in addition to the ones described in earlier chapters). These are case-sensitive, so
pay attention to the capitalization.
UsbDecodeType
Values: “Endpoint” or “Request”. Used to distinguish whether the .dec file
is to be used for endpoint decoding or for decoding control transfers (The
ones that start with a Setup packet).
UsbReqType
Values: “Class” or “Vendor”. Used to distinguish the request types for
decoding.