Vendor Specific Class Decoding
Previous  Next


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).

You need to perform the following 2 steps to achieve this functionality:

1.   Download the vendor specific class decoder DLL (Download)
2.   Write your custom device class decoder DLL (Download Sample Code)

Both the above DLLs must be copied to USBTrace installation directory.


Step1: Download vendor specific class decoder

You can download the vendor specific class decoder from here. Extract VendorDecoder.dll to USBTrace installation directory (Ex: \Program Files\USBTrace\)


Step2: 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).

graphic

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 paramter 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.

graphic


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.

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