mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Trying harder to find a primary device
This commit is contained in:
		
							
								
								
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -1975,3 +1975,8 @@ Video Disk Recorder Revision History | ||||
|  | ||||
| - Removed signal handling and usleep(5000) from cDvbOsd::Cmd() (apparently this | ||||
|   is no longer necessary with DVB driver 1.0.0pre2 or later). | ||||
| - If the primary device (as defined in setup.conf) doesn't have an MPEG decoder | ||||
|   (and thus can't be used as a primary device) VDR now scans all devices at | ||||
|   startup and uses the first one (if any) that actually has an MPEG decoder. | ||||
|   That way this will also work automatically if the primary device is implemented | ||||
|   by a plugin. | ||||
|   | ||||
							
								
								
									
										9
									
								
								device.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								device.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: device.c 1.36 2003/01/03 15:41:14 kls Exp $ | ||||
|  * $Id: device.c 1.37 2003/03/09 14:05:23 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "device.h" | ||||
| @@ -106,6 +106,7 @@ bool cDevice::SetPrimaryDevice(int n) | ||||
| { | ||||
|   n--; | ||||
|   if (0 <= n && n < numDevices && device[n]) { | ||||
|      if (device[n]->HasDecoder()) { | ||||
|         isyslog("setting primary device to %d", n + 1); | ||||
|         if (primaryDevice) | ||||
|            primaryDevice->MakePrimaryDevice(false); | ||||
| @@ -113,7 +114,11 @@ bool cDevice::SetPrimaryDevice(int n) | ||||
|         primaryDevice->MakePrimaryDevice(true); | ||||
|         return true; | ||||
|         } | ||||
|   esyslog("invalid primary device number: %d", n + 1); | ||||
|      else | ||||
|         esyslog("ERROR: device number %d has no MPEG decoder", n + 1); | ||||
|      } | ||||
|   else | ||||
|      esyslog("ERROR: invalid primary device number: %d", n + 1); | ||||
|   return false; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										12
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								vdr.c
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ | ||||
|  * | ||||
|  * The project's page is at http://www.cadsoft.de/people/kls/vdr | ||||
|  * | ||||
|  * $Id: vdr.c 1.145 2003/02/16 10:34:24 kls Exp $ | ||||
|  * $Id: vdr.c 1.146 2003/03/09 14:07:46 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <getopt.h> | ||||
| @@ -364,6 +364,16 @@ int main(int argc, char *argv[]) | ||||
|   // Primary device: | ||||
|  | ||||
|   cDevice::SetPrimaryDevice(Setup.PrimaryDVB); | ||||
|   if (!cDevice::PrimaryDevice()) { | ||||
|      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)) | ||||
|                Setup.PrimaryDVB = i + 1; | ||||
|             } | ||||
|          } | ||||
|      } | ||||
|   if (!cDevice::PrimaryDevice()) { | ||||
|      const char *msg = "no primary device found - giving up!"; | ||||
|      fprintf(stderr, "vdr: %s\n", msg); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user