Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75204

Please add a possibility to specify the socket family used by the socketcan plugin for QCanBus

    XMLWordPrintable

    Details

    • Platform/s:
      Linux/Wayland, Linux/X11, Linux/Other display system
    • Commits:
      9f5b8ba590d424f82498fca5f2cc8594b1757ff0 (qt/qtserialbus/dev)

      Description

      The socketcanbackend.cpp opens the socket hardcoded:

      if (Q_UNLIKELY((canSocket = socket(PF_CAN, SOCK_RAW | SOCK_NONBLOCK, CAN_RAW)) < 0)) {
        setError(qt_error_string(errno), QCanBusDevice::CanBusError::ConnectionError);
        return false;
      }
      

      Now what if you have a device that does not use CAN_RAW as the family. But instead uses a different implementation defined by the hardware vendor?

      In my case, I have to pass "7" instead of whatever value CAN_RAW has, to get socketcan working on my device.

      Probably the socketcan plugin can get made configurable so that you can pass an arbitrary value here?
       

        Attachments

        For Gerrit Dashboard: QTBUG-75204
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            aha_1980 André Hartmann
            Reporter:
            darkmattercoder Jochen Bauer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes