QTSerialBUS giving qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000.
-
Hi,
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?
Thanks -
Hi Garza,
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: 1000000Can anyone help?
Regards,
lera -
Hi @lera,
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?Regards
-
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
-
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
-
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.
-
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
-
@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." -
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.