Hi Brent, On Thursday 13 January 2011 19:59:00 Brent Weatherall wrote: > Hello. My name is Brent Weatherall. I am new to developing with the UVC. > I am developing in Linux. I have a device that uses an extension unit. > Looking at the device's last generation of software for the extension unit > portion of the device I do not see 100% of the correlation with the UVC XU > documentation. The old device code (which functions properly) does not > actually use the extension descriptor in the software at all, yet it works > anyway. The extension descriptor does not show up in the uvcvideo.h file > either. My questions are as follows: > > 1. Is this XU descriptor something agreed upon on paper and then > implemented solely inside the device?
The XU descriptor is sent by the device to the host. The uvcvideo driver parses the XU descriptor when initializing the device to understand the entities topology and instantiate controls. > 2. When sending the first xu control via ioctl to activate the specified xu > control, is the bUnitID from the descriptor specification the same thing as > the "__u8 unit" field in the data structure "struct uvc_xu_control"? Yes it is. > 3. Is it correct that when using an XU control, it takes two ioctl > commands? One to specify the control to use, and then one to actually > get/send the control data? To address a control the uvcvideo driver needs its control selector, which is a 8-bit value. Unfortunately that value can't be retrieved from the XU descriptor. For that reason the uvcvideo driver needs to be told in advance about the mappings between XU controls and control selectors. That's what the UVCIOC_CTRL_ADD ioctl is for. You only need to call it once to add an XU control, and you can then get/set the control value as many times as you want. In practice I've found that UVC devices use the XU control index + 1 as the control selector value. For that reason newer driver versions will not require applications to use the UVCIOC_CTRL_ADD ioctl anymore. > 4. If 3 is correct, when sending the first xu control via ioctl, what > should be put in the '__u8 selector', '__u16 size' and '__u8 *data' > fields? The control selector value (which is usually the XU control index + 1), the control size in bytes, and a pointer to a buffer that stores the control value. > 5. How does one determine the size of an XU control? The size can be retrieved from the device using the GET_LEN request. That's what newer driver versions will do (likely in 2.6.39). The other way is to get it from the vendor documentation. > Sorry if these questions are basic or should be obvious; however, they are > not clear to me at this time from reading the UVC documentation. No worries. -- Regards, Laurent Pinchart _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel