2008-09-17, 07:06
I was not able to get the QuickCam Pro 9000's Focus control working in ucview after using uvcdynctrl to load logitech.xml unless I added the GET_CUR flag to the focus control definition in logitech.xml. This is because the v4l2_get_property routine fails for "write only" controls. There appears to be the assumption floating around that all the motor controls are "write only" - or more specifically, that since they are relative controls, they reads will only return the amount of the last incremental move - useless information if absolute position is wanted.
I suspect that the confusion here arises from the fact that some cameras use rotational (i.e., stepping) motors to drive the focus, as is done in the case of the pan and tilt motors. Clearly, in those cases, the only way to get absolute position is by step counting or by adding suitable sensors to the drives and additional registers to the hardware. No doubt this was not done due to the prohibitive cost - hence a relative motion specification on these motors. However, the focus control on the 9000 uses a linear voice coil motor and is completely different. It's position is directly related to the DC drive current through the coil and (doing a little mental reverse engineering on the fly) is no doubt driven by a current source/DAC combination. Since the DAC register contents will be identical to the contents of the USB Focus control register, the read back value will be proportional to the absolute focus position. This camera's focus control definition should be specified with the GET_CUR flag set, regardless of any contrary contention in the Logitech camera spec. Direct testing of the read capability of the 9000's focus control confirms this suspicion.
Temporary workaround:
Open logitech.xml and find the control definition named:
<control id="logitech_motor_focus">
Find the child section labeled "requests". It should read as follows:
<requests>
<request>SET_CUR</request>
<request>GET_MIN</request>
<request>GET_MAX</request>
<request>GET_DEF</request>
</requests>
To this section, add the single line:
<request>GET_CUR</request>
Then save and close the file. You will need to force a reload of the xml file into the driver. I have found that it is easiest to sudo rmmod uvcvideo, sudo modprobe uvcvideo and then re-run uvcdynctrl -i /path/to/logitech.xml.
I suspect that the confusion here arises from the fact that some cameras use rotational (i.e., stepping) motors to drive the focus, as is done in the case of the pan and tilt motors. Clearly, in those cases, the only way to get absolute position is by step counting or by adding suitable sensors to the drives and additional registers to the hardware. No doubt this was not done due to the prohibitive cost - hence a relative motion specification on these motors. However, the focus control on the 9000 uses a linear voice coil motor and is completely different. It's position is directly related to the DC drive current through the coil and (doing a little mental reverse engineering on the fly) is no doubt driven by a current source/DAC combination. Since the DAC register contents will be identical to the contents of the USB Focus control register, the read back value will be proportional to the absolute focus position. This camera's focus control definition should be specified with the GET_CUR flag set, regardless of any contrary contention in the Logitech camera spec. Direct testing of the read capability of the 9000's focus control confirms this suspicion.
Temporary workaround:
Open logitech.xml and find the control definition named:
<control id="logitech_motor_focus">
Find the child section labeled "requests". It should read as follows:
<requests>
<request>SET_CUR</request>
<request>GET_MIN</request>
<request>GET_MAX</request>
<request>GET_DEF</request>
</requests>
To this section, add the single line:
<request>GET_CUR</request>
Then save and close the file. You will need to force a reload of the xml file into the driver. I have found that it is easiest to sudo rmmod uvcvideo, sudo modprobe uvcvideo and then re-run uvcdynctrl -i /path/to/logitech.xml.