host: Allow matching of device to USB path, not just address

USB addresses change every time the device re-enumerates, while the path
reflects the physical topology of USB connections and stays persistent
unless the usb cabling is changed.  Let's allow the user to specify the
path instead of the address to uniquely identify a given slot.
diff --git a/host/simtrace2-remsim.c b/host/simtrace2-remsim.c
index 67cf8b8..df38f77 100644
--- a/host/simtrace2-remsim.c
+++ b/host/simtrace2-remsim.c
@@ -522,6 +522,7 @@
 	{ "usb-interface", 1, 0, 'I' },
 	{ "usb-altsetting", 1, 0, 'S' },
 	{ "usb-address", 1, 0, 'A' },
+	{ "usb-path", 1, 0, 'H' },
 	{ NULL, 0, 0, 0 }
 };
 
@@ -601,6 +602,7 @@
 	int if_num = 0, vendor_id = -1, product_id = -1;
 	int config_id = -1, altsetting = 0, addr = -1;
 	char *remote_udp_host = NULL;
+	char *path = NULL;
 	struct osim_reader_hdl *reader;
 	struct osim_card_hdl *card;
 
@@ -609,7 +611,7 @@
 	while (1) {
 		int option_index = 0;
 
-		c = getopt_long(argc, argv, "r:p:hi:V:P:C:I:S:A:ak", opts, &option_index);
+		c = getopt_long(argc, argv, "r:p:hi:V:P:C:I:S:A:H:ak", opts, &option_index);
 		if (c == -1)
 			break;
 		switch (c) {
@@ -650,6 +652,9 @@
 		case 'A':
 			addr = atoi(optarg);
 			break;
+		case 'H':
+			path = optarg;
+			break;
 		}
 	}
 
@@ -714,6 +719,8 @@
 			ifm->interface = if_num;
 			ifm->altsetting = altsetting;
 			ifm->addr = addr;
+			if (path)
+				osmo_strlcpy(ifm->path, path, sizeof(ifm->path));
 			transp->usb_devh = usb_open_claim_interface(NULL, ifm);
 			if (!transp->usb_devh) {
 				fprintf(stderr, "can't open USB device\n");