2 # -*- coding: UTF-8 -*-
4 import os
, sys
, serial
.tools
.list_ports
, time
7 for item
in serial
.tools
.list_ports
.comports():
8 if not item
.pid
or not item
.location
:
10 if item
.vid
== 0x19d1 and item
.pid
== 0x0001 and "x.6" in item
.location
:
13 with serial
.Serial(item
.name
, 115200, timeout
=1) as ser
:
17 if data
and data
.startswith(b
"#FOTA") :
19 with
open("fota_uart.bin", "rb") as f
:
25 print("发送升级包数据", len(fdata
))