Open Source Telephony
 help / color / mirror / Atom feed
* GPRS Attach/Detach
@ 2018-02-14 10:03 Nikolas Sepos
  2018-02-14 16:54 ` Denis Kenzior
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolas Sepos @ 2018-02-14 10:03 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2555 bytes --]

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
nikolas(a)endocode.com

------
Endocode AG, Brückenstraße 5A, 10179 Berlin
info(a)endocode.com | www.endocode.com

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

Registergericht: Amtsgericht
Charlottenburg - HRB 150748 B

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 5422 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-19 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 10:03 GPRS Attach/Detach Nikolas Sepos
2018-02-14 16:54 ` Denis Kenzior
2018-02-19 12:55   ` Nikolas Sepos
2018-02-19 16:36     ` Denis Kenzior
2018-02-19 17:58       ` Nikolas Sepos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox