Jump to content

UsbQueryStringReport: Difference between revisions

From EDM2
W.m.brul (talk | contribs)
updated whole page
Line 1: Line 1:
==Description==
==Description==
Obtains an array of languages supported by a specific USB device.
Obtains the array of languages supported by a USB device.
Obtains the specified string descriptor of a specific USB device.
Obtains the specified string descriptor of a USB device.
 


==Syntax==
==Syntax==
<pre>
<pre>
ulrc=UsbQueryStringReport(Handle,usLangID,ucStringID,*pulBufLen,*pucData)
ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)
</pre>
</pre>


==Parameters==
==Parameters==
; Handle :  
; Handle : the Device Handle received from the previous UsbOpen.


; usLangID :  
; usLangID : the appropriate Language Code as to the array of Language Codes.


; ucStringID :  
; ucStringID : ucStringID - the Descriptor Index or 0 to obtain the array of Language Codes.


; *pulBufLen :  
; pulBufLen : the address of the variable to specify/receive the number of bytes.


; *pucData :
; pucData : the address of the buffer to receive the String Descriptor.


==Return Code==
==Return Code==
 
<pre>
0x0000 - NO_ERROR
</pre>
===Errors===
===Errors===
  [0000] - NO_ERROR
<pre>
  [0057] - ERROR_INVALID_PARAMETER
0x0057 - ERROR_INVALID_PARAMETER
  [1B58] - USB_NOT_INIT (7000)
0x1B58 - USB_NOT_INIT
  [FF1F] - ERROR_GEN_FAILURE
0xFF1F - ERROR_GEN_FAILURE
  [FF57] - ERROR_INVALID_PARAMETER
0xFF57 - ERROR_INVALID_PARAMETER
 
</pre>
==Remarks==
==Remarks==


==Example Code==
==Example Code==
<pre>
<pre>
//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]);
  }
}
</pre>
</pre>



Revision as of 17:58, 26 January 2017

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