pyxcp 0.21.6__cp312-cp312-win32.whl → 0.21.9__cp312-cp312-win32.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.

pyxcp/__init__.py CHANGED
@@ -24,5 +24,5 @@ from .transport import Eth
24
24
  from .transport import SxI
25
25
  from .transport import Usb
26
26
 
27
- # if you update this manually, do not forget to update .bumpversion.cfg
28
- __version__ = "0.21.6"
27
+ # if you update this manually, do not forget to update .bumpversion.cfg and pyproject.toml
28
+ __version__ = "0.21.9"
pyxcp/master/master.py CHANGED
@@ -218,17 +218,20 @@ class Master:
218
218
  self.DWORD_unpack = makeDWordUnpacker(byteOrderPrefix)
219
219
  self.DLONG_pack = makeDLongPacker(byteOrderPrefix)
220
220
  self.DLONG_unpack = makeDLongUnpacker(byteOrderPrefix)
221
-
221
+ self.slaveProperties.bytesPerElement = None # Download/Upload commands are using element- not byte-count.
222
222
  if self.slaveProperties.addressGranularity == types.AddressGranularity.BYTE:
223
223
  self.AG_pack = struct.Struct("<B").pack
224
224
  self.AG_unpack = struct.Struct("<B").unpack
225
+ self.slaveProperties.bytesPerElement = 1
225
226
  elif self.slaveProperties.addressGranularity == types.AddressGranularity.WORD:
226
227
  self.AG_pack = self.WORD_pack
227
228
  self.AG_unpack = self.WORD_unpack
229
+ self.slaveProperties.bytesPerElement = 2
228
230
  elif self.slaveProperties.addressGranularity == types.AddressGranularity.DWORD:
229
231
  self.AG_pack = self.DWORD_pack
230
232
  self.AG_unpack = self.DWORD_unpack
231
- # self.connected = True
233
+ self.slaveProperties.bytesPerElement = 4
234
+ # self.connected = True
232
235
  return result
233
236
 
234
237
  @wrapped
@@ -431,6 +434,7 @@ class Master:
431
434
  Parameters
432
435
  ----------
433
436
  length : int
437
+ Number of elements (address granularity).
434
438
 
435
439
  Note
436
440
  ----
@@ -440,24 +444,23 @@ class Master:
440
444
  -------
441
445
  bytes
442
446
  """
443
-
447
+ byte_count = length * self.slaveProperties.bytesPerElement
444
448
  response = self.transport.request(types.Command.UPLOAD, length)
445
- if length > (self.slaveProperties.maxCto - 1):
446
- block_response = self.transport.block_receive(length_required=(length - len(response)))
449
+ if byte_count > (self.slaveProperties.maxCto - 1):
450
+ block_response = self.transport.block_receive(length_required=(byte_count - len(response)))
447
451
  response += block_response
448
452
  elif self.transport_name == "can":
449
453
  # larger sizes will send in multiple CAN messages
450
454
  # each valid message will start with 0xFF followed by the upload bytes
451
455
  # the last message might be padded to the required DLC
452
- rem = length - len(response)
456
+ rem = byte_count - len(response)
453
457
  while rem:
454
458
  if len(self.transport.resQueue):
455
459
  data = self.transport.resQueue.popleft()
456
460
  response += data[1 : rem + 1]
457
- rem = length - len(response)
461
+ rem = byte_count - len(response)
458
462
  else:
459
463
  sleep(SHORT_SLEEP)
460
-
461
464
  return response
462
465
 
463
466
  @wrapped
@@ -467,6 +470,8 @@ class Master:
467
470
 
468
471
  Parameters
469
472
  ----------
473
+ length : int
474
+ Number of elements (address granularity).
470
475
  address : int
471
476
  addressExt : int
472
477
 
@@ -475,7 +480,12 @@ class Master:
475
480
  bytes
476
481
  """
477
482
  addr = self.DWORD_pack(address)
478
- return self.transport.request(types.Command.SHORT_UPLOAD, length, 0, addressExt, *addr)
483
+ byte_count = length * self.slaveProperties.bytesPerElement
484
+ max_byte_count = self.slaveProperties.maxCto - 1
485
+ if byte_count > max_byte_count:
486
+ self.logger.warn(f"SHORT_UPLOAD: {byte_count} bytes exceeds the maximum value of {max_byte_count}.")
487
+ response = self.transport.request(types.Command.SHORT_UPLOAD, length, 0, addressExt, *addr)
488
+ return response[:byte_count]
479
489
 
480
490
  @wrapped
481
491
  def buildChecksum(self, blocksize: int):
pyxcp/transport/can.py CHANGED
@@ -321,7 +321,7 @@ class Can(BaseTransport):
321
321
  self.processResponse(
322
322
  payload,
323
323
  len(payload),
324
- counter=self.counterReceived + 1,
324
+ counter=(self.counterReceived + 1) & 0xffff,
325
325
  recv_timestamp=recv_timestamp,
326
326
  )
327
327
 
