rpmsg/smdpkt ports reset all CIDs when closing device
At the moment it is not possible to make use of the --client-cid
/ --client-no-release-cid
options in qmicli for rpmsg/smdpkt ports. The modem will always behave as if the CIDs do not exist.
Unlike USB ports (and likely also QRTR ports), rpmsg ports are somewhat "stateful", i.e. the modem is notified when we open and close them. It seems like the modem uses that as opportunity to reset the control port entirely when it is no longer used. Whenever we close the rpmsg chardev, the modem cleans up all CIDs that were not released. The only way to keep CIDs alive is to make sure we do not close the rpmsg chardev. In practice, this is not a problem when using ModemManager (because it runs continuously) but can be quite frustrating when attempting to use qmicli for testing.
Actually there is almost a convenient solution for this in libqmi. With the -p
option, qmicli spawns a qmi-proxy
in the background that would be able to keep the rpmsg chardev open. It works almost, the only problem is that it immediately closes device ports if there are no clients active:
If I disable this function entirely, --client-cid
/ --client-no-release-cid
can be used properly with rpmsg/smdpkt ports when also passing the -p
option to start the qmi-proxy.
For a proper solution I was thinking about the following:
- At least for rpmsg/smdpkt ports we should not close unused devices if there is a CID in
disowned_qmi_client_info_array
.- I'm not sure if we need to make this conditional for rpmsg/smdpkt, perhaps it would not hurt to keep USB ports open as well in that case?
- Perhaps
qmi-proxy
should track "disowned" CIDs per device instead of globally?- This would allow to close at least the devices that have no "disowned" CIDs, instead of keeping all of them open.
- Are the CIDs even portable across QMI ports?