vl600: remove legacy notes and tool
This commit is contained in:
171
vl600/atcom.py
171
vl600/atcom.py
@@ -1,171 +0,0 @@
|
||||
#! /bin/env python
|
||||
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details:
|
||||
#
|
||||
# Copyright (C) 2012 Red Hat, Inc.
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import select
|
||||
import struct
|
||||
import string
|
||||
from termios import *
|
||||
|
||||
debug = False
|
||||
|
||||
def lg_pack(data, seqno):
|
||||
l = len(data)
|
||||
|
||||
fmt = "<"
|
||||
fmt += "I" # magic
|
||||
fmt += "I" # sequence number
|
||||
fmt += "I" # data length
|
||||
fmt += "H" # MUX channel
|
||||
fmt += "%ds" % l # AT data
|
||||
|
||||
# Packets always padded to 4-byte boundaries
|
||||
sz = struct.calcsize(fmt)
|
||||
padding = 0
|
||||
if sz % 4 > 0:
|
||||
padding = 4 - (sz % 4)
|
||||
fmt += "%ds" % padding
|
||||
|
||||
return struct.pack(fmt, 0xa512485a, seqno, l, 0xf011, data, "\0" * padding)
|
||||
|
||||
def lg_unpack(data):
|
||||
fmt = "<"
|
||||
fmt += "I" # magic
|
||||
fmt += "I" # sequence number
|
||||
fmt += "I" # data length
|
||||
fmt += "H" # MUX channel
|
||||
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)
|
||||
if chan != 0xf011:
|
||||
print "Unhandled channel 0x%04x" % chan
|
||||
|
||||
# It appears that we're supposed to ignore any data after \r\n, or if
|
||||
# we don't get a \r\n we ignore all of it. The modem adds random
|
||||
# data to the end of the response, for example:
|
||||
#
|
||||
# > 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" (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:
|
||||
# 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, status)
|
||||
|
||||
def dump_raw(data, to_modem):
|
||||
if debug:
|
||||
line = ""
|
||||
if to_modem:
|
||||
line += "> "
|
||||
else:
|
||||
line += "< "
|
||||
for c in data:
|
||||
line += "%02x " % ord(c)
|
||||
print line
|
||||
|
||||
def make_printable(data):
|
||||
p = ""
|
||||
for c in data:
|
||||
if c in string.printable and ord(c) >= 32 or c == '\n' or c == '\r':
|
||||
p += c
|
||||
else:
|
||||
p += "<%02x>" % ord(c)
|
||||
return p
|
||||
|
||||
|
||||
#########################################
|
||||
|
||||
if len(sys.argv) != 2 and len(sys.argv) != 3:
|
||||
print "Usage: %s <port> [--debug]" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 2 and sys.argv[2] == "--debug":
|
||||
debug = True
|
||||
|
||||
fd = os.open(sys.argv[1], os.O_RDWR)
|
||||
|
||||
# read existing port attributes and mask the ones we don't want
|
||||
attrs = tcgetattr(fd)
|
||||
attrs[0] = attrs[0] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON) # iflag
|
||||
attrs[1] = attrs[1] & ~OPOST # oflag
|
||||
attrs[2] = attrs[2] & ~(CSIZE | PARENB) # cflag
|
||||
attrs[3] = attrs[3] & ~(ECHO | ICANON | IEXTEN | ISIG) # lflag
|
||||
|
||||
# Set up the attributes we do want
|
||||
attrs[2] = attrs[2] | CS8 # cflag
|
||||
attrs[4] = B115200 # ispeed
|
||||
attrs[5] = B115200 # ospeed
|
||||
attrs[6][VMIN] = 1 # cc
|
||||
attrs[6][VTIME] = 0 # cc
|
||||
tcsetattr(fd, TCSAFLUSH, attrs)
|
||||
|
||||
infd = sys.stdin.fileno()
|
||||
seqno = 0
|
||||
while 1:
|
||||
try:
|
||||
rfd, wfd, xfd = select.select([ fd, infd ], [], [])
|
||||
except KeyboardInterrupt:
|
||||
print ""
|
||||
break
|
||||
|
||||
if fd in rfd:
|
||||
data = os.read(fd, 4096)
|
||||
dump_raw(data, False)
|
||||
(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)
|
||||
if line:
|
||||
data = lg_pack(line, seqno)
|
||||
seqno += 1
|
||||
dump_raw(data, True)
|
||||
os.write(fd, data)
|
||||
|
||||
os.close(fd)
|
396
vl600/vl600.txt
396
vl600/vl600.txt
@@ -1,396 +0,0 @@
|
||||
Device uses an LG L2000 LTE chip and a Qualcomm MDM6800A for CDMA/EVDO.
|
||||
|
||||
The firmware flasher tool speaks DIAG and includes a lot of LTE-related
|
||||
NV items.
|
||||
|
||||
Device has two USB interfaces:
|
||||
|
||||
0 - Proprietary ethernet interface
|
||||
1 - CDC-ACM serial port
|
||||
|
||||
The ACM port speaks a proprietary protocol that MUX-es traffic from the
|
||||
following virtual interfaces (according to Windows):
|
||||
|
||||
0: LGE LTE DM Port
|
||||
1: LGE USB Modem Port
|
||||
2: LGE LTE RF Serial Port (com)
|
||||
3: LGE CDMA USB Serial Port (com)
|
||||
4: LGE CDMA USB GPS NMEA Port (com)
|
||||
5: LGE CDMA LBS Serial Port (com)
|
||||
|
||||
MUX Header Format
|
||||
-----------------
|
||||
|
||||
u32: magic, always [ 0x5a 0x48 0x12 0xa5 ]
|
||||
u32: sequence number (unpaired; host and device use separate sequence numbers)
|
||||
u32: length (not including this header, but including any padding)
|
||||
u16: MUX channel (21 f0: CMD) (11 f0: AT)
|
||||
<data>
|
||||
|
||||
|
||||
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 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
|
||||
--------------------
|
||||
|
||||
Firmware version VL600ZV8 reports the following supported AT commands in
|
||||
response to an AT+CLAC query:
|
||||
|
||||
E0V1
|
||||
HE1
|
||||
E
|
||||
Q
|
||||
V
|
||||
Z
|
||||
&F
|
||||
S3
|
||||
S4
|
||||
S5
|
||||
CIMI
|
||||
GCAP
|
||||
CEER
|
||||
CPAS
|
||||
CSQ
|
||||
CLAC
|
||||
CGDCONT
|
||||
CGDSCONT
|
||||
CGTFT
|
||||
CGATT
|
||||
CGACT
|
||||
CGCMOD
|
||||
CGDATA
|
||||
CGPADDR
|
||||
CGEREP
|
||||
CSCB
|
||||
CSAS
|
||||
CRES
|
||||
CSDH
|
||||
CEREG
|
||||
CGEQOS
|
||||
CGCONTRDP
|
||||
CGSCONTRDP
|
||||
CGTFTRDP
|
||||
CGEQOSRDP
|
||||
CGMI
|
||||
CGMM
|
||||
CGMR
|
||||
CGSN
|
||||
GSN
|
||||
PWDT
|
||||
PTIMER
|
||||
PDMA
|
||||
PSDRAM
|
||||
PSMACTIVE
|
||||
PSMT
|
||||
PHIMLP
|
||||
PURTTX
|
||||
PURTRX
|
||||
PURTCB
|
||||
PFSEL
|
||||
PFID
|
||||
PFREAD
|
||||
PFRW
|
||||
PCSMWID
|
||||
PCSMCP
|
||||
PSYSC
|
||||
PCPGB
|
||||
PUETH
|
||||
PUMDM1
|
||||
PUMDM2
|
||||
PI2C
|
||||
PHIMULPATH
|
||||
PHIMTX
|
||||
PHIMTXPATH
|
||||
PHIMSTOPTX
|
||||
PCC5BOOT
|
||||
PURTLOOPBACK
|
||||
PMEMWRITE
|
||||
PMEMREAD
|
||||
PMUXLOOPBACK
|
||||
PSQ
|
||||
PHIMNC
|
||||
PUESTATUS
|
||||
PSWRESET
|
||||
PRFCONTROL
|
||||
PCMDBYPASS
|
||||
PTM
|
||||
PEMUATCI
|
||||
PNVTEST
|
||||
PNVRD
|
||||
PNVWR
|
||||
PSWTTST
|
||||
PSWT
|
||||
PSMTESTIP
|
||||
PTESTDATAPATH
|
||||
PTXPOWER
|
||||
PSPIWRITE
|
||||
PSPIREAD
|
||||
PLLARCSEND
|
||||
PLLARCNV
|
||||
PANTDISABLE
|
||||
PLLARCSTART
|
||||
PLLARCEND
|
||||
TURNMODE
|
||||
PPHYSTATUS
|
||||
PPHYSNR
|
||||
PLLARCSTARTEX
|
||||
PCPELTIMER
|
||||
PCPESTIMER
|
||||
PGCTCAL
|
||||
CSG
|
||||
AUTH
|
||||
LTEINIT
|
||||
SETIMSI
|
||||
SETPLMNID
|
||||
SETNPARAM
|
||||
ATCMODE
|
||||
SETKEY
|
||||
SETOP
|
||||
&C
|
||||
&D
|
||||
&E
|
||||
&F
|
||||
&S
|
||||
&V
|
||||
&W
|
||||
E
|
||||
I
|
||||
L
|
||||
M
|
||||
Q
|
||||
V
|
||||
X
|
||||
Z
|
||||
T
|
||||
P
|
||||
\Q
|
||||
\S
|
||||
\V
|
||||
%V
|
||||
D
|
||||
A
|
||||
H
|
||||
O
|
||||
S0
|
||||
S3
|
||||
S4
|
||||
S5
|
||||
S6
|
||||
S7
|
||||
S8
|
||||
S9
|
||||
S10
|
||||
S11
|
||||
S30
|
||||
S103
|
||||
S104
|
||||
+VZWMRUC
|
||||
+VZWMRUE
|
||||
+VZWAPNE
|
||||
+CRSM
|
||||
+CSCS
|
||||
+CMEE
|
||||
+CCLK
|
||||
+CLCK
|
||||
+COPS
|
||||
+CPOL
|
||||
+CGDCONT
|
||||
+CPBS
|
||||
+CPBW
|
||||
+CPBR
|
||||
+CNMI
|
||||
+CMGF
|
||||
+CMGC
|
||||
+CSCA
|
||||
+CSMP
|
||||
+CPMS
|
||||
+CMGL
|
||||
+CMGR
|
||||
+CMGW
|
||||
+CMGS
|
||||
+CMGD
|
||||
+CMSS
|
||||
+CNMA
|
||||
+CMMS
|
||||
+CPWD
|
||||
+CNUM
|
||||
+CIMI
|
||||
+CPIN
|
||||
+CACM
|
||||
+CGSN
|
||||
+CFUN
|
||||
+CSIM
|
||||
+FCLASS
|
||||
+ICF
|
||||
+IFC
|
||||
+IPR
|
||||
+GMI
|
||||
+GMM
|
||||
+GMR
|
||||
+GCAP
|
||||
+GSN
|
||||
+DR
|
||||
+DS
|
||||
+CMEE
|
||||
$QCCLR
|
||||
$QCDMG
|
||||
$QCDMR
|
||||
$QCDNSP
|
||||
$QCDNSS
|
||||
$QCTER
|
||||
$QCSLOT
|
||||
$QCPWRDN
|
||||
$BREW
|
||||
$QCSYSMODE
|
||||
$QCCTM
|
||||
%ATCTEST
|
||||
%HOYATEST
|
||||
%EJTEST
|
||||
%CHANGTEST
|
||||
%TEMPTEST
|
||||
%FRST
|
||||
%SWV
|
||||
%SIMCHECK
|
||||
%GPS
|
||||
%CMSTATE
|
||||
%LCATT
|
||||
%LCRSSI
|
||||
%LCNWCHK
|
||||
%LCNWINFO
|
||||
%LCNWP
|
||||
%LCPID
|
||||
%LCPHPING
|
||||
%LCLTESTATE
|
||||
%LCLQOS
|
||||
%LCCQOS
|
||||
%LCDQOS
|
||||
%LCTFT
|
||||
%LCQOSAC
|
||||
%LCQOSRL
|
||||
%LCQOSMD
|
||||
%LCEMULP
|
||||
%LCVER
|
||||
%LCPKTSTATS
|
||||
%LCPINBLK
|
||||
%LCPINUNBLK
|
||||
%LCDMBR
|
||||
%LCMOD
|
||||
%LCMTU
|
||||
%LCIMSON
|
||||
%LCPINNUM
|
||||
%LCCMDT
|
||||
%LCFREQ
|
||||
%LCRETCTR
|
||||
%LCPTMR
|
||||
%LCLTEBOOTM
|
||||
%WIMSI
|
||||
%LCLTEBOOTTIME
|
||||
%GMTMR
|
||||
%LCIMSSETCFG
|
||||
%LCIMSGETCFG
|
||||
%LCRST
|
||||
%LCAPN
|
||||
%LCRPT
|
||||
%RSTSQN
|
||||
%SetApp
|
||||
%SETPIN
|
||||
%TSTRFSH
|
||||
%LCTCIV
|
||||
%LCINTPDNCTL
|
||||
%LCIIP
|
||||
%GMTT
|
||||
%LCINACT
|
||||
%RESETEN
|
||||
%LCACONMOD
|
||||
%LCGMSSCFG
|
||||
%SETLOG
|
||||
%LCBIPENABLEFLAG
|
||||
%LCROAMING
|
||||
%LOCGET
|
||||
%LOCON
|
||||
%LOCOFF
|
||||
|
||||
+UART
|
||||
+MDN
|
||||
+MIN
|
||||
+LGPASS
|
||||
+LGUSERID
|
||||
+LGPASSX
|
||||
+PING
|
||||
+PINGF
|
||||
+PINGD
|
||||
+PPPCAR
|
||||
+MIPRMNAI
|
||||
+PPPPW
|
||||
+SKTENABLE
|
||||
+PINGA
|
||||
$LGTEST
|
||||
$QCDMG
|
||||
$LGDMGO
|
||||
$LGSO
|
||||
$LGFRC
|
||||
$LGSCI
|
||||
$LGSCM
|
||||
$LGMTH
|
||||
$LGMTS
|
||||
$LGMTN
|
||||
$LGOTAPA
|
||||
$LGNLOCK
|
||||
$LGMCCM
|
||||
$LGMNCM
|
||||
$LGS2M
|
||||
$LGS1M
|
||||
$LGMCCT
|
||||
$LGMNCT
|
||||
$LGS2T
|
||||
$LGS1T
|
||||
$LGMRUCL
|
||||
$LGACCOLC
|
||||
$LGBYCHAR
|
||||
$LGMEID
|
||||
$LGMDN
|
||||
$LGMIN
|
||||
$LGMODEP
|
||||
$LGBANDP
|
||||
$LGROAMP
|
||||
$LGDTB
|
||||
$LGPREV
|
||||
$LGAKEY
|
||||
$LGPWR
|
||||
$LGACTV
|
||||
$LGTC
|
||||
$LGEPRL
|
||||
$LGUIMID
|
||||
$OTADM
|
||||
|
Reference in New Issue
Block a user