[PATCH v2] port-serial: rework response parsing

Aleksander Morgado aleksander at aleksander.es
Sat Jan 23 02:31:16 PST 2016


On 22/01/16 19:55, Dan Williams wrote:
> On Fri, 2016-01-22 at 19:05 +0100, Aleksander Morgado wrote:
>> > On 22/01/16 18:00, Dan Williams wrote:
>>>>> > > > > Patch looks good to me, I actually have no comments at all, and
>>>>> > > > > it
>>>>> > > > > seemed to work OK on 3 modems (including 2 with QCDM) :)  Nice
>>>>> > > > > cleanup.
>>> > > Since this patch applies on top of the original "port-serial:
>>> > > remove
>>> > > response buffer when an error is returned" patch, were you thinking
>>> > > of
>>> > > pushing the two separately to record the bug fix that the first one
>>> > > has?
>> > 
>> > Actually I was going to skip the first one all together. Maybe the
>> > other
>> > one could go to mm-1-4 and the big one to master? or not worth?
> I think it's worth committing the first patch to mm-1-4.
> 
> I only noticed the new v2 was diffed off the original patch, so you'd
> need to squash for master then if you don't want them separate.

I've pushed the first fix commit to both master and mm-1-4; and the new
rework of the serial port only to git master.

The patch I pushed has one additional fix w.r.t. the v2 I sent to the
mailing list, in the parse_response() call:

/* If there's no response to receive, we're done; e.g. if we only got
 * unsolicited messages */
 if (!response->len)
    return MM_PORT_SERIAL_RESPONSE_NONE;

Which was due to:

ModemManager[2889]: <debug> [1453541386.686982]
[mm-port-serial-at.c:454] debug_log(): (ttyUSB2): <-- '<CR><LF>+CREG:
5,"1022","45B9"<CR><LF><CR><LF>+CGREG: 5,"1022","45B9"<CR><LF>'

(ModemManager:2889): GLib-CRITICAL **: g_byte_array_remove_range:
assertion 'index_ < array->len' failed

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff660964b in g_logv () from /usr/lib/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff660964b in g_logv () from /usr/lib/libglib-2.0.so.0
#1  0x00007ffff66097bf in g_log () from /usr/lib/libglib-2.0.so.0
#2  0x00007ffff65d795a in g_byte_array_remove_range () from
/usr/lib/libglib-2.0.so.0
#3  0x00000000004d83b1 in parse_response (port=0x7accc0,
response=0x813c40, parsed_response=0x7fffffffdfd0, error=0x7fffffffdfd8)
at mm-port-serial-at.c:142
#4  0x00000000004d4790 in parse_response_buffer (self=0x7accc0) at
mm-port-serial.c:882
#5  0x00000000004d4d08 in common_input_available (self=0x7accc0,
condition=G_IO_IN) at mm-port-serial.c:991
#6  0x00000000004d4d97 in iochannel_input_available (iochannel=0x82c530,
condition=G_IO_IN, data=0x7accc0) at mm-port-serial.c:1004
#7  0x00007ffff6602c7a in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#8  0x00007ffff6603020 in ?? () from /usr/lib/libglib-2.0.so.0
#9  0x00007ffff6603342 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#10 0x0000000000434aab in main (argc=2, argv=0x7fffffffeae8) at main.c:181



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list