From 16d85f7b33b51beaf7c6155eb2d939c338b811f5 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 22 Jun 2012 12:06:08 -0500 Subject: decode: update with latest QMI enums Since QC stopped distributing the database files, we can't easily decode the TLV names unless we start parsing the C headers. --- decode/qmux.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'decode/qmux.py') diff --git a/decode/qmux.py b/decode/qmux.py index 4ff5cad7..b26d5345 100644 --- a/decode/qmux.py +++ b/decode/qmux.py @@ -60,7 +60,11 @@ class Tlv: def show(self, prefix): svc = services[self.service] - cmd = svc[1][self.cmdno] + cmd = [ None, None, None ] + try: + cmd = svc[1][self.cmdno] + except KeyError: + pass tlvlist = None if self.direction == TP_REQUEST: tlvlist = cmd[1] @@ -69,7 +73,7 @@ class Tlv: elif self.direction == TP_INDICATION: tlvlist = cmd[3] else: - raise ValueError("Unknown TLV dir0ection %s" % self.direction) + raise ValueError("Unknown TLV direction %s" % self.direction) tlvname = "!!! UNKNOWN !!!" if self.service == 1 and self.cmdno == 77: # WDS/SET_IP_FAMILY @@ -79,6 +83,8 @@ class Tlv: tlvname = tlvlist[self.id] except KeyError: pass + except TypeError: + pass print prefix + " TLV: 0x%02x (%s)" % (self.id, tlvname) print prefix + " Size: 0x%04x" % self.size @@ -173,7 +179,11 @@ def show(data, prefix, direction): print prefix + " TXN: 0x%04x" % txnid - scmd = qmi_cmd_to_string(cmdno, service) + scmd = "!!! UNKNOWN !!!" + try: + scmd = qmi_cmd_to_string(cmdno, service) + except KeyError: + pass print prefix + " Cmd: 0x%04x (%s)" % (cmdno, scmd) print prefix + " Size: 0x%04x" % size -- cgit v1.2.3-70-g09d2