mac-can / PCBUSB-Library

macOS® User-Space Driver for PCAN-USB Interfaces (Binaries only)
https://mac-can.com
Other
29 stars 0 forks source link

TPCANTimestamp corrupted starting in version 0.9.0 #2

Closed babldev closed 3 years ago

babldev commented 3 years ago

After upgrading from the 0.8.1 working driver to 0.9.0+, message timestamps are corrupted when accessed using https://github.com/hardbyte/python-can

0.8.1 (working)

Screen Shot 2021-02-09 at 2 47 54 PM

0.9.0 (broken)

Screen Shot 2021-02-09 at 2 49 25 PM

Did the serialization of timestamp offsets change in this release? https://github.com/hardbyte/python-can/blob/291af86e3898229a8bacebd82f4ff7a8b81a41c0/can/interfaces/pcan/basic.py#L505-L518

My setup: MacBook Pro (15-inch, 2018) macOS Catalina 10.15.4 (19E266)

babldev commented 3 years ago

Related https://github.com/hardbyte/python-can/pull/947

mac-can commented 3 years ago

That´s true. With version 0.9 the replacement for Windows data type DWORD (which is frequently used by PEAK´s PCANBasic API) was changed from unsigned long to UInt32. On Windows the data type long is 32-bit wide, and on Unix based system it is 64-bit wide. With this change the data types matches on all OS.

This issue is also tracked in the python-can project. Meanwhile PEAK added the PCBUSB library to their Python wrapper. My suggestion is to take this one instead of the patched one from the python-can repo. And of course the latest PCBUSB release.

babldev commented 3 years ago

thanks for the clarification, I can work with @kail on the python-can patch