Re: [MM] [PATCH v2] serial-port: avoid opening a serial port that has been disposed



On 30/11/12 02:18, Ben Chan wrote:
> It looks like the modem is getting disposed but then something is
> causing it to get enabled again after wakeup:
> 
> ModemManager[2858]: <debug> [1354146967.597474] [mm-base-modem.c:1252]
> finalize(): Modem (Samsung) '/sys/devices/s5p-ehci/usb1/1-2/1-2.1'
> completely disposed
> ModemManager[2858]: <info>  [1354147018.549702]
> [mm-broadband-modem.c:7341] enabling_step(): Modem enabling...
> ModemManager[2858]: <info>  [1354147018.549838] [mm-iface-modem.c:1176]
> mm_iface_modem_update_state():
> Modem /org/freedesktop/ModemManager1/Modem/1: state changed (disabled ->
> enabling)

Kind of. What I believe is happening is the following:

 * Modem starts to get connected. This modem (Icera-based Samsung) will
get confirmation of the successful connection via unsolicited messages.
So, once we send the IPDPACT command to request the connection, we just
sit waiting for the unsolicited reply to come.
 * While we are waiting, PC gets suspended. Serial ports get closed. But
we're still waiting for the unsolicited reply: we should detect that,
and process it as a failure in the connection request.
 * Anyway, we don't process that for now, so we end up with the modem
object waiting for a long time for the unsolicited message.
 * And while we wait, the PC wakes up from suspend, and starts probing
ports again, create a *new* modem object, we even get it connected and
disabled afterwards.
 * And suddenly, after some time, the timeout to wait for the connection
(of the first modem) gets fired and we end up fully disposing the modem
object.
 * The next enabling request that can be seen in the logs is actually
ok, that one is really for the second modem I believe.

So, things to fix:
 * Include unique modemID / bearerID in the logs.
 * Whenever we wait for an unsolicited message to keep on processing an
operation, we also need to consider the case where the port is forced to
be closed due to being removed. At least *Icera* and *HSO* are affected
by this issue.

-- 
Aleksander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]