2017-09-19 16:12:01 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-10-05 22:51:07 +01:00
|
|
|
# pylint: disable=C0111,C0326,C0103
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2018-02-03 21:25:26 +00:00
|
|
|
"""Check all/given PRDs for FULL updates."""
|
|
|
|
|
2017-11-03 05:25:25 +00:00
|
|
|
import sys
|
2018-02-03 20:24:36 +00:00
|
|
|
|
|
|
|
from requests.exceptions import RequestException
|
|
|
|
|
2017-09-19 16:12:01 +01:00
|
|
|
import tcllib
|
2018-02-02 02:33:53 +00:00
|
|
|
import tcllib.argparser
|
2018-02-03 00:36:08 +00:00
|
|
|
from tcllib import ansi
|
2018-02-03 20:24:36 +00:00
|
|
|
|
2017-09-19 16:12:01 +01:00
|
|
|
|
|
|
|
fc = tcllib.FotaCheck()
|
|
|
|
fc.serid = "3531510"
|
|
|
|
fc.fv = "AAA000"
|
2017-10-15 00:51:38 +01:00
|
|
|
fc.mode = fc.MODE.FULL
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2018-01-30 17:31:05 +00:00
|
|
|
dpdesc = """
|
|
|
|
Checks for the latest FULL updates for all PRD numbers or only for
|
|
|
|
the PRD specified as prd.
|
|
|
|
"""
|
2018-02-02 02:33:53 +00:00
|
|
|
dp = tcllib.argparser.DefaultParser(__file__, dpdesc)
|
2018-01-30 17:31:05 +00:00
|
|
|
dp.add_argument("-p", "--prd", help="CU Reference # to filter scan results", dest="tocheck", nargs="?", default=None, metavar="PRD")
|
2017-11-03 05:25:25 +00:00
|
|
|
args = dp.parse_args(sys.argv[1:])
|
|
|
|
|
2017-10-15 00:51:38 +01:00
|
|
|
# CLTP = 10 (only show actual updates or HTTP 206) / 2010 (always show latest version for MODE.FULL)
|
2018-02-03 20:24:36 +00:00
|
|
|
#fc.cltp = fc.CLTP.MOBILE
|
|
|
|
fc.cltp = fc.CLTP.DESKTOP
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2017-11-03 05:25:25 +00:00
|
|
|
prdcheck = "" if args.tocheck is None else args.tocheck
|
|
|
|
|
2017-12-19 23:01:55 +00:00
|
|
|
print("Loading list of devices.")
|
2017-12-17 02:12:09 +00:00
|
|
|
prds = tcllib.FotaCheck.get_devicelist()
|
|
|
|
|
2017-09-19 16:12:01 +01:00
|
|
|
print("List of latest FULL firmware by PRD:")
|
|
|
|
|
2017-12-17 02:18:55 +00:00
|
|
|
for prd, variant in prds.items():
|
|
|
|
model = variant["variant"]
|
|
|
|
lastver = variant["last_full"]
|
2017-12-17 02:12:09 +00:00
|
|
|
if prdcheck in prd:
|
|
|
|
try:
|
|
|
|
fc.reset_session()
|
|
|
|
fc.curef = prd
|
|
|
|
check_xml = fc.do_check(max_tries=20)
|
|
|
|
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
|
|
|
txt_tv = tv
|
|
|
|
if tv != lastver:
|
2017-12-19 23:00:28 +00:00
|
|
|
txt_tv = "{} (old: {} / OTA: {})".format(
|
2018-02-03 00:36:08 +00:00
|
|
|
ansi.CYAN + txt_tv + ansi.RESET,
|
|
|
|
ansi.CYAN_DARK + variant["last_full"] + ansi.RESET,
|
2017-12-19 23:00:28 +00:00
|
|
|
variant["last_ota"]
|
|
|
|
)
|
2018-01-17 23:47:27 +00:00
|
|
|
else:
|
|
|
|
fc.delete_last_dump()
|
2017-12-17 02:12:09 +00:00
|
|
|
print("{}: {} {} ({})".format(prd, txt_tv, fhash, model))
|
|
|
|
except RequestException as e:
|
|
|
|
print("{}: {}".format(prd, str(e)))
|
|
|
|
continue
|
2017-11-12 21:19:04 +00:00
|
|
|
|
|
|
|
tcllib.FotaCheck.write_info_if_dumps_found()
|