Motion - Support Question 2008x 01x 29x 112921

Logitech Quickcam Sphere MP - Pan & Tilt do not work

Question

I have a brand new Logitech Quickcam Sphere MP. The picture is fine through motion and other tools but i can not get pan & tilt to work.

This is my configuration:
- Fedora Core 6
- Kernel 2.6.20
- V4L2 as it came with the kernel (don't know how to determine the version)
- UVCvideo from latest svn 2008-01-28 (don't know how to determine the version)
- libwebcam 0.1 (latest from quickcamteam.net)
- Motion 3.2.9

Please Help...

Here are some things I've tried and the responses I got:

## UVCDYNCTRL import ok but any other action on the camera fails with the same error.
[root@server]# uvcdynctrl -i ./logitech.xml
Importing dynamic controls from file ./logitech.xml.
[root@server]# uvcdynctrl -l
[libwebcam] Unable to refresh device list. (error 12: A Video4Linux2 API call returned an unexpected error)

## LUVCVIEW output on screen when pressing pan / tilt buttons (pan up as example)
[root@server] # luvcview
luvcview version 0.2.1
Video dreive: x11
A window manager is available
video /dev/video0
ioctl quirycontrol error 22
Set Pan up error
ioctl quirycontrol error 22
Set Pan up error

## MOTION output in /var/log/messages when enabling tracking
Jan 29 00:41:40 tjserver motion: [0] Processing thread 0 - config file /usr/local/etc/motion.conf
Jan 29 00:41:40 tjserver motion: [0] Motion 3.2.9 Started
Jan 29 00:41:40 tjserver motion: [0] Created process id file /var/run/motion.pid. Process ID is 29668
Jan 29 00:41:40 tjserver motion: [0] Motion running as daemon process
Jan 29 00:41:40 tjserver motion: [0] ffmpeg LIBAVCODEC_BUILD 3352580 LIBAVFORMAT_BUILD 3345409
Jan 29 00:41:40 tjserver motion: [0] Thread 1 is from /usr/local/etc/motion.conf
Jan 29 00:41:40 tjserver motion: [1] cap.driver: "uvcvideo"
Jan 29 00:41:40 tjserver motion: [1] cap.card: "UVC Camera (046d:08cc)"
Jan 29 00:41:40 tjserver motion: [1] cap.bus_info: "0000:00:02.1"
Jan 29 00:41:40 tjserver motion: [1] cap.capabilities=0x04000001
Jan 29 00:41:40 tjserver motion: [1] - VIDEO_CAPTURE
Jan 29 00:41:40 tjserver motion: [1] - STREAMING
Jan 29 00:41:40 tjserver motion: [1] Supported palettes:
Jan 29 00:41:40 tjserver motion: [1] 0: MJPG (MJPEG)
Jan 29 00:41:40 tjserver motion: [1] 1: YUYV (YUV 4:2:2 (YUYV))
Jan 29 00:41:40 tjserver motion: [1] Test palette YUYV (640x480)
Jan 29 00:41:40 tjserver motion: [1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008
Jan 29 00:41:40 tjserver motion: [1] found control 0x00980900, "Brightness", range 0,255
Jan 29 00:41:40 tjserver motion: [1]    "Brightness", default 127, current 127
Jan 29 00:41:40 tjserver motion: [1] found control 0x00980901, "Contrast", range 0,255
Jan 29 00:41:40 tjserver motion: [1]    "Contrast", default 32, current 32
Jan 29 00:41:40 tjserver motion: [1] found control 0x00980902, "Saturation", range 0,255
Jan 29 00:41:40 tjserver motion: [1]    "Saturation", default 32, current 32
Jan 29 00:41:40 tjserver motion: [1] found control 0x00980913, "Gain", range 0,255
Jan 29 00:41:40 tjserver motion: [1]    "Gain", default 0, current 127
Jan 29 00:41:40 tjserver motion: [1] found control 0x08000000, "Backlight Compensation", range 0,2
Jan 29 00:41:40 tjserver motion: [1]    "Backlight Compensation", default 1, current 1
Jan 29 00:41:40 tjserver motion: [1] found control 0x08000001, "Power Line Frequency", range 0,2
Jan 29 00:41:40 tjserver motion: [1]    "Power Line Frequency", default 2, current 2
Jan 29 00:42:38 tjserver motion: [1] Failed to reset camera to starting position! Reason: Invalid argument


Update:
I Just installed the new libwebcam that was released yesterday: version 0.1.1

Outputs:

[root@tjserver libwebcam-0.1.1]# uvcdynctrl -c
[libwebcam] Unsupported V4L2 _CID_EXPOSURE_AUTO control with a non-contiguous
range of choice IDs found
[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 134217738, name = 'Exposure, Auto'
Listing available controls for device video0:
Raw bits per pixel
Disable video processing
LED1 Frequency
LED1 Mode
Pan/tilt Reset
Tilt (relative)
Pan (relative)
Exposure, Auto Priority
White Balance Temperature
White Balance Temperature, Auto
Exposure (Absolute)
Sharpness
Power Line Frequency
Backlight Compensation
Gain
Saturation
Contrast
Brightness

[root@tjserver libwebcam-0.1.1]# uvcdynctrl -i /etc/udev/data/046d/logitech.xml
[libwebcam] Unsupported V4L2 _CID_EXPOSURE_AUTO control with a non-contiguous
range of choice IDs found
[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 134217738, name = 'Exposure, Auto'
Importing dynamic controls from file /etc/udev/data/046d/logitech.xml.
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d2250} and selector 5. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d2250} and selector 8. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d221f} and selector 1. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d2256} and selector 3. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d2256} and selector 1. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to add control with GUID {63610682-5070-49ab-b8cc-b3855e8d2256} and selector 2. ioctl(UVCIOC_CTRL_ADD) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Pan (relative)' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Tilt (relative)' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Pan/tilt Reset' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Focus' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'LED1 Mode' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'LED1 Frequency' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Disable video processing' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
/etc/udev/data/046d/logitech.xml: error: video0: unable to map 'Raw bits per pixel' control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 17: File exists)
Does it look like a uvcvideo driver problem? 
 
