laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/30152 )
Change subject: remsim-client-st2: Proper error if not all endpoints can be found ......................................................................
remsim-client-st2: Proper error if not all endpoints can be found
Let's avoid a segfault and rather print a proper error message in case we cannot find all the required USB endpoints when opening the user-specified interface/config/device.
This can happen if the device is currently in DFU mode, or a completely wrong device/interface was specified.
Before this patch: Assert failed rc == 0 user_simtrace2.c:305
After this patch: DMAIN ERROR user_simtrace2.c:448 specified USB dev/config/interface doesn't have at least one IN, OUT and IRQ_IN endpoint
Closes: OS#5416 Change-Id: Icfcc482fff106a232c5125ed8ab463ecc13824ae --- M src/client/user_simtrace2.c 1 file changed, 6 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/src/client/user_simtrace2.c b/src/client/user_simtrace2.c index f71c720..29ab196 100644 --- a/src/client/user_simtrace2.c +++ b/src/client/user_simtrace2.c @@ -444,6 +444,12 @@ goto close_exit; }
+ if (!transp->usb_ep.in || !transp->usb_ep.out || !transp->usb_ep.irq_in) { + LOGP(DMAIN, LOGL_ERROR, "specified USB dev/config/interface doesn't have " + "at least one IN, OUT and IRQ_IN endpoint\n"); + goto close_exit; + } + allocate_and_submit_irq(ci); /* submit multiple IN URB in order to work around OS#4409 */ for (i = 0; i < 4; i++)