Change in simtrace2[master]: host sniff: process remaining usb messages in buffer

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Tue Jul 10 14:04:08 UTC 2018


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/9945


Change subject: host sniff: process remaining usb messages in buffer
......................................................................

host sniff: process remaining usb messages in buffer

Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
---
M host/simtrace2-sniff.c
1 file changed, 6 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/45/9945/1

diff --git a/host/simtrace2-sniff.c b/host/simtrace2-sniff.c
index eb547b0..d5fe48a 100644
--- a/host/simtrace2-sniff.c
+++ b/host/simtrace2-sniff.c
@@ -276,12 +276,15 @@
 		if (xfer_len > 0) {
 			//printf("URB: %s\n", osmo_hexdump(&buf[buf_i], xfer_len));
 			buf_i += xfer_len;
-			if (buf_i>=sizeof(buf)) {
+			if (buf_i >= sizeof(buf)) {
 				perror("preventing USB buffer overflow");
 				return;
 			}
-			int processed = process_usb_msg(buf, buf_i);
-			if (processed > 0 && processed <= buf_i) {
+			int processed;
+			while ((processed = process_usb_msg(buf, buf_i)) > 0) {
+				if (processed > buf_i) {
+					break;
+				}
 				for (i = processed; i < buf_i; i++) {
 					buf[i-processed] = buf[i];
 				}

-- 
To view, visit https://gerrit.osmocom.org/9945
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
Gerrit-Change-Number: 9945
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180710/68fcb167/attachment.htm>


More information about the gerrit-log mailing list