[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: Re: [kopete-devel] Webcam doesnt work
From: Jaroslav Reznik <jreznik () redhat ! com>
Date: 2009-03-20 15:50:41
Message-ID: 200903201650.42013.jreznik () redhat ! com
[Download RAW message or body]
On Sunday 15 March 2009 12:29:21 Pali Rohár wrote:
> Hello,
> with new v4l webcam patch my webcam doesnt work. I use ov51x-jpeg
> driver. Before commited new patch my webcam works fine.
>
> output from kopete:
> kopete(8300) AVDeviceConfig::AVDeviceConfig: kopete:config (avdevice):
> KopeteAVDeviceConfigFactory::componentData() called.
> kopete(8300) Kopete::AV::VideoInput::VideoInput: Executing Video Input's
> constructor!!!
> kopete(8300) Kopete::AV::VideoDevicePool::open: open(): No devices
> found. Must scan for available devices. 0
> kopete(8300) Kopete::AV::VideoDevicePool::scanDevices: called
> kopete(8300) Kopete::AV::VideoDevicePool::registerDevice: New video
> device at
> "/org/freedesktop/Hal/devices/usb_device_41e_4068_noserial_video4linux"
> kopete(8300) Kopete::AV::VideoDevicePool::registerDevice: vendor:
> "Creative Technology, Ltd" , product: "WebCam Live! Notebook"
> kopete(8300) Kopete::AV::VideoDevicePool::registerDevice: V4L device
> path is "/dev/video0"
> kopete(8300) Kopete::AV::VideoDevicePool::registerDevice: Found device
> "/dev/video0"
> kopete(8300) Kopete::AV::VideoDevice::open: called
> libv4l2: error getting capabilities: Invalid argument
> kopete(8300) Kopete::AV::VideoDevice::open: Unable to open file
> "/dev/video0" Err: 22
> kopete(8300) Kopete::AV::VideoDevicePool::scanDevices: exited successfuly
> kopete(8300) Kopete::AV::VideoDevicePool::open: open(): No devices
> found. bailing out. 0
> kopete(8300) Kopete::AV::VideoDevicePool::setSize:
> VideoDevicePool::setSize() fallback for no device.
> kopete(8300) Kopete::AV::VideoDevicePool::setSize:
> VideoDevicePool::setSize() buffer size: 230400
> kopete(8300) Kopete::AV::VideoDevicePool::fillDeviceKComboBox: Called.
> kopete(8300) Kopete::AV::VideoDevicePool::fillDeviceKComboBox: Combobox
> cleaned.
> kopete(8300) Kopete::AV::VideoDevicePool::fillInputKComboBox: Called.
> kopete(8300) Kopete::AV::VideoDevicePool::fillStandardKComboBox: Called.
> kopete(8300) Kopete::AV::VideoDevicePool::startCapturing:
> startCapturing() called.
>
> lsusb:
> Bus 001 Device 004: ID 041e:4068 Creative Technology, Ltd WebCam Live!
> Notebook
Hi Pali,
could you try this quick patch (in attachment)? I'm trying to use fallback
system open when v4l2_open fails. It doesn't look nice but...
Jaroslav
["kopete-v4l1.patch" (text/x-patch)]
Index: videodevice.cpp
===================================================================
--- videodevice.cpp (revision 941694)
+++ videodevice.cpp (working copy)
@@ -41,6 +41,9 @@
descriptor = -1;
m_streambuffers = 0;
m_current_input = 0;
+#ifdef HAVE_LIBV4L2
+ m_libv4lfallback = false;
+#endif
// kDebug() << "libkopete (avdevice): VideoDevice() exited successfuly";
}
@@ -148,12 +151,23 @@
int r;
#ifdef HAVE_LIBV4L2
- do r = v4l2_ioctl (descriptor, request, arg);
+ if(!m_libv4lfallback)
+ {
+ do r = v4l2_ioctl (descriptor, request, arg);
+ while (-1 == r && EINTR == errno);
+ return r;
+ }
+ else
+ {
+ do r = ioctl (descriptor, request, arg);
+ while (-1 == r && EINTR == errno);
+ return r;
+ }
#else
do r = ioctl (descriptor, request, arg);
-#endif
while (-1 == r && EINTR == errno);
return r;
+#endif
}
/*!
@@ -191,6 +205,19 @@
}
#ifdef HAVE_LIBV4L2
descriptor = ::v4l2_open (QFile::encodeName(full_filename), O_RDWR, 0);
+ if(!isOpen())
+ {
+ // v4l2_open fails while trying to open v4l1 device so we have to use
+ // system open call
+ if(errno==EINVAL)
+ {
+ kDebug() << "V4L2 fallback to standard system open call";
+ descriptor = ::open (QFile::encodeName(full_filename), O_RDWR, 0);
+ m_libv4lfallback = true;
+ }
+ }
+ else
+ m_libv4lfallback = false;
#else
descriptor = ::open (QFile::encodeName(full_filename), O_RDWR, 0);
#endif
@@ -853,7 +880,11 @@
#if defined(__linux__) && defined(ENABLE_AV)
#ifdef V4L2_CAP_VIDEO_CAPTURE
case VIDEODEV_DRIVER_V4L2:
+#ifdef HAVE_LIBV4L2
+ if (-1 == v4l2_ioctl (descriptor, VIDIOC_S_INPUT, &newinput))
+#else
if (-1 == ioctl (descriptor, VIDIOC_S_INPUT, &newinput))
+#endif
{
perror ("VIDIOC_S_INPUT");
return EXIT_FAILURE;
@@ -997,7 +1028,10 @@
return EXIT_FAILURE;
#ifdef HAVE_LIBV4L2
- bytesread = v4l2_read (descriptor, &m_currentbuffer.data[0], m_currentbuffer.data.size());
+ if(!m_libv4lfallback)
+ bytesread = v4l2_read (descriptor, &m_currentbuffer.data[0], m_currentbuffer.data.size());
+ else
+ bytesread = read (descriptor, &m_currentbuffer.data[0], m_currentbuffer.data.size());
#else
bytesread = read (descriptor, &m_currentbuffer.data[0], m_currentbuffer.data.size());
#endif
Index: videodevice.h
===================================================================
--- videodevice.h (revision 941694)
+++ videodevice.h (working copy)
@@ -331,6 +331,9 @@
bool m_videoread;
bool m_videoasyncio;
bool m_videostream;
+#ifdef HAVE_LIBV4L2
+ bool m_libv4lfallback;
+#endif
int xioctl(int request, void *arg);
int errnoReturn(const char* s);
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic