]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
hdhomerun: autodetect ATSC network type
authorLauri Myllari <lauri.myllari@gmail.com>
Sun, 18 Jan 2015 20:36:42 +0000 (12:36 -0800)
committerJaroslav Kysela <perex@perex.cz>
Fri, 23 Jan 2015 17:19:19 +0000 (18:19 +0100)
src/input/mpegts/tvhdhomerun/tvhdhomerun.c

index 4162f8432bc748c15feefc12e5d3959f1c48b1f5..9eb24181575d4b055755dd25e927663bb3887709 100644 (file)
@@ -263,6 +263,15 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo)
 
   tvhdhomerun_device_calc_uuid(&uuid, dInfo->device_id);
 
+  hdhomerun_tuner = hdhomerun_device_create(dInfo->device_id, dInfo->ip_addr, 0, NULL);
+  {
+    const char *deviceModel =  hdhomerun_device_get_model_str(hdhomerun_tuner);
+    if(deviceModel != NULL) {
+      hd->hd_info.deviceModel = strdup(deviceModel);
+    }
+    hdhomerun_device_destroy(hdhomerun_tuner);
+  }
+
   conf = hts_settings_load("input/tvhdhomerun/adapters/%s", uuid.hex);
 
   if ( conf != NULL ) {
@@ -273,6 +282,9 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo)
         type = DVB_TYPE_C;
       }
     }
+  } else {
+    if (strstr(hd->hd_info.deviceModel, "_atsc"))
+      type = DVB_TYPE_ATSC;
   }
 
   hd->hd_override_type = strdup(dvb_type2str(type));
@@ -283,15 +295,6 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo)
   hd->hd_pids_len    = 127;
   hd->hd_pids_max    = 32;
   hd->hd_pids_deladd = 1;
-  
-  hdhomerun_tuner = hdhomerun_device_create(dInfo->device_id, dInfo->ip_addr, 0, NULL);
-  {
-    const char *deviceModel =  hdhomerun_device_get_model_str(hdhomerun_tuner);
-    if(deviceModel != NULL) {
-      hd->hd_info.deviceModel = strdup(deviceModel);
-    }
-    hdhomerun_device_destroy(hdhomerun_tuner);
-  }
 
   if (!tvh_hardware_create0((tvh_hardware_t*)hd, &tvhdhomerun_device_class,
                             uuid.hex, conf)) {