laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-remsim/+/43347?usp=email )

Change subject: remsim_client: only set usb parameters if given by arguments
......................................................................

remsim_client: only set usb parameters if given by arguments

When calling osmo-remsim-client-st2 without setting the usb address (-A),
previous libusb_claim_interface() was called with an usb address of 255,
which is not valid on usb.
Only set arguments to libusb_claim_interface() when given.

Change-Id: I30f27b166db72fa8796aa4da98f9fc01e348c87a
---
M src/client/user_simtrace2.c
1 file changed, 12 insertions(+), 6 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 2535efb..5d7d3c9 100644
--- a/src/client/user_simtrace2.c
+++ b/src/client/user_simtrace2.c
@@ -415,12 +415,18 @@
        bc->cardem = ci;

        memset(ifm, 0, sizeof(*ifm));
-       ifm->vendor = cfg->usb.vendor_id;
-       ifm->product = cfg->usb.product_id;
-       ifm->configuration = cfg->usb.config_id;
-       ifm->interface = cfg->usb.if_num;
-       ifm->altsetting = cfg->usb.altsetting;
-       ifm->addr = cfg->usb.addr;
+       if (cfg->usb.vendor_id > 0)
+               ifm->vendor = cfg->usb.vendor_id;
+       if (cfg->usb.product_id > 0)
+               ifm->product = cfg->usb.product_id;
+       if (cfg->usb.config_id > 0)
+               ifm->configuration = cfg->usb.config_id;
+       if (cfg->usb.if_num > 0)
+               ifm->interface = cfg->usb.if_num;
+       if (cfg->usb.altsetting > 0)
+               ifm->altsetting = cfg->usb.altsetting;
+       if (cfg->usb.addr > 0)
+               ifm->addr = cfg->usb.addr;
        if (cfg->usb.path)
                osmo_strlcpy(ifm->path, cfg->usb.path, sizeof(ifm->path));
        transp->udp_fd = -1;

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43347?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I30f27b166db72fa8796aa4da98f9fc01e348c87a
Gerrit-Change-Number: 43347
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to