Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QTSerialBUS giving qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000.
Forum Updated to NodeBB v4.3 + New Features

QTSerialBUS giving qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
15 Posts 7 Posters 4.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lera
    wrote on last edited by
    #4

    Hi @aha_1980 ,

    the error string placed around line 150 is empty.

    However, the configuration is applied when connectDevice() is called (this is what causes the mentioned error message). Querying the error from the CAN device right after connecting doesn't return an error either...

    BR

    aha_1980A 1 Reply Last reply
    1
    • L lera

      Hi @aha_1980 ,

      the error string placed around line 150 is empty.

      However, the configuration is applied when connectDevice() is called (this is what causes the mentioned error message). Querying the error from the CAN device right after connecting doesn't return an error either...

      BR

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #5

      Hi @lera,

      However, the configuration is applied when connectDevice() is called (this is what causes the mentioned error message).

      ah ok. Well, then try placing the qDebug() after the connectDevice() line and see if this gives more insight...

      You do have libsocketcan installed, do you?

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lera
        wrote on last edited by
        #6

        Hi @aha_1980 ,

        querying the error from the CAN device right after connectDevice() doesn't return an error either.

        libsocketcan is installed.

        BR

        aha_1980A 2 Replies Last reply
        0
        • L lera

          Hi @aha_1980 ,

          querying the error from the CAN device right after connectDevice() doesn't return an error either.

          libsocketcan is installed.

          BR

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by aha_1980
          #7

          Hi @lera,

          strange. Can you file a bugreport at bugreports.qt.io and add a link to the report here?

          Thanks!

          Edit: Forget what I said. I can see where the error comes from:

          https://code.woboq.org/qt5/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp.html#376 must be changed to:

          success = libSocketCan->setBitrate(canSocketName, bitRate);

          I will create a patch soon.

          Qt has to stay free or it will die.

          1 Reply Last reply
          2
          • L lera

            Hi @aha_1980 ,

            querying the error from the CAN device right after connectDevice() doesn't return an error either.

            libsocketcan is installed.

            BR

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #8

            Hi @lera,

            I've modified the code for testing, but the error persists.

            I think the bitrate cannot be changed while the interface is up, so the change might be a bigger one. Can you please create a bugreport on bugreports.qt.io and add a link from here so others can follow later?

            Thanks and regards

            Qt has to stay free or it will die.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lera
              wrote on last edited by
              #9

              Hi,

              the bug is reported here: https://bugreports.qt.io/browse/QTBUG-89066

              Thank you @aha_1980 for supporting!

              Regards

              aha_1980A 1 Reply Last reply
              1
              • L lera

                Hi,

                the bug is reported here: https://bugreports.qt.io/browse/QTBUG-89066

                Thank you @aha_1980 for supporting!

                Regards

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #10

                Hi @lera,

                thanks! No promises for a fast fix though, I'm pretty busy ATM.

                Regards

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mbn12
                  wrote on last edited by
                  #11

                  I am trygin to use QT 5.15 CANBus without success.

                  Based on the forum messages and open issues, the bug still persists? QTSerialBUS/SocketCAN is completely unusable in 5.15 as of today? Or is there any workaround?

                  Thank you

                  L 1 Reply Last reply
                  0
                  • M mbn12

                    I am trygin to use QT 5.15 CANBus without success.

                    Based on the forum messages and open issues, the bug still persists? QTSerialBUS/SocketCAN is completely unusable in 5.15 as of today? Or is there any workaround?

                    Thank you

                    L Offline
                    L Offline
                    lera
                    wrote on last edited by
                    #12

                    Hi @mbn12 ,
                    the bug still persists. However, it only concerns setting the bitrate from an application. Workaround: The bitrate needs to be set when the interface is brought up:

                    ip link set can0 up type can bitrate 1000000
                    

                    BR

                    D 1 Reply Last reply
                    1
                    • L lera

                      Hi @mbn12 ,
                      the bug still persists. However, it only concerns setting the bitrate from an application. Workaround: The bitrate needs to be set when the interface is brought up:

                      ip link set can0 up type can bitrate 1000000
                      

                      BR

                      D Offline
                      D Offline
                      danielvolt
                      wrote on last edited by
                      #13

                      @lera what do you mean by this? I'm trying to use the CANBus but it won't work. Could you please elaborate on how to get around "qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 500000."?

                      I tried setting the bitrate when i bring up the interface on boot, i get : "RTNETLINK answers: Device or resource busy
                      qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 500000."

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        atreat
                        wrote on last edited by
                        #14

                        You can workaround this by doing m_canDevice->setConfigurationParameter(QCanBusDevice::BitRateKey, QVariant()); before the call to connectDevice...

                        T 1 Reply Last reply
                        2
                        • A atreat

                          You can workaround this by doing m_canDevice->setConfigurationParameter(QCanBusDevice::BitRateKey, QVariant()); before the call to connectDevice...

                          T Offline
                          T Offline
                          tozymandias
                          wrote on last edited by
                          #15

                          @atreat

                          All, I know this is quite old ... but the suggested workaround is not working for me.

                          I am just not able to use socketcan on raspberry pi with QT at the moment.
                          I can make "candump can0" work with 500Kbit bitrate setting from the command line, but I am just not able to view CAN traffic using my application.

                          Does anybody have an example code snippet showcasing the workaround ?

                          Is there a patch or fix for this? I have not been able to find anything.

                          Thanks.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved