USB Video (UVC) extension unit

I am having difficulty accessing UVC extension units using DirectShow IKsControl::KsProperty. When I try doing KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY on PropertyId 0, I get back the extension unit GUID and six additional bytes (1,1,3,2,1,0,6) which do not seem to be defined in the DDK. PropertyId 1 returns error 0x80070490. Any suggestions?
[365 byte] By [hgoldstand] at [2007-12-24]
# 1

Extension unit property IDs correspond to similarly numbered extension unit control IDs exposed by the UVC hardware (or more accurately firmware). Since the extension unit control IDs are 1-based, Property ID=0 (KSPROPERTY_EXTENSION_UNIT_INFO) is used to return part of the extension unit descriptor, the syntax for which is defined by the UVC specification. The data returned by KSPROPERTY_EXTENSION_UNIT_INFO starts at the GUID and lists the number of controls, number of input pins and the IDs of the units connected as input to the extension unit. The input pin IDs are hardware IDs not DShow Pin IDs. In the above case it seems that bNumControls=1, bNrInPins=1 and baSourceID[0]=3. Now, the error value of 0x80070490 (ERROR_NOT_FOUND) would normally mean that the hardware doesn't support any control request with control ID=1 which seems odd given that bNumControls = 1. Is it possible there is a firmware bug here ? It is also odd that KSPROPERTY_EXTENSION_UNIT_INFO returns six bytes after the GUID whereas, given that bNrInPins=1, one would expect that there are only three. The latter fact suggests that the Length field of the extension unit descriptor may be incorrect.

Below is an example extension unit descriptor copied from the example at http://www.microsoft.com/whdc/device/stream/vidcap/USBVid-ext.mspx

BYTELength:0x1a

BYTEDescriptorType:0x24

BYTEDescriptorSubtype: 0x06

BYTEbUnitID:0x05

GUIDguidExtensionCode: xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx

BYTEbNumControls:0x03

BYTEbNrInPins:0x01

BYTEbaSourceID[0]:0x01

[Bytes representing SourceID which are bNrInPins in number]

HTH,

Anand.

This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. (c) 2006 Microsoft Corporation. All rights reserved.

AnandGanesh at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 2

Thanks for your insight about the extension unit descriptor. My descriptor is indeed 27 rather than 26 bytes since I specify 2 bytes for the property bitmap (2,1,0 of my returned buffer above). I see no traffic relating to extension units on the USB (via bus trace) except during board powerup when the pc issues get len requests for each of my defined extension unit property ids. The values returned by KSPROPERTY_TYPE_GET on PropertyId 0 appears to be cached in the driver and is not read from the device when KsProperty is issued.

Is any 'initialization' required by the application before using KSPROPERTY_TYPE_GET? How does the driver know which properties may be read?

TIA

hgoldstand at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 3

The data for KSPROPERTY_EXTENSION_UNIT_INFO (PropertyId = 0) is copied over from the device's extension unit descriptor which is cached during device startup. During startup, the driver issues a number of control requests to the device like GET_INFO, GET_LEN, GET_MIN and GET_MAX. The value returned by GET_INFO tells the driver which of GET and SET requests are valid for a given control, whether the control is asynchronous, etc. If any of these initial requests fail, the driver disables the particular control. This may explain why the driver returns ERROR_NOT_FOUND on a subsequent property request. You could monitor extension unit traffic during startup to debug this problem.

HTH,

Anand.

This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. (c) 2006 Microsoft Corporation. All rights reserved.

AnandGanesh at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 4
We have taken traces during startup and the only request we see is GET_LEN. Any idea why we don't get other requests? Besides the device descriptor, is there anything else that needs to be set up in the device?
hgoldstand at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...

Software Development for Windows Vista

Site Classified