Hello ofono maintainers,

i had an issue with a modem and the GPRS attach/detach command. It was
hanging my modem for 3 seconds (modem issue not ofono). So in order to work
around it i implemented attach and detach as NoOp (not sending
AT+CGATT=0/1) but still had to callback to ofono that i am attached or
detached. But in order for that to make it work i had to patch src/gprs.c

Here is the function i made changes to:

static void gprs_attached_update(struct ofono_gprs *gprs)
{
        ofono_bool_t attached;

        attached = gprs->driver_attached &&
                (gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
                        gprs->status ==
NETWORK_REGISTRATION_STATUS_ROAMING);

        if (attached == gprs->attached)
                return;

        /*
         * If an active context is found, a PPP session might be still
active
         * at driver level. "Attached" = TRUE property can't be signalled to
         * the applications registered on GPRS properties.
         * Active contexts have to be release at driver level.
         */
        if (attached == FALSE) {
                release_active_contexts(gprs);
                gprs->bearer = -1;
        } else if (have_active_contexts(gprs) == TRUE) {
                /*
                 * Some times the context activates after a detach event and
                 * right before an attach. We close it to avoid unexpected
open
                 * contexts.
                 */
                release_active_contexts(gprs);
                gprs->flags |= GPRS_FLAG_ATTACHED_UPDATE;
                return;
        }

        gprs_set_attached_property(gprs, attached);
}


I had to remove the `else if (have_active_contexts(gprs) == TRUE) { ... }`
block because when attached was TRUE i still had active context and i
didn't want it to be deactivated.

As the comments say it's to mitigate some PPP issues. Should that be the
case for all type of connections? What if my connection is RNDIS and not
PPP?

I hope i explained this well enough. If not please ask me to explain more.

Looking forward to your reply.

All the best,

---

Nikolas Sepos
DevOps Engineer @ Endocode AG
niko...@endocode.com

------
Endocode AG, Brückenstraße 5A, 10179 Berlin
i...@endocode.com | www.endocode.com

Vorstandsvorsitzender: Mirko Boehm
Vorstände: Dr. Thomas Fricke, Sebastian Sucker
Aufsichtsratsvorsitzende: Alexandra Boehm

Registergericht: Amtsgericht
Charlottenburg - HRB 150748 B
_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to