Avoiding repeats of HID interfaces on Windows.
Avoiding repeats of HID interfaces on Windows.

When setting a HID interface, its path would just be added as the next item in the windows_device_priv usb_interface array. If requesting the device list several times within the same context, and when the device gets added and removed repeatedly, the same path was being added. This caused the number of interfaces to go beyond the maximum number of USB interfaces (of 32).

To fix this problem, I added a check that the interface limit has not been reached. If the limit is reached I report an error. Also there is a check that the path being added is not already present in the interfaces array. If found in the array, success is reported and the number of interfaces doesn't increase anymore.

RealVNC/libusbx,RealVNC/libusbx