Re: [Linux-uvc-devel] [SVN] Added preliminary pan/tilt support for Quickcam Orbit MP
Linux UVC driver and tools
Brought to you by:
pinchartl
|
From: Laurent P. <lau...@sk...> - 2006-02-07 14:44:08
|
> The pantilt reset now work fine , but the pan tilt relative, not really
> like i need :)
> as i did not really understand, how the signed value are in the 4 char
> array, i have try to set up one union like that :
> union pantilt {
> struct {
> short pan;
> short tilt;
> } s16;
> int value;
> } pantilt;
> so i expect s16.pan reffer to the signed value of pan and
> s16.tilt to the tilt value.
> as a result the sign of relative goes right, tilt and pan is not mixed and
> i can scan min to max or max to min , but difficukt to stop the scan
> between :(
I just noticed that there's an endianess problem in the driver. Please try the
following code.
-----------------------------------------------------------------------------
union pantilt {
unsigned char bytes[4];
int value;
} pantilt;
pantilt.bytes[0] = (pan >> 0) & 0xff;
pantilt.bytes[1] = (pan >> 8) & 0xff;
pantilt.bytes[2] = (tilt >> 0) & 0xff;
pantilt.bytes[3] = (tilt >> 8) & 0xff;
ctrl.value = pantilt.value;
-----------------------------------------------------------------------------
This will only work on little endian platforms. Please note that the interface
will probably change as soon as I find time to rework the controls handling
code.
Laurent Pinchart
|