Jump to content

UsbQueryStringReport: Difference between revisions

From EDM2
Created page with "==Description== Obtains an array of languages supported by a specific USB device. Obtains the specified string descriptor of a specific USB device. ==Syntax== <pre> ulrc=Usb..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
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>
ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)
ulrc=UsbQueryStringReport(Handle,usLangID,ucStringID,*pulBufLen,*pucData)
</pre>


==Parameters==
==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==
==Return Code==
0x0000 - NO_ERROR


===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==
Line 24: Line 28:
==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>


==Related Functions==
==Related Functions==
* [[UsbQueryDeviceReport]]
* [[UsbOpen]]


[[Category:USBCalls]]
[[Category:USBCalls]]

Latest revision as of 22:42, 13 September 2021

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