Samsung GI-B3740 support in Modem-manager?
Oskar Enoksson
enok at lysator.liu.se
Tue Oct 28 11:20:54 PDT 2014
On 10/28/2014 09:27 AM, Aleksander Morgado wrote:
> Hey Oskar,
>
> On Tue, Oct 28, 2014 at 12:44 AM, Oskar Enoksson <enok at lysator.liu.se> wrote:
>> I'm making some progress.
>>
>> However, I did some necessary improvements in the 1.4.0 main sourcecode
>> in order to make modem command responses parsing work correctly (this
>> modem inserted whitespace in places that weren't handled by current
>> scanf pattern. It was just a few very easy fixes) . How can I commit
>> those fixes? Can I commit using git to somewhere?
>>
>
> The best approach would be to send patches directly to this mailing
> list (e.g. with git send-email), so that maintainers can review and
> apply them.
>
> Cheers!
>
My modem had whitespace in CRSM responses e.g.
+CRSM: 144, 0, "98641001415070613508"
Parsing the response in mm-base-sim.c failed. With this patch it works.
Just skip whitespace after ',' using conversion specifier "%*[ \t]":
>>>>>>>>>>>>>>>>>
*** ModemManager-1.4.0.org/src/mm-base-sim.c 2014-08-20
00:17:16.000000000 +0200
--- ModemManager-1.4.0/src/mm-base-sim.c 2014-10-26
19:36:21.040427048 +0100
***************
*** 952,962 ****
memset (buf, 0, sizeof (buf));
str = mm_strip_tag (response, "+CRSM:");
! if (sscanf (str, "%d,%d,\"%20c\"", &sw1, &sw2, (char *) &buf) == 3)
success = TRUE;
else {
/* May not include quotes... */
! if (sscanf (str, "%d,%d,%20c", &sw1, &sw2, (char *) &buf) == 3)
success = TRUE;
}
--- 952,962 ----
memset (buf, 0, sizeof (buf));
str = mm_strip_tag (response, "+CRSM:");
! if (sscanf (str, "%d,%*[ \t]%d,%*[ \t]\"%20c\"", &sw1, &sw2, (char
*) &buf) == 3)
success = TRUE;
else {
/* May not include quotes... */
! if (sscanf (str, "%d,%*[ \t]%d,%*[ \t]%20c", &sw1, &sw2, (char
*) &buf) == 3)
success = TRUE;
}
***************
*** 1107,1117 ****
gchar hex[51];
memset (hex, 0, sizeof (hex));
! if (sscanf (response, "+CRSM:%d,%d,\"%50c\"", &sw1, &sw2, (char *)
&hex) == 3)
success = TRUE;
else {
/* May not include quotes... */
! if (sscanf (response, "+CRSM:%d,%d,%50c", &sw1, &sw2, (char *)
&hex) == 3)
success = TRUE;
}
--- 1107,1117 ----
gchar hex[51];
memset (hex, 0, sizeof (hex));
! if (sscanf (response, "+CRSM:%d,%*[ \t]%d,%*[ \t]\"%50c\"", &sw1,
&sw2, (char *) &hex) == 3)
success = TRUE;
else {
/* May not include quotes... */
! if (sscanf (response, "+CRSM:%d%*[ \t],%d%*[ \t],%50c", &sw1,
&sw2, (char *) &hex) == 3)
success = TRUE;
}
More information about the ModemManager-devel
mailing list