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'])
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:
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
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
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()
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:' )
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:'):