@@ -8,6 +8,9 @@ from time import perf_counter
8
8
  from time import sleep
9
9
  from time import time
10
10
 
11
+ import usb.backend.libusb1 as libusb1
12
+ import usb.backend.libusb0 as libusb0
13
+ import usb.backend.openusb as openusb
11
14
  import usb.core
12
15
  import usb.util
13
16
 
@@ -29,6 +32,7 @@ class Usb(BaseTransport):
29
32
  "reply_endpoint_number": (int, True, 1),
30
33
  "vendor_id": (int, False, 0),
31
34
  "product_id": (int, False, 0),
35
+ "library": (str, False, "") # absolute path to USB shared library
32
36
  }
33
37
  HEADER = struct.Struct("<2H")
34
38
  HEADER_SIZE = HEADER.size
@@ -43,6 +47,7 @@ class Usb(BaseTransport):
43
47
  self.interface_number = self.config.get("interface_number")
44
48
  self.command_endpoint_number = self.config.get("command_endpoint_number")
45
49
  self.reply_endpoint_number = self.config.get("reply_endpoint_number")
50
+ self.library = self.config.get("library")
46
51
  self.device = None
47
52
 
48
53
  self.status = 0
@@ -55,15 +60,25 @@ class Usb(BaseTransport):
55
60
  self._packets = deque()
56
61
 
57
62
  def connect(self):
63
+ if self.library:
64
+ for backend_provider in (libusb1, libusb0, openusb):
65
+ backend = backend_provider.get_backend(find_library=lambda x: self.library)
66
+ if backend:
67
+ break
68
+ else:
69
+ backend = None
70
+
58
71
  if self.vendor_id and self.product_id:
59
72
  kwargs = {
60
73
  "find_all": True,
61
74
  "idVendor": self.vendor_id,
62
75
  "idProduct": self.product_id,
76
+ "backend": backend,
63
77
  }
64
78
  else:
65
79
  kwargs = {
66
80
  "find_all": True,
81
+ "backend": backend,
67
82
  }
68
83
 
