pyvisionect 0.1.0__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.
- pyvisionect/__init__.py +120 -0
- pyvisionect/devices/__init__.py +92 -0
- pyvisionect/devices/enums.py +403 -0
- pyvisionect/devices/panels.py +242 -0
- pyvisionect/devices/tclv.py +460 -0
- pyvisionect/imaging/README.md +175 -0
- pyvisionect/imaging/__init__.py +181 -0
- pyvisionect/imaging/checksum.py +114 -0
- pyvisionect/imaging/constants.py +131 -0
- pyvisionect/imaging/data/blue_noise_64.npy +0 -0
- pyvisionect/imaging/decode.py +172 -0
- pyvisionect/imaging/dither.py +357 -0
- pyvisionect/imaging/encoder.py +594 -0
- pyvisionect/imaging/geometry.py +129 -0
- pyvisionect/imaging/grey.py +104 -0
- pyvisionect/imaging/interlace.py +244 -0
- pyvisionect/imaging/pack.py +142 -0
- pyvisionect/imaging/panel.py +339 -0
- pyvisionect/imaging/partial.py +931 -0
- pyvisionect/imaging/rects.py +466 -0
- pyvisionect/io/__init__.py +33 -0
- pyvisionect/io/tcp.py +795 -0
- pyvisionect/io/usb/__init__.py +237 -0
- pyvisionect/io/usb/cli.py +278 -0
- pyvisionect/io/usb/commands.py +781 -0
- pyvisionect/io/usb/console.py +730 -0
- pyvisionect/io/usb/device.py +914 -0
- pyvisionect/io/usb/discovery.py +260 -0
- pyvisionect/io/usb/encryption.py +262 -0
- pyvisionect/io/usb/errors.py +175 -0
- pyvisionect/io/usb/fake.py +292 -0
- pyvisionect/io/usb/parsers.py +1464 -0
- pyvisionect/io/usb/provisioning.py +502 -0
- pyvisionect/packets/__init__.py +135 -0
- pyvisionect/packets/control.py +95 -0
- pyvisionect/packets/file.py +325 -0
- pyvisionect/packets/image.py +234 -0
- pyvisionect/packets/misc.py +202 -0
- pyvisionect/packets/param.py +284 -0
- pyvisionect/packets/status.py +518 -0
- pyvisionect/packets/stored.py +217 -0
- pyvisionect/py.typed +0 -0
- pyvisionect/session/__init__.py +100 -0
- pyvisionect/session/connection.py +1043 -0
- pyvisionect/session/device.py +587 -0
- pyvisionect/session/events.py +196 -0
- pyvisionect/session/filetransfer.py +251 -0
- pyvisionect/session/pending.py +425 -0
- pyvisionect/wire/__init__.py +91 -0
- pyvisionect/wire/blocks.py +350 -0
- pyvisionect/wire/checksum.py +115 -0
- pyvisionect/wire/errors.py +176 -0
- pyvisionect/wire/framing.py +334 -0
- pyvisionect-0.1.0.dist-info/METADATA +1030 -0
- pyvisionect-0.1.0.dist-info/RECORD +58 -0
- pyvisionect-0.1.0.dist-info/WHEEL +4 -0
- pyvisionect-0.1.0.dist-info/entry_points.txt +3 -0
- pyvisionect-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
'''The command set this firmware actually has, read off the device.
|
|
2
|
+
|
|
3
|
+
Why this table exists
|
|
4
|
+
---------------------
|
|
5
|
+
|
|
6
|
+
The vendor's CLI reference documents **162** commands. ``help`` on firmware
|
|
7
|
+
7.4.4407 on a 32" system board prints **111** of them, and the firmware is known
|
|
8
|
+
to answer **112**: ``wifi_ssid_set`` is present but unlisted. Commands are
|
|
9
|
+
compiled in behind switches (``USE_CC3100_DRIVER``, ``USE_RS9113_DRIVER``,
|
|
10
|
+
``USE_MMA7660_DRIVER``, ``USE_VPLATFORM_SCPU_EXT``, ...), so the device in front
|
|
11
|
+
of you is the only authority -- but ``help`` is not a complete index of it, which
|
|
12
|
+
is the single most important thing on this page. The delta is not small: 97
|
|
13
|
+
documented commands are unlisted and 47 undocumented ones are printed.
|
|
14
|
+
|
|
15
|
+
Two findings matter enough to call out:
|
|
16
|
+
|
|
17
|
+
* **``help`` hides at least one command.** ``wifi_ssid_set`` is documented by
|
|
18
|
+
the vendor, is not printed by ``help``, and yet answers ``E: Invalid
|
|
19
|
+
argument(s)`` to a bare call -- which a missing command does not; it answers
|
|
20
|
+
``Command '...' not recognised.`` So it exists. It is the documented way to
|
|
21
|
+
set an SSID containing a space, it takes the SSID alone with no PSK, and it
|
|
22
|
+
**does** carry the space: measured on 7.4.4407, it consumes everything after
|
|
23
|
+
the command name and one separating space verbatim, with no quoting or
|
|
24
|
+
escaping convention at all. See ``A2`` in ``OPEN-QUESTIONS.md`` and
|
|
25
|
+
:func:`pyvisionect.io.usb.provisioning.plan_wifi`, which emits it.
|
|
26
|
+
* **...and exactly one.** 49 of the 97 unlisted commands have since been
|
|
27
|
+
probed by bare invocation on the device -- every one whose vendor-documented
|
|
28
|
+
arity includes a required argument, which is what makes the probe safe --
|
|
29
|
+
and **all 49 answered** ``Command '...' not recognised.`` So
|
|
30
|
+
``wifi_ssid_set`` is a one-off and not the tip of an iceberg, and the whole
|
|
31
|
+
``scpu_*``/``touch_*``/``mobile_*``/``frontlight_*`` story really is "not
|
|
32
|
+
compiled into this build". See :data:`PROBED_ABSENT_7_4_4407` for the list
|
|
33
|
+
and ``A1`` in ``OPEN-QUESTIONS.md`` for the method and the 48 still unprobed.
|
|
34
|
+
|
|
35
|
+
Note that the existence oracle has **two** positive spellings, not one. A
|
|
36
|
+
present-but-misinvoked command answers either ``E: Invalid argument(s)`` (the
|
|
37
|
+
``wifi_*`` and ``vlog_*`` setters) or ``Incorrect command parameter(s).`` (the
|
|
38
|
+
``vlog_*`` family on a bare call). Only ``Command '...' not recognised.``
|
|
39
|
+
means the firmware does not have it. Matching on the error *prefix* is not
|
|
40
|
+
enough: the firmware also emits unsolicited ``E: ...`` log lines such as
|
|
41
|
+
``E: TCP connection Error: -111``, so a probe has to match the full string.
|
|
42
|
+
* **``flash_print`` is not listed**, although the reverse engineering notes call
|
|
43
|
+
it "the single highest-value command" for dumping every stored setting. There
|
|
44
|
+
is no *known* single-command settings dump here; the per-area getters are the
|
|
45
|
+
whole story, which is why :meth:`pyvisionect.io.usb.device.Sign.dump` walks
|
|
46
|
+
them. Note this one has not been probed the way ``wifi_ssid_set`` was: it is
|
|
47
|
+
nullary in the vendor reference, and a bare call to a nullary command executes
|
|
48
|
+
it rather than failing, so the existence oracle is unsafe here.
|
|
49
|
+
|
|
50
|
+
The delta is recorded as data, in :data:`ABSENT_FROM_7_4_4407` and
|
|
51
|
+
:data:`UNDOCUMENTED_IN_7_4_4407`, so it stays checkable rather than becoming a
|
|
52
|
+
paragraph in a README that rots.
|
|
53
|
+
|
|
54
|
+
Relationship to the TCLV table
|
|
55
|
+
------------------------------
|
|
56
|
+
|
|
57
|
+
The CLI's key space *is* the TCLV key space -- see
|
|
58
|
+
:mod:`pyvisionect.devices.tclv`, whose ``USB_HINTS`` already names the command
|
|
59
|
+
that sets each network-read-only id. This module does not restate that mapping;
|
|
60
|
+
:data:`TCLV_FOR` gives the reverse direction for the commands where it is
|
|
61
|
+
unambiguous.
|
|
62
|
+
|
|
63
|
+
Safety tiers
|
|
64
|
+
------------
|
|
65
|
+
|
|
66
|
+
Every command carries a :class:`Kind`. The gating in
|
|
67
|
+
:class:`pyvisionect.io.usb.device.Sign` is built on it, so adding a command here
|
|
68
|
+
is enough to make it respect the right flag:
|
|
69
|
+
|
|
70
|
+
``READ``
|
|
71
|
+
Emits information and changes nothing. Always allowed.
|
|
72
|
+
``ACTION``
|
|
73
|
+
Changes nothing persistent but *does* something: ``pss`` makes the sign send
|
|
74
|
+
a status packet, ``conn_scan`` scans. (``play_music`` is *not* harmless --
|
|
75
|
+
see its entry; it takes the console down with it.) Needs
|
|
76
|
+
``allow_writes``.
|
|
77
|
+
``WRITE``
|
|
78
|
+
An ordinary setter. RAM-only until ``flash_save``. Needs ``allow_writes``.
|
|
79
|
+
``DESTRUCTIVE``
|
|
80
|
+
Can corrupt the panel, drop the sign off the network, or make it
|
|
81
|
+
unreachable: the ``dcm*`` display-driver controls, ``display_conf_set``,
|
|
82
|
+
every network setter, ``app_sleep``, ``reboot``, ``flash_save``, the
|
|
83
|
+
battery/temperature simulators. Needs ``allow_destructive``.
|
|
84
|
+
``HARD``
|
|
85
|
+
Formats something, flashes firmware, or sets a password you then have to
|
|
86
|
+
know: ``fs_format``, ``cc3100_format``, ``cc3100_fw_upgrade``,
|
|
87
|
+
``feat_enable``/``feat_disable``, ``cli_password_set``, ``sf_unprot``,
|
|
88
|
+
``sf_wrst``. Needs ``i_really_mean_it``.
|
|
89
|
+
|
|
90
|
+
The tiers are deliberately coarser than "does it write". ``server_tcp_set`` is
|
|
91
|
+
a plain setter by mechanism but it is the command that strands a sign off the
|
|
92
|
+
network, and ``IPV4_SERVER_IP`` is USB-only to recover -- so it sits in
|
|
93
|
+
``DESTRUCTIVE`` with the display-driver pokes.
|
|
94
|
+
'''
|
|
95
|
+
|
|
96
|
+
from __future__ import annotations
|
|
97
|
+
|
|
98
|
+
from dataclasses import dataclass
|
|
99
|
+
from enum import Enum
|
|
100
|
+
|
|
101
|
+
__all__ = [
|
|
102
|
+
"ABSENT_FROM_7_4_4407",
|
|
103
|
+
"HIDDEN_IN_7_4_4407",
|
|
104
|
+
"LISTED_BY_HELP",
|
|
105
|
+
"ASSERTS_AND_KILLS_CLI",
|
|
106
|
+
"COMMANDS",
|
|
107
|
+
"DESTRUCTIVE_COMMANDS",
|
|
108
|
+
"DOCUMENTED_COUNT",
|
|
109
|
+
"HARD_COMMANDS",
|
|
110
|
+
"Kind",
|
|
111
|
+
"PROBED_ABSENT_7_4_4407",
|
|
112
|
+
"READ_COMMANDS",
|
|
113
|
+
"TCLV_FOR",
|
|
114
|
+
"UNDOCUMENTED_IN_7_4_4407",
|
|
115
|
+
"VLOG_DESTINATIONS",
|
|
116
|
+
"VLOG_LEVELS",
|
|
117
|
+
"VLOG_QUIET",
|
|
118
|
+
"VLOG_VERBOSE",
|
|
119
|
+
"Command",
|
|
120
|
+
"lookup",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
DOCUMENTED_COUNT = 162
|
|
124
|
+
"""Commands in the vendor's published CLI reference.
|
|
125
|
+
|
|
126
|
+
Counted off the page itself (one ``<h*>`` section per command) rather than by
|
|
127
|
+
hand: it is **162**, not the 160 this module claimed until 2026-10-05. The two
|
|
128
|
+
that were missed are ``rs9110_scan`` and ``rs9113_scan``, which were absent from
|
|
129
|
+
:data:`ABSENT_FROM_7_4_4407` as well, so both counts moved together.
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
VLOG_LEVELS: range = range(1, 6)
|
|
133
|
+
"""Valid ``<level>`` arguments for every ``vlog_*`` setter: **1 to 5**.
|
|
134
|
+
|
|
135
|
+
Measured, not inferred. All three of ``vlog_unify_levels``,
|
|
136
|
+
``vlog_set_source_level`` and ``vlog_set_destination_level`` answer
|
|
137
|
+
``E: Invalid argument(s)`` to ``-1``, ``0``, ``6``, ``99`` and a non-numeric
|
|
138
|
+
argument, and accept 1..5 silently.
|
|
139
|
+
|
|
140
|
+
**``0`` is not a valid level.** That retires the question ``A3`` was built on
|
|
141
|
+
("does 0 mean emit nothing or emit everything?") -- it means neither, because
|
|
142
|
+
the firmware rejects it.
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
VLOG_QUIET: int = 1
|
|
146
|
+
"""The silent end of :data:`VLOG_LEVELS`.
|
|
147
|
+
|
|
148
|
+
``vlog_unify_levels 1`` reduces the USB log stream to nothing: 0 lines in 90 s,
|
|
149
|
+
and 0/0/1 lines across three ``pss``-triggered trials, against 18-61 lines per
|
|
150
|
+
90 s at level 5 on a healthy link and ~1 400 lines/min while the radio was
|
|
151
|
+
flapping. Verified in four separate runs on 2026-10-05, including one with the
|
|
152
|
+
level order reversed. See :data:`VLOG_VERBOSE` and
|
|
153
|
+
:meth:`pyvisionect.io.usb.device.Sign.unify_usb_log_levels`.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
VLOG_VERBOSE: int = 5
|
|
157
|
+
"""The loud end of :data:`VLOG_LEVELS`: everything, including image and frame detail.
|
|
158
|
+
|
|
159
|
+
Levels are a severity threshold and the scale is ordered quiet-to-loud. Level 1
|
|
160
|
+
emits nothing; 2 and 3 emit only ``E:`` error lines; 4 adds the informational
|
|
161
|
+
state narration (``From state N going to state N``, ``New connectivity state``,
|
|
162
|
+
DHCP/IP/DNS); 5 adds debug detail (``Frame send N bytes``, ``Image transfer
|
|
163
|
+
pending``, ``EPD temperature``).
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
VLOG_DESTINATIONS: range = range(0, 9)
|
|
167
|
+
"""Valid ``<destination>`` ids for ``vlog_set_destination_level``: **0 to 8**.
|
|
168
|
+
|
|
169
|
+
The firmware validates this one -- ``-1``, ``9``, ``16``, ``100``, ``255`` and
|
|
170
|
+
``9999`` are all refused -- so there are exactly nine sinks. Which id is the
|
|
171
|
+
USB UART was **not** established; see ``A3`` in ``OPEN-QUESTIONS.md``.
|
|
172
|
+
|
|
173
|
+
.. warning::
|
|
174
|
+
|
|
175
|
+
``vlog_set_source_level`` validates its *level* but **not** its *source id*.
|
|
176
|
+
``-1``, ``14``, ``32``, ``100``, ``255`` and ``9999`` are all accepted
|
|
177
|
+
silently, so there is no way to enumerate the source namespace by probing and
|
|
178
|
+
an out-of-range id is an unchecked index into firmware state. Validate it
|
|
179
|
+
caller-side; :meth:`pyvisionect.io.usb.device.Sign.set_log_source_level`
|
|
180
|
+
does.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class Kind(str, Enum):
|
|
185
|
+
"""How dangerous a command is. See the module docstring for the tiers."""
|
|
186
|
+
|
|
187
|
+
READ = "READ"
|
|
188
|
+
ACTION = "ACTION"
|
|
189
|
+
WRITE = "WRITE"
|
|
190
|
+
DESTRUCTIVE = "DESTRUCTIVE"
|
|
191
|
+
HARD = "HARD"
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
def is_write(self) -> bool:
|
|
195
|
+
return self is not Kind.READ
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@dataclass(frozen=True, slots=True)
|
|
199
|
+
class Command:
|
|
200
|
+
"""One row of the device's own ``help`` output.
|
|
201
|
+
|
|
202
|
+
Attributes:
|
|
203
|
+
name: the command word. Matching is case-insensitive on the device
|
|
204
|
+
(``UPTIME`` works), but the canonical spelling is lowercase.
|
|
205
|
+
args: the argument placeholder string exactly as ``help`` prints it,
|
|
206
|
+
e.g. ``"<ip> <port>"``, or ``""`` for a nullary command. **Not
|
|
207
|
+
always correct**: ``max17135_dump`` is listed nullary and rejects a
|
|
208
|
+
bare invocation with ``Incorrect command parameter(s).``
|
|
209
|
+
description: the help text, verbatim. Also not always correct:
|
|
210
|
+
``conn_fw_ver`` is described as "Scan for WiFi APs".
|
|
211
|
+
kind: the safety tier.
|
|
212
|
+
documented: whether the vendor's reference lists this command.
|
|
213
|
+
asserts: the ``file:line`` of a firmware assertion this command trips,
|
|
214
|
+
or None. Non-None means calling it kills the CLI task.
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
name: str
|
|
218
|
+
args: str
|
|
219
|
+
description: str
|
|
220
|
+
kind: Kind
|
|
221
|
+
documented: bool = True
|
|
222
|
+
asserts: str | None = None
|
|
223
|
+
|
|
224
|
+
@property
|
|
225
|
+
def arity(self) -> int:
|
|
226
|
+
"""How many placeholders ``help`` shows. See the caveat on :attr:`args`."""
|
|
227
|
+
return self.args.count("<")
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def syntax(self) -> str:
|
|
231
|
+
"""``"name <arg> <arg>"``, for an error message or a dry-run plan."""
|
|
232
|
+
return f"{self.name} {self.args}".strip()
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
_ROWS = (
|
|
236
|
+
('24aa256_test', '', 'EEPROM pattern read/write test', 'DESTRUCTIVE'),
|
|
237
|
+
('app_sleep', '<minutes>', 'Put app into deep sleep', 'DESTRUCTIVE'),
|
|
238
|
+
('app_wakeup', '', 'Wake-up app from the deep sleep', 'ACTION'),
|
|
239
|
+
('autoconn', '<timeout>', 'Disable auto-connect', 'DESTRUCTIVE'),
|
|
240
|
+
('battery_conf_get', '', 'Display battery cfg', 'READ'),
|
|
241
|
+
('battery_conf_set', '<thr_off> <thr_on> <thr_cnt>', 'Set battery cfg', 'WRITE'),
|
|
242
|
+
('border_get', '', 'Get border mode', 'READ'),
|
|
243
|
+
('bq24023_mode_get', '', 'Display state', 'READ'),
|
|
244
|
+
('bsim', '<mode> <force>', 'Simulate battery state', 'DESTRUCTIVE'),
|
|
245
|
+
('bsimi', '<mode> <current>', 'Simulate battery charging current', 'DESTRUCTIVE'),
|
|
246
|
+
('bsimv', '<voltage>', 'Simulate battery voltage', 'DESTRUCTIVE'),
|
|
247
|
+
('cc3100_dns', '<url>', 'Resolve IP from URL', 'WRITE'),
|
|
248
|
+
('cc3100_format', '', 'Formats the CC3100 SPI FLASH', 'HARD'),
|
|
249
|
+
('cc3100_fw_upgrade', '', 'Force FW upgrade', 'HARD'),
|
|
250
|
+
('cc3100_fw_version', '', 'Display WiFi FW version', 'READ'),
|
|
251
|
+
('cc3100_mac_address', '', 'Display WiFi MAC address', 'READ'),
|
|
252
|
+
('cc3100_rssi', '', 'Read RSSI value from CC3100 WiFi module', 'READ'),
|
|
253
|
+
('cc3100_scan', '', 'Scan for WiFi APs', 'ACTION'),
|
|
254
|
+
('certs_config_get', '', 'Display WiFi certificate cfg', 'READ'),
|
|
255
|
+
('cli_password_set', '<password> <password>', 'Sets CLI password', 'HARD'),
|
|
256
|
+
('cli_version_get', '', 'Display CLI version', 'READ'),
|
|
257
|
+
('conn_fw_ver', '', 'Scan for WiFi APs', 'READ'),
|
|
258
|
+
('conn_retry_get', '', 'Display conn error retry interval', 'READ'),
|
|
259
|
+
('conn_retry_set', '<time>', 'Set conn. error retry interval', 'WRITE'),
|
|
260
|
+
('conn_scan', '', 'Scan for WiFi APs', 'ACTION'),
|
|
261
|
+
('conn_state_get', '', 'Display connection state', 'READ'),
|
|
262
|
+
('conn_type_get', '', 'Display connectivity type', 'READ'),
|
|
263
|
+
('conn_type_list', '', 'List available connections', 'READ'),
|
|
264
|
+
('conn_type_set', '<type>', 'Set connectivity type', 'DESTRUCTIVE'),
|
|
265
|
+
('cs', '<state>', 'Change connection state', 'DESTRUCTIVE'),
|
|
266
|
+
('dcmb', '<mode>', 'Sets the border mode', 'DESTRUCTIVE'),
|
|
267
|
+
('dcmc', '<color>', 'Clears the display to a specified color', 'DESTRUCTIVE'),
|
|
268
|
+
('dcmd', '', 'DCM Power-down display driver', 'DESTRUCTIVE'),
|
|
269
|
+
('dcmh', '<mode>', 'Runs EPD pre/post-update hook', 'DESTRUCTIVE'),
|
|
270
|
+
('dcms', '', 'Put display driver to sleep', 'DESTRUCTIVE'),
|
|
271
|
+
('dcmt', '<driver_no>', 'DCM Select ESPON driver to communicate with', 'DESTRUCTIVE'),
|
|
272
|
+
('dcmu', '', 'DCM Power-up display driver an put it to sleep', 'DESTRUCTIVE'),
|
|
273
|
+
('dcmw', '', 'DCM Wake-up display driver', 'DESTRUCTIVE'),
|
|
274
|
+
('display_conf_get', '', 'Display VCOMs and display type', 'READ'),
|
|
275
|
+
('display_conf_set', '<vcom1> <vcom2> ... <vcom16> <display_id>', 'Set display cfg', 'DESTRUCTIVE'),
|
|
276
|
+
('encryption_config_get', '', 'Display encryption settings', 'READ'),
|
|
277
|
+
('encryption_key_set', '<key>', 'Set encryption key', 'DESTRUCTIVE'),
|
|
278
|
+
('encryption_mode_set', '<mode>', 'Set encryption mode', 'DESTRUCTIVE'),
|
|
279
|
+
('eth_conf_ext_set', '<mac> <trc> <trt>', 'Set extented Eth cfg', 'DESTRUCTIVE'),
|
|
280
|
+
('eth_conf_get', '', 'Display Eth cfg', 'READ'),
|
|
281
|
+
('eth_conf_mac_reset', '', 'Reset Eth MAC cfg', 'DESTRUCTIVE'),
|
|
282
|
+
('eth_conf_set', '<mac>', 'Set Eth MAC', 'DESTRUCTIVE'),
|
|
283
|
+
('feat_disable', '<key>', 'Disable feature', 'HARD'),
|
|
284
|
+
('feat_enable', '<key>', 'Enable feature', 'HARD'),
|
|
285
|
+
('feat_get', '', 'List features status', 'READ'),
|
|
286
|
+
('flash_load', '', 'Reload settings', 'DESTRUCTIVE'),
|
|
287
|
+
('flash_save', '', 'Save settings', 'DESTRUCTIVE'),
|
|
288
|
+
('fs_format', '', 'Formats the file system', 'HARD'),
|
|
289
|
+
('fs_ls', '', 'List files on the file system.', 'READ'),
|
|
290
|
+
('fs_stats', '', 'Displays block usage statistics', 'READ'),
|
|
291
|
+
('fw_version_get', '', 'Show system FW version', 'READ'),
|
|
292
|
+
('gtin_get', '', 'Get GTIN code', 'READ'),
|
|
293
|
+
('help', '', 'Lists all the registered commands', 'READ'),
|
|
294
|
+
('image_rotate_config_get', '', 'Display image rotate cfg', 'READ'),
|
|
295
|
+
('image_rotate_config_set', '<mode> <timeout> <num_images>', 'Sets image rotate cfg', 'WRITE'),
|
|
296
|
+
('ipv4_conf_get', '', 'Display IPv4 cfg', 'READ'),
|
|
297
|
+
('ipv4_conf_set', '<ip> <nm> <gw> <dns> <mode>', 'Set IPv4 Eth cfg', 'DESTRUCTIVE'),
|
|
298
|
+
('lmr', '', 'Read temperature from LM75', 'READ'),
|
|
299
|
+
('lms', '<mode> <value>', 'Simulates LM75 temperature', 'DESTRUCTIVE'),
|
|
300
|
+
('log_config_get', '', 'Display debug logging', 'READ'),
|
|
301
|
+
('log_config_set', '<module> <value>', 'Set debug logging', 'WRITE'),
|
|
302
|
+
('m2m_mode', '<timeout>', 'Disable autonomous connectivity reconnection', 'DESTRUCTIVE'),
|
|
303
|
+
('max17135_dump', '', 'Dump register values', 'READ'),
|
|
304
|
+
('max17135_pwr', '<enable>', 'Enables/disables MAX17135 power', 'DESTRUCTIVE'),
|
|
305
|
+
('max17135_selftest', '<i2c_channel>', 'Performs MAX17135 selftest', 'DESTRUCTIVE'),
|
|
306
|
+
('max17135_sleep', '<i2c_channel>', 'Puts MAX17135 to sleep', 'DESTRUCTIVE'),
|
|
307
|
+
('max17135_wakeup', '<i2c_channel>', 'Wakes up MAX17135', 'DESTRUCTIVE'),
|
|
308
|
+
('pbs', '', 'PV2 send button', 'ACTION'),
|
|
309
|
+
('pgs', '', 'PV2 send GPS', 'ACTION'),
|
|
310
|
+
# Plays the Indiana Jones theme -- and appears to kill usb_cli_task with it,
|
|
311
|
+
# exactly like sf_rdid/sf_rdst: console dead to everything afterwards while the
|
|
312
|
+
# device keeps heartbeating normally, then the watchdog resets it ~25 min later.
|
|
313
|
+
# Verified audibly; the crash is inferred from console-alive-before/dead-after.
|
|
314
|
+
('play_music', '', 'Play built-in song (KILLS THE CONSOLE)', 'HARD'),
|
|
315
|
+
('pss', '', 'PV2 send status', 'ACTION'),
|
|
316
|
+
('pts', '<x> <y>', 'PV2 send touch', 'WRITE'),
|
|
317
|
+
('reboot', '', 'Reboot device', 'DESTRUCTIVE'),
|
|
318
|
+
('server_hb_get', '', 'Display HB', 'READ'),
|
|
319
|
+
('server_hb_set', '<time>', 'Set heart-beat', 'WRITE'),
|
|
320
|
+
('server_tcp_get', '', "Display server's IP and port", 'READ'),
|
|
321
|
+
('server_tcp_set', '<ip> <port>', "Set server's IP and port", 'DESTRUCTIVE'),
|
|
322
|
+
('sf_list', '', 'Lists all registered SPI FLASH devices', 'READ'),
|
|
323
|
+
('sf_rdid', '', 'Reads SPI FLASH chip ID', 'READ'),
|
|
324
|
+
('sf_rdst', '', 'Reads SPI FLASH chip status', 'READ'),
|
|
325
|
+
('sf_select', '', 'Selects a SPI FLASH decice from the list', 'DESTRUCTIVE'),
|
|
326
|
+
('sf_unprot', '', 'Unprotects the SPI FLASH chip', 'HARD'),
|
|
327
|
+
('sf_wrst', '', 'Writes 0x00 to SPI FLASH chip status register', 'HARD'),
|
|
328
|
+
('status_get', '', 'Display status packet', 'READ'),
|
|
329
|
+
('system_conf_get', '', 'Display system cfg', 'READ'),
|
|
330
|
+
('system_conf_set', '<batt_ind_en> <touch_en> <ship_en>', 'Set system cfg', 'WRITE'),
|
|
331
|
+
('task_list', '', 'Show registered tasks', 'READ'),
|
|
332
|
+
('uptime', '', 'Display system uptime', 'READ'),
|
|
333
|
+
('uuid_get', '', "Display device's UUID", 'READ'),
|
|
334
|
+
('vlog_set_default_levels', '', 'Reset logger levels to default', 'WRITE'),
|
|
335
|
+
('vlog_set_destination_level', '<destination> <level>', 'Set logger level on a destination side', 'WRITE'),
|
|
336
|
+
('vlog_set_source_level', '<source> <level>', 'Set logger level on a source side', 'WRITE'),
|
|
337
|
+
('vlog_unify_levels', '<usb_level>', 'Reset logger levels to default for USB', 'WRITE'),
|
|
338
|
+
('wifi_bssid_get', '', 'Get WiFi BSSID', 'READ'),
|
|
339
|
+
('wifi_conf_get', '', 'Get WiFi cfg', 'READ'),
|
|
340
|
+
('wifi_conf_set', '<ssid> <psk> <security> <band>', 'Set WiFi connection', 'DESTRUCTIVE'),
|
|
341
|
+
('wifi_eap_conf_em_set', '<eap_method>', 'Set WiFi EAP method', 'DESTRUCTIVE'),
|
|
342
|
+
('wifi_eap_conf_get', '', 'Display WiFi EAP cfg', 'READ'),
|
|
343
|
+
('wifi_eap_conf_pwd_set', '<password>', 'Set WiFi EAP password', 'DESTRUCTIVE'),
|
|
344
|
+
('wifi_eap_conf_usr_set', '<username>', 'Set WiFi EAP username', 'DESTRUCTIVE'),
|
|
345
|
+
('wifi_ext_mode_set', '<mode>', 'Sets WiFi mode', 'DESTRUCTIVE'),
|
|
346
|
+
('wifi_ext_region_set', '<region>', 'Set WiFi region cfg', 'DESTRUCTIVE'),
|
|
347
|
+
('wifi_mac_conf_get', '', 'Display WiFi MAC cfg', 'READ'),
|
|
348
|
+
('wifi_mac_conf_set', '<mac>', 'Set WiFi MAC cfg', 'DESTRUCTIVE'),
|
|
349
|
+
# Hidden: absent from `help`, but present and functional. A bare call answers
|
|
350
|
+
# `E: Invalid argument(s)`, not `Command ... not recognised`. Verified on
|
|
351
|
+
# 7.4.4407. This is the documented way to set an SSID containing spaces, it
|
|
352
|
+
# takes the SSID alone -- no PSK needed -- and the space really does survive:
|
|
353
|
+
# it takes the rest of the line verbatim. See OPEN-QUESTIONS.md A2.
|
|
354
|
+
('wifi_ssid_set', '<ssid>', 'Set WiFi SSID (hidden; handles spaces)', 'DESTRUCTIVE'),
|
|
355
|
+
('wifi_psk_set', '<psk>', 'Set wpa2 password', 'DESTRUCTIVE'),
|
|
356
|
+
('wifi_security_set', '<security>', 'Set WiFi security mode', 'DESTRUCTIVE'),
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
_ABSENT = (
|
|
360
|
+
'accelerometer_conf_get',
|
|
361
|
+
'accelerometer_conf_set',
|
|
362
|
+
'bq24022_mode_get',
|
|
363
|
+
'bq24023_mode_set',
|
|
364
|
+
'bq_veps_mode_get',
|
|
365
|
+
'cc3100_pwr',
|
|
366
|
+
'ext_conf_get',
|
|
367
|
+
'ext_conf_set',
|
|
368
|
+
'flash_print',
|
|
369
|
+
'frontlight_conf_get',
|
|
370
|
+
'frontlight_conf_ldr_set',
|
|
371
|
+
'frontlight_conf_pwm_set',
|
|
372
|
+
'frontlight_conf_set',
|
|
373
|
+
'fw_checksum_get',
|
|
374
|
+
'get_sw_wd',
|
|
375
|
+
'heater_conf_get',
|
|
376
|
+
'heater_conf_set',
|
|
377
|
+
'mobile_apn_set',
|
|
378
|
+
'mobile_conf_get',
|
|
379
|
+
'mobile_conf_set',
|
|
380
|
+
'mobile_password_set',
|
|
381
|
+
'mobile_security_set',
|
|
382
|
+
'mobile_username_set',
|
|
383
|
+
'roaming_conf_get',
|
|
384
|
+
'roaming_conf_set',
|
|
385
|
+
'rs9110_fw_version',
|
|
386
|
+
'rs9110_mac_address',
|
|
387
|
+
'rs9110_rssi',
|
|
388
|
+
'rs9110_scan',
|
|
389
|
+
'rs9113_fw_version',
|
|
390
|
+
'rs9113_mac_address',
|
|
391
|
+
'rs9113_rssi',
|
|
392
|
+
'rs9113_scan',
|
|
393
|
+
'scpu_config_get',
|
|
394
|
+
'scpu_config_save',
|
|
395
|
+
'scpu_config_set',
|
|
396
|
+
'scpu_dev_batt_thr',
|
|
397
|
+
'scpu_dev_ctl',
|
|
398
|
+
'scpu_dev_mode',
|
|
399
|
+
'scpu_dev_toff_max',
|
|
400
|
+
'scpu_dev_toff_min',
|
|
401
|
+
'scpu_fl_ctl',
|
|
402
|
+
'scpu_fl_ldr_set',
|
|
403
|
+
'scpu_fl_mode',
|
|
404
|
+
'scpu_fl_postf',
|
|
405
|
+
'scpu_fl_pref',
|
|
406
|
+
'scpu_fl_pwm_set',
|
|
407
|
+
'scpu_fl_pwmf',
|
|
408
|
+
'scpu_fl_pwmlim',
|
|
409
|
+
'scpu_fl_senst',
|
|
410
|
+
'scpu_fl_sr',
|
|
411
|
+
'scpu_ht_mode',
|
|
412
|
+
'scpu_ht_toff',
|
|
413
|
+
'scpu_ht_ton',
|
|
414
|
+
'scpu_meas',
|
|
415
|
+
'scpu_power',
|
|
416
|
+
'scpu_psu_config_get',
|
|
417
|
+
'scpu_psu_config_save',
|
|
418
|
+
'scpu_psu_config_set',
|
|
419
|
+
'scpu_psu_dev_ctl',
|
|
420
|
+
'scpu_psu_dev_mode',
|
|
421
|
+
'scpu_psu_disp_ctl',
|
|
422
|
+
'scpu_psu_meas',
|
|
423
|
+
'scpu_psu_power',
|
|
424
|
+
'scpu_psu_rail_level',
|
|
425
|
+
'scpu_psu_reset',
|
|
426
|
+
'scpu_psu_sleep_mode',
|
|
427
|
+
'scpu_psu_status',
|
|
428
|
+
'scpu_psu_upgrade',
|
|
429
|
+
'scpu_psu_version',
|
|
430
|
+
'scpu_reset',
|
|
431
|
+
'scpu_sleep_mode',
|
|
432
|
+
'scpu_stats_get',
|
|
433
|
+
'scpu_status',
|
|
434
|
+
'scpu_upgrade',
|
|
435
|
+
'scpu_version',
|
|
436
|
+
'sim5320_gps_read',
|
|
437
|
+
'sim5320_gps_sw',
|
|
438
|
+
'sim5320_power_cmd',
|
|
439
|
+
'sim5320_rssi',
|
|
440
|
+
't2s_config_get',
|
|
441
|
+
't2s_config_set',
|
|
442
|
+
't2s_speak',
|
|
443
|
+
'touch_cal_get',
|
|
444
|
+
'touch_cal_set',
|
|
445
|
+
'touch_fw_get',
|
|
446
|
+
'touch_fw_update',
|
|
447
|
+
'touch_hw_pwr',
|
|
448
|
+
'touch_palm_get',
|
|
449
|
+
'touch_palm_set',
|
|
450
|
+
'touch_pwr_get',
|
|
451
|
+
'touch_pwr_set',
|
|
452
|
+
'touch_sens_get',
|
|
453
|
+
'touch_sens_set',
|
|
454
|
+
'touch_sr_set',
|
|
455
|
+
'touch_test',
|
|
456
|
+
'vcom_test',
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
# Probed by bare invocation on 7.4.4407 on 2026-10-05 and answered
|
|
460
|
+
# `Command '<x>' not recognised.` -- i.e. genuinely not in the firmware, not
|
|
461
|
+
# merely unlisted. Every one of these takes at least one required argument in
|
|
462
|
+
# the vendor reference, which is what made the probe safe: argument validation
|
|
463
|
+
# rejects the call before the command body runs. See PROBED_ABSENT_7_4_4407.
|
|
464
|
+
_PROBED_ABSENT = (
|
|
465
|
+
'accelerometer_conf_set',
|
|
466
|
+
'bq24023_mode_set',
|
|
467
|
+
'cc3100_pwr',
|
|
468
|
+
'ext_conf_get',
|
|
469
|
+
'ext_conf_set',
|
|
470
|
+
'frontlight_conf_ldr_set',
|
|
471
|
+
'frontlight_conf_pwm_set',
|
|
472
|
+
'frontlight_conf_set',
|
|
473
|
+
'heater_conf_set',
|
|
474
|
+
'mobile_apn_set',
|
|
475
|
+
'mobile_conf_set',
|
|
476
|
+
'mobile_password_set',
|
|
477
|
+
'mobile_security_set',
|
|
478
|
+
'mobile_username_set',
|
|
479
|
+
'roaming_conf_set',
|
|
480
|
+
'scpu_dev_batt_thr',
|
|
481
|
+
'scpu_dev_ctl',
|
|
482
|
+
'scpu_dev_mode',
|
|
483
|
+
'scpu_dev_toff_max',
|
|
484
|
+
'scpu_dev_toff_min',
|
|
485
|
+
'scpu_fl_ctl',
|
|
486
|
+
'scpu_fl_ldr_set',
|
|
487
|
+
'scpu_fl_mode',
|
|
488
|
+
'scpu_fl_postf',
|
|
489
|
+
'scpu_fl_pref',
|
|
490
|
+
'scpu_fl_pwm_set',
|
|
491
|
+
'scpu_fl_pwmf',
|
|
492
|
+
'scpu_fl_pwmlim',
|
|
493
|
+
'scpu_fl_senst',
|
|
494
|
+
'scpu_fl_sr',
|
|
495
|
+
'scpu_ht_mode',
|
|
496
|
+
'scpu_ht_toff',
|
|
497
|
+
'scpu_ht_ton',
|
|
498
|
+
'scpu_power',
|
|
499
|
+
'scpu_psu_dev_ctl',
|
|
500
|
+
'scpu_psu_dev_mode',
|
|
501
|
+
'scpu_psu_disp_ctl',
|
|
502
|
+
'scpu_psu_power',
|
|
503
|
+
'scpu_psu_rail_level',
|
|
504
|
+
'scpu_psu_sleep_mode',
|
|
505
|
+
'scpu_sleep_mode',
|
|
506
|
+
'sim5320_gps_sw',
|
|
507
|
+
'sim5320_power_cmd',
|
|
508
|
+
't2s_config_set',
|
|
509
|
+
'touch_hw_pwr',
|
|
510
|
+
'touch_palm_set',
|
|
511
|
+
'touch_pwr_set',
|
|
512
|
+
'touch_sens_set',
|
|
513
|
+
'touch_sr_set',
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
_UNDOCUMENTED = (
|
|
517
|
+
'24aa256_test',
|
|
518
|
+
'bsimi',
|
|
519
|
+
'cli_password_set',
|
|
520
|
+
'conn_fw_ver',
|
|
521
|
+
'conn_scan',
|
|
522
|
+
'dcmb',
|
|
523
|
+
'dcmc',
|
|
524
|
+
'dcmd',
|
|
525
|
+
'dcmh',
|
|
526
|
+
'dcms',
|
|
527
|
+
'dcmt',
|
|
528
|
+
'dcmu',
|
|
529
|
+
'dcmw',
|
|
530
|
+
'encryption_config_get',
|
|
531
|
+
'encryption_key_set',
|
|
532
|
+
'encryption_mode_set',
|
|
533
|
+
'eth_conf_mac_reset',
|
|
534
|
+
'fs_format',
|
|
535
|
+
'fs_ls',
|
|
536
|
+
'fs_stats',
|
|
537
|
+
'image_rotate_config_get',
|
|
538
|
+
'image_rotate_config_set',
|
|
539
|
+
'lmr',
|
|
540
|
+
'lms',
|
|
541
|
+
'm2m_mode',
|
|
542
|
+
'max17135_dump',
|
|
543
|
+
'max17135_pwr',
|
|
544
|
+
'max17135_selftest',
|
|
545
|
+
'max17135_sleep',
|
|
546
|
+
'max17135_wakeup',
|
|
547
|
+
'pbs',
|
|
548
|
+
'pgs',
|
|
549
|
+
'pts',
|
|
550
|
+
'sf_list',
|
|
551
|
+
'sf_rdid',
|
|
552
|
+
'sf_rdst',
|
|
553
|
+
'sf_select',
|
|
554
|
+
'sf_unprot',
|
|
555
|
+
'sf_wrst',
|
|
556
|
+
'task_list',
|
|
557
|
+
'vlog_set_default_levels',
|
|
558
|
+
'vlog_set_destination_level',
|
|
559
|
+
'vlog_set_source_level',
|
|
560
|
+
'vlog_unify_levels',
|
|
561
|
+
'wifi_bssid_get',
|
|
562
|
+
'wifi_ext_mode_set',
|
|
563
|
+
'wifi_ext_region_set',
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
_ASSERTS = {
|
|
567
|
+
'sf_rdid': 'spi_flash_cli.c:139',
|
|
568
|
+
'sf_rdst': 'spi_flash_cli.c:188',
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
ASSERTS_AND_KILLS_CLI: dict[str, str] = dict(_ASSERTS)
|
|
572
|
+
"""Commands that trip a firmware assertion and take ``usb_cli_task`` with them.
|
|
573
|
+
|
|
574
|
+
Measured on 7.4.4407, not inferred. Both entries are in the SPI-flash family
|
|
575
|
+
and both read a *selected* device without checking that ``sf_select`` has
|
|
576
|
+
chosen one, so a bare call dereferences nothing and asserts::
|
|
577
|
+
|
|
578
|
+
> sf_rdid
|
|
579
|
+
assert: spi_flash_cli.c:139
|
|
580
|
+
> sf_rdst
|
|
581
|
+
assert: spi_flash_cli.c:188
|
|
582
|
+
|
|
583
|
+
The rest of the firmware survives -- the sign stays online, keeps its heartbeat
|
|
584
|
+
and keeps its picture -- but the console is gone until the device reboots. The
|
|
585
|
+
software watchdog does notice (``W WD task timeout: cli_USB`` appears on the
|
|
586
|
+
UART) and does not act on it.
|
|
587
|
+
|
|
588
|
+
``sf_list`` is fine and is how you find out what there is to select.
|
|
589
|
+
"""
|
|
590
|
+
|
|
591
|
+
ABSENT_FROM_7_4_4407: frozenset[str] = frozenset(_ABSENT)
|
|
592
|
+
"""Documented by the vendor but **not listed by this firmware's** ``help``.
|
|
593
|
+
|
|
594
|
+
Membership here means "absent from ``help``", which is not automatically the
|
|
595
|
+
same as "absent from the firmware" -- ``wifi_ssid_set`` was in this set until a
|
|
596
|
+
bare invocation proved it present. **49 of these 97 have since been probed and
|
|
597
|
+
are genuinely absent** (:data:`PROBED_ABSENT_7_4_4407`); the remaining 48 are
|
|
598
|
+
still only "unlisted".
|
|
599
|
+
|
|
600
|
+
.. warning::
|
|
601
|
+
|
|
602
|
+
The probe is safe only for commands taking at least one **required**
|
|
603
|
+
argument, because argument validation then rejects the call before anything
|
|
604
|
+
happens. A bare call to a *nullary* command (``fs_format``, ``scpu_reset``,
|
|
605
|
+
``cc3100_format``, ``scpu_upgrade``) would **execute** it. That is why the
|
|
606
|
+
48 unprobed entries stay unprobed: 39 of them are nullary in the vendor
|
|
607
|
+
reference, 4 have an arity the reference and the field notes disagree about
|
|
608
|
+
(``vcom_test``, ``touch_test``, ``scpu_reset``, ``scpu_psu_reset``), 3 flash
|
|
609
|
+
firmware, and ``t2s_speak`` would make noise if its documented arity is
|
|
610
|
+
wrong.
|
|
611
|
+
|
|
612
|
+
The 97 entries are mostly whole hardware families that were not compiled in:
|
|
613
|
+
every ``scpu_*`` (sensor/front-light co-processor), ``touch_*`` calibration,
|
|
614
|
+
``t2s_*`` text-to-speech, ``frontlight_*``, ``heater_*``, ``mobile_*``,
|
|
615
|
+
``rs911x_*`` (the other radio), ``sim5320_*`` (cellular). Plus three one-offs
|
|
616
|
+
worth knowing about: ``flash_print``, ``fw_checksum_get`` and
|
|
617
|
+
``accelerometer_conf_get``/``_set``.
|
|
618
|
+
"""
|
|
619
|
+
|
|
620
|
+
PROBED_ABSENT_7_4_4407: frozenset[str] = frozenset(_PROBED_ABSENT)
|
|
621
|
+
"""The subset of :data:`ABSENT_FROM_7_4_4407` **proven** absent on the device.
|
|
622
|
+
|
|
623
|
+
Each of these 49 was sent bare to firmware 7.4.4407 on 2026-10-05 and answered
|
|
624
|
+
``Command '<x>' not recognised.`` That is the negative arm of the same oracle
|
|
625
|
+
that proved ``wifi_ssid_set`` present, so these are not inferences from ``help``
|
|
626
|
+
-- the firmware was asked directly and said no.
|
|
627
|
+
|
|
628
|
+
The oracle was validated in the same session, before, between and after the
|
|
629
|
+
batch: a bare ``wifi_ssid_set`` answered ``E: Invalid argument(s)`` every time
|
|
630
|
+
and a nonsense name answered ``not recognised`` every time, so a false
|
|
631
|
+
"absent" would have had to survive a working positive control.
|
|
632
|
+
|
|
633
|
+
**Nothing new was found hidden.** The practical upshot is that
|
|
634
|
+
:data:`HIDDEN_IN_7_4_4407` is a set of one on this firmware, and the hardware
|
|
635
|
+
families in the unlisted set are genuinely not compiled into this build -- so
|
|
636
|
+
the library is not refusing capabilities the device actually has.
|
|
637
|
+
"""
|
|
638
|
+
|
|
639
|
+
UNDOCUMENTED_IN_7_4_4407: frozenset[str] = frozenset(_UNDOCUMENTED)
|
|
640
|
+
"""The 47 commands this firmware has that the vendor's reference omits.
|
|
641
|
+
|
|
642
|
+
Three groups, and the first two are the interesting ones:
|
|
643
|
+
|
|
644
|
+
* **Encryption** -- ``encryption_config_get``, ``encryption_key_set``,
|
|
645
|
+
``encryption_mode_set``. The only documentation of the sign's outbound
|
|
646
|
+
encryption anywhere outside the firmware itself. See
|
|
647
|
+
:mod:`pyvisionect.io.usb.encryption`.
|
|
648
|
+
* **Filesystem and logging** -- ``fs_ls``, ``fs_stats``, ``fs_format``, and the
|
|
649
|
+
four ``vlog_*`` level controls that can silence the asynchronous log stream.
|
|
650
|
+
* Hardware pokes: ``dcm*`` (display driver), ``max17135_*`` (PMIC),
|
|
651
|
+
``sf_*`` (SPI flash), ``lmr``/``lms`` (temperature), ``24aa256_test``
|
|
652
|
+
(EEPROM), ``bsim*`` (battery simulation), ``pbs``/``pgs``/``pts`` (synthetic
|
|
653
|
+
button/GPS/touch events), ``task_list``.
|
|
654
|
+
"""
|
|
655
|
+
|
|
656
|
+
COMMANDS: dict[str, Command] = {
|
|
657
|
+
name: Command(
|
|
658
|
+
name=name,
|
|
659
|
+
args=args,
|
|
660
|
+
description=description,
|
|
661
|
+
kind=Kind(kind),
|
|
662
|
+
documented=name not in UNDOCUMENTED_IN_7_4_4407,
|
|
663
|
+
asserts=ASSERTS_AND_KILLS_CLI.get(name),
|
|
664
|
+
)
|
|
665
|
+
for name, args, description, kind in _ROWS
|
|
666
|
+
}
|
|
667
|
+
"""Every command firmware 7.4.4407 is known to answer, keyed by name.
|
|
668
|
+
|
|
669
|
+
Mostly built from the device's own ``help`` rather than the vendor's reference --
|
|
670
|
+
but ``help`` is not a complete index, so this table is a superset of it: see
|
|
671
|
+
:data:`HIDDEN_IN_7_4_4407`.
|
|
672
|
+
"""
|
|
673
|
+
|
|
674
|
+
HIDDEN_IN_7_4_4407: frozenset[str] = frozenset({"wifi_ssid_set"})
|
|
675
|
+
"""Present and working, but **not listed by** ``help``.
|
|
676
|
+
|
|
677
|
+
Found by bare invocation: a hidden command answers ``E: Invalid argument(s)``
|
|
678
|
+
while a genuinely missing one answers ``Command '...' not recognised.``.
|
|
679
|
+
|
|
680
|
+
**Still a set of one, and now on evidence rather than for want of looking.**
|
|
681
|
+
49 of the 97 unlisted commands -- every one the oracle can safely be pointed at
|
|
682
|
+
-- were probed on 2026-10-05 and all 49 were genuinely absent
|
|
683
|
+
(:data:`PROBED_ABSENT_7_4_4407`). The 48 that remain unprobed are nullary,
|
|
684
|
+
firmware-flashing, or of disputed arity, so this set could still grow, but not
|
|
685
|
+
by much and not cheaply: ``flash_print`` is the one worth wanting and it is
|
|
686
|
+
exactly the kind the oracle cannot touch.
|
|
687
|
+
"""
|
|
688
|
+
|
|
689
|
+
#: Commands this firmware's ``help`` actually prints.
|
|
690
|
+
LISTED_BY_HELP: frozenset[str] = frozenset(COMMANDS) - HIDDEN_IN_7_4_4407
|
|
691
|
+
|
|
692
|
+
assert len(LISTED_BY_HELP) == 111, f"help on 7.4.4407 lists 111, got {len(LISTED_BY_HELP)}"
|
|
693
|
+
assert len(COMMANDS) == 111 + len(HIDDEN_IN_7_4_4407)
|
|
694
|
+
assert HIDDEN_IN_7_4_4407 <= frozenset(COMMANDS)
|
|
695
|
+
assert not (HIDDEN_IN_7_4_4407 & ABSENT_FROM_7_4_4407), "a hidden command is not absent"
|
|
696
|
+
assert len(ABSENT_FROM_7_4_4407) == 97
|
|
697
|
+
assert len(UNDOCUMENTED_IN_7_4_4407) == 47
|
|
698
|
+
assert len(PROBED_ABSENT_7_4_4407) == 49
|
|
699
|
+
assert PROBED_ABSENT_7_4_4407 <= ABSENT_FROM_7_4_4407, "probed-absent is a subset of unlisted"
|
|
700
|
+
assert PROBED_ABSENT_7_4_4407.isdisjoint(COMMANDS), "proven absent, so not in the table"
|
|
701
|
+
# Documented = present-and-documented + unlisted. Keeps the three counts in step:
|
|
702
|
+
# this is the arithmetic that was wrong while DOCUMENTED_COUNT said 160.
|
|
703
|
+
assert (
|
|
704
|
+
len(frozenset(COMMANDS) - UNDOCUMENTED_IN_7_4_4407) + len(ABSENT_FROM_7_4_4407)
|
|
705
|
+
== DOCUMENTED_COUNT
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
READ_COMMANDS: frozenset[str] = frozenset(
|
|
709
|
+
name for name, c in COMMANDS.items() if c.kind is Kind.READ
|
|
710
|
+
)
|
|
711
|
+
"""The commands that change nothing. Always allowed, ``allow_writes`` or not."""
|
|
712
|
+
|
|
713
|
+
DESTRUCTIVE_COMMANDS: frozenset[str] = frozenset(
|
|
714
|
+
name for name, c in COMMANDS.items() if c.kind is Kind.DESTRUCTIVE
|
|
715
|
+
)
|
|
716
|
+
"""Needs ``allow_destructive``. See the tier list in the module docstring."""
|
|
717
|
+
|
|
718
|
+
HARD_COMMANDS: frozenset[str] = frozenset(
|
|
719
|
+
name for name, c in COMMANDS.items() if c.kind is Kind.HARD
|
|
720
|
+
)
|
|
721
|
+
"""Needs ``i_really_mean_it``: formats, firmware flashes, feature keys, passwords."""
|
|
722
|
+
|
|
723
|
+
TCLV_FOR: dict[str, tuple[int, ...]] = {
|
|
724
|
+
"battery_conf_set": (36, 37, 38),
|
|
725
|
+
"border_get": (109,),
|
|
726
|
+
"cli_password_set": (126,),
|
|
727
|
+
"conn_retry_set": (30,),
|
|
728
|
+
"conn_type_set": (2,),
|
|
729
|
+
"display_conf_set": (20, 21, 22, 23, 24, 25, 26, 27, 28),
|
|
730
|
+
"encryption_key_set": (131,),
|
|
731
|
+
"encryption_mode_set": (130,),
|
|
732
|
+
"eth_conf_ext_set": (8, 9, 10),
|
|
733
|
+
"eth_conf_set": (8,),
|
|
734
|
+
"feat_disable": (78,),
|
|
735
|
+
"feat_enable": (77,),
|
|
736
|
+
"flash_save": (53,),
|
|
737
|
+
"fs_format": (157,),
|
|
738
|
+
"gtin_get": (108,),
|
|
739
|
+
"ipv4_conf_set": (13, 14, 15, 16, 17),
|
|
740
|
+
"m2m_mode": (171,),
|
|
741
|
+
"server_hb_set": (29,),
|
|
742
|
+
"server_tcp_set": (18, 19),
|
|
743
|
+
"system_conf_set": (49, 50, 51),
|
|
744
|
+
"uuid_get": (89,),
|
|
745
|
+
"wifi_bssid_get": (170,),
|
|
746
|
+
"wifi_conf_set": (65, 67, 66, 68),
|
|
747
|
+
"wifi_eap_conf_em_set": (74,),
|
|
748
|
+
"wifi_eap_conf_pwd_set": (75,),
|
|
749
|
+
"wifi_eap_conf_usr_set": (76,),
|
|
750
|
+
"wifi_ext_mode_set": (173,),
|
|
751
|
+
"wifi_ext_region_set": (144,),
|
|
752
|
+
"wifi_mac_conf_set": (110,),
|
|
753
|
+
"wifi_psk_set": (67,),
|
|
754
|
+
"wifi_security_set": (66,),
|
|
755
|
+
"wifi_ssid_set": (65,),
|
|
756
|
+
}
|
|
757
|
+
"""TCLV ids each command touches, in argument order where there are several.
|
|
758
|
+
|
|
759
|
+
Only the unambiguous ones. ``wifi_conf_set <ssid> <psk> <security> <band>`` is
|
|
760
|
+
``(65, 67, 66, 68)`` -- note that is *not* ascending, because the command's
|
|
761
|
+
argument order is SSID, password, security, band while the ids run SSID,
|
|
762
|
+
security, password, band. Getting that backwards writes the PSK into the
|
|
763
|
+
security field.
|
|
764
|
+
|
|
765
|
+
``wifi_ssid_set`` is in here too, even though ``help`` never mentions it: TCLV
|
|
766
|
+
65 is the id it writes, and :data:`pyvisionect.devices.tclv.USB_HINTS` has named
|
|
767
|
+
it as the setter for 65 all along.
|
|
768
|
+
|
|
769
|
+
Cross-reference :mod:`pyvisionect.devices.tclv`: every id here is in that table,
|
|
770
|
+
and :data:`~pyvisionect.devices.tclv.NETWORK_READ_ONLY` says which of them the
|
|
771
|
+
network protocol refuses to write -- which is the whole reason this module
|
|
772
|
+
exists.
|
|
773
|
+
"""
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
def lookup(name: str) -> Command | None:
|
|
777
|
+
"""The :class:`Command` for *name*, or None if this firmware lacks it.
|
|
778
|
+
|
|
779
|
+
Case-insensitive, matching the device.
|
|
780
|
+
"""
|
|
781
|
+
return COMMANDS.get(name.strip().lower())
|