pyxcp 0.21.10__tar.gz → 0.21.11__tar.gz
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 pyxcp might be problematic. Click here for more details.
- {pyxcp-0.21.10 → pyxcp-0.21.11}/PKG-INFO +1 -1
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyproject.toml +1 -1
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/__init__.py +1 -1
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cmdline.py +5 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/logger.py +0 -3
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/master/master.py +48 -6
- pyxcp-0.21.11/pyxcp/scripts/xcp_info.py +89 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/types.py +8 -0
- pyxcp-0.21.10/pyxcp/scripts/xcp_info.py +0 -74
- {pyxcp-0.21.10 → pyxcp-0.21.11}/LICENSE +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/README.md +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/build_ext.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/EtasCANMonitoring.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/EtasCANMonitoring.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCP_Common.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCPonCAN.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCPonEth.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCPonFlx.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCPonSxI.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/XCPonUSB.aml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/ifdata_CAN.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/ifdata_Eth.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/ifdata_Flx.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/ifdata_SxI.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/aml/ifdata_USB.a2l +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/asam/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/asam/types.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/asamkeydll.c +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/asamkeydll.sh +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/checksum.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/config.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/constants.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/asynchiofactory.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/blocking_client.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/blocking_socket.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/blocking_socket.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/concurrent_queue.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/eth.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/exceptions.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/iasyncioservice.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/iresource.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/isocket.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/linux/epoll.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/linux/epoll.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/linux/lit_tester.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/linux/socket.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/linux/timeout.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/memoryblock.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/pool.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/poolmgr.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/poolmgr.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/test_queue.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/timestamp.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/utils.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/utils.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/iocp.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/iocp.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/perhandledata.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/periodata.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/socket.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/cxx/win/timeout.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/dllif.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/errormatrix.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_can.json +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_can.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_can_user.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_can_vector.json +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_can_vector.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_eth.json +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_eth.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_nixnet.json +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_socket_can.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_sxi.json +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/conf_sxi.toml +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcp_policy.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcp_read_benchmark.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcp_skel.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcp_unlock.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcp_user_supplied_driver.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcphello.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/examples/xcphello_recorder.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/master/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/master/errorhandler.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/build_clang.cmd +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/build_clang.sh +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/build_gcc.cmd +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/build_gcc.sh +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/build_gcc_arm.sh +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/lz4.c +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/lz4.h +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/lz4hc.c +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/lz4hc.h +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/mio.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/reco.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/recorder.rst +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/rekorder.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/rekorder.hpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/setup.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/test_reko.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/recorder/wrap.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/scripts/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/scripts/pyxcp_probe_can_drivers.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/scripts/xcp_fetch_a2l.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/scripts/xcp_id_scanner.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_asam_types.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_can.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_checksum.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_config.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_frame_padding.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_master.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_transport.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/tests/test_utils.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/timing.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/base.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/can.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_canalystii.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_etas.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_gsusb.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_iscan.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_ixxat.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_kvaser.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_neovi.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_nican.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_nixnet.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_pcan.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_seeed.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_serial.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_slcan.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_socketcan.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_systec.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_usb2can.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/pc_vector.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/candriver/python_can.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/cxx_ext/CMakeLists.txt +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/cxx_ext/setup.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/cxx_ext/tests/test_basic_socket.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/cxx_ext/tests/test_pool.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/cxx_ext/tests/test_timestamp.cpp +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/eth.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/sxi.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/transport/usb_transport.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/utils.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/vector/__init__.py +0 -0
- {pyxcp-0.21.10 → pyxcp-0.21.11}/pyxcp/vector/map.py +0 -0
|
@@ -5,12 +5,14 @@ Parse (transport-layer specific) command line parameters
|
|
|
5
5
|
and create a XCP master instance.
|
|
6
6
|
"""
|
|
7
7
|
import argparse
|
|
8
|
+
import logging
|
|
8
9
|
|
|
9
10
|
from pyxcp.config import readConfiguration
|
|
10
11
|
from pyxcp.master import Master
|
|
11
12
|
from pyxcp.transport.can import registered_drivers
|
|
12
13
|
from pyxcp.transport.can import try_to_install_system_supplied_drivers
|
|
13
14
|
|
|
15
|
+
|
|
14
16
|
try_to_install_system_supplied_drivers()
|
|
15
17
|
|
|
16
18
|
CAN_DRIVERS = registered_drivers()
|
|
@@ -51,6 +53,9 @@ class ArgumentParser:
|
|
|
51
53
|
|
|
52
54
|
def run(self, policy=None):
|
|
53
55
|
""""""
|
|
56
|
+
# Create a default logging context if run as command line
|
|
57
|
+
logging.basicConfig()
|
|
58
|
+
|
|
54
59
|
self._args = self.parser.parse_args()
|
|
55
60
|
args = self.args
|
|
56
61
|
if args.conf is None:
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
.. [1] XCP Specification, Part 2 - Protocol Layer Specification
|
|
9
9
|
"""
|
|
10
10
|
import functools
|
|
11
|
-
import logging
|
|
12
11
|
import struct
|
|
13
12
|
import traceback
|
|
14
13
|
import warnings
|
|
15
14
|
from time import sleep
|
|
15
|
+
from typing import Any
|
|
16
16
|
from typing import Callable
|
|
17
17
|
from typing import Collection
|
|
18
18
|
from typing import Dict
|
|
19
19
|
from typing import List
|
|
20
20
|
from typing import Optional
|
|
21
|
-
from typing import
|
|
21
|
+
from typing import Tuple
|
|
22
22
|
|
|
23
23
|
from pyxcp import checksum
|
|
24
24
|
from pyxcp import types
|
|
@@ -33,6 +33,7 @@ from pyxcp.constants import makeWordPacker
|
|
|
33
33
|
from pyxcp.constants import makeWordUnpacker
|
|
34
34
|
from pyxcp.constants import PackerType
|
|
35
35
|
from pyxcp.constants import UnpackerType
|
|
36
|
+
from pyxcp.logger import Logger
|
|
36
37
|
from pyxcp.master.errorhandler import disable_error_handling
|
|
37
38
|
from pyxcp.master.errorhandler import wrapped
|
|
38
39
|
from pyxcp.transport.base import createTransport
|
|
@@ -92,8 +93,7 @@ class Master:
|
|
|
92
93
|
self.ctr = 0
|
|
93
94
|
self.succeeded = True
|
|
94
95
|
self.config = Configuration(self.PARAMETER_MAP or {}, config or {})
|
|
95
|
-
self.logger =
|
|
96
|
-
self.logger.setLevel(self.config.get("LOGLEVEL"))
|
|
96
|
+
self.logger = Logger("master.Master", level=self.config.get("LOGLEVEL"))
|
|
97
97
|
disable_error_handling(self.config.get("DISABLE_ERROR_HANDLING"))
|
|
98
98
|
|
|
99
99
|
self.transport = createTransport(transportName, config, policy)
|
|
@@ -124,6 +124,7 @@ class Master:
|
|
|
124
124
|
self.disconnect_response_optional = self.config.get("DISCONNECT_RESPONSE_OPTIONAL")
|
|
125
125
|
self.slaveProperties = SlaveProperties()
|
|
126
126
|
self.slaveProperties.pgmProcessor = SlaveProperties()
|
|
127
|
+
self.slaveProperties.transport_layer = self.transport_name.upper()
|
|
127
128
|
|
|
128
129
|
def __enter__(self):
|
|
129
130
|
"""Context manager entry part."""
|
|
@@ -1795,7 +1796,7 @@ class Master:
|
|
|
1795
1796
|
result = self.getSeed(types.XcpGetSeedMode.REMAINING, resource_value)
|
|
1796
1797
|
seed.extend(list(result.seed))
|
|
1797
1798
|
|
|
1798
|
-
seed = seed[:
|
|
1799
|
+
seed = seed[:length] # maybe there are some padding bytes
|
|
1799
1800
|
|
|
1800
1801
|
result, key = getKey(
|
|
1801
1802
|
self.logger,
|
|
@@ -1810,7 +1811,7 @@ class Master:
|
|
|
1810
1811
|
offset = 0
|
|
1811
1812
|
while offset < total_length:
|
|
1812
1813
|
data = key[offset : offset + MAX_PAYLOAD]
|
|
1813
|
-
self.unlock(total_length-offset, data)
|
|
1814
|
+
self.unlock(total_length - offset, data)
|
|
1814
1815
|
offset += len(data)
|
|
1815
1816
|
else:
|
|
1816
1817
|
raise SeedNKeyError("SeedAndKey DLL returned: {}".format(SeedNKeyResult(result).name))
|
|
@@ -1903,6 +1904,47 @@ class Master:
|
|
|
1903
1904
|
result[name] = response
|
|
1904
1905
|
return result
|
|
1905
1906
|
|
|
1907
|
+
def try_command(self, cmd: Callable, *args, **kws) -> Tuple[types.TryCommandResult, Any]:
|
|
1908
|
+
"""Call master functions and handle XCP errors more gracefuly.
|
|
1909
|
+
|
|
1910
|
+
Parameter
|
|
1911
|
+
---------
|
|
1912
|
+
cmd: Callable
|
|
1913
|
+
args: list
|
|
1914
|
+
variable length arguments to `cmd`.
|
|
1915
|
+
kws: dict
|
|
1916
|
+
keyword arguments to `cmd`.
|
|
1917
|
+
|
|
1918
|
+
`extra_msg`: str
|
|
1919
|
+
Additional info to log message (not passed to `cmd`).
|
|
1920
|
+
|
|
1921
|
+
Returns
|
|
1922
|
+
-------
|
|
1923
|
+
|
|
1924
|
+
Note
|
|
1925
|
+
----
|
|
1926
|
+
Mainly used for plug-and-play applications, e.g. `id_scanner` may confronted with `ERR_OUT_OF_RANGE` errors, which
|
|
1927
|
+
is normal for this kind of applications -- or to test for optional commands.
|
|
1928
|
+
Use carefuly not to hide serious error causes.
|
|
1929
|
+
"""
|
|
1930
|
+
try:
|
|
1931
|
+
extra_msg: Optional[str] = kws.get("extra_msg")
|
|
1932
|
+
if extra_msg:
|
|
1933
|
+
kws.pop("extra_msg")
|
|
1934
|
+
res = cmd(*args, **kws)
|
|
1935
|
+
except SystemExit as e:
|
|
1936
|
+
if e.error_code == types.XcpError.ERR_CMD_UNKNOWN:
|
|
1937
|
+
# This is a rather common use-case, so let the user know that there is some functionality missing.
|
|
1938
|
+
if extra_msg:
|
|
1939
|
+
self.logger.warning(f"Optional command {cmd.__name__!r} not implemented -- {extra_msg!r}")
|
|
1940
|
+
else:
|
|
1941
|
+
self.logger.warning(f"Optional command {cmd.__name__!r} not implemented.")
|
|
1942
|
+
return (types.TryCommandResult.XCP_ERROR, e)
|
|
1943
|
+
except Exception as e:
|
|
1944
|
+
return (types.TryCommandResult.OTHER_ERROR, e)
|
|
1945
|
+
else:
|
|
1946
|
+
return (types.TryCommandResult.OK, res)
|
|
1947
|
+
|
|
1906
1948
|
|
|
1907
1949
|
def ticks_to_seconds(ticks, resolution):
|
|
1908
1950
|
"""Convert DAQ timestamp/tick value to seconds.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""XCP info/exploration tool.
|
|
3
|
+
"""
|
|
4
|
+
from pprint import pprint
|
|
5
|
+
|
|
6
|
+
from pyxcp.cmdline import ArgumentParser
|
|
7
|
+
from pyxcp.types import TryCommandResult
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
ap = ArgumentParser(description="XCP info/exploration tool.")
|
|
11
|
+
|
|
12
|
+
with ap.run() as x:
|
|
13
|
+
x.connect()
|
|
14
|
+
if x.slaveProperties.optionalCommMode:
|
|
15
|
+
x.try_command(x.getCommModeInfo, extra_msg="availability signaled by CONNECT, this may be a slave configuration error.")
|
|
16
|
+
print("\nSlave Properties:")
|
|
17
|
+
print("=================")
|
|
18
|
+
pprint(x.slaveProperties)
|
|
19
|
+
|
|
20
|
+
# result = x.id_scanner()
|
|
21
|
+
# print("\n")
|
|
22
|
+
# print("Implemented IDs:")
|
|
23
|
+
# print("================")
|
|
24
|
+
# for key, value in result.items():
|
|
25
|
+
# print(f"{key}: {value}", end="\n\n")
|
|
26
|
+
cps = x.getCurrentProtectionStatus()
|
|
27
|
+
print("\nProtection Status")
|
|
28
|
+
print("=================")
|
|
29
|
+
for k, v in cps.items():
|
|
30
|
+
print(f" {k:6s}: {v}")
|
|
31
|
+
x.cond_unlock()
|
|
32
|
+
print("\nDAQ Info:")
|
|
33
|
+
print("=========")
|
|
34
|
+
daq_info = x.getDaqInfo()
|
|
35
|
+
pprint(daq_info)
|
|
36
|
+
|
|
37
|
+
daq_pro = daq_info["processor"]
|
|
38
|
+
daq_properties = daq_pro["properties"]
|
|
39
|
+
if x.slaveProperties.transport_layer == "CAN":
|
|
40
|
+
print("")
|
|
41
|
+
if daq_properties["pidOffSupported"]:
|
|
42
|
+
print("*** pidOffSupported -- i.e. one CAN-ID per DAQ-list.")
|
|
43
|
+
else:
|
|
44
|
+
print("*** NO support for PID_OFF")
|
|
45
|
+
num_predefined = daq_pro["minDaq"]
|
|
46
|
+
print("\nPredefined DAQ-Lists")
|
|
47
|
+
print("====================")
|
|
48
|
+
if num_predefined > 0:
|
|
49
|
+
print(f"There are {num_predefined} predefined DAQ-lists")
|
|
50
|
+
for idx in range(num_predefined):
|
|
51
|
+
print(f"DAQ-List #{idx}\n____________\n")
|
|
52
|
+
status, dm = x.try_command(x.getDaqListMode, idx)
|
|
53
|
+
if status == TryCommandResult.OK:
|
|
54
|
+
print(dm)
|
|
55
|
+
status, di = x.try_command(x.getDaqListInfo, idx)
|
|
56
|
+
if status == TryCommandResult.OK:
|
|
57
|
+
print(di)
|
|
58
|
+
else:
|
|
59
|
+
print("*** NO Predefined DAQ-Lists")
|
|
60
|
+
print("\nPAG Info:")
|
|
61
|
+
print("=========")
|
|
62
|
+
if x.slaveProperties.supportsCalpag:
|
|
63
|
+
status, pag = x.try_command(x.getPagProcessorInfo)
|
|
64
|
+
if status == TryCommandResult.OK:
|
|
65
|
+
print(pag)
|
|
66
|
+
# for idx in range(pag.maxSegments):
|
|
67
|
+
# x.getSegmentInfo(0x01, idx, 0, 0)
|
|
68
|
+
else:
|
|
69
|
+
print("*** PAGING IS NOT SUPPORTED.")
|
|
70
|
+
|
|
71
|
+
print("\nPGM Info:")
|
|
72
|
+
print("=========")
|
|
73
|
+
if x.slaveProperties.supportsPgm:
|
|
74
|
+
status, pgm = x.try_command(x.getPgmProcessorInfo)
|
|
75
|
+
if status == TryCommandResult.OK:
|
|
76
|
+
print(pgm)
|
|
77
|
+
else:
|
|
78
|
+
print("*** FLASH PROGRAMMING IS NOT SUPPORTED.")
|
|
79
|
+
|
|
80
|
+
if x.slaveProperties.transport_layer == "CAN":
|
|
81
|
+
# print("OK, CAN!!!")
|
|
82
|
+
for idx in range(num_predefined):
|
|
83
|
+
status, daq_id = x.try_command(x.getDaqId, idx)
|
|
84
|
+
if status != TryCommandResult.OK:
|
|
85
|
+
break
|
|
86
|
+
print(f"DAQ-ID #{idx}", daq_id)
|
|
87
|
+
x.disconnect()
|
|
88
|
+
|
|
89
|
+
print("\nDone.")
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""Very basic hello-world example.
|
|
4
|
-
"""
|
|
5
|
-
from pprint import pprint
|
|
6
|
-
|
|
7
|
-
from pyxcp.cmdline import ArgumentParser
|
|
8
|
-
|
|
9
|
-
daq_info = False
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def callout(master, args):
|
|
13
|
-
global daq_info
|
|
14
|
-
if args.daq_info:
|
|
15
|
-
daq_info = True
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ap = ArgumentParser(description="pyXCP hello world.", callout=callout)
|
|
19
|
-
ap.parser.add_argument(
|
|
20
|
-
"-d",
|
|
21
|
-
"--daq-info",
|
|
22
|
-
dest="daq_info",
|
|
23
|
-
help="Display DAQ-info",
|
|
24
|
-
default=False,
|
|
25
|
-
action="store_true",
|
|
26
|
-
)
|
|
27
|
-
with ap.run() as x:
|
|
28
|
-
x.connect()
|
|
29
|
-
if x.slaveProperties.optionalCommMode:
|
|
30
|
-
x.getCommModeInfo()
|
|
31
|
-
identifier = x.identifier(0x01)
|
|
32
|
-
print("\nSlave Properties:")
|
|
33
|
-
print("=================")
|
|
34
|
-
print(f"ID: '{identifier}'")
|
|
35
|
-
pprint(x.slaveProperties)
|
|
36
|
-
cps = x.getCurrentProtectionStatus()
|
|
37
|
-
print("\nProtection Status")
|
|
38
|
-
print("=================")
|
|
39
|
-
for k, v in cps.items():
|
|
40
|
-
print(f" {k:6s}: {v}")
|
|
41
|
-
if daq_info:
|
|
42
|
-
dqp = x.getDaqProcessorInfo()
|
|
43
|
-
print("\nDAQ Processor Info:")
|
|
44
|
-
print("===================")
|
|
45
|
-
print(dqp)
|
|
46
|
-
print("\nDAQ Events:")
|
|
47
|
-
print("===========")
|
|
48
|
-
for idx in range(dqp.maxEventChannel):
|
|
49
|
-
evt = x.getDaqEventInfo(idx)
|
|
50
|
-
length = evt.eventChannelNameLength
|
|
51
|
-
name = x.pull(length).decode("utf-8")
|
|
52
|
-
dq = "DAQ" if evt.daqEventProperties.daq else ""
|
|
53
|
-
st = "STIM" if evt.daqEventProperties.stim else ""
|
|
54
|
-
dq_st = dq + " " + st
|
|
55
|
-
print(f' [{idx:04}] "{name:s}"')
|
|
56
|
-
print(f" dir: {dq_st}")
|
|
57
|
-
print(f" packed: {evt.daqEventProperties.packed}")
|
|
58
|
-
PFX_CONS = "CONSISTENCY_"
|
|
59
|
-
print(f" consistency: {evt.daqEventProperties.consistency.strip(PFX_CONS)}")
|
|
60
|
-
print(f" max. DAQ lists: {evt.maxDaqList}")
|
|
61
|
-
PFX_TU = "EVENT_CHANNEL_TIME_UNIT_"
|
|
62
|
-
print(f" unit: {evt.eventChannelTimeUnit.strip(PFX_TU)}")
|
|
63
|
-
print(f" cycle: {evt.eventChannelTimeCycle or 'SPORADIC'}")
|
|
64
|
-
print(f" priority {evt.eventChannelPriority}")
|
|
65
|
-
|
|
66
|
-
dqr = x.getDaqResolutionInfo()
|
|
67
|
-
print("\nDAQ Resolution Info:")
|
|
68
|
-
print("====================")
|
|
69
|
-
print(dqr)
|
|
70
|
-
for idx in range(dqp.maxDaq):
|
|
71
|
-
print(f"\nDAQ List Info #{idx}")
|
|
72
|
-
print("=================")
|
|
73
|
-
print(f"{x.getDaqListInfo(idx)}")
|
|
74
|
-
x.disconnect()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|