Jump to content

UsbQueryStringReport

From EDM2

Description

Obtains the array of languages supported by a USB device. Obtains the specified string descriptor of a USB device.

Syntax

ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)

Parameters

Handle
the Device Handle received from the previous UsbOpen.
usLangID
the appropriate Language Code as to the array of Language Codes.
ucStringID
ucStringID - the Descriptor Index or 0 to obtain the array of Language Codes.
pulBufLen
the address of the variable to specify/receive the number of bytes.
pucData
the address of the buffer to receive the String Descriptor.

Return Code

0x0000 - NO_ERROR

Errors

0x0057 - ERROR_INVALID_PARAMETER
0x1B58 - USB_NOT_INIT
0xFF1F - ERROR_GEN_FAILURE
0xFF57 - ERROR_INVALID_PARAMETER

Remarks

Example Code

//Code Snippet - UsbQueryStringReport
{
  APIRET ulrc;
  PUCHAR pucReport;
  PULONG pulBufLen;
  UCHAR ucIndex = 2;
  UCHAR ucReport[4096];
  ULONG ulBufLen = sizeof(ucReport);
  USHORT usLanguage = 0x0409;

  pucReport = &ucReport[0];
  pulBufLen = &ulBufLen;
  ulrc = UsbQueryStringReport(Handle,usLanguage,ucIndex,pulBufLen,pucReport);
  printf("\nUsbQueryStringReport - ulrc: 0x%04X (%hu)",ulrc,ulrc);
  if (!ulrc) //success
  {
    int i; printf(" - StringReport:\n");
    for (i=0;i<ulBufLen;i++) printf("%02X",ucReport[i]);
  }
}

Related Functions