2009/5/21 Dan Williams <[email protected]>

> On Wed, 2009-05-20 at 10:23 +0200, Pablo Martí Gamboa wrote:
> > Hi all,
> >
> > I've just been bitten by a small bug in src/nm-gsm-device.c +443:
> >
> > const char *responses[] = { "+CREG: 0,0", "+CREG: 0,1", "+CREG: 0,2",
> > "+CREG: 0,3", "+CREG: 0,5", NULL };
> >
> >
> > If an external implementation has send '+CREG=1' those terminators
> > won't work. I think that you should just check the last part of the
> > +CREG response.
>
> What would the response & terminator look like in that case?  Not quite
> sure I follow.


Something along the lines of what is done in ModemManager:
if (g_str_has_prefix (response->str, "+CREG: ")) {
    int unsolicited, stat;
    sscanf (response->str + 7, "%d,%d", &unsolicited, &stat);
    ....
    switch(stat) {
        case 5: break;
        case 4: break;
        ....
    }
}

Regards,
Pablo

-- 
Pablo Martí
http://www.linkedin.com/in/pmarti || http://www.warp.es
python -c "print '706d6172746940776172702e6573'.decode('hex')"
_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to