From da25f596344b30020862f0d32e5ae2d78efabfc5 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 22 Oct 2013 19:26:24 -0500
Subject: LinHES-config:  autocard.py increase default timeout for discovering
 infinitv to 15 seconds Added some extra try/except to autocard to avoid
 abnormal aborting.

---
 abs/core/LinHES-config/PKGBUILD             |  6 ++--
 abs/core/LinHES-config/autocard.py          | 44 ++++++++++++++++-------------
 abs/core/LinHES-config/discover_infinitv.py |  2 +-
 3 files changed, 29 insertions(+), 23 deletions(-)
 mode change 100644 => 100755 abs/core/LinHES-config/autocard.py

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index d4983bb..b748d65 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=8.0
-pkgrel=11
+pkgrel=12
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -152,7 +152,7 @@ md5sums=('c832059cd635359d39a2ac3166ff463c'
          'ab2aa42c2947148c2b1cac0ade6d1d55'
          'd429b59d3cfb37b0624c6a4a71a7c2c0'
          'f6a935c35123fdc7c259c01cbc794a64'
-         '5e865cc04fe5de8a39d9c1e377fc4ebe'
+         'b3ce302473883ca118d4a58f1b1306e2'
          'd3490e93f313bbbcbc6c3693c56b9c17'
          'e959df98947eb0d2ea64ff616b61aab5'
          '2506860a416e1988934225d80d501c2c'
@@ -181,4 +181,4 @@ md5sums=('c832059cd635359d39a2ac3166ff463c'
          'c9279fa095af624ee3d9bc75d3328360'
          '02cf69074d2bbacef05fa3e451af9af3'
          '85d15efc55074a94c58d44542ea1dd13'
-         'e410d108ed4778dd898dc68fad4e8828')
+         '062d191eb9717a40c7bbc2d6c194db4a')
diff --git a/abs/core/LinHES-config/autocard.py b/abs/core/LinHES-config/autocard.py
old mode 100644
new mode 100755
index c461714..19563a4
--- a/abs/core/LinHES-config/autocard.py
+++ b/abs/core/LinHES-config/autocard.py
@@ -766,20 +766,21 @@ def gather_ceton(tuner_list):
         command="/usr/MythVantage/bin/discover_infinitv.py %s" %iface
         results=os.popen(command,'r')
         lines=results.readlines()
-        #try:
-        if lines[0].strip().split()[0] == "no":
-            print "Ceton not detected"
-        else:
-            for line in lines:
-                #Found InfiniTV. Location URL: http://192.168.200.1/description.xml
-                #cetondevice = line.strip().split()[0]
-                cetonip = line.strip().split("/")[2]
-
-                tuners = [0,1,2,3]
-                for t in tuners:
-                    tuner_list.append(infinitv_tuner(t,cetonip))
-        #except:
-        #    print "Error finding Ceton InfinitTV"
+        try:
+            print lines
+            if lines[0].strip().split()[0].lower() == "no":
+                print "Ceton not detected on %s" %iface
+            else:
+                for line in lines:
+                    #Found InfiniTV. Location URL: http://192.168.200.1/description.xml
+                    #cetondevice = line.strip().split()[0]
+                    cetonip = line.strip().split("/")[2]
+
+                    tuners = [0,1,2,3]
+                    for t in tuners:
+                        tuner_list.append(infinitv_tuner(t,cetonip))
+        except:
+            print "Error finding Ceton InfinitTV on %s" %iface
 
     return tuner_list
 
@@ -816,11 +817,16 @@ def find_ceton_network_list():
     for i in netinterfaces:
         if i.startswith("ctn") or i.startswith("usb"):
             #configure and start ctn network
-            config_ctn_network(i)
-
-            #read ip
-            ctnip.append(netifaces.ifaddresses(i)
-                        [netifaces.AF_INET][0]['addr'])
+            try:
+                config_ctn_network(i)
+
+                #read ip
+                ctnip.append(netifaces.ifaddresses(i)
+                            [netifaces.AF_INET][0]['addr'])
+            except:
+                print "    * Error scanning network interface %s" %i
+                print "    * Please check that the interface is ready and configured"
+                
     return ctnip
 
 #--end of linhes specific
diff --git a/abs/core/LinHES-config/discover_infinitv.py b/abs/core/LinHES-config/discover_infinitv.py
index 5c39c59..421ba84 100755
--- a/abs/core/LinHES-config/discover_infinitv.py
+++ b/abs/core/LinHES-config/discover_infinitv.py
@@ -74,7 +74,7 @@ if __name__ == "__main__":
     try:
         timeout = float(sys.argv[2])
     except:
-        timeout=5
+        timeout=15
     L = find_the_infiniTV(interface_ip=interface_ip)
     thread.start_new_thread(L.listen, ())
     time.sleep(timeout)
-- 
cgit v0.12

