[PATCH] qcap: fix recent regression that limited Wine's v4l2 support to devices that read()

Damjan Jovanovic damjan.jov at gmail.com
Sat Apr 20 08:15:06 CDT 2019


Recent changes to qcap/v4l.c resulted in the removal of mmap()
for v4l2 devices, but read() is optional for device drivers and
some don't support it. This isn't a major problem with the
presense of libv4l2 though, as it can emulate read() on top of
mmap(). However the code checks whether the device can read(),
and if not, doesn't even try to use it, even though it can.

Fix this by only warning that read() is being emulated, and
continuing with libv4l2 if available.

Also clarifies the logging.

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/qcap/v4l.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
-------------- next part --------------
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index 32c2c02512..57ea09fe37 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -585,14 +585,17 @@ Capture * qcap_driver_init( IPin *pOut, USHORT card )
 
     if (!(caps.capabilities & V4L2_CAP_READWRITE))
     {
-        WARN("Device does not support read().\n");
-        if (!have_libv4l2)
+        if (have_libv4l2)
+            WARN("Device %s doesn't natively support read(), emulating it with libv4l2.\n", path);
+        else
+        {
 #ifdef SONAME_LIBV4L2
-            ERR_(winediag)("Reading from %s requires libv4l2, but it could not be loaded.\n", path);
+            ERR_(winediag)("Device %s doesn't natively support read(), and emulation requires libv4l2, but it could not be loaded.\n", path);
 #else
-            ERR_(winediag)("Reading from %s requires libv4l2, but Wine was compiled without libv4l2 support.\n", path);
+            ERR_(winediag)("Device %s doesn't natively support read(), and emulation requires libv4l2, but Wine was compiled without libv4l2 support.\n", path);
 #endif
-        goto error;
+            goto error;
+        }
     }
 
     format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;


More information about the wine-devel mailing list