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.
This commit is contained in:
Harald Welte
2017-05-11 01:31:45 +02:00
parent 37ad41e092
commit a601635885
4 changed files with 44 additions and 4 deletions

View File

@@ -2,6 +2,8 @@
#include <libusb.h>
#define USB_MAX_PATH_LEN 20
struct dev_id {
uint16_t vendor_id;
uint16_t product_id;
@@ -21,6 +23,8 @@ struct usb_interface_match {
uint16_t product;
/* USB Bus Address */
uint8_t addr;
/* physical path */
char path[USB_MAX_PATH_LEN];
/* configuration of matching interface */
uint8_t configuration;
/* interface number of matching interface */