1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The DVB device adapters/frontends are now probed by scanning the /dev/dvb directory instead of looping through adapter/frontend numbers

This commit is contained in:
Klaus Schmidinger 2012-02-17 12:38:57 +01:00
parent 6a93cfe0c9
commit f1eecdeb1c
3 changed files with 48 additions and 25 deletions

View File

@ -6847,7 +6847,7 @@ Video Disk Recorder Revision History
- Fixed cRecordings::DelByName() to avoid compilation errors with gcc 4.4
(backport from version 1.7.9, thanks to Ralf Schueler).
2012-02-16: Version 1.7.24
2012-02-17: Version 1.7.24
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed a high load in case a transponder can't be received.
@ -6881,3 +6881,6 @@ Video Disk Recorder Revision History
version of the recording is deleted from the Recordings menu.
- The SVDRP command DELR now won't delete a recording that is currently being edited.
- Removed code stub for obsolete SVDRP command MOVT.
- The DVB device adapters/frontends are now probed by scanning the /dev/dvb directory
instead of looping through adapter/frontend numbers. This allows for "holes" in the
device numbering.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 2.61 2012/02/12 15:45:10 kls Exp $
* $Id: dvbdevice.c 2.62 2012/02/17 12:20:34 kls Exp $
*/
#include "dvbdevice.h"
@ -1048,7 +1048,7 @@ cDvbDevice::~cDvbDevice()
cString cDvbDevice::DvbName(const char *Name, int Adapter, int Frontend)
{
return cString::sprintf("%s%d/%s%d", DEV_DVB_ADAPTER, Adapter, Name, Frontend);
return cString::sprintf("%s/%s%d/%s%d", DEV_DVB_BASE, DEV_DVB_ADAPTER, Adapter, Name, Frontend);
}
int cDvbDevice::DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError)
@ -1096,28 +1096,47 @@ bool cDvbDevice::Initialize(void)
new cDvbSourceParam('C', "DVB-C");
new cDvbSourceParam('S', "DVB-S");
new cDvbSourceParam('T', "DVB-T");
cStringList Nodes;
cReadDir DvbDir(DEV_DVB_BASE);
if (DvbDir.Ok()) {
struct dirent *a;
while ((a = DvbDir.Next()) != NULL) {
if (strstr(a->d_name, DEV_DVB_ADAPTER) == a->d_name) {
int Adapter = strtol(a->d_name + strlen(DEV_DVB_ADAPTER), NULL, 10);
cReadDir AdapterDir(AddDirectory(DEV_DVB_BASE, a->d_name));
if (AdapterDir.Ok()) {
struct dirent *f;
while ((f = AdapterDir.Next()) != NULL) {
if (strstr(f->d_name, DEV_DVB_FRONTEND) == f->d_name) {
int Frontend = strtol(f->d_name + strlen(DEV_DVB_FRONTEND), NULL, 10);
Nodes.Append(strdup(cString::sprintf("%2d %2d", Adapter, Frontend)));
}
}
}
}
}
}
int Checked = 0;
int Found = 0;
for (int Adapter = 0; ; Adapter++) {
for (int Frontend = 0; ; Frontend++) {
if (Exists(Adapter, Frontend)) {
if (Checked++ < MAXDVBDEVICES) {
if (UseDevice(NextCardIndex())) {
if (Probe(Adapter, Frontend))
Found++;
}
else
NextCardIndex(1); // skips this one
}
}
else if (Frontend == 0)
goto LastAdapter;
else
goto NextAdapter;
}
NextAdapter: ;
}
LastAdapter:
if (Nodes.Size() > 0) {
Nodes.Sort();
for (int i = 0; i < Nodes.Size(); i++) {
int Adapter;
int Frontend;
if (2 == sscanf(Nodes[i], "%d %d", &Adapter, &Frontend)) {
if (Exists(Adapter, Frontend)) {
if (Checked++ < MAXDVBDEVICES) {
if (UseDevice(NextCardIndex())) {
if (Probe(Adapter, Frontend))
Found++;
}
else
NextCardIndex(1); // skips this one
}
}
}
}
}
NextCardIndex(MAXDVBDEVICES - Checked); // skips the rest
if (Found > 0)
isyslog("found %d DVB device%s", Found, Found > 1 ? "s" : "");

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 2.22 2012/01/16 12:51:39 kls Exp $
* $Id: dvbdevice.h 2.23 2012/02/17 11:18:55 kls Exp $
*/
#ifndef __DVBDEVICE_H
@ -22,7 +22,8 @@
#define MAXDELIVERYSYSTEMS 8
#define DEV_VIDEO "/dev/video"
#define DEV_DVB_ADAPTER "/dev/dvb/adapter"
#define DEV_DVB_BASE "/dev/dvb"
#define DEV_DVB_ADAPTER "adapter"
#define DEV_DVB_OSD "osd"
#define DEV_DVB_FRONTEND "frontend"
#define DEV_DVB_DVR "dvr"