feat(usb-can): add isolated adapter runtime and confirmed CAN transactions
Package the adapter SDK boundary and runtime lifecycle. Confirm admitted CAN transactions, bound retained data and test failure paths with synthetic hardware.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Immutable USB-CAN runtime included in the standard Node package."""
|
||||
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def payload():
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
files = [
|
||||
("usr/lib/mission-core-usb-can/runtime/" + p.name, p.read_bytes(), 0o644)
|
||||
for p in sorted((root / "runtime").glob("*.py"))
|
||||
]
|
||||
files.append(("usr/lib/mission-core-usb-can/runtime/maintenance.py",
|
||||
(root.parents[1] / "packages/plugin-sdk/python/missioncore_plugin_sdk/maintenance.py").read_bytes(), 0o644))
|
||||
for name in ("prepare.py", "native_check.py"):
|
||||
files.append(
|
||||
(
|
||||
"usr/lib/mission-core-usb-can/" + name,
|
||||
(root / "packaging" / name).read_bytes(),
|
||||
0o644,
|
||||
)
|
||||
)
|
||||
for name in ("mission-core-usb-can.service", "mission-core-node-usb-can-prepare.service"):
|
||||
files.append(
|
||||
("usr/lib/systemd/system/" + name, (root / "packaging" / name).read_bytes(), 0o644)
|
||||
)
|
||||
name = "70-mission-core-usb-can.rules"
|
||||
files.append(
|
||||
(
|
||||
"usr/share/mission-core-node/profiles/usb-can/" + name,
|
||||
(root / "packaging" / name).read_bytes(),
|
||||
0o644,
|
||||
)
|
||||
)
|
||||
data = (root / "build/sdk/libcontrolcanfd.so").read_bytes()
|
||||
if (
|
||||
len(data) != 235000
|
||||
or hashlib.sha256(data).hexdigest()
|
||||
!= "3f4681c64b086ecd4bf538908e09ed5203a05286632c0d99485b88f9b069285c"
|
||||
):
|
||||
raise ValueError("USB-CAN SDK differs from the reviewed pin")
|
||||
files.append(("usr/lib/mission-core-usb-can/sdk/libcontrolcanfd.so", data, 0o644))
|
||||
files.append(
|
||||
(
|
||||
"usr/lib/mission-core-usb-can/sdk/source.json",
|
||||
(root / "packaging/sdk-lock.json").read_bytes(),
|
||||
0o644,
|
||||
)
|
||||
)
|
||||
return files
|
||||
Reference in New Issue
Block a user