69
84
  for device in usb.core.find(**kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyxcp
3
- Version: 0.21.6
3
+ Version: 0.21.9
4
4
  Summary: Universal Calibration Protocol for Python
5
5
  Keywords: automotive,ecu,xcp,asam,autosar
6
6
  Author: Christoph Schueler
@@ -1,4 +1,4 @@
1
- pyxcp/__init__.py,sha256=4l-w2zNdkVviaSUSTwh61dbvVE6HKKtVUKt3JQ5K_jQ,727
1
+ pyxcp/__init__.py,sha256=ZX9y5UF2dvHjSpwztOnczBmD28aII5Qu6Xts6pWZxuA,746
2
2
  pyxcp/aml/EtasCANMonitoring.a2l,sha256=hEHpb3GpuFDvU6GpAiuV028mu7MUXtfE7wslPA0GlZg,1640
3
3
  pyxcp/aml/EtasCANMonitoring.aml,sha256=xl0DdyeiIaLW0mmmJNAyJS0CQdOLSxt9dxfgrdSlU8Y,2405
4
4
  pyxcp/aml/ifdata_CAN.a2l,sha256=mQFDM6y9qyxUORYR1L0m8fMJ7S1oGheuD8ouEeYxEnI,614
@@ -72,7 +72,7 @@ pyxcp/examples/xcphello_recorder.py,sha256=RbnuMzk67zszp3t0PAEcpXzuZELHYq-3VovZl
72
72
  pyxcp/logger.py,sha256=-g6VIWsu7uyPilZHz41qWUTha1B1a0ZTGJwckMxaTjI,1991
73
73
  pyxcp/master/__init__.py,sha256=sZOjpI4cZS_kuTXYGQ3R6FL96w0bNbWTtNzSZAtngUw,329
74
74
  pyxcp/master/errorhandler.py,sha256=eCO3RWqfv5CTV84HBw6i26NSmU0L6LGZzq5EsmgSu_s,13622
75
- pyxcp/master/master.py,sha256=4FJk3QNXP-5wsUTFuEOp09Dk2HfEyZtdFplIo_oLvDc,71861
75
+ pyxcp/master/master.py,sha256=GNw_EH2zGCu9qjmiut8eXrqyr9egRS2lGVk2H34e9n0,72676
76
76
  pyxcp/recorder/__init__.py,sha256=hdIkTKrGePj8-7A5UpvNIaZnY44ayh4fP-0gfzm14a8,2260
77
77
  pyxcp/recorder/build_clang.cmd,sha256=JvFngSnb28XcBGXxC6MGrcOCGYfahOIvHpgRpqbA6HQ,175
78
78
  pyxcp/recorder/build_clang.sh,sha256=zmU3nZxaNH1pxGWMyQ-S541TuVqxS00p3iPR9NUP4Ec,181
@@ -107,7 +107,7 @@ pyxcp/tests/test_utils.py,sha256=qmsJfyYhDBtdx60U1SwZakETgdmB27KpMVipVIwSDz8,974
107
107
  pyxcp/timing.py,sha256=ZO320bMqtAbFPkQc8JnGV9FGxDYEyN4Co6kRTyIkRVA,1732
108
108
  pyxcp/transport/__init__.py,sha256=GnoxnBa7MTIR-4pdfODsfDJepNv5G8sYsU_pAq8wCLQ,307
109
109
  pyxcp/transport/base.py,sha256=dKcVCa6Xkw7BvuUcryfitCVa_Oo8lkqlAB15BZcEt6I,14786
110
- pyxcp/transport/can.py,sha256=wYswrln4dbawQfWuB7uPoh-5thR3-SPSrZNZWWVnfSs,12642
110
+ pyxcp/transport/can.py,sha256=FauEdOBqMybE2ubr4wwonSAvoo9AZwDQsl6W1BAiF_w,12653
111
111
  pyxcp/transport/candriver/__init__.py,sha256=2un8k8GFsH9dCD4_ZThEPCMZq_JL335e0Wzkk034rmo,48
112
112
  pyxcp/transport/candriver/pc_canalystii.py,sha256=zHeWKG3UUklW6unVfWldkgKBEREFUTKMpEqpPsahmZY,740
113
113
  pyxcp/transport/candriver/pc_etas.py,sha256=S4rMqquhz09GL6-Lrei9awzqMUabidyuSowwh_Uop4o,627
@@ -134,14 +134,14 @@ pyxcp/transport/cxx_ext/tests/test_pool.cpp,sha256=vztxjVtzXXoTKWt4KHoiTN-UpjGMH
134
134
  pyxcp/transport/cxx_ext/tests/test_timestamp.cpp,sha256=6V_rZJR9rtQgIO-CFdFIWSx7iAUga2C9BRr5TBJXgNc,540
135
135
  pyxcp/transport/eth.py,sha256=PoCafj5BF1Ir0SLEvscZivXTEihGJPo7EAgYq5WHvok,7923
136
136
  pyxcp/transport/sxi.py,sha256=VVqiXD800GociBryMtXma9l2QspQpwECE1eNy4Cq4us,2583
137
- pyxcp/transport/usb_transport.py,sha256=ho8-i3mbVtBAp6uRdTytO0-EQpifZHHbKY-2CwRcw54,7284
137
+ pyxcp/transport/usb_transport.py,sha256=hK4FTl1DM7xDoNjcBXoMeb-YZfk2SP3BihlbJM6mL2w,7888
138
138
  pyxcp/types.py,sha256=uV-f4XlG1IjqeIT8PGUnb5CwEBcX10JQ7aDt3gWJrwk,24950
139
139
  pyxcp/utils.py,sha256=b7zNSMLOYhgKBHXQSDbSfGYzhgXlje_xsJK0LztdNTk,1960
140
140
  pyxcp/vector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  pyxcp/vector/map.py,sha256=5FPdKgvP5CKuas2R5PIsxUvip-bVp7kwrEcQAZjZcAw,2369
142
- rekorder.cp312-win32.pyd,sha256=gkoecgIoUGpX2x5xonqxaLd8fR0I6mjJ6ICVaGSOEQE,141824
143
- pyxcp-0.21.6.dist-info/entry_points.txt,sha256=wL4Cgx0wIAbuEr93nPewLCL-6DCSunxxTkui-bibme8,219
144
- pyxcp-0.21.6.dist-info/WHEEL,sha256=4b0mtI0-qo1BufjhFYXXEqC6LZSbmC3VzWKotlxOTkM,93
145
- pyxcp-0.21.6.dist-info/METADATA,sha256=wnrJ_7sGy-beWOXX_2budDF1d_jvN1OBvhCPN1trNzA,3861
146
- pyxcp-0.21.6.dist-info/licenses/LICENSE,sha256=fTqV5eBpeAZO0_jit8j4Ref9ikBSlHJ8xwj5TLg7gFk,7817
147
- pyxcp-0.21.6.dist-info/RECORD,,
142
+ rekorder.cp312-win32.pyd,sha256=TR-9NniT40HIWZ1u8EXkos6VRPfYhiHiFvp7kh9-RUg,141824
143
+ pyxcp-0.21.9.dist-info/entry_points.txt,sha256=wL4Cgx0wIAbuEr93nPewLCL-6DCSunxxTkui-bibme8,219
144
+ pyxcp-0.21.9.dist-info/WHEEL,sha256=4b0mtI0-qo1BufjhFYXXEqC6LZSbmC3VzWKotlxOTkM,93
145
+ pyxcp-0.21.9.dist-info/METADATA,sha256=9SEGwDGqBqsFd_2HpxNHjbV6C4I4iwgJx1XhjQmFtGE,3861
146
+ pyxcp-0.21.9.dist-info/licenses/LICENSE,sha256=fTqV5eBpeAZO0_jit8j4Ref9ikBSlHJ8xwj5TLg7gFk,7817
147
+ pyxcp-0.21.9.dist-info/RECORD,,
rekorder.cp312-win32.pyd CHANGED
Binary file
File without changes