]> git.alsa-project.org Git - alsa.git/commitdiff
hda-analyzer: fix function_id parsing for separate afg and mfg
authorJaroslav Kysela <perex@perex.cz>
Tue, 20 Jul 2010 10:41:05 +0000 (12:41 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 20 Jul 2010 10:41:05 +0000 (12:41 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
hda-analyzer/hda_codec.py
hda-analyzer/hda_guilib.py
hda-analyzer/hda_proc.py

index 8b8ade2f302dd61835de2b5791c436525cde7de3..2f300eca056869befc65099032af6b12636237b9 100644 (file)
@@ -1008,7 +1008,10 @@ class HDACodec:
     self.mfg = None
     self.nodes = {}
     self.gpio = None
-    self.function_id = 0                       # invalid
+    self.afg_function_id = 0                   # invalid
+    self.mfg_function_id = 0                   # invalid
+    self.afg_unsol = 0
+    self.mfg_unsol = 0
     self.vendor_id = self.param_read(AC_NODE_ROOT, PARAMS['VENDOR_ID'])
     self.subsystem_id = self.param_read(AC_NODE_ROOT, PARAMS['SUBSYSTEM_ID'])
     self.revision_id = self.param_read(AC_NODE_ROOT, PARAMS['REV_ID'])
@@ -1026,11 +1029,13 @@ class HDACodec:
 
     total, nid = self.get_sub_nodes(AC_NODE_ROOT)
     for i in range(total):
-      self.function_id = func = self.param_read(nid, PARAMS['FUNCTION_TYPE'])
+      func = self.param_read(nid, PARAMS['FUNCTION_TYPE'])
       if (func & 0xff) == 0x01:                # audio group
+        self.afg_function_id = func & 0xff
         self.afg_unsol = (func & 0x100) and True or False
         self.afg = nid
       elif (func & 0xff) == 0x02:      # modem group
+        self.mfg_function_id = func & 0xff
         self.mfg_unsol = (func & 0x100) and True or False
         self.mfg = nid
       else:
@@ -1152,7 +1157,10 @@ class HDACodec:
       self.analyze()
     str = 'Codec: %s\n' % self.name
     str += 'Address: %i\n' % self.device
-    str += 'Function Id: 0x%x\n' % self.function_id
+    if not self.afg is None:
+      str += 'AFG Function Id: 0x%x (unsol %u)\n' % (self.afg_function_id, self.afg_unsol)
+    if not self.mfg is None:
+      str += 'MFG Function Id: 0x%x (unsol %u)\n' % (self.mfg_function_id, self.mfg_unsol)
     str += 'Vendor Id: 0x%x\n' % self.vendor_id
     str += 'Subsystem Id: 0x%x\n' % self.subsystem_id
     str += 'Revision Id: 0x%x\n' % self.revision_id
index 5df14cdea715343fd9500809b173790cc9a4beed..dbe81f3556f4c509b3cff0bb5ffb5e65e0ea150e 100644 (file)
@@ -701,7 +701,11 @@ class NodeGui(gtk.ScrolledWindow):
     frame = gtk.Frame('Codec Identification')
     frame.set_border_width(4)
     str = 'Audio Fcn Group: %s\n' % (codec.afg and "0x%02x" % codec.afg or "N/A")
+    if codec.afg:
+      str += 'AFG Function Id: 0x%02x (unsol %u)\n' % (codec.afg_function_id, codec.afg_unsol)
     str += 'Modem Fcn Group: %s\n' % (codec.mfg and "0x%02x" % codec.mfg or "N/A")
+    if codec.mfg:
+      str += 'MFG Function Id: 0x%02x (unsol %u)\n' % (codec.mfg_function_id, codec.mfg_unsol)
     str += 'Vendor ID:\t 0x%08x\n' % codec.vendor_id
     str += 'Subsystem ID:\t 0x%08x\n' % codec.subsystem_id
     str += 'Revision ID:\t 0x%08x\n' % codec.revision_id
index 09a0c4ef10cd5e397156cf2f6f307d11a9b2d016..b9836e510978ff142be8fa4c3bdb93ea54cd003c 100644 (file)
@@ -493,6 +493,16 @@ class HDACodecProc(HDACodec, HDABaseProc):
       str, res = self.decodeintw(lines[idx], prefix)
       return idx+1, res
 
+    def decodefcnid(idx, prefix):
+      if lines[idx].startswith(prefix):
+        str, res = self.decodeintw(lines[idx][len(prefix):])
+        if str.startswith('(unsol '):
+          str, res1 = self.decodeintw(str[:-1], '(unsol ')
+        else:
+          res1 = 0
+        return idx + 1, ((res1 & 1) << 8) | (res & 0xff)
+      return idx, 0        
+
     def decodeampcap(idx, prefix):
       if lines[idx].startswith(prefix):
         res = lines[idx][len(prefix):].strip()
@@ -557,9 +567,9 @@ class HDACodecProc(HDACodec, HDABaseProc):
       return
     idx, tmp = lookforint(idx, 'Address: ')
     self.device = tmp # really?
-    self.proc_function_id = None
-    if lines[idx].startswith('Function Id: '):
-      idx, function_id = lookforint(idx, 'Function Id: ')
+    idx, function_id = decodefcnid(idx, 'Function Id: ')
+    idx, self.proc_afg_function_id = decodefcnid(idx, 'AFG Function Id: ')
+    idx, self.proc_mfg_function_id = decodefcnid(idx, 'MFG Function Id: ')
     idx, self.proc_vendor_id = lookforint(idx, 'Vendor Id: ')
     idx, self.proc_subsystem_id = lookforint(idx, 'Subsystem Id: ')
     idx, self.proc_revision_id = lookforint(idx, 'Revision Id:' )
@@ -568,15 +578,18 @@ class HDACodecProc(HDACodec, HDABaseProc):
     nomfg = lines[idx].strip() == 'No Modem Function Group found'
     if nomfg:
       self.proc_afg = 1
-      self.proc_afg_function_id = function_id
+      if self.proc_afg_function_id == 0:
+        self.proc_afg_function_id = function_id
       idx += 1
     elif lines[idx].startswith('Default PCM:'):
       self.proc_afg = 1
-      self.proc_afg_function_id = function_id
+      if self.proc_afg_function_id == 0:
+        self.proc_afg_function_id = function_id
     else:
       idx, self.proc_mfg = lookforint(idx, 'Modem Function Group: ')
       if not self.proc_mfg is None:
-        self.proc_mfg_function_id = function_id
+        if self.proc_mfg_function_id == 0:
+          self.proc_mfg_function_id = function_id
       else:
         self.proc_mfg = -1
       if lines[idx].startswith('Default PCM:'):