serial: dump DMM packets during stream detection
Regular operation of serial DMM drivers optionally can dump packet bytes after the intialization phase has synchronized to the stream. Failure to synchronize to the stream left developers without a dump, which complicates research what went wrong. Do dump packet content while the serial_stream_detect() routine tries to synchronize to the stream. Use the spew level since the dump occurs upon every attempt, which translates to: every received byte until a valid packet was seen (or the synchronization phase expired).
This commit is contained in:
parent
75aaf967e3
commit
e5fa47c1c9
|
@ -715,7 +715,11 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial,
|
||||||
time /= 1000;
|
time /= 1000;
|
||||||
|
|
||||||
if ((ibuf - i) >= packet_size) {
|
if ((ibuf - i) >= packet_size) {
|
||||||
|
GString *text;
|
||||||
/* We have at least a packet's worth of data. */
|
/* We have at least a packet's worth of data. */
|
||||||
|
text = sr_hexdump_new(&buf[i], packet_size);
|
||||||
|
sr_spew("Trying DMM packet: %s", text->str);
|
||||||
|
sr_hexdump_free(text);
|
||||||
if (is_valid(&buf[i])) {
|
if (is_valid(&buf[i])) {
|
||||||
sr_spew("Found valid %zu-byte packet after "
|
sr_spew("Found valid %zu-byte packet after "
|
||||||
"%" PRIu64 "ms.", (ibuf - i), time);
|
"%" PRIu64 "ms.", (ibuf - i), time);
|
||||||
|
|
Loading…
Reference in New Issue