Some v4l devices have non-video-source interfaces such as radio devices, 
videotext and tv tuners.  These are all reported by hal as video4linux 
devices.  The attached patch filters out all but the video sources, please 
review.

-- 
Will Stephenson
IRC: Bille
Index: solid/solid/backends/hal/halmanager.cpp
===================================================================
--- solid/solid/backends/hal/halmanager.cpp	(revision 737987)
+++ solid/solid/backends/hal/halmanager.cpp	(working copy)
@@ -178,8 +178,31 @@
             qWarning() << Q_FUNC_INFO << " error: " << reply.error().name() << endl;
             return QStringList();
         }
-
-        result << reply;
+        if ( cap == QLatin1String( "video4linux" ) )
+        {
+            QStringList foundDevices ( reply );
+            QStringList filtered;
+            foreach ( QString udi, foundDevices )
+            {
+                QDBusInterface device( "org.freedesktop.Hal", udi, "org.freedesktop.Hal.Device", QDBusConnection::systemBus() );
+                QDBusReply<QString> reply = device.call( "GetProperty", "video4linux.device" );
+                if (!reply.isValid())
+                {
+                    qWarning() << Q_FUNC_INFO << " error getting video4linux.device: " << reply.error().name() << endl;
+                    continue;
+                }
+                if ( !reply.value().contains( "video" ) )
+                {
+                    continue;
+                }
+                filtered.append( udi );
+            }
+            result += filtered;
+        }
+        else
+        {
+            result << reply;
+        }
     }
 
     return result;
_______________________________________________
Kde-hardware-devel mailing list
Kde-hardware-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-hardware-devel

Reply via email to