Discussion:
[linux-uvc-devel] Implementing uvc extension units
Edgar Thier
2014-05-14 14:25:36 UTC
Permalink
Hi,

I am trying to implement an extension unit for the "The Imaging Source
DFK AFU 130".

I am having trouble finding the correct setting for the xml
description, so that I can even
get one extension feature running via uvcdynctrl.

Are there any descriptions/documentations that could be of help?
I keep getting "unable to map", but have et to find a good explanation
as to why.

Any help, hint or pointer in the general direction I should be looking
would be greatly appreciated.

Cheers,

Edgar
Paulo Assis
2014-05-14 15:40:23 UTC
Permalink
Hi,
first you should determine the unit ID and selector for the
corresponding control GUID,

Try using lsusb to list all of the device exported controls, this will
give you the unit id.

You should then be able to use uvcdynctrl to get/set the raw control
with different selectors, this will help determine the correct
selector and the control offsets (if any).

With this data it should be easy enoght to map the device control to
the matching V4L2 control(s)


Regards,
Paulo
Post by Edgar Thier
Hi,
I am trying to implement an extension unit for the "The Imaging Source
DFK AFU 130".
I am having trouble finding the correct setting for the xml
description, so that I can even
get one extension feature running via uvcdynctrl.
Are there any descriptions/documentations that could be of help?
I keep getting "unable to map", but have et to find a good explanation
as to why.
Any help, hint or pointer in the general direction I should be looking
would be greatly appreciated.
Cheers,
Edgar
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Linux-uvc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel
Edgar Thier
2014-06-24 08:41:52 UTC
Permalink
Hi,

Tank you for the hint with the raw controls that got me in the right direction

For reference sake and to help future generations, here a little
introduction as to how I did it:

sudo lsusb -vd <verndorID>:<productID>

This will give you a long description. Look for something like:
VideoControl Interface Descriptor:
bLength 33
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 3
guidExtensionCode {0aba49de-5c0b-49d5-8f71-0be40f94a67a}
bNumControl 2
bNrPins 1
baSourceID( 0) 2
bControlSize 8
bmControls( 0) 0x0f
bmControls( 1) 0x00
bmControls( 2) 0x00
bmControls( 3) 0xcd
bmControls( 4) 0xff
bmControls( 5) 0x07
bmControls( 6) 0x00
bmControls( 7) 0x00
iExtension 0

After fighting a bug in uvcdynctrl (they do not use the device GUID but always
have 00000000-0000-0000-0000-000000000000) I was able to correctly read the
values.

The problem with controls is that it is impossible to interpret them correctly
without talking to the manufacturer. With things like an uint32 containing two
16 bit values it is rather difficult to address everything correctly.

For examples of functioning xml descriptions take a look at logitech.xml or
tisEUVC.xml. Those are the only examples I found.

<constant type="guid">
<id>UVC_GUID_TISEUVC_XU</id>
<!-- <value>0aba49de-5c0b-49d5-8f71-0be40f94a67a</value> value from
the camera-->
<value>de49ba0a-0b5c-d549-8f71-0be40f94a67a</value>
</constant>

The first three sections of the GIUD of the extension have to be swapped.


<constant type="integer">
<id>V4L2_STROBE_POLARITY</id>
<value>0x0199e212</value> <!-- still not sure if this range is
specified anywhere-->
</constant>

<constant type="integer">
<id>XU_STROBE_MODE</id>
<value>0x06</value>
</constant>

The constants are good for two things:
Defining the needed v4l2 identifier (assuming you do not use preexisting ones)
and defining the registers of your extension unit for readable names.


<!-- BM8, bit 0 = ENABLE, bit 1 = POLARITY, bit 2 = USE_EXPOSURE_TIME -->
<control id="strobe_mode">
<entity>UVC_GUID_TISEUVC_XU</entity>
<selector>XU_STROBE_MODE</selector>
<index>5</index>
<size>4</size>
<requests>
<request>SET_CUR</request>
<request>GET_CUR</request>
<request>GET_DEF</request>
<request>GET_RES</request>
</requests>
</control>

The control sections defines multiple things:
- The extension unit the control is related to (<entity>)
- The associated register (selector and index); index is selector - 1
- The size of the register in byte (though every value seems to work)
- The requests that are possible (e.g. is the register writable, etc.)

<mapping>
<name>Strobe Polarity</name>
<uvc>
<control_ref idref="strobe_mode"/>
<size>1</size>
<offset>1</offset>
<uvc_type>UVC_CTRL_DATA_TYPE_BOOLEAN</uvc_type>
</uvc>
<v4l2>
<id>V4L2_STROBE_POLARITY</id>
<v4l2_type>V4L2_CTRL_TYPE_BOOLEAN</v4l2_type>
</v4l2>
</mapping>

In the mapping section you describe how the control should be interpreted by
uvc and v4l2.

size is in bits and offset describes the bit offset within the register.


Open questions that hopefully someone can explain to me:

What is the difference between selector and index?
Is there a specified range for additional v4l2 controls, or am I free
to choose my own?
Is the size for the control really necessary?


Cheers,

Edgar

Loading...