USBTrace : Class Decoding : Vendor Specific

Download class decoders

Download USBTrace and class decoders:

Download USBTrace Download USBTrace

Feedback
Help us to make USBTrace better!
Send us your feedback
Download sample code

Download custom device class decoder sample:

Download Vendor Decoder Sample Download Sample Code

With the help of vendor class decoder you can write your own custom device class decoders, for your devices which belong to the vendor specific USB device class (Class Code: 0xFF).

Refer Sample Code for writing your own vendor decoder DLL. The output DLL (named vsdecoder.dll) should be copied to USBTrace installation directory.

How to write your custom device class decoder DLL ?

The custom device class decoder which you should write is a Windows DLL which has the following 2 exported functions implemented:

Please download the well documented custom device class decoder sample code.
You can modify this sample to implement your own device class decoder.

GetReqName

BOOL GetReqName([IN] UCHAR bmRequestType, [IN] UCHAR bRequest, [IN] USHORT wValue, [IN] USHORT wIndex, [IN] PVOID pData, [IN] ULONG nDataLen, [OUT] PCHAR sReqName, [IN] USHORT reqNameLen);

In this function, you will have to return the name of the given request (Ex: "SetPortDetails"). The request name must be filled in the sReqName parameter. Request details such as bmRequestType, bRequest, wValue, wIndex are as per the USB specification (Setup Packet, 8 Bytes). Request data and length of the data (pData, nDataLen) are also given. reqNameLen specifies the length of sReqName buffer.

The request name which you provide will be displayed in the Log view (USBTrace captured data list).

USBTrace Vendor Specific Decoding

GetReqInfo

In this function, you will have to return the detailed request information.

BOOL GetReqInfo([IN] UCHAR bmRequestType, [IN] UCHAR bRequest, [IN] USHORT wValue, [IN] USHORT wIndex, [IN] BOOL in, [IN] PVOID pData, [IN] ULONG nDataLen, [OUT] PCHAR sInfoString, [IN][OUT] PUSHORT pInfoStringLen);

The detailed request information must be filled in sInfoString parameter in the following format:

"<header>;<param1>=<value1>;<param2>=<value2>"

Example: "VENDOR_SEND_COMMAND;Command Code=0x21;Control=CT_NONE"

This will be displayed in the additional information view.

USBTrace Vendor Specific Decoding

pInfoStringLen points to the length of sInfoString. If the given pInfoStringLen is insufficient, you must fail this function providing the required length in the same variable.

Handling Bulk, Interrupt, Isochronous packets

In addition to control packets, you can also decode bulk, interrupt and isochronous packets from your own custom vendor specific class decoder.

The bmRequestType parameter can take the following values for these transfer types: TRANSFER_TYPE_BULKORINTERRUPT, TRANSFER_TYPE_ISOCH

#define TRANSFER_TYPE_BULKORINTERRUPT 0xFF
#define TRANSFER_TYPE_ISOCH 0xFE

The wValue parameter will contain the endpoint address if bmRequestType equals any one of the above 2 values. pData will contain the transfer buffer and nDataLen will contain the buffer length.

How to install ?

The name of the DLL should be vsdecoder.dll. This DLL should be copied to USBTrace installation directory. For more information, we recommend you to refer the sample DLL source code.