Skip to content

Commit

Permalink
Update VisionSourceManager.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Feb 16, 2024
1 parent d49ba44 commit c5ae317
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ private final Predicate<CameraInfo> getCameraMatcher(
boolean checkVidPid,
boolean checkBaseName,
boolean checkPath) {

if (checkUSBPath && savedConfig.getUSBPath().isEmpty()) {
logger.debug(
"WARN: Camera has empty USB path, but asked to match by name: "
Expand Down Expand Up @@ -319,7 +318,20 @@ public List<CameraConfiguration> matchCameras(
logger.info("Matching by usb port & name & USB VID/PID...");
cameraConfigurations.addAll(
matchCamerasByStrategy(detectedCameraList, unloadedConfigs, true, true, true, false));
} else logger.debug("Skipping matchByPathAndName, no configs or cameras left to match");
} else
logger.debug("Skipping match by usb port/name/vid/pid, no configs or cameras left to match");

// On windows, the v4l path is actually useful and tells us the port the camera is physically
// connected to which is neat
if (Platform.isWindows()) {
if (detectedCameraList.size() > 0 || unloadedConfigs.size() > 0) {
logger.info("Matching by windows-path & USB VID/PID only...");
cameraConfigurations.addAll(
matchCamerasByStrategy(detectedCameraList, unloadedConfigs, false, true, true, true));
} else
logger.debug(
"Skipping matching by windiws-path/name/vid/pid, no configs or cameras left to match");
}

if (detectedCameraList.size() > 0 || unloadedConfigs.size() > 0) {
logger.info("Matching by usb port & USB VID/PID...");
Expand All @@ -335,12 +347,6 @@ public List<CameraConfiguration> matchCameras(
matchCamerasByStrategy(detectedCameraList, unloadedConfigs, false, true, true, false));
} else
logger.debug("Skipping match by base-name/viid/pid, no configs or cameras left to match");

if (detectedCameraList.size() > 0 || unloadedConfigs.size() > 0) {
logger.info("Matching by v4l-path & USB VID/PID only...");
cameraConfigurations.addAll(
matchCamerasByStrategy(detectedCameraList, unloadedConfigs, false, true, false, true));
} else logger.debug("Skipping matchByName, no configs or cameras left to match");
} else logger.info("Skipping match by filepath/vid/pid, disabled by user");

if (detectedCameraList.size() > 0) {
Expand Down Expand Up @@ -373,7 +379,6 @@ private List<CameraConfiguration> matchCamerasByStrategy(
boolean checkVidPid,
boolean checkBaseName,
boolean checkPath) {

List<CameraConfiguration> ret = new ArrayList<CameraConfiguration>();
List<CameraConfiguration> unloadedConfigsCopy =
new ArrayList<CameraConfiguration>(unloadedConfigs);
Expand Down

0 comments on commit c5ae317

Please sign in to comment.