aj090-hw-tools 0.0.5__py3-none-any.whl → 0.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aj090-hw-tools might be problematic. Click here for more details.
- aj090_hw_tools/__about__.py +1 -1
- aj090_hw_tools/common/const.py +2 -1
- aj090_hw_tools/tools/info.py +2 -2
- aj090_hw_tools/tools/serial_number.py +19 -7
- aj090_hw_tools/tools/test.py +1 -1
- {aj090_hw_tools-0.0.5.dist-info → aj090_hw_tools-0.0.7.dist-info}/METADATA +1 -1
- aj090_hw_tools-0.0.7.dist-info/RECORD +16 -0
- aj090_hw_tools-0.0.5.dist-info/RECORD +0 -16
- {aj090_hw_tools-0.0.5.dist-info → aj090_hw_tools-0.0.7.dist-info}/WHEEL +0 -0
- {aj090_hw_tools-0.0.5.dist-info → aj090_hw_tools-0.0.7.dist-info}/entry_points.txt +0 -0
- {aj090_hw_tools-0.0.5.dist-info → aj090_hw_tools-0.0.7.dist-info}/licenses/LICENSE.txt +0 -0
aj090_hw_tools/__about__.py
CHANGED
aj090_hw_tools/common/const.py
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
SERIAL_NUM_PATTERN = r'\
|
|
1
|
+
SERIAL_NUM_PATTERN = r'\w\d{10}'
|
|
2
|
+
SERIAL_INPUT_PATTERN = r'\d{10}'
|
aj090_hw_tools/tools/info.py
CHANGED
|
@@ -58,7 +58,7 @@ async def device_info_get(dut: DUT) -> Optional[DeviceInfo]:
|
|
|
58
58
|
# MAC: 64:E8:33:48:EF:C4
|
|
59
59
|
# serial: XXXXXXXX
|
|
60
60
|
MATCH_PATTERN = re.compile(
|
|
61
|
-
r'DEVICE_INFO:\s+app version:\s+(\w{{7}})\s+compile time:\s+(\d{{2}}:\d{{2}}:\d{{2}})\s+sha256:\s+(\w{{64}})\s+hw version:\s+(\d{{1}}\.\d{{1}})\s+MAC:\s+(\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}})\s+serial:\s+({SERIAL_NUM_PATTERN})'.format(SERIAL_NUM_PATTERN=SERIAL_NUM_PATTERN)
|
|
61
|
+
r'DEVICE_INFO:\s+app version:\s+(\w{{7}}|\w{{7}}-dirty)\s+compile time:\s+(\d{{2}}:\d{{2}}:\d{{2}})\s+sha256:\s+(\w{{64}})\s+hw version:\s+(\d{{1}}\.\d{{1}})\s+MAC:\s+(\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}}:\w{{2}})\s+serial:\s+({SERIAL_NUM_PATTERN})'.format(SERIAL_NUM_PATTERN=SERIAL_NUM_PATTERN)
|
|
62
62
|
)
|
|
63
63
|
result = await dut.expect([MATCH_PATTERN, pexpect.TIMEOUT], timeout=5.0, async_=True)
|
|
64
64
|
if result:
|
|
@@ -118,7 +118,7 @@ def info(argv) -> int:
|
|
|
118
118
|
port = argv.port if argv.port is not None else esptool.ESPLoader.DEFAULT_PORT
|
|
119
119
|
connects = 10 # NOTE: the workaround to the issue "Could not open /dev/tty..., the port is busy or doesn't exist"
|
|
120
120
|
for _ in range(connects):
|
|
121
|
-
try:
|
|
121
|
+
try:
|
|
122
122
|
with detect_chip(port=port, connect_attempts=0) as device:
|
|
123
123
|
return asyncio.run(gather_info(device, argv))
|
|
124
124
|
except OSError:
|
|
@@ -10,7 +10,7 @@ import time
|
|
|
10
10
|
from esptool.cmds import detect_chip
|
|
11
11
|
from rich.console import Console
|
|
12
12
|
|
|
13
|
-
from ..common.const import
|
|
13
|
+
from ..common.const import SERIAL_INPUT_PATTERN
|
|
14
14
|
|
|
15
15
|
__all__ = [
|
|
16
16
|
'serial'
|
|
@@ -44,14 +44,24 @@ async def nvs_write(device, bin_file: str, offset: int = 0x11000) -> None:
|
|
|
44
44
|
loop = asyncio.get_running_loop()
|
|
45
45
|
return await loop.run_in_executor(None, _write)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
def check_serial(serial: str) -> int:
|
|
48
|
+
INPUT_SERIAL="""Serial number format: YYWWXXXXXX, where:
|
|
49
|
+
YY - 2 digits of the year of manufacture of the product;
|
|
50
|
+
WW - 2 digits of the product production week number;
|
|
51
|
+
XXXXXX - 6 digits of the serial number of the product.
|
|
52
|
+
"""
|
|
53
|
+
match = re.search(SERIAL_INPUT_PATTERN, serial)
|
|
49
54
|
if match is None:
|
|
50
|
-
console.print('Wrong serial number format', style='bold red')
|
|
55
|
+
console.print('Wrong serial number format. Must be: YYWWXXXXXX', style='bold red')
|
|
56
|
+
console.print(f'{INPUT_SERIAL}')
|
|
51
57
|
return -1
|
|
52
|
-
|
|
58
|
+
|
|
59
|
+
return 0
|
|
60
|
+
|
|
61
|
+
async def serial_write(device, device_type: str, serial: str) -> int:
|
|
62
|
+
type = 'S' if device_type == "shelf" else "C"
|
|
53
63
|
with tempfile.NamedTemporaryFile(suffix='.csv') as nvs_csv:
|
|
54
|
-
data = bytes(nvs_partition_template(True, '1.0', serial).encode())
|
|
64
|
+
data = bytes(nvs_partition_template(True, '1.0', f'{type}{serial}').encode())
|
|
55
65
|
nvs_csv.write(data)
|
|
56
66
|
nvs_csv.seek(0)
|
|
57
67
|
logger.debug(f'CSV file data: {nvs_csv.read()}')
|
|
@@ -71,6 +81,8 @@ async def serial_read() -> int:
|
|
|
71
81
|
return -1
|
|
72
82
|
|
|
73
83
|
def serial(argv) -> int:
|
|
84
|
+
if check_serial(argv.serial):
|
|
85
|
+
return -1
|
|
74
86
|
port = argv.port if argv.port is not None else esptool.ESPLoader.DEFAULT_PORT
|
|
75
87
|
connects = 10 # NOTE: the workaround to the issue "Could not open /dev/tty..., the port is busy or doesn't exist"
|
|
76
88
|
for _ in range(connects):
|
|
@@ -78,7 +90,7 @@ def serial(argv) -> int:
|
|
|
78
90
|
with detect_chip(port=port, connect_attempts=0) as device:
|
|
79
91
|
match argv.operation:
|
|
80
92
|
case 'write':
|
|
81
|
-
return asyncio.run(serial_write(device, argv.serial))
|
|
93
|
+
return asyncio.run(serial_write(device, argv.device, argv.serial))
|
|
82
94
|
case 'read':
|
|
83
95
|
return asyncio.run(serial_read(device))
|
|
84
96
|
case _:
|
aj090_hw_tools/tools/test.py
CHANGED
|
@@ -78,7 +78,7 @@ async def do_test(dut: DUT, unit:str, expected: str, timeout: float = 5.0) -> in
|
|
|
78
78
|
|
|
79
79
|
async def device_boot_test(dut: DUT) -> BootInfo:
|
|
80
80
|
boot_expect = [
|
|
81
|
-
r'boot: ESP-IDF v(\d\.\d
|
|
81
|
+
r'boot: ESP-IDF v(\d\.\d(?:.\d)*|\d\.\d+(?:.\d)*-dirty) 2nd stage bootloader',
|
|
82
82
|
r'boot: Loaded app from partition at offset (0x\d{5,})',
|
|
83
83
|
r'app_init: App version:\s+(\w{7})'
|
|
84
84
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aj090-hw-tools
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Project-URL: Documentation, https://github.com/Vasencheg/aj090-hw-tools#readme
|
|
5
5
|
Project-URL: Issues, https://github.com/Vasencheg/aj090-hw-tools/issues
|
|
6
6
|
Project-URL: Source, https://github.com/Vasencheg/aj090-hw-tools
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
aj090_hw_tools/__about__.py,sha256=HDbMuGpnbLXsyoPNu1msRz-vvfJPgrVby_swoL1LlzY,134
|
|
2
|
+
aj090_hw_tools/__init__.py,sha256=fS-eXIfkbovPWSUIPvR9PgKcywBqV4Cbx_0viWMS954,2222
|
|
3
|
+
aj090_hw_tools/__main__.py,sha256=lgLhZKtFbsENp3hWyT0EoqDiKMkTdJ_Z0DBNoEXd0VU,110
|
|
4
|
+
aj090_hw_tools/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
aj090_hw_tools/common/const.py,sha256=LApGf_6G8znoFVqoWRKFj4D5sQaZOEjFY-pOVnWJtQo,65
|
|
6
|
+
aj090_hw_tools/targets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
aj090_hw_tools/tools/__init__.py,sha256=zPFvS-hx_IdS07KYhYeZ4RmPlEnab6J2Z9bqNjDjOMU,110
|
|
8
|
+
aj090_hw_tools/tools/firmware.py,sha256=8de3f4t4oUeaDkVnUj5yUw-9E4l2yBATm_O-FR3j6H0,10652
|
|
9
|
+
aj090_hw_tools/tools/info.py,sha256=nZoXM92KydljYBe8ZHwo4jrDhFQEGBTWOaH987saBOk,4681
|
|
10
|
+
aj090_hw_tools/tools/serial_number.py,sha256=XZ_-mtaVoZyBHlxBcALYRFWMk5KVK4ZNUg8MtJlq5Q0,3758
|
|
11
|
+
aj090_hw_tools/tools/test.py,sha256=54KN-a2gxH-Tfdu9tCNkLFX3ogQ5zfE58XiMX33az3k,8356
|
|
12
|
+
aj090_hw_tools-0.0.7.dist-info/METADATA,sha256=VBa5TsEJoAebKF-UIe77azGQ4LLZM1RnM3EcvzcF-6o,1787
|
|
13
|
+
aj090_hw_tools-0.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
aj090_hw_tools-0.0.7.dist-info/entry_points.txt,sha256=1AwKATXzb-NsDJEaS5fMAmQYsOAi2ly5Ey5RJZf4Iis,69
|
|
15
|
+
aj090_hw_tools-0.0.7.dist-info/licenses/LICENSE.txt,sha256=otEZO2jmzBs9ErzZVB3CaAUU7n3-1jC0D2oFZXv8kxs,1096
|
|
16
|
+
aj090_hw_tools-0.0.7.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
aj090_hw_tools/__about__.py,sha256=GnR-1-mF0DDmr5Uyy1HPKl75IV5E3GBLSX7yRHqmJps,134
|
|
2
|
-
aj090_hw_tools/__init__.py,sha256=fS-eXIfkbovPWSUIPvR9PgKcywBqV4Cbx_0viWMS954,2222
|
|
3
|
-
aj090_hw_tools/__main__.py,sha256=lgLhZKtFbsENp3hWyT0EoqDiKMkTdJ_Z0DBNoEXd0VU,110
|
|
4
|
-
aj090_hw_tools/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
aj090_hw_tools/common/const.py,sha256=Aqg27jSkNfsbF8GmFf9vwK_MkkpyWwn6EVXWw8AIEZc,43
|
|
6
|
-
aj090_hw_tools/targets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
aj090_hw_tools/tools/__init__.py,sha256=zPFvS-hx_IdS07KYhYeZ4RmPlEnab6J2Z9bqNjDjOMU,110
|
|
8
|
-
aj090_hw_tools/tools/firmware.py,sha256=8de3f4t4oUeaDkVnUj5yUw-9E4l2yBATm_O-FR3j6H0,10652
|
|
9
|
-
aj090_hw_tools/tools/info.py,sha256=Z6QVXzFzG88PYSHAGvCTtRdGLf6arSrjE_reRwhTIcs,4670
|
|
10
|
-
aj090_hw_tools/tools/serial_number.py,sha256=TNSmLm3T0XO4CUntilZb-jOdXUwDRZJivylcLZlXkkc,3289
|
|
11
|
-
aj090_hw_tools/tools/test.py,sha256=_IB9VfKoe76dVcgwOf1xzEZXKgxBA3EAPry-UZoQMpw,8340
|
|
12
|
-
aj090_hw_tools-0.0.5.dist-info/METADATA,sha256=DNQ_PI6yicvj3wnk_fwZHsZvcRQTduA9uRWE0rM-_1o,1787
|
|
13
|
-
aj090_hw_tools-0.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
-
aj090_hw_tools-0.0.5.dist-info/entry_points.txt,sha256=1AwKATXzb-NsDJEaS5fMAmQYsOAi2ly5Ey5RJZf4Iis,69
|
|
15
|
-
aj090_hw_tools-0.0.5.dist-info/licenses/LICENSE.txt,sha256=otEZO2jmzBs9ErzZVB3CaAUU7n3-1jC0D2oFZXv8kxs,1096
|
|
16
|
-
aj090_hw_tools-0.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|