diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-06-27 15:38:58 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-06-30 11:03:39 +0300 |
commit | de786a075b31b4988341a625ef85c081530e2a7d (patch) | |
tree | ec8d645580223e95a70eae0b0c7d4706ea61609c /kopete/libkopete/avdevice/videodevicepool.cpp | |
parent | e7fdaa7a61e79a1c14d72da2b02cdcfee1956579 (diff) | |
download | tdenetwork-de786a075b31b4988341a625ef85c081530e2a7d.tar.gz tdenetwork-de786a075b31b4988341a625ef85c081530e2a7d.zip |
Fixes for Kopete videodevice support
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kopete/libkopete/avdevice/videodevicepool.cpp')
-rw-r--r-- | kopete/libkopete/avdevice/videodevicepool.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/kopete/libkopete/avdevice/videodevicepool.cpp b/kopete/libkopete/avdevice/videodevicepool.cpp index 7396d5a0..ffb9b770 100644 --- a/kopete/libkopete/avdevice/videodevicepool.cpp +++ b/kopete/libkopete/avdevice/videodevicepool.cpp @@ -608,8 +608,10 @@ int VideoDevicePool::scanDevices() kdDebug(14010) << k_funcinfo << "called" << endl; #if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV) TQDir videodevice_dir; - const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/v4l/"); - const TQString videodevice_dir_filter=TQString::fromLocal8Bit("video*"); + + // Check *video* symlinks in /dev/v4l/by-id + const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/v4l/by-id/"); + const TQString videodevice_dir_filter=TQString::fromLocal8Bit("*video*"); VideoDevice videodevice; m_videodevice.clear(); @@ -617,7 +619,7 @@ int VideoDevicePool::scanDevices() videodevice_dir.setPath(videodevice_dir_path); videodevice_dir.setNameFilter(videodevice_dir_filter); - videodevice_dir.setFilter( TQDir::System | TQDir::NoSymLinks | TQDir::Readable | TQDir::Writable ); + videodevice_dir.setFilter( TQDir::System | TQDir::Readable | TQDir::Writable ); videodevice_dir.setSorting( TQDir::Name ); kdDebug(14010) << k_funcinfo << "Looking for devices in " << videodevice_dir_path << endl; @@ -627,6 +629,8 @@ int VideoDevicePool::scanDevices() { kdDebug(14010) << k_funcinfo << "Found no suitable devices in " << videodevice_dir_path << endl; TQDir videodevice_dir; + + // Alternatively, check all block devices starting with 'video' in /dev const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/"); const TQString videodevice_dir_filter=TQString::fromLocal8Bit("video*"); VideoDevice videodevice; @@ -679,7 +683,12 @@ int VideoDevicePool::scanDevices() kdDebug(14010) << k_funcinfo << "scanning devices in " << videodevice_dir_path << "..." << endl; while ( (fileinfo = fileiterator.current()) != 0 ) { - videodevice.setFileName(fileinfo->absFilePath()); + if( fileinfo->isSymLink() ) { + TQFileInfo realfileinfo(videodevice_dir_path + fileinfo->readLink()); + videodevice.setFileName(realfileinfo.absFilePath()); + } else { + videodevice.setFileName(fileinfo->absFilePath()); + } kdDebug(14010) << k_funcinfo << "Found device " << videodevice.full_filename << endl; videodevice.open(); // It should be opened with O_NONBLOCK (it's a FIFO) but I dunno how to do it using TQFile if(videodevice.isOpen()) |