diff options
author | Dan Williams <dcbw@redhat.com> | 2013-02-14 14:51:54 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-02-14 14:52:23 -0600 |
commit | 7144b673e2d102a08186d48d13c71b49800a7274 (patch) | |
tree | 4b48ba9cb116370a99a5811af6ddcb437a72f67e | |
parent | 594adc38ff5a6277d120b21856dba5cfcff2b3a1 (diff) | |
download | ModemManager-7144b673e2d102a08186d48d13c71b49800a7274.tar.gz |
vl600: update AT com tool and RE notes
-rwxr-xr-x | vl600/atcom.py | 36 | ||||
-rw-r--r-- | vl600/vl600.txt | 28 |
2 files changed, 56 insertions, 8 deletions
diff --git a/vl600/atcom.py b/vl600/atcom.py index 5ca52b032..74aa151ec 100755 --- a/vl600/atcom.py +++ b/vl600/atcom.py @@ -51,6 +51,7 @@ def lg_unpack(data): fmt += "%ds" % (len(data) - 14) # AT data (magic, seq, l, chan, resp) = struct.unpack(fmt, data) + resp = resp[:l] if magic != 0xa512485a: raise Exception("Bad magic: 0x%08x" % magic) @@ -64,14 +65,28 @@ def lg_unpack(data): # > 5a 48 12 a5 08 00 00 00 0a 00 00 00 11 f0 41 54 2b 43 45 52 45 47 3f 0a # < 5a 48 12 a5 4e 00 00 00 15 00 00 00 11 f0 2b 43 45 52 45 47 3a 20 30 2c 31 0d 0a 00 00 4f 4b 0d 0a 00 47 74 # - # where there's a trailing "00 47 74". The trailing bytes appear - # totally random in value and length. + # where there's a trailing "00 47" (the 0x74 is not included in the packet + # due to the data length field). The trailing bytes appear totally random + # in value and length. + + # status is last two bytes for most commands if there are trailing bytes + status = [] + if (resp >= 2): + statbytes = resp[len(resp) - 2:] + status = [ ord(statbytes[0]), ord(statbytes[1]) ] crlf = resp.rfind("\r\n") if crlf == -1: - return "" + # if last char is a newline then it's probably an echo, otherwise status + if resp[len(resp) - 1:] == '\n': + status = [] + resp = "" + else: + if crlf == len(resp) - 2: + status = [] + resp = resp[:crlf + 2] - return resp[:crlf + 2] + return (resp, status) def dump_raw(data, to_modem): if debug: @@ -90,7 +105,7 @@ def make_printable(data): if c in string.printable and ord(c) >= 32 or c == '\n' or c == '\r': p += c else: - p += "<%2x>" % ord(c) + p += "<%02x>" % ord(c) return p @@ -132,9 +147,18 @@ while 1: if fd in rfd: data = os.read(fd, 4096) dump_raw(data, False) - line = lg_unpack(data) + (line, status) = lg_unpack(data) if line: print make_printable(line) + if (len(status) == 2): + if status[0] == 0x30 and status[1] == 0x0d: + print "OK\n" + elif status[0] == 0x34 and status[1] == 0x0d: + print "ERROR\n" + elif status[0] == 0x33 and status[1] == 0x0d: + print "ERROR\n" + else: + print "STAT: 0x%02x 0x%02x" % (status[0], status[1]) if infd in rfd: line = os.read(infd, 512) diff --git a/vl600/vl600.txt b/vl600/vl600.txt index 20a332610..8fdc60455 100644 --- a/vl600/vl600.txt +++ b/vl600/vl600.txt @@ -31,11 +31,35 @@ u16: MUX channel (21 f0: CMD) (11 f0: AT) Packets are 4-byte aligned with padding of zeros, and this padding is included in the length given in the header. -AT commands may have trailing junk bytes. It appears that interpreters should -simply ignore any data in AT packets after the last CRLF. +AT commands may have trailing bytes outside the data length specified in the +header, obviously these should be ignored. AT commands may also have trailing +status bytes after the last 0x0D 0x0A which may take the place of OK and +ERROR in some AT commands. Status bytes include 0x30 0x0d (success) and +0x34 0x0d (unknown AT command). CMD packets are terminated with a standard HDLC CRC-16 and 0x7E. +Known CMD numbers are: +0xf14a - network attach, ethernet port start (use DHCP and IPv6 RA) + + + +AT SMS Indications +------------------ +They appear out of nowhere without AT formatting: + +MT MSG: "612804xxxx","13/02/13,19:27:11+00",73 +Heyy it's Tiffany i uploaded some pics on my profile on www.hottsites.com + + +Misc AT command notes: +---------------------- ++VZWMRUE: <entry>,<rat>,<band>,<channel> + +%LCNWINFO: <rat>, <roam>, <1x>, <Ev>, <LTE>, <state>, <cause>, <PDNid> +%LCNWINFO: <rat>, <roam>, <1x>, <Ev>, <LTE>, <state>, <cause> +<rat> = 6:LTE + Reported AT Commands -------------------- |