On Fri, 2011-12-23 at 12:59 +0100, Aleksander Morgado wrote: > Hey, > > One of the things that annoys me when using ModemManager is that > whenever I plug in a modem, I need to wait for the modem to get all > ports probed before I can see the NM applet updated with the new > broadband-related menu elements. In the worst case, where the modem just > returns errors to probing, I may end up waiting forever unless I check > syslog. > > This long time to wait is mainly related to the fact that we probe all > ports of the modem trying to send several AT commands, or even trying to > see if the port is QCDM and such.
One reason here is that we don't know whether or not the modem will have more than one usable port. If, for example, one port responds very quickly which triggers creation of the modem object in D-Bus, which is then noticed by a connection manager which then attempts to start a WWAN connection, we may be still probing other ports when the connection request starts. It made the code a lot simpler to ensure that we had fully found the modem before exposing it. It might be simple enough to just ensure that we have at least two ports: the Data port and the Command port (whether AT, QMI, WMC, or QCDM/DIAG), and then expose the modem, and let the other ports finish probing after we have what we need. I'm not opposed to tagging certain ports via udev rules if we know they are going to be QMI or WMC or whatever too; I'm just against using that as the primary mechanism because it can and does change, especially for vendors that use the same USB IDs for multiple deivces, which happens often with phones and ZTE dongles. Tagging here can speed up probing too since we could skip a useless AT probe on a QCDM port. As long as we have logic in place to walk the parent/child relationships and always match up ports with their parent modem (so that we never get two USB interfaces of the same physical device exposed as two modems over D-Bus) then it doesn't really matter when the modem is exposed as long as we have a full understanding of it's capabilities. One other note; we may not be able to detect that a device supports EVDO until we can query it with QCDM/DIAG since sometimes the AT+GCAP won't report that. So capabilities need to be able to change too, but that was the whole point of the 06-api so that shouldn't be an issue there. > For example: > * I plugin a Huawei modem which exposes lots of ports. > * Probing is started in all of them in parallel > * The good AT ports reply instantly and probing ends quite fast for them. > * Non-AT ports go on with the probing, timing out in each AT command. > * Once all non-AT ports get timed out in the last command from the > probing sequence, we successfully initialize and export the modem, as we > got valid AT ports previously. We can initialize whenever the modem is valid, which at least means we have 1 data port and 1 command port. But since those can be the same port (and they are until additional ports are found) we need to be careful here or we may export a modem that only knows one port and have a connection manager start a connection using only that one port. Allowing export in this situation would imply that we are able to open and use secondary ports *while the connection is potentially active*, which isn't the case now and could be somewhat complicated in the code. > * If for whatever reason the probing completely fails, we don't really > notify it to the user in any way. > > This whole sequence may take up to 10-20s to complete. > > The new 06-api branch tries to minimize this by early trying to probe > just for AT support; and more improvements can even be done (like, if we > got an AT port already, just allow max one AT command timeout in the > other ports, just an idea). But, in order to minimize the effect of > probing ports which will end up timing out and not being used, I think > we could try to show to the user some status that the device was > detected and probing is ongoing. Even if the whole probing of the modem > takes 10s, the user could see an in-progress icon, or even a > notification that a modem was detected and support is being checked. > > So, a probing-specific ModemManager status could be of help here: > MM_PROBING_STATUS_IDLE, > MM_PROBING_STATUS_LAUNCHED, > MM_PROBING_STATUS_ONGOING, (device specific) > MM_PROBING_STATUS_FAILED, (device specific) > MM_PROBING_STATUS_COMPLETED (device specific) This would be per-modem specific status I assume? > Whenever a new modem is connected and probing launched, or when a > re-scan of modems is started, we would go to the LAUNCHED state. This makes it sound like it's an MM global state? > As soon as we create the Modem object once the first valid port is > probed, we would go to the ONGOING state. In this ONGOING state we The point of probing is to provide enough info to connection managers to do something useful with the modem, so if the manager still has to wait for the device's capabilities to be fully detected then exposing the modem before it's actually usable doesn't really speed things up. But I don't have a problem with exposing the modem earlier but not allowing it to be Enabled or something like that until we have complete information. Dan > already have enough modem-specific information, like Vendor/Product ID, > but the modem is not yet exported. We could signal that information so > that the user gets a "Initializing support for modem XXX" message as > soon as possible, and at least she knows that something is going on with > the newly connected device. > > When all ports of the modem get finally probed, the modem would get > initialized. If this initialization succeeds we would signal COMPLETED > and the probing-specific status would go back to IDLE if there are no > other devices being probed. If the initialization fails and we decide > the modem is not usable (e.g. when trying to check SIM PIN status we get > a NO SIM error), we would signal FAILED including the specific error. > > I think that with this new probing-related state we could improve a lot > the user experience, which right now is a bit "connect and wait for the > applet to hopefully show the device". > > Comments, other suggestions? > _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list