When is cdc-wdm0 ready?
aleksander at aleksander.es
Fri Sep 3 12:51:33 UTC 2021
> I'm having a problem in my app right now where I wait for
> /dev/cdc-wdm0 to appear then call:
> qmicli --device=/dev/cdc-wdm0 --device-open-qmi --dms-get-ids
> but it fails with:
> error: couldn't create client for the 'dms' service: CID
> allocation failed in the CTL client: Transaction timed out
> If I add a delay it works fine.
> Is there some way of checking if cdc-wdm0 is ready to receive commands?
A lot of new modules will require a lot of time between the cdc-wdm
port exposed in the system until the port is QMI operational. E.g. in
ModemManager we have a timeout of up to 45s.
The timeout in qmicli for the device open operation is by default
hardcoded to 15s, and for the QMI client allocation operation is 10s.
Ideally, these timeouts should be configurable by the qmicli user, but
they're not currrently.
So, right now, polling with a command until the command succeeds
doesn't seem like a bad solution. E.g. you could just attempt to
allocate and release a DMS client with "qmicli --device=/dev/cdc-wdm0
--device-open-qmi --dms-noop", and if it fails, retry until it
succeeds, with a max number of attempts or something.
I guess we could also have a new --wait-ready command in qmicli to do
a better wait process more similar to what ModemManager does.
More information about the libqmi-devel