Skip to content

Commit

Permalink
Fix comment format, fix bug when a csi camera is not the first camera…
Browse files Browse the repository at this point in the history
… loaded or the only csi camera.
  • Loading branch information
BytingBulldogs3539 committed Nov 16, 2023
1 parent 84f8881 commit 82f4344
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,20 @@ private List<UsbCameraInfo> filterAllowedDevices(List<UsbCameraInfo> allDevices)

List<String> paths = new ArrayList<>();


// Use the other paths to filter out devices that share the same path other than the index select only the lowest index.
// A ov5647 on a raspi 5 would show another path as platform-1000880000.pisp_be-video-index0, platform-1000880000.pisp_be-video-index4, and platform-1000880000.pisp_be-video-index5.
// This code will remove "indexX" from all the other paths from all the devices and make sure that we only take one camera stream from each device the stream with the lowest index.
// Use the other paths to filter out devices that share the same path other than the index
// select only the lowest index.
// A ov5647 on a raspi 5 would show another path as platform-1000880000.pisp_be-video-index0,
// platform-1000880000.pisp_be-video-index4, and platform-1000880000.pisp_be-video-index5.
// This code will remove "indexX" from all the other paths from all the devices and make sure
// that we only take one camera stream from each device the stream with the lowest index.
for (String p : device.otherPaths) {
paths.add(p.replace("index" + device.dev, ""));
paths.add(p.split("index")[0]);
}
boolean skip = false;
for (var otherDevice : filteredDevices) {
List<String> otherPaths = new ArrayList<>();
for (String p : otherDevice.otherPaths) {
otherPaths.add(p.replace("index" + otherDevice.dev, ""));
otherPaths.add(p.split("index")[0]);
}
if (paths.containsAll(otherPaths)) {
if (otherDevice.dev >= device.dev) {
Expand Down

0 comments on commit 82f4344

Please sign in to comment.