From aa09e0ff9b2d0ed05a4bd0ebe9bf3581b581327d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 19 Nov 2012 17:31:04 -0600
Subject: LinHES-config: mv_ir.py add support for remotes needing their own
 modprode.d/conf file. refs #854

---
 abs/core/LinHES-config/PKGBUILD |  4 ++--
 abs/core/LinHES-config/mv_ir.py | 27 +++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index f35c42f..cf4d529 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=189
+pkgrel=190
 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=('0bde52e0cc7708f3c208d4b424da49cc'
          'af6b3c5ec0d974b3e19ff1ed50662ee5'
          'cbc7cb10bde9a133e16fb63df6242f29'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
-         'a971121bc0b447d3b525778e73985c40'
+         'f5b2f4ed26a3099e66163040811ea2bd'
          '8b7dce4a3a0a281fa6656aa8781a648e'
          'f7f2dc11d1ba454cd25eeaa133104b62'
          '824e49d9b01fed295c704ab68908b464'
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index f0863c4..658a118 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -56,8 +56,12 @@ def add_module(filename,module):
     cmd = ''' echo "%s" >> %s ''' %(module,filename)
     mv_common.runcmd(cmd)
 
-def unload_all_lirc():
+def unload_all_lirc(Remotetype):
     logging.debug("    Unloading all remote modules")
+    #ati bucket specific
+    if "snapstream_firefly" in Remotetype :
+        cmd = "rmmod ati_remote"
+        mv_common.runcmd(cmd)
     cmd = "sv stop remotes"
     mv_common.runcmd(cmd)
     cmd = "killall -9 lircd"
@@ -101,6 +105,7 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
 
         files =  remote_path + "/lircd*"
         logging.debug("    Using %s",files)
+        # /etc/lircd.conf include
         for filename in glob.glob(files):
             # Ignore subfolders
             if os.path.isdir (filename):
@@ -108,6 +113,8 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
                 continue
             include_file("/etc/lircd.conf",filename)
         #files = templates + "/remotes/" + Remotetype + "/lircrc*"
+
+        # inluce lircrc
         files = remote_path + "/lircrc*"
         logging.debug("    Using %s",files)
         for filename in glob.glob(files):
@@ -116,6 +123,8 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
                 logging.debug("    %s is a dir, skipping",filename)
                 continue
             include_file("/etc/lircrc",filename)
+
+        #if remote has a special run file  use it.
         files = remote_path + "/remote.run*"
         logging.debug("    Using %s",files)
         for filename in glob.glob(files):
@@ -126,7 +135,21 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
             cmd = "cp %s /etc/remote.run" %filename
             mv_common.runcmd(cmd)
 
+        #remote has it's own modprobe.d/conf filename
+        cmd = "rm  -f /etc/modprobe.d/mv_ir.conf"
+        mv_common.runcmd(cmd)
+        files = remote_path + "/ir.conf*"
+        logging.debug("    Using %s",files)
+        for filename in glob.glob(files):
+            # Ignore subfolders
+            if os.path.isdir (filename):
+                logging.debug("    %s is a dir, skipping",filename)
+                continue
+            cmd = "cp %s /etc/modprobe.d/mv_ir.conf" %filename
+            mv_common.runcmd(cmd)
+
 
+        #cleanup
         cmd =  "chmod 755 /etc/lircrc /etc/remote.run"
         mv_common.runcmd(cmd)
         mv_common.add_service("remotes")
@@ -342,7 +365,7 @@ def setup_ir(systemconfig, data_config):
                               systemconfig.get("mythip"))
         else:
             setup_ir_receiver("unknown", systemconfig.get("TEMPLATES"),'','127.0.0.1')
-        unload_all_lirc()
+        unload_all_lirc(remotetype)
         setup_blaster_proto(HostBlasterType,
                             Hostnumblaster,
                             systemconfig.get("TEMPLATES"),
-- 
cgit v0.12

