summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-04-12 12:20:07 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2003-04-12 12:20:07 +0200
commit00166dac5fce46cb15ec558f176d45f734f815e9 (patch)
tree7b344099f2fab0dc81792e9ce62bc15c7d3e178a /vdr.c
parentf8a7e51d00d66f2fd71c9f5966a893c59485584b (diff)
downloadvdr-00166dac5fce46cb15ec558f176d45f734f815e9.tar.gz
vdr-00166dac5fce46cb15ec558f176d45f734f815e9.tar.bz2
If no device with an MPEG decoder can be found at startup, the first device is now used as primary device
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/vdr.c b/vdr.c
index 86becfe0..f05ecfa0 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.147 2003/03/30 10:43:58 kls Exp $
+ * $Id: vdr.c 1.148 2003/04/12 12:17:32 kls Exp $
*/
#include <getopt.h>
@@ -364,21 +364,32 @@ int main(int argc, char *argv[])
// Primary device:
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
- if (!cDevice::PrimaryDevice()) {
+ if (!cDevice::PrimaryDevice() || !cDevice::PrimaryDevice()->HasDecoder()) {
+ if (cDevice::PrimaryDevice() && !cDevice::PrimaryDevice()->HasDecoder())
+ isyslog("device %d has no MPEG decoder", cDevice::PrimaryDevice()->DeviceNumber() + 1);
for (int i = 0; i < cDevice::NumDevices(); i++) {
cDevice *d = cDevice::GetDevice(i);
if (d && d->HasDecoder()) {
isyslog("trying device number %d instead", i + 1);
- if (cDevice::SetPrimaryDevice(i + 1))
+ if (cDevice::SetPrimaryDevice(i + 1)) {
Setup.PrimaryDVB = i + 1;
+ break;
+ }
}
}
- }
- if (!cDevice::PrimaryDevice()) {
- const char *msg = "no primary device found - giving up!";
- fprintf(stderr, "vdr: %s\n", msg);
- esyslog("ERROR: %s", msg);
- return 2;
+ if (!cDevice::PrimaryDevice()) {
+ const char *msg = "no primary device found - using first device!";
+ fprintf(stderr, "vdr: %s\n", msg);
+ esyslog("ERROR: %s", msg);
+ if (!cDevice::SetPrimaryDevice(0))
+ return 2;
+ if (!cDevice::PrimaryDevice()) {
+ const char *msg = "no primary device found - giving up!";
+ fprintf(stderr, "vdr: %s\n", msg);
+ esyslog("ERROR: %s", msg);
+ return 2;
+ }
+ }
}
// OSD: