QTSerialBUS giving qt.canbus.plugins.socketcan: Cannot apply parameter: 4 with value: 1000000.
-
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 @aha_1980 ,
querying the error from the CAN device right after
connectDevice()
doesn't return an error either.libsocketcan
is installed.BR
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 @aha_1980 ,
querying the error from the CAN device right after
connectDevice()
doesn't return an error either.libsocketcan
is installed.BR
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
-
Hi,
the bug is reported here: https://bugreports.qt.io/browse/QTBUG-89066
Thank you @aha_1980 for supporting!
Regards
-
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
-
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
@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." -
You can workaround this by doing m_canDevice->setConfigurationParameter(QCanBusDevice::BitRateKey, QVariant()); before the call to connectDevice...
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.