Jump to content

UsbQueryDeviceReport: Difference between revisions

From EDM2
Ak120 (talk | contribs)
m sections with no content
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Registers semaphores for a generic attach/detach notification of USB devices.
Obtains the Compound Descriptor of a specific USB device.


==Syntax==
==Syntax==
  APIRET APIENTRY UsbQueryDeviceReport( ULONG ulDevNumber,
''For access by Device Handle use:''
                                        ULONG *ulBufLen,
ulrc = UsbQueryDeviceReport(Handle,pulBufLen,pucData)
                                        PVOID pvData);
''For access by Device Number:''
  ulrc = UsbQueryDeviceReport(ulDevNumber,pulBufLen,pucData)
 
==Parameters==
==Parameters==
; ulDevNumber :  
; Handle : the Device Handle received from the previous [[UsbOpen]].
; *ulBufLen :  
; ulDevNumber : the Device Number from 1 up to the Total Number from [[UsbQueryNumberDevices]].
; pvData :  
; 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
<pre>
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
</pre>
 
==Remarks==
The Compound Descriptor is the concatenation of Device Descriptor and Configuration Descriptor.
 
==Example Code==
<pre>
//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]);
  }
}
</pre>
 
==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