UVCVideo - Webcam not stopping after opening and closing the device file /dev/video0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


Sorry for interrupting.

I have a (174f:5a35) Syntek Sonix 1.3MPixel USB 2.0 Camera (Most
probably based on ov9655  chipset/sensor) on a Asus laptop (G1Sn).
The device is working fine when required.
But unfortunately, it automatically gets started (green light
indicator goes on) after each page refresh in web browsers having some
flash content.

As per my understanding,

1) The flash player tries to check for webcam existence. It opens
/dev/video0 device file and after doing it's probing it closes the
device.
  Opening the device switched it on and green light stays on.
2) Unfortunately the device is kept awake even after the flash player
closes the device handle.

Trace returns following output during this:
[116432.340419] uvcvideo: uvc_v4l2_open
[116432.388332] uvcvideo: Resuming interface 0
[116432.388338] uvcvideo: Resuming interface 1
[116432.723761] uvcvideo: uvc_v4l2_ioctl(VIDIOC_QUERYCAP)
[116432.723780] uvcvideo: uvc_v4l2_release
[116433.589880] uvcvideo: uvc_v4l2_open
[116433.589916] uvcvideo: uvc_v4l2_ioctl(VIDIOC_QUERYCAP)
[116433.589934] uvcvideo: uvc_v4l2_release
[116435.804067] uvcvideo: Suspending interface 1
[116435.804073] uvcvideo: Suspending interface 0

lsusb output:
Bus 001 Device 002: ID 174f:5a35 Syntek Sonix 1.3MPixel USB 2.0 Camera


So,I wrote a test program using v4l2,
What I did is, I opened the device (it switches on the usb cam) and I
never asked for starting the streaming.
Then, unless I did this before closing the device handle it'll keep
the device on :

    type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    xioctl(fd, VIDIOC_STREAMOFF, &type);




So the following code will switch on the device and keep it going
forever: (unless I do the above)
void test()
{
     char     *dev_name = "/dev/video0";
     int fd;
     enum v4l2_buf_type              type;


     fd = v4l2_open(dev_name,  O_RDWR | O_NONBLOCK , 0);
                        //switches on the device
     if (fd < 0) {
          perror("Cannot open device /dev/video0 : ");
          exit(EXIT_FAILURE);
     }

    //IMP: Only way to stop this behavior is to uncomment the following..
    // type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    // xioctl(fd, VIDIOC_STREAMOFF, &type);              //only way to

       switch it off

     v4l2_close(fd);      //never stops the device
}






My question is, is it the proper behavior? IMHO, It is switching on
the webcam unnecessarily,

What I can do to stop this ? Currently I had to write a daemon to do
this manually after 10-15 minutes.



[Kernel: Linux aniruddha-G1Sn 3.2.0-23-generic #36-Ubuntu SMP Tue Apr
10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Linux Mint13]


Thanking you,
Aniruddha Bhattacharyya
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux