Logitech Orbit/Sphere Tilt/Pan ioctl() probs

Getting your soundcard to work, using Debian on non-i386 hardware, etc

Logitech Orbit/Sphere Tilt/Pan ioctl() probs

Postby sthomas » 2012-03-19 03:55

Hello,

I have a Logitech Orbit/Sphere web cam (ID 046d:0994) I'm trying to tilt/pan via ioctl()s without any luck. I can capture images (via OpenCV 1.1) and get device info (via ioctrl()), but not tilt/pan. I must be missing something and hope someone can help! In the code at the end of this post, the ioctrl() fails with a invalid command (errno=22). What am I doing wrong or missing?

Thanks for your help in advance.

-Steve

Here are the details:

The system is a debian Lenny (5.0) running on a Embedded Arm TS-7800 board with a 2.6.34 kernel. Here is the uname -a output:
    Linux ts7800 2.6.34 #7 PREEMPT Sun Mar 18 20:05:22 CDT 2012 armv5tel GNU/Linux.

The webcam is attached to the system (here is the usbls output):
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 046d:0994 Logitech, Inc. QuickCam Orbit/Sphere AF
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

And I believe I have all the modules loaded (here is the lsmod output):
Code: Select all
Module                  Size  Used by
uvcvideo               55899  0
pwc                    89138  0
sd_mod                 25400  6
sata_mv                27559  5
libata                163445  1 sata_mv
plat_nand               2161  0
tsuart7800              1612  0
tsuart1                12996  1 tsuart7800
ehci_hcd               39169  0
tssdcard               33251  3
usbcore               142601  4 uvcvideo,pwc,ehci_hcd
ts7800                  2637  0


And the system finds it when it is plugged in (here is the tail of the dmesg):
    usb 1-1: new high speed USB device using orion-ehci and address 2
    uvcvideo: Found UVC 1.00 device <unnamed> (046d:0994)
    input: UVC Camera (046d:0994) as /class/input/input1

Here is the sample code:
Code: Select all
#include <stdio.h>
#include <fcntl.h>

#include <errno.h>
#include "uvcvideo.h"

#include "/usr/include/include/linux/videodev.h"

//#include "pwc-ioctl.h"

#ifndef V4L2_CID_PANTILT_RESET
#define V4L2_CID_PANTILT_RESET (V4L2_CID_PRIVATE_BASE+9)
#endif


int main( void )
{
  int VideoDev = -1;
  struct v4l2_ext_control ExtCtl[3];
  struct v4l2_ext_controls Ctls;
  int tRetVal;


  //VideoDev = open( "/dev/video0", O_RDONLY );
  VideoDev = open( "/dev/video0", O_RDWR );
  if( VideoDev < 0 )
  {
    fprintf( stderr, "Failed to open /dev/video0\n" );
  }
  else
  {

    //ExtCtl[0].id = V4L2_CID_PANTILT_RESET;
    //ExtCtl[0].value = 3;
    ExtCtl[0].id = V4L2_CID_PAN_RELATIVE;
    ExtCtl[0].value = 20;
    Ctls.count = 1;
    Ctls.controls = ExtCtl;

    tRetVal = ioctl( VideoDev, VIDIOC_S_EXT_CTRLS, &Ctls );
    if( tRetVal < 0 )
    {
      // ioctl() failed
      fprintf( stderr, "IOCTLs failed: %d\n", errno );
      fprintf( stderr, "IOCTLs failed: %s\n", strerror(errno) );
    }

    (void)close( VideoDev );
  }
}


And finally, a sample typescript:
    swt@ts7800:~/work/TEST/TiltPan$ make
    gcc -c TiltPan.c
    gcc -o TiltPan TiltPan.o
    swt@ts7800:~/work/TEST/TiltPan$ su root
    Password:
    ts7800:/mnt/home/swt/work/TEST/TiltPan# ./TiltPan
    IOCTLs failed: 22
    IOCTLs failed: Invalid argument
sthomas
 
Posts: 1
Joined: 2012-03-19 03:11

Re: Logitech Orbit/Sphere Tilt/Pan ioctl() probs

Postby minimec » 2012-03-26 15:23

Hi

I do own one of these.

I guess you know that you need the following packages to squeeze all out of these webcams.

libwebcam0
uvcdynctrl
guvcview (or luvcview) // 'guvcview -o' gives you a GUI interface for interaction with a running Cam (on Skype for example)


After that do the following command as 'root' once. The Pan/Tilt mappings should now be available for guvcview (luvcview).
Code: Select all
uvcdynctrl --import=/usr/share/uvcdynctrl/data/046d/logitech.xml


There is a interesting website, talking about our cam in combination with a vacuum cleaner. :)

german original: http://roombactrl.dyndns.org/wiki/index ... Cam_Sphere
english translation: http://translate.google.com/translate?s ... Cam_Sphere

It states:

For the pan and tilt function, the appropriate IOCTL mappings are performed. One start of guvcview as root causes of this rather quickly. The automation of these mappings can be done by extracting the function init_dynctrl (int fd) from guvcview. Could be but not yet due to many missing dependencies.


Hope this helps...
minimec
 
Posts: 1
Joined: 2012-03-26 14:48


Return to Hardware

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable