[PATCH 3/5] allow space before ICCID in +CRSM response. Thuraya XT sends +CRSM: 144, 0, 9888...

Aleksander Morgado aleksander at aleksander.es
Thu Feb 11 14:32:29 UTC 2016


On Thu, Feb 11, 2016 at 1:45 PM, Thomas Sailer
<sailer at sailer.dynip.lugs.ch> wrote:
> From: Thomas Sailer <t.sailer at alumni.ethz.ch>
>
> Signed-off-by: Thomas Sailer <t.sailer at alumni.ethz.ch>
> ---
>  src/mm-base-sim.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c
> index 104e7f8..20b9923 100644
> --- a/src/mm-base-sim.c
> +++ b/src/mm-base-sim.c
> @@ -956,7 +956,7 @@ parse_iccid (const gchar *response,
>          success = TRUE;
>      else {
>          /* May not include quotes... */
> -        if (sscanf (str, "%d,%d,%20c", &sw1, &sw2, (char *) &buf) == 3)
> +        if (sscanf (str, "%d,%d, %20c", &sw1, &sw2, (char *) &buf) == 3)
>              success = TRUE;

Could you update this and make it a regex, and totally avoid the 2
chained sscanf()s we have there? (the first one is just up in the
context, not in the patch diff). Looks like the regex would be very
easy, and we can have it as a mm_modem_helper_parse_crsm_response()
method in mm-modem-helpers.c, with a couple of unit tests for the
different cases... :)

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list