summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-02-17 12:38:57 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-02-17 12:38:57 +0100
commitf1eecdeb1c10e51a85a33ed41aacd34a9e2353f0 (patch)
treeaaca4e2d7347b4a1a80c651d9163f393f0670027
parent6a93cfe0c9c71a8f12fa667fda063a74504ee0e3 (diff)
downloadvdr-f1eecdeb1c10e51a85a33ed41aacd34a9e2353f0.tar.gz
vdr-f1eecdeb1c10e51a85a33ed41aacd34a9e2353f0.tar.bz2
The DVB device adapters/frontends are now probed by scanning the /dev/dvb directory instead of looping through adapter/frontend numbers
-rw-r--r--HISTORY5
-rw-r--r--dvbdevice.c63
-rw-r--r--dvbdevice.h5
3 files changed, 48 insertions, 25 deletions
diff --git a/HISTORY b/HISTORY
index d5afee7a..6f818079 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/dvbdevice.c b/dvbdevice.c
index ca522e8b..c2503ed0 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -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" : "");
diff --git a/dvbdevice.h b/dvbdevice.h
index b8e0e2df..e072bb3f 100644
--- a/dvbdevice.h
+++ b/dvbdevice.h
@@ -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"