[PATCH] Fix problem parsing space in CRSM response

Aleksander Morgado aleksander at aleksander.es
Wed Oct 29 16:12:19 PDT 2014


On Wed, Oct 29, 2014 at 11:59 PM, Oskar Enoksson <enok at lysator.liu.se> wrote:
> Yes, regex is better. Adding a test seems like a good thing.
>

Would you be willing to do that? There are logs of examples of how
this could be done.

BTW; Dan checked the changes you did in the sscanf() format string and
said that the "%*[ ]" conversion specifier wasn't really needed, just
a " " whitespace would have done the fix (matches 0 or more
whitespaces).

> On 10/29/2014 10:14 PM, Aleksander Morgado wrote:
>> Hey Oskar,
>>
>> On Wed, Oct 29, 2014 at 9:56 PM, Oskar Enoksson <enok at lysator.liu.se> wrote:
>>> My modem (Samsung GI-B3740) 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 "%*[ ]"
>>
>> Maybe we should instead update this response parser to use a GRegex
>> and match it with a regular expression? We could have a helper method
>> to parse the string, which would return the sw1, sw2 and the string.
>> What do you think? Having the helper method would also allow us to
>> setup unit tests in the tests/ directory with your exact +CRSM
>> response string.
>>
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list