Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeakCanUSB is not found in QtCanBus PeakCan Plugin #12

Open
OckyKristanto-TomTom opened this issue Nov 10, 2022 · 7 comments
Open

PeakCanUSB is not found in QtCanBus PeakCan Plugin #12

OckyKristanto-TomTom opened this issue Nov 10, 2022 · 7 comments
Labels
documentation Improvements or additions to documentation

Comments

@OckyKristanto-TomTom
Copy link

OckyKristanto-TomTom commented Nov 10, 2022

PeakCanUSB is not scanned under QtCanBus PeakCan Plugin

Steps to reproduce:

  1. Ensure same Qt application running fine and able to connect PeakCan via QtCanBusPeakCanPlugin ("peakcan") on Linux
    (:+1:)
  2. 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
  3. Observe that upon start, calling this snippet result on empty devices list (:-1:)
auto devices = QCanBus::instance()->availableDevices("peakcan", &errorString);
@andre-hartmann
Copy link

Dear @OckyKristanto-TomTom,

to help you, we need more information.

  1. Which Peak CAN hardware are you using?
  2. Which Qt version is that?
  3. What does the variable errorString contain when the availableDevices() call fails?
  4. 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.

@OckyKristanto-TomTom
Copy link
Author

OckyKristanto-TomTom commented Nov 11, 2022

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 ?

@mac-can
Copy link
Owner

mac-can commented Nov 11, 2022

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?

@andre-hartmann
Copy link

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.

@andre-hartmann
Copy link

@OckyKristanto-TomTom

Please tell us, which Qt version that is. Also, did you build Qt from source or did you download the binaries? Thanks!

@OckyKristanto-TomTom
Copy link
Author

OckyKristanto-TomTom commented Nov 12, 2022

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.

@andre-hartmann
Copy link

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

@mac-can mac-can added the documentation Improvements or additions to documentation label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants