Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTSerialBUS giving qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000.
Garza last edited by
Im using the sample GUI for reading CAN data on a pc that has PeakCAN hardware, Im using SocketCAN on Ubuntu. My question is why does the GUI always get :
RTNETLINK answers: Operation not permitted
when I try to configure the CAN connection from the connect window. I noticed that I need to do the CAN channel set up from the command line or otherwise the GUI cannot make the channels go UP or change their configuration.
Even If I configure the channels via "iplink set can0 up" only then is the GUI able to see can0 and also after giving connect I get the RTNETLINK. So This connect window is practially only to choose the channel number and set the paramenter of the channel to the same ones done through iplink or other wise the messages are lost.
Does anybody know why is this?
to get rid of the RTNETLINK answers: Operation not permitted error run the application as root , as described in the Configuration parameter key section here: https://doc.qt.io/qt-5/qtserialbus-socketcan-overview.html#creating-can-bus-devices
I am running the can example project as root, but still get message:
qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000
Can anyone help?
can you add a
qDebug() << m_canDevice->errorString()to the example, around line 150 in mainwindow.cpp after the configuration is applied, and see what this gives?
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...
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
libsocketcaninstalled, do you?
Hi @aha_1980 ,
querying the error from the CAN device right after
connectDevice()doesn't return an error either.
strange. Can you file a bugreport at bugreports.qt.io and add a link to the report here?
Edit: Forget what I said. I can see where the error comes from:
success = libSocketCan->setBitrate(canSocketName, bitRate);
I will create a patch soon.
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
the bug is reported here: https://bugreports.qt.io/browse/QTBUG-89066
Thank you @aha_1980 for supporting!
thanks! No promises for a fast fix though, I'm pretty busy ATM.
mbn12 last edited by
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?
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