diff options
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()) |