tidyup output
[pinmux.git] / src / ifacebase.py
index 2fb834cbfff5e3e39f0df2384277b4bbbdc13372..0d6d25039ecb38be3c7afbacbd6a4f2b81ee036b 100644 (file)
@@ -32,13 +32,23 @@ class InterfacesBase(UserDict):
                 ]
                 """
                 spec, ganged = self.read_spec(pth, name)
-                iface = ifacekls(name, spec, ganged, count == 1)
-                self.ifaceadd(name, count, iface)
+                # XXX HORRIBLE hack!!!
+                if name == 'pwm' and count == 1 and len(spec) != 1:
+                    #print "read", name, count, spec, ganged
+                    #print "multi pwm", spec[:1], len(spec)
+                    spec[0]['name'] = 'out'
+                    iface = ifacekls(name, spec[:1], ganged, False)
+                    self.ifaceadd(name, len(spec), iface)
+                else:
+                    iface = ifacekls(name, spec, ganged, count == 1)
+                    self.ifaceadd(name, count, iface)
 
     def getifacetype(self, fname):
         # finds the interface type, e.g sd_d0 returns "inout"
         for iface in self.values():
             typ = iface.getifacetype(fname)
+            # if fname.startswith('pwm'):
+            #   print fname, iface.ifacename, typ
             if typ:
                 return typ
         return None
@@ -66,7 +76,8 @@ class InterfacesBase(UserDict):
                 ln = ln.strip()
                 ln = ln.split("\t")
                 name = ln[0]
-                d = {'name': name}  # here we start to make the dictionary
+                d = {'name': name,  # here we start to make the dictionary
+                     'type': ln[1]}
                 if ln[1] == 'out':
                     d['action'] = True  # adding element to the dict
                 elif ln[1] == 'inout':
@@ -78,4 +89,3 @@ class InterfacesBase(UserDict):
                         ganged[bus].append(name)
                 spec.append(d)
         return spec, ganged
-