PCBUSB-Library
PCBUSB-Library copied to clipboard
PeakCanUSB is not found in QtCanBus PeakCan Plugin
PeakCanUSB is not scanned under QtCanBus PeakCan Plugin
Steps to reproduce:
- Ensure same Qt application running fine and able to connect PeakCan via QtCanBusPeakCanPlugin ("peakcan") on Linux (:+1:)
- Build same QtAppplication on MacOS (M1 Chip) + install https://github.com/mac-can/PCBUSB-Library/releases/download/v0.11.2/macOS_Library_for_PCANUSB_v0.11.2.tar.gz
- Observe that upon start, calling this snippet result on empty devices list (:-1:)
auto devices = QCanBus::instance()->availableDevices("peakcan", &errorString);
Dear @OckyKristanto-TomTom,
to help you, we need more information.
- Which Peak CAN hardware are you using?
- Which Qt version is that?
- What does the variable
errorString
contain when theavailableDevices()
call fails? - Can you please enable logging inside QtCanBus? E.g. by adding the following lines before creating
QCoreApplication
:
#include <QLoggingCategory>
...
QLoggingCategory::setFilterRules("qt.canbus* = true");
Then you should see the output in the Terminal or in QtCreator. Please post it here.
Hi @andre-hartmann , just today I found the solution into it.
Indeed in the errorString
, it is mentioned that Qt can't find pcanbasic
in any library locations.
This command solves the issue:
sudo ln -s libPCBUSB.0.11.2.dylib pcanbasic.dylib
Maybe it is worth to be added into install.sh
?
This command solves the issue:
sudo ln -s libPCBUSB.0.11.2.dylib pcanbasic.dylib
Maybe it is worth to be added into
install.sh
?
The name of the library is libPCBUSB
. "PCAN" and "PCANBasic" are registered word marks of company PEAK-System Technik GmbH, Darmstadt.
If the symbolic link pcanbasic.dylib
is a required for use with the Qt Serial Bus API, I can write a note in the installation instructions. @andre-hartmann Is this a prerequisite for working with the Qt Serial Bus API?
The name of the library is libPCBUSB.
Which is what I expected:
#ifdef Q_OS_MACOS
pcanLibrary->setFileName(QStringLiteral("PCBUSB"));
#else
pcanLibrary->setFileName(QStringLiteral("pcanbasic"));
#endif
is the code in https://code.qt.io/cgit/qt/qtserialbus.git/tree/src/plugins/canbus/peakcan/peakcan_symbols_p.h?h=6.4#n325
So what we originaly demanded was the unversioned name PCBUSB
. Maybe that broke with MacOS on ARM CPUs, i.e. Q_OS_MACOS is no longer valid? Will need to check.
@OckyKristanto-TomTom
Please tell us, which Qt version that is. Also, did you build Qt from source or did you download the binaries? Thanks!
I used Qt5.12.6
. Download the binaries (installer)
Do you know in which Qt version does the fix being introduced?
Once we know the version, then maybe we can write in the note that for Qt Version < <fixed-version>
extra linkage is needed.
Well, its getting complicated here.
Official support for PCBUSB 0.8 was added in Qt 5.14.0, and this support continues until now with the Qt 6 series.
Unfortunately, PCBUSB 0.9 changed the binary format of some API calls, and therefore we don't have official support from Qt side yet. I have a Qt patch ready for testing [1], but there is currently no review progress. Any help (especially testing) in that regard is welcome.
[1] https://codereview.qt-project.org/c/qt/qtserialbus/+/381442