Jump to content

UsbQueryDeviceReport: Difference between revisions

From EDM2
W.m.brul (talk | contribs)
updated whole page
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
Obtains the Compound Descriptor of a specific USB device.
Obtains the Compound Descriptor of a specific USB device.


==Syntax==
==Syntax==
''For acces 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.


==Return Code==
==Return Code==
<pre>
0x0000 - NO_ERROR
0x0000 - NO_ERROR
;Errors
</pre>
===Errors===
<pre>
<pre>
0x0057 - ERROR_INVALID_PARAMETER
0x0057 - ERROR_INVALID_PARAMETER
Line 36: Line 26:
0xFFEA - ERROR_MORE_DATA
0xFFEA - ERROR_MORE_DATA
</pre>
</pre>
==Remarks==
==Remarks==
The Compound Descriptor is the concatenation of Device Descriptor and Configuration Descriptor.
The Compound Descriptor is the concatenation of Device Descriptor and Configuration Descriptor.
Line 60: Line 51:
   }
   }
}
}
</pre>
</pre>


==Related Functions==
==Related Functions==
* [[UsbQueryDeviceInfo]]
* [[UsbQueryNumberDevices]]
* [[UsbOpen]]


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

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