BTW: just did a full system update (yum update):
Now running on kernel 2.6.22 etc...
With the new libwebcam, uvcdynctrl now works on all capabilities. For example, this does tilt:
[root@tjserver libwebcam-0.1.1]# uvcdynctrl --set="Tilt (relative)" 100
[libwebcam] Unsupported V4L2_CID_EXPOSURE_AUTO control with a non-contiguous
  range of choice IDs found
[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 134217738, name = 'Exposure, Auto'
 
luvcview: still prints; ioctl querycontrol error 22
motion: still logs; Failed to reset camera to starting position! Reason: Invalid argument 

Environment

Motion version: 3.2.9
ffmpeg version: SVN-r9816
Libraries: ffmpeg, mysql, postgresql
Server OS: Fedora Core 6, kernel 2.6.20

-- TjOnline - 29 Jan 2008

Follow up

Well track (pan/tilt) worked fine with motion-3.2.9 and uvc webcams , but maybe driver changed pan/tilt API or controls ... it's hard to work on it without any

webcam of this type :-/

I'll try to add a track debug feature in motion trunk to help on this issue.

-- AngelCarpintero - 30 Jan 2008

Follow up

Thanks you for your quick reply.
I'll wait for the debug feature.

It is weird though; I have full control via uvcdynctrl, but no pan and tilt through luvcview and motion...

-- TjOnline - 30 Jan 2008

I ran into the this link:
http://www.quickcamteam.net/documentation/faq/i-have-a-logitech-quickcam-orbit-sphere-mp-why-dont-the-pan-tilt-buttons-in-luvcview-work

Could my problems with motion be exactly the same? Does this help?

-- TjOnline - 31 Jan 2008


Thanks for the link , that was an old issue that already was fixed in motion . Current problem is the introduction of dynctrl , i've been reading documentation and development is still in progress so API is not stable yet. Lets see if there's a way to introduce a quick patch to workaround.

-- AngelCarpintero - 02 Feb 2008

Follow up: SOLVED

You are totally right about dynctrl;


FINDINGS:

The uvcvideo driver maps all standard controls like brightnes, saturation etc.
Maps for pan, tilt, reset and other specials are mapped by dynctrl based on an xml file; logitech.xml

The latest version of libwebcam, version 0.1.1 (containing libwebcam and uvcdynctrl) comes with logitech.xml version 0.15.
This version of logitech.xml contains some strange keys for the controls:

MOTION uses the CORRECT values:
V4L2 _CID_PAN_RELATIVE = V4L2 _CID_PRIVATE_BASE+7 = 0x08000007
V4L2 _CID_TILT_RELATIVE = V4L2 _CID_PRIVATE_BASE+8 = 0x08000008
V4L2 _CID_PANTILT_RESET = V4L2 _CID_PRIVATE_BASE+9 = 0x08000009

LOGITECH.XML maps these controls WEIRD like this:

In other words, the controls will be at:
V4L2 _CID_PAN_RELATIVE = 0x0A046D01
V4L2 _CID_TILT_RELATIVE = 0x0A046D02
V4L2 _CID_PANTILT_RESET = 0x0A046D03


SYMPTOMS:

With the uvcvideo kernel module set to trace controls (rmmod uvcvideo; modprobe uvcvideo trace=0x004)...

MOTION will generate trace messages like (shown with dmesg):
uvcvideo: Control 0x08000009 not found.

Which is weird because this is the right id for pan/tilt-reset.


SOLUTION:

By changing the control values in logitech.xml like this:
<constant type="integer">
  <id>V4L2_CID_PAN_RELATIVE</id>
  <value>0x08000007</value>
</constant>
<constant type="integer">
  <id>V4L2_CID_TILT_RELATIVE</id>
 <value>0x08000008</value>
</constant>
<constant type="integer">
  <id>V4L2_CID_PANTILT_RESET</id>
  <value>0x08000009</value>
</constant>

Tracking came to life an now works like expected in motion and luvcview.


NOTES:

1. Do note there are more weird values in logitech.xml for "focus", "led1 mode", "led1 frequency", "disable video processing" and "raw bits per pixel".
I left these untouched since I use uvcdynctrl to change them and uvcdynctrl knows where to find them by using the logitech.xml itself (I think).

2. Could the following support question be about the same cause?:
http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x01x05x042506


CONCLUSION:

As could be expected, it was not a problem with MOTION but with dynctrl and it's logitech.xml.

Thanks for your effort and I hope this helps others as well.

-- TjOnline - 03 Feb 2008


Answer

Thanks a lot , you did a great job smile

About notes :

1-. Ok , i don't know much about dynctrl i had not time to take a look yet. Maybe if you have time you can create a new topic in Twiki to explain how it works , i'm sure many users will contribute and many users will find a solution to its problems with uvcvideo.

UvcvideoDynctrl

2-. Absolutely , i've already edit to point answer to this post.

-- AngelCarpintero - 04 Feb 2008

Great work TjOnline

-- KennethLavrsen - 02 Mar 2008
Topic revision: r11 - 11 Aug 2009, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.