UsbQueryDeviceInfo: Difference between revisions
Appearance
Created page with "==Description== Obtains attachment information about a specific USB device. ==Syntax== <pre> ulrc=UsbQueryDeviceInfo(ulDevNumber,*pulBufLen,*pucData) </pre> ==Parameters== ..." |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
''For access by Device Handle use:'' | |||
<pre> | <pre> | ||
ulrc=UsbQueryDeviceInfo(ulDevNumber, | ulrc = UsbQueryDeviceInfo(Handle,pulBufLen,pucData) | ||
</pre> | |||
''For access by Device Number use:'' | |||
<pre> | |||
ulrc=UsbQueryDeviceInfo(ulDevNumber,pulBufLen,pucData) | |||
</pre> | </pre> | ||
==Parameters== | ==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 containing the buffer length. Must be set to 12. | |||
; pucData : the address of the buffer to receive the Attachment Information. | |||
==Return Code== | ==Return Code== | ||
<pre> | |||
0x0000 - NO_ERROR | |||
</pre> | |||
===Errors=== | ===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 | |||
</pre> | |||
==Remarks== | |||
The Attachment Information consists of the following: | |||
* UCHAR ctrlID - controller identifier. | |||
* UCHAR deviceAddres - USB device address. | |||
* UCHAR bConfigurationValue - current USB device Configuration Value. | |||
* UCHAR bInterfaceNumber - current index in interface array for this item. | |||
* UCHAR lowSpeedDevice - 0 is full speed, 2 is high speed, else low speed. | |||
* UCHAR portNum - port number to which the USB device is attached. | |||
* USHORT parentHubIndex - index in hub table to parent hub. | |||
* HDEVICE rmDevHandle - Resource Manager device handle. | |||
==Example Code== | ==Example Code== | ||
<pre> | <pre> | ||
//Code Snippet - UsbQueryDeviceInfo | |||
{ | |||
APIRET ulrc; | |||
PUCHAR pucInfo; | |||
PULONG pulBufLen; | |||
UCHAR ucInfo[12]; | |||
ULONG ulBufLen = sizeof(ucInfo); | |||
ULONG ulDevNumber = ulNumDev; | |||
pucInfo = &ucInfo[0]; | |||
pulBufLen = &ulBufLen; | |||
ulrc = UsbQueryDeviceInfo(ulDevNumber,pulBufLen,pucInfo); | |||
printf("\nUsbQueryDeviceInfo - ulrc: 0x%04X (%hu)",ulrc,ulrc); | |||
if (!ulrc) //success | |||
{ | |||
int i; printf(" - DeviceInfo:\n"); | |||
for (i=0;i<ulBufLen;i++) printf("%02X",ucInfo[i]); | |||
} | |||
} | |||
</pre> | </pre> | ||
==Related Functions== | ==Related Functions== | ||
* [[UsbQueryDeviceReport]] | |||
* [[UsbQueryNumberDevices]] | |||
* [[UsbOpen]] | |||
[[Category:USBCalls]] | [[Category:USBCalls]] |
Latest revision as of 17:21, 12 February 2017
Description
Obtains attachment information about a specific USB device.
Syntax
For access by Device Handle use:
ulrc = UsbQueryDeviceInfo(Handle,pulBufLen,pucData)
For access by Device Number use:
ulrc=UsbQueryDeviceInfo(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 containing the buffer length. Must be set to 12.
- pucData
- the address of the buffer to receive the Attachment Information.
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
Remarks
The Attachment Information consists of the following:
- UCHAR ctrlID - controller identifier.
- UCHAR deviceAddres - USB device address.
- UCHAR bConfigurationValue - current USB device Configuration Value.
- UCHAR bInterfaceNumber - current index in interface array for this item.
- UCHAR lowSpeedDevice - 0 is full speed, 2 is high speed, else low speed.
- UCHAR portNum - port number to which the USB device is attached.
- USHORT parentHubIndex - index in hub table to parent hub.
- HDEVICE rmDevHandle - Resource Manager device handle.
Example Code
//Code Snippet - UsbQueryDeviceInfo { APIRET ulrc; PUCHAR pucInfo; PULONG pulBufLen; UCHAR ucInfo[12]; ULONG ulBufLen = sizeof(ucInfo); ULONG ulDevNumber = ulNumDev; pucInfo = &ucInfo[0]; pulBufLen = &ulBufLen; ulrc = UsbQueryDeviceInfo(ulDevNumber,pulBufLen,pucInfo); printf("\nUsbQueryDeviceInfo - ulrc: 0x%04X (%hu)",ulrc,ulrc); if (!ulrc) //success { int i; printf(" - DeviceInfo:\n"); for (i=0;i<ulBufLen;i++) printf("%02X",ucInfo[i]); } }