From kde-commits Mon Aug 03 18:48:53 2009 From: George Kiagiadakis Date: Mon, 03 Aug 2009 18:48:53 +0000 To: kde-commits Subject: KDE/kdelibs/solid/solid/backends/hal Message-Id: <1249325333.681982.10191.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124932539202368 SVN commit 1006441 by gkiagia: Distinguish between v4l1 and v4l2 devices. Patch reviewed on reviewboard. This patch allows applications using solid for video device detection to distinguish between video4linux1 and video4linux2 devices. This is useful to know because v4l1 and v4l2 use different API, so the application needs to know which API to use to communicate with the device. This is accomplished by returning "video4linux" for v4l1 devices and "video4linux2" for v4l2 devices as a supported driver for the "video4linux" protocol. The actual information is retrieved from HAL, using the "video4linux.version" device property field. M +8 -3 halvideo.cpp --- trunk/KDE/kdelibs/solid/solid/backends/hal/halvideo.cpp #1006440:1006441 @@ -42,15 +42,20 @@ QStringList Video::supportedDrivers(QString protocol) const { - // if there is a difference between v4l and v4l2 QStringList drivers; - drivers << QString( "video4linux" ); + if ( protocol == "video4linux" ) { + if ( m_device->property("video4linux.version") == "2" ) { + drivers << QString( "video4linux2" ); + } else { + drivers << QString( "video4linux" ); + } + } return drivers; } QVariant Solid::Backends::Hal::Video::driverHandle(const QString &driver) const { - if (driver=="video4linux") { + if ( driver=="video4linux" || driver=="video4linux2" ) { return m_device->property("video4linux.device"); } // TODO: Fill in the blank for other drivers