pyxcp 0.22.1__cp38-cp38-macosx_13_0_x86_64.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 pyxcp might be problematic. Click here for more details.
- CMakeLists.txt +117 -0
- pyxcp/__init__.py +20 -0
- pyxcp/aml/EtasCANMonitoring.a2l +82 -0
- pyxcp/aml/EtasCANMonitoring.aml +67 -0
- pyxcp/aml/XCP_Common.aml +408 -0
- pyxcp/aml/XCPonCAN.aml +78 -0
- pyxcp/aml/XCPonEth.aml +33 -0
- pyxcp/aml/XCPonFlx.aml +113 -0
- pyxcp/aml/XCPonSxI.aml +66 -0
- pyxcp/aml/XCPonUSB.aml +106 -0
- pyxcp/aml/ifdata_CAN.a2l +20 -0
- pyxcp/aml/ifdata_Eth.a2l +11 -0
- pyxcp/aml/ifdata_Flx.a2l +94 -0
- pyxcp/aml/ifdata_SxI.a2l +13 -0
- pyxcp/aml/ifdata_USB.a2l +81 -0
- pyxcp/asam/__init__.py +0 -0
- pyxcp/asam/types.py +131 -0
- pyxcp/asamkeydll.c +116 -0
- pyxcp/asamkeydll.sh +2 -0
- pyxcp/checksum.py +722 -0
- pyxcp/cmdline.py +52 -0
- pyxcp/config/__init__.py +1089 -0
- pyxcp/config/legacy.py +120 -0
- pyxcp/constants.py +47 -0
- pyxcp/cpp_ext/__init__.py +8 -0
- pyxcp/cpp_ext/bin.hpp +104 -0
- pyxcp/cpp_ext/blockmem.hpp +58 -0
- pyxcp/cpp_ext/cpp_ext.cpython-312-darwin.so +0 -0
- pyxcp/cpp_ext/daqlist.hpp +197 -0
- pyxcp/cpp_ext/event.hpp +67 -0
- pyxcp/cpp_ext/extension_wrapper.cpp +94 -0
- pyxcp/cpp_ext/helper.hpp +264 -0
- pyxcp/cpp_ext/mcobject.hpp +241 -0
- pyxcp/cpp_ext/tsqueue.hpp +46 -0
- pyxcp/daq_stim/__init__.py +226 -0
- pyxcp/daq_stim/optimize/__init__.py +67 -0
- pyxcp/daq_stim/optimize/binpacking.py +41 -0
- pyxcp/daq_stim/scheduler.cpp +28 -0
- pyxcp/daq_stim/scheduler.hpp +75 -0
- pyxcp/daq_stim/stim.cpp +13 -0
- pyxcp/daq_stim/stim.cpython-312-darwin.so +0 -0
- pyxcp/daq_stim/stim.hpp +604 -0
- pyxcp/daq_stim/stim_wrapper.cpp +48 -0
- pyxcp/dllif.py +95 -0
- pyxcp/errormatrix.py +878 -0
- pyxcp/examples/conf_can.toml +19 -0
- pyxcp/examples/conf_can_user.toml +16 -0
- pyxcp/examples/conf_can_vector.json +11 -0
- pyxcp/examples/conf_can_vector.toml +11 -0
- pyxcp/examples/conf_eth.toml +9 -0
- pyxcp/examples/conf_nixnet.json +20 -0
- pyxcp/examples/conf_socket_can.toml +12 -0
- pyxcp/examples/conf_sxi.json +9 -0
- pyxcp/examples/conf_sxi.toml +7 -0
- pyxcp/examples/ex_arrow.py +109 -0
- pyxcp/examples/ex_mdf.py +124 -0
- pyxcp/examples/ex_sqlite.py +128 -0
- pyxcp/examples/run_daq.py +146 -0
- pyxcp/examples/xcp_policy.py +60 -0
- pyxcp/examples/xcp_read_benchmark.py +38 -0
- pyxcp/examples/xcp_skel.py +49 -0
- pyxcp/examples/xcp_unlock.py +38 -0
- pyxcp/examples/xcp_user_supplied_driver.py +54 -0
- pyxcp/examples/xcphello.py +79 -0
- pyxcp/examples/xcphello_recorder.py +107 -0
- pyxcp/master/__init__.py +9 -0
- pyxcp/master/errorhandler.py +436 -0
- pyxcp/master/master.py +2029 -0
- pyxcp/py.typed +0 -0
- pyxcp/recorder/__init__.py +102 -0
- pyxcp/recorder/build_clang.cmd +1 -0
- pyxcp/recorder/build_clang.sh +2 -0
- pyxcp/recorder/build_gcc.cmd +1 -0
- pyxcp/recorder/build_gcc.sh +2 -0
- pyxcp/recorder/build_gcc_arm.sh +2 -0
- pyxcp/recorder/converter/__init__.py +37 -0
- pyxcp/recorder/lz4.c +2829 -0
- pyxcp/recorder/lz4.h +879 -0
- pyxcp/recorder/lz4hc.c +2041 -0
- pyxcp/recorder/lz4hc.h +413 -0
- pyxcp/recorder/mio.hpp +1714 -0
- pyxcp/recorder/reader.hpp +139 -0
- pyxcp/recorder/reco.py +277 -0
- pyxcp/recorder/recorder.rst +0 -0
- pyxcp/recorder/rekorder.cpp +59 -0
- pyxcp/recorder/rekorder.cpython-312-darwin.so +0 -0
- pyxcp/recorder/rekorder.hpp +274 -0
- pyxcp/recorder/setup.py +41 -0
- pyxcp/recorder/test_reko.py +34 -0
- pyxcp/recorder/unfolder.hpp +1249 -0
- pyxcp/recorder/wrap.cpp +189 -0
- pyxcp/recorder/writer.hpp +302 -0
- pyxcp/scripts/__init__.py +0 -0
- pyxcp/scripts/pyxcp_probe_can_drivers.py +20 -0
- pyxcp/scripts/xcp_fetch_a2l.py +40 -0
- pyxcp/scripts/xcp_id_scanner.py +19 -0
- pyxcp/scripts/xcp_info.py +109 -0
- pyxcp/scripts/xcp_profile.py +27 -0
- pyxcp/stim/__init__.py +0 -0
- pyxcp/tests/test_asam_types.py +24 -0
- pyxcp/tests/test_binpacking.py +184 -0
- pyxcp/tests/test_can.py +1324 -0
- pyxcp/tests/test_checksum.py +95 -0
- pyxcp/tests/test_daq.py +188 -0
- pyxcp/tests/test_frame_padding.py +153 -0
- pyxcp/tests/test_master.py +2006 -0
- pyxcp/tests/test_transport.py +64 -0
- pyxcp/tests/test_utils.py +30 -0
- pyxcp/timing.py +60 -0
- pyxcp/transport/__init__.py +10 -0
- pyxcp/transport/base.py +436 -0
- pyxcp/transport/base_transport.hpp +0 -0
- pyxcp/transport/can.py +443 -0
- pyxcp/transport/eth.py +219 -0
- pyxcp/transport/sxi.py +133 -0
- pyxcp/transport/transport_wrapper.cpp +0 -0
- pyxcp/transport/usb_transport.py +213 -0
- pyxcp/types.py +993 -0
- pyxcp/utils.py +102 -0
- pyxcp/vector/__init__.py +0 -0
- pyxcp/vector/map.py +82 -0
- pyxcp-0.22.1.dist-info/LICENSE +165 -0
- pyxcp-0.22.1.dist-info/METADATA +107 -0
- pyxcp-0.22.1.dist-info/RECORD +126 -0
- pyxcp-0.22.1.dist-info/WHEEL +4 -0
- pyxcp-0.22.1.dist-info/entry_points.txt +7 -0
pyxcp/asam/types.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import struct
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
INTEL = "<"
|
|
6
|
+
MOTOROLA = ">"
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
A_VOID: pseudo type for non-existing elements
|
|
10
|
+
A_BIT: one bit
|
|
11
|
+
A_ASCIISTRING: string, ISO-8859-1 encoded
|
|
12
|
+
A_UTF8STRING: string, UTF-8 encoded
|
|
13
|
+
A_UNICODE2STRING: string, UCS-2 encoded
|
|
14
|
+
A_BYTEFIELD: Field of bytes
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AsamBaseType:
|
|
19
|
+
"""Base class for ASAM codecs.
|
|
20
|
+
|
|
21
|
+
Note
|
|
22
|
+
----
|
|
23
|
+
Always use derived classes.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self, byteorder):
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
byteorder: char {'<', '>'}
|
|
32
|
+
- '<' Little-endian
|
|
33
|
+
- '>' Big-endian
|
|
34
|
+
"""
|
|
35
|
+
if byteorder not in ("<", ">"):
|
|
36
|
+
raise ValueError("Invalid byteorder.")
|
|
37
|
+
self.byteorder = byteorder
|
|
38
|
+
|
|
39
|
+
def encode(self, value):
|
|
40
|
+
"""Encode a value.
|
|
41
|
+
|
|
42
|
+
Encode means convert a value, eg. an integer, to a byte-string.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
value: data-type
|
|
47
|
+
data-type is determined by derived class.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
bytes
|
|
52
|
+
Encoded value.
|
|
53
|
+
"""
|
|
54
|
+
return struct.pack(f"{self.byteorder}{self.FMT}", value)
|
|
55
|
+
|
|
56
|
+
def decode(self, value):
|
|
57
|
+
"""Decode a value.
|
|
58
|
+
|
|
59
|
+
Decode means convert a byte-string to a meaningful data-type, eg. an
|
|
60
|
+
integer.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
value: bytes
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
data-type
|
|
69
|
+
data-type is determined by derived class.
|
|
70
|
+
"""
|
|
71
|
+
return struct.unpack(f"{self.byteorder}{self.FMT}", bytes(value))[0]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class A_Uint8(AsamBaseType):
|
|
75
|
+
"""ASAM A_UINT8 codec."""
|
|
76
|
+
|
|
77
|
+
FMT = "B"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class A_Uint16(AsamBaseType):
|
|
81
|
+
"""ASAM A_UINT16 codec."""
|
|
82
|
+
|
|
83
|
+
FMT = "H"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class A_Uint32(AsamBaseType):
|
|
87
|
+
"""ASAM A_UINT32 codec."""
|
|
88
|
+
|
|
89
|
+
FMT = "I"
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class A_Uint64(AsamBaseType):
|
|
93
|
+
"""ASAM A_UINT64 codec."""
|
|
94
|
+
|
|
95
|
+
FMT = "Q"
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class A_Int8(AsamBaseType):
|
|
99
|
+
"""ASAM A_INT8 codec."""
|
|
100
|
+
|
|
101
|
+
FMT = "b"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class A_Int16(AsamBaseType):
|
|
105
|
+
"""ASAM A_INT16 codec."""
|
|
106
|
+
|
|
107
|
+
FMT = "h"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class A_Int32(AsamBaseType):
|
|
111
|
+
"""ASAM A_INT32 codec."""
|
|
112
|
+
|
|
113
|
+
FMT = "i"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class A_Int64(AsamBaseType):
|
|
117
|
+
"""ASAM A_INT64 codec."""
|
|
118
|
+
|
|
119
|
+
FMT = "q"
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class A_Float32(AsamBaseType):
|
|
123
|
+
"""ASAM A_FLOAT32 codec."""
|
|
124
|
+
|
|
125
|
+
FMT = "f"
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class A_Float64(AsamBaseType):
|
|
129
|
+
"""ASAM A_FLOAT64 codec."""
|
|
130
|
+
|
|
131
|
+
FMT = "d"
|
pyxcp/asamkeydll.c
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
#include <stdlib.h>
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <string.h>
|
|
6
|
+
#include <stdio.h>
|
|
7
|
+
|
|
8
|
+
#if defined(_WIN32)
|
|
9
|
+
#include <windows.h>
|
|
10
|
+
|
|
11
|
+
#define LOAD_LIB(name) LoadLibrary((name))
|
|
12
|
+
#define GET_SYM(module, sym) GetProcAddress((module), (sym))
|
|
13
|
+
|
|
14
|
+
#else
|
|
15
|
+
|
|
16
|
+
#define _GNU_SOURCE
|
|
17
|
+
#include <dlfcn.h>
|
|
18
|
+
|
|
19
|
+
typedef uint8_t BYTE;
|
|
20
|
+
typedef uint32_t DWORD;
|
|
21
|
+
typedef void * HANDLE;
|
|
22
|
+
|
|
23
|
+
#define LOAD_LIB(name) dlopen((name), RTLD_LAZY)
|
|
24
|
+
#define GET_SYM(module, sym) dlsym((module), (sym))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#define NP_BUFSIZE (4096)
|
|
33
|
+
#define KEY_BUFSIZE (255)
|
|
34
|
+
|
|
35
|
+
#define ERR_OK (0)
|
|
36
|
+
|
|
37
|
+
#define ERR_INVALID_CMD_LINE (2)
|
|
38
|
+
|
|
39
|
+
#define ERR_COULD_NOT_LOAD_DLL (16)
|
|
40
|
+
#define ERR_COULD_NOT_LOAD_FUNC (17)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
char dllname[NP_BUFSIZE] = {0};
|
|
44
|
+
|
|
45
|
+
DWORD GetKey(char * const dllName, BYTE privilege, BYTE lenSeed, BYTE * seed, BYTE * lenKey, BYTE * key);
|
|
46
|
+
void hexlify(uint8_t const * const buf, uint16_t len);
|
|
47
|
+
|
|
48
|
+
typedef DWORD (*XCP_GetAvailablePrivilegesType)(BYTE * privilege);
|
|
49
|
+
typedef DWORD (*XCP_ComputeKeyFromSeedType)(BYTE privilege, BYTE lenSeed, BYTE *seed, BYTE * lenKey, BYTE * key);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
uint8_t keyBuffer[KEY_BUFSIZE] = {0};
|
|
53
|
+
uint8_t seedBuffer[KEY_BUFSIZE] = {0};
|
|
54
|
+
char nameBuffer[KEY_BUFSIZE] = {0};
|
|
55
|
+
uint8_t keylen = KEY_BUFSIZE;
|
|
56
|
+
uint8_t seedlen = 0;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
void hexlify(uint8_t const * const buf, uint16_t len)
|
|
60
|
+
{
|
|
61
|
+
for (uint16_t idx = 0; idx < len; ++idx) {
|
|
62
|
+
printf("%02X", buf[idx]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
DWORD GetKey(char * const dllName, BYTE privilege, BYTE lenSeed, BYTE * seed, BYTE * lenKey, BYTE * key)
|
|
67
|
+
{
|
|
68
|
+
HANDLE hModule = LOAD_LIB(dllName);
|
|
69
|
+
XCP_ComputeKeyFromSeedType XCP_ComputeKeyFromSeed;
|
|
70
|
+
|
|
71
|
+
if (hModule != NULL) {
|
|
72
|
+
XCP_ComputeKeyFromSeed = (XCP_ComputeKeyFromSeedType)GET_SYM(hModule, "XCP_ComputeKeyFromSeed");
|
|
73
|
+
//printf("fp: %p\n", XCP_ComputeKeyFromSeed);
|
|
74
|
+
if (XCP_ComputeKeyFromSeed != NULL) {
|
|
75
|
+
return XCP_ComputeKeyFromSeed(privilege, lenSeed, seed, lenKey, key);
|
|
76
|
+
} else {
|
|
77
|
+
return ERR_COULD_NOT_LOAD_FUNC;
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
return ERR_COULD_NOT_LOAD_DLL;
|
|
81
|
+
}
|
|
82
|
+
return ERR_OK;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
int main(int argc, char ** argv)
|
|
88
|
+
{
|
|
89
|
+
BYTE privilege = 0;
|
|
90
|
+
int idx;
|
|
91
|
+
DWORD res;
|
|
92
|
+
char cbuf[3] = {0};
|
|
93
|
+
|
|
94
|
+
for (idx = 1; idx < argc; ++idx) {
|
|
95
|
+
if (idx == 1) {
|
|
96
|
+
strcpy(dllname, argv[idx]);
|
|
97
|
+
} else if (idx == 2) {
|
|
98
|
+
privilege = atoi(argv[idx]);
|
|
99
|
+
} else if (idx == 3) {
|
|
100
|
+
strcpy(nameBuffer, argv[idx]);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
seedlen = strlen(nameBuffer) >> 1;
|
|
105
|
+
for (idx = 0; idx < seedlen; ++idx) {
|
|
106
|
+
cbuf[0] = nameBuffer[idx * 2];
|
|
107
|
+
cbuf[1] = nameBuffer[(idx * 2) + 1 ];
|
|
108
|
+
cbuf[2] = '\x00';
|
|
109
|
+
seedBuffer[idx] = strtol(cbuf, 0, 16);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
res = GetKey((char *)&dllname, privilege, seedlen, (BYTE *)&seedBuffer, &keylen, (BYTE *)&keyBuffer);
|
|
113
|
+
if (res == 0) {
|
|
114
|
+
hexlify(keyBuffer, keylen);
|
|
115
|
+
}
|
|
116
|
+
}
|
pyxcp/asamkeydll.sh
ADDED