unplug replug usb cable connected to modem

Aleksander Morgado aleksander at aleksander.es
Thu Nov 17 09:04:06 UTC 2016

On Wed, Nov 16, 2016 at 11:35 PM, Shilpa Velamuri <shilpa.vel at gmail.com> wrote:
> Application is talking to Telit LE910 modem over USB using libqmi with the
> proxy flag to open device connection.
> When i unplug and replug the USB cable connected to modem,
> the callback in qmi_device_new () never gets invoked.
> I need to kill my process and restart it for things to work.
> If i do not unplug the USB and run through the same client release/device
> close and reopen sequence, everything works just fine.
> Could you help me, by telling me why qmi_device_new() callback never gets
> invoked, when USB is unplugged and replugged in.

The callback given in qmi_device_new() isn't supposed to be called
automatically on unplug/replug. Actually, libqmi doesn't do any
monitoring of whether the port is available or gone; if it goes away
the QmiDevice will stop working (e.g. the qmi-proxy will return errors
to the QmiDevice in your application).

If you need to handle the case of unplug/replug, I'd suggest you use
GUdev to do such monitoring, so that whenever the /dev/cdc-wdm port is
gone, you trigger a re-creation of the QmiDevice from scratch.


More information about the libqmi-devel mailing list