remsim-client: Query + Store the USB device path

While the user may have specified a USB path at the command line
(or not), let's make sure we obtain the actual path after opening
the respective USB device.

Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
This commit is contained in:
Harald Welte 2019-12-17 01:13:53 +01:00
parent 943ae6286a
commit 499e1d90b5
1 changed files with 5 additions and 0 deletions

View File

@ -87,6 +87,7 @@ struct cardem_inst {
/* slot on which this card emulation instance runs */
struct st_slot *slot;
struct cardemu_usb_msg_status last_status;
char *usb_path;
};
/* global GSMTAP instance */
@ -993,6 +994,10 @@ static void main_body(struct cardem_inst *ci, struct client_config *cfg)
return;
}
/* (re)determine the USB path of the opened device */
talloc_free(ci->usb_path);
ci->usb_path = osmo_libusb_dev_get_path_c(ci, libusb_get_device(transp->usb_devh));
rc = libusb_claim_interface(transp->usb_devh, cfg->usb.if_num);
if (rc < 0) {
fprintf(stderr, "can't claim interface %d; rc=%d\n", cfg->usb.if_num, rc);