add debug
[enigma2.git] / keymapparser.py
index 032805b..7b64ae0 100644 (file)
@@ -9,12 +9,14 @@ def readKeymap():
        enigma.eActionMap.getInstance(p)
        assert p
        
        enigma.eActionMap.getInstance(p)
        assert p
        
-       filename = "keymap.xml"
-       
+       filename1 = "data/keymap.xml"
+       filename2 = "/usr/share/enigma2/keymap.xml"
+               
        try:
        try:
-               source = open(filename)
+               source = open(filename1)
        except:
        except:
-               raise "couldn't open keymap.xml!"
+               source = open(filename2)
+#              raise "couldn't open keymap.xml!"
        
        try:
                dom = xml.dom.minidom.parse(source)
        
        try:
                dom = xml.dom.minidom.parse(source)
@@ -38,11 +40,11 @@ def readKeymap():
                                id = x.getAttribute("id")
                                flags = x.getAttribute("flags")
                                
                                id = x.getAttribute("id")
                                flags = x.getAttribute("flags")
                                
-                               flag_ascii_to_id = lambda x: {'m':1,'r':2,'b':4}[x]
+                               flag_ascii_to_id = lambda x: {'m':1,'b':2,'r':4}[x]
                                
 #                              try:
                                flags = sum(map(flag_ascii_to_id, flags))
                                
 #                              try:
                                flags = sum(map(flag_ascii_to_id, flags))
-                               print "-> " + str(flags)
+#                              print "-> " + str(flags)
 #                              except:
 #                                      raise str("%s: illegal flags '%s' specificed in context %s, id '%s'" % (filename, flags, context, id))
                                
 #                              except:
 #                                      raise str("%s: illegal flags '%s' specificed in context %s, id '%s'" % (filename, flags, context, id))
                                
@@ -65,8 +67,8 @@ def readKeymap():
                                        except:
                                                raise "key id '" + str(id) + "' is illegal"
 
                                        except:
                                                raise "key id '" + str(id) + "' is illegal"
 
-                               print context + "::" + mapto + " -> " + device + "." + hex(keyid)
-                               p.bindKey(device, keyid, 7, context, mapto)
+#                              print context + "::" + mapto + " -> " + device + "." + hex(keyid)
+                               p.bindKey(device, keyid, flags, context, mapto)
                
                parseKeys("generic", cmap)
                
                
                parseKeys("generic", cmap)