Jump to content

UsbQueryDeviceReport: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
==Syntax==
==Syntax==
''For access by Device Handle use:''
''For access by Device Handle use:''
<pre>
ulrc = UsbQueryDeviceReport(Handle,pulBufLen,pucData)
ulrc = UsbQueryDeviceReport(Handle,pulBufLen,pucData)
''For access by Device Number:''
</pre>
ulrc = UsbQueryDeviceReport(ulDevNumber,pulBufLen,pucData)
''For acces by Device Number:''
<pre>
ulrc = UsbQueryDeviceReport(ulDevNumber,pulBufLen,pucData)
</pre>


==Parameters==
==Parameters==
; Handle : the Device Handle received from the previous UsbOpen.
; Handle : the Device Handle received from the previous [[UsbOpen]].
; ulDevNumber : the Device Number from 1 up to the Total Number from UsbQueryNumberDevices.
; ulDevNumber : the Device Number from 1 up to the Total Number from [[UsbQueryNumberDevices]].
; pulBufLen : the address of the variable to specify/receive the number of bytes.
; pulBufLen : the address of the variable to specify/receive the number of bytes.
; pucData : the address of the buffer to receive the Compound Descriptor.
; pucData : the address of the buffer to receive the Compound Descriptor.
Line 19: Line 15:
==Return Code==
==Return Code==
  0x0000 - NO_ERROR
  0x0000 - NO_ERROR
;Errors
;Errors
<pre>
<pre>

Latest revision as of 20:46, 13 September 2021

Obtains the Compound Descriptor of a specific USB device.

Syntax

For access by Device Handle use:

ulrc = UsbQueryDeviceReport(Handle,pulBufLen,pucData)

For access by Device Number:

ulrc = UsbQueryDeviceReport(ulDevNumber,pulBufLen,pucData)

Parameters

Handle
the Device Handle received from the previous UsbOpen.
ulDevNumber
the Device Number from 1 up to the Total Number from UsbQueryNumberDevices.
pulBufLen
the address of the variable to specify/receive the number of bytes.
pucData
the address of the buffer to receive the Compound Descriptor.

Return Code

0x0000 - NO_ERROR
Errors
0x0057 - ERROR_INVALID_PARAMETER
0x1B58 - USB_NOT_INIT
0xFF13 - ERROR_I24_INVALID_PARAMETER
0xFF1F - ERROR_GEN_FAILURE
0xFF37 - ERROR_DEV_NOT_EXIST
0xFF57 - ERROR_INVALID_PARAMETER
0xFF6F - ERROR_BUFFER_OVERFLOW
0xFFEA - ERROR_MORE_DATA

Remarks

The Compound Descriptor is the concatenation of Device Descriptor and Configuration Descriptor.

Example Code

//Code Snippet - UsbQueryDeviceReport
{
  APIRET ulrc;
  PUCHAR pucReport;
  PULONG pulBufLen;
  UCHAR ucReport[4096];
  ULONG ulBufLen = sizeof(ucReport);
  ULONG ulDevNumber = ulNumDev;

  pucReport = &ucReport[0];
  pulBufLen = &ulBufLen;
  ulrc = UsbQueryDeviceReport(ulDevNumber,pulBufLen,pucReport);
  printf("\nUsbQueryDeviceReport - ulrc: 0x%04X (%hu)",ulrc,ulrc);
  if (!ulrc) //success
  {
    int i; printf(" - DeviceReport:\n");
    for (i=0;i<ulBufLen;i++) printf("%02X",ucReport[i]);
  }
}

Related Functions