Skip to content

Commit c6aae31

Browse files
authored
Merge branch 'dev' into patch-32
2 parents 4f1a392 + b008ccf commit c6aae31

39 files changed

+264
-1478
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ jobs:
1212
CACHE_VERSION: 2
1313
PYTHON_VERSION_DEFAULT: 3.9.15
1414
PRE_COMMIT_CACHE_PATH: ~/.cache/pre-commit
15-
MINIMUM_COVERAGE_PERCENTAGE: 99
15+
MINIMUM_COVERAGE_PERCENTAGE: 99
16+
secrets:
17+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

bellows/cli/dump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def cb(frame_name, response):
8989
hdr = pure_pcapy.Pkthdr(ts_sec, ts_usec, len(data), len(data))
9090

9191
try:
92-
pcap.dump(hdr, data)
92+
pcap.dump(hdr, bytes(data))
9393
except BrokenPipeError:
9494
done_event.set()
9595

bellows/cli/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def cb(fut, frame_name, response):
7272
if isinstance(extended_pan_id, str):
7373
extended_pan_id = util.parse_epan(extended_pan_id)
7474
if extended_pan_id is None:
75-
extended_pan_id = t.fixed_list(8, t.uint8_t)([t.uint8_t(0)] * 8)
75+
extended_pan_id = t.FixedList[t.uint8_t, 8]([t.uint8_t(0)] * 8)
7676

7777
v = await util.network_init(s)
7878

bellows/cli/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async def network_init(s):
147147
def parse_epan(epan):
148148
"""Parse a user specified extended PAN ID"""
149149
epan_list = [t.uint8_t(x, 16) for x in epan.split(":")]
150-
return t.fixed_list(8, t.uint8_t)(epan_list)
150+
return t.FixedList[t.uint8_t, 8](epan_list)
151151

152152

153153
async def basic_tc_permits(s):

bellows/ezsp/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,14 @@ async def _get_nv3_restored_eui64_key(self) -> t.NV3KeyId | None:
379379
t.NV3KeyId.NVM3KEY_STACK_RESTORED_EUI64, # RCP firmware
380380
):
381381
try:
382-
status, data = await self.getTokenData(key, 0)
382+
rsp = await self.getTokenData(key, 0)
383383
except (InvalidCommandError, AttributeError):
384384
# Either the command doesn't exist in the EZSP version, or the command
385385
# is not implemented in the firmware
386386
return None
387387

388-
if status == t.EmberStatus.SUCCESS:
389-
nv3_restored_eui64, _ = t.EUI64.deserialize(data)
388+
if rsp.status == t.EmberStatus.SUCCESS:
389+
nv3_restored_eui64, _ = t.EUI64.deserialize(rsp.value)
390390
LOGGER.debug("NV3 restored EUI64: %s=%s", key, nv3_restored_eui64)
391391

392392
return key

bellows/ezsp/protocol.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ async def command(self, name, *args) -> Any:
6565
LOGGER.debug("Send command %s: %s", name, args)
6666
data = self._ezsp_frame(name, *args)
6767
self._gw.data(data)
68-
c = self.COMMANDS[name]
69-
future = asyncio.Future()
70-
self._awaiting[self._seq] = (c[0], c[2], future)
68+
cmd_id, _, rx_schema = self.COMMANDS[name]
69+
future = asyncio.get_running_loop().create_future()
70+
self._awaiting[self._seq] = (cmd_id, rx_schema, future)
7171
self._seq = (self._seq + 1) % 256
7272

7373
async with asyncio_timeout(EZSP_CMD_TIMEOUT):
@@ -89,7 +89,7 @@ def __call__(self, data: bytes) -> None:
8989
sequence, frame_id, data = self._ezsp_frame_rx(data)
9090

9191
try:
92-
frame_name, _, schema = self.COMMANDS_BY_ID[frame_id]
92+
frame_name, _, rx_schema = self.COMMANDS_BY_ID[frame_id]
9393
except KeyError:
9494
LOGGER.warning(
9595
"Unknown application frame 0x%04X received: %s (%s). This is a bug!",
@@ -100,7 +100,10 @@ def __call__(self, data: bytes) -> None:
100100
return
101101

102102
try:
103-
result, data = self.types.deserialize(data, schema)
103+
if isinstance(rx_schema, tuple):
104+
result, data = self.types.deserialize(data, rx_schema)
105+
else:
106+
result, data = rx_schema.deserialize(data)
104107
except Exception:
105108
LOGGER.warning(
106109
"Failed to parse frame %s: %s", frame_name, binascii.hexlify(data)

0 commit comments

Comments
 